From 367222a3d40403c8d9ab71310ba01dbc33378861 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 9 Mar 2024 17:01:48 +0100 Subject: [PATCH 001/280] tree cover cropland --- core/macros.gms | 4 ++-- modules/30_crop/endo_apr21/declarations.gms | 12 +++++++++++ modules/30_crop/endo_apr21/equations.gms | 10 ++++++++-- modules/30_crop/endo_apr21/input.gms | 12 +++++++++++ modules/30_crop/endo_apr21/input/files | 2 ++ modules/30_crop/endo_apr21/postsolve.gms | 9 +++++++++ modules/30_crop/endo_apr21/preloop.gms | 20 +++++++++++++++++++ modules/30_crop/endo_apr21/presolve.gms | 11 ++++++++++ modules/44_biodiversity/bii_target/sets.gms | 4 ++-- modules/44_biodiversity/bv_btc_mar21/sets.gms | 4 ++-- 10 files changed, 80 insertions(+), 8 deletions(-) diff --git a/core/macros.gms b/core/macros.gms index 0cb9567bd1..67dfedc1ed 100644 --- a/core/macros.gms +++ b/core/macros.gms @@ -97,12 +97,12 @@ $macro m_linear_cell_data_interpol(output,x,input_x1,input_x2,input_y1,input_y2) * macro for simple carbon stocks $macro m_carbon_stock(land,carbon_density,item) \ (land(j2,item) * sum(ct,carbon_density(ct,j2,item,ag_pools)))$(sameas(stockType,"actual")) + \ - (land(j2,item) * sum(ct,carbon_density(ct,j2,item,ag_pools)))$(sameas(stockType,"actualNoAcEst")); + (land(j2,item) * sum(ct,carbon_density(ct,j2,item,ag_pools)))$(sameas(stockType,"actualNoAcEst")) * macro for carbon stocks with age classes $macro m_carbon_stock_ac(land,carbon_density,sets,sets_sub) \ sum((&&sets), land(j2,&&sets) * sum(ct, carbon_density(ct,j2,&&sets,ag_pools)))$(sameas(stockType,"actual")) + \ - sum((&&sets_sub), land(j2,&&sets_sub) * sum(ct, carbon_density(ct,j2,&&sets_sub,ag_pools)))$(sameas(stockType,"actualNoAcEst")); + sum((&&sets_sub), land(j2,&&sets_sub) * sum(ct, carbon_density(ct,j2,&&sets_sub,ag_pools)))$(sameas(stockType,"actualNoAcEst")) * macros for peatland module $macro m58_LandMerge(land,landForestry,set) \ diff --git a/modules/30_crop/endo_apr21/declarations.gms b/modules/30_crop/endo_apr21/declarations.gms index 0ab0da5cad..d945f199fb 100644 --- a/modules/30_crop/endo_apr21/declarations.gms +++ b/modules/30_crop/endo_apr21/declarations.gms @@ -5,6 +5,10 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de +scalars + s30_shift number of 5-year age-classes corresponding to current time step length (1) +; + parameters p30_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) p30_country_snv_weight(i) SNV policy country weight per region (1) @@ -16,6 +20,10 @@ parameters i30_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) p30_snv_scenario_fader(t_all) SNV scenario fader (1) p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) + p30_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) + pc30_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) + p30_carbon_density_ac(t,j,ac,ag_pools) Carbon density cropland tree cover (tC per ha) + p30_treecover_bii_coeff(bii_class_secd,potnatveg) bii coeff (1) ; positive variables @@ -23,6 +31,7 @@ positive variables vm_fallow(j) Fallow land (mio. ha) vm_area(j,kcr,w) Agricultural production area (mio. ha) vm_rotation_penalty(i) Penalty for violating rotational constraints (USD05MER) + v30_treecover(j,ac) Cropland tree cover per age class (mio. ha) ; equations @@ -36,6 +45,7 @@ equations q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) q30_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) q30_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) + q30_bv_treecover(j,potnatveg) Biodiversity value for cropland treecover (Mha) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### @@ -43,6 +53,7 @@ parameters ov_fallow(t,j,type) Fallow land (mio. ha) ov_area(t,j,kcr,w,type) Agricultural production area (mio. ha) ov_rotation_penalty(t,i,type) Penalty for violating rotational constraints (USD05MER) + ov30_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) oq30_cropland(t,j,type) Total cropland calculation (mio. ha) oq30_avl_cropland(t,j,type) Available cropland constraint (mio. ha) oq30_rotation_max(t,j,crp30,w,type) Local maximum rotational constraints (mio. ha) @@ -53,6 +64,7 @@ parameters oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (mio. ha) oq30_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) oq30_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) + oq30_bv_treecover(t,j,potnatveg,type) Biodiversity value for cropland treecover (Mha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/30_crop/endo_apr21/equations.gms b/modules/30_crop/endo_apr21/equations.gms index a4c495c099..11e3f6add8 100644 --- a/modules/30_crop/endo_apr21/equations.gms +++ b/modules/30_crop/endo_apr21/equations.gms @@ -10,7 +10,7 @@ *' the sum of crop and water supply type specific land requirements: q30_cropland(j2) .. - sum((kcr,w), vm_area(j2,kcr,w)) =e= vm_land(j2,"crop"); + sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + sum(ac, v30_treecover(j2,ac)) =e= vm_land(j2,"crop"); *' We assume that crop production can only take place on suitable cropland area. *' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas @@ -68,7 +68,8 @@ q30_carbon(j2,ag_pools,stockType) .. vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= - m_carbon_stock(vm_land,fm_carbon_density,"crop"); + m_carbon_stock(vm_land,fm_carbon_density,"crop") + + m_carbon_stock_ac(v30_treecover,p30_carbon_density_ac,"ac","ac_sub"); *' The biodiversity value for cropland is calculated separately for annual and perennial crops: q30_bv_ann(j2,potnatveg) .. vm_bv(j2,"crop_ann",potnatveg) @@ -79,3 +80,8 @@ =e= (vm_land(j2,"crop") - sum((crop_ann30,w), vm_area(j2,crop_ann30,w))) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + + q30_bv_treecover(j2,potnatveg) .. vm_bv(j2,"crop_tree",potnatveg) + =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v30_treecover(j2,ac)) * + p30_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/30_crop/endo_apr21/input.gms b/modules/30_crop/endo_apr21/input.gms index a8c1656d83..b5dbb6f6d7 100644 --- a/modules/30_crop/endo_apr21/input.gms +++ b/modules/30_crop/endo_apr21/input.gms @@ -29,6 +29,8 @@ s30_snv_relocation_data_x1 First reference value in SNV target cropland dat s30_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / s30_rotation_scenario_start Rotation scenario start year / 2020 / s30_rotation_scenario_target Rotation scenario target year / 2050 / +s30_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / +s30_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=natural vegetation 1=plantation (1) / 0 / ; * Set-switch for countries affected by regional SNV policy @@ -122,3 +124,13 @@ $ondelim $include "./modules/30_crop/endo_apr21/input/SNVTargetCropland.cs3" $offdelim ; + +********* Cropland tree cover ******************************************* + +parameter f30_treecover(j) Tree cover on cropland in 2019 (mio. ha) +/ +$ondelim +$include "./modules/30_crop/endo_apr21/input/CroplandTreecover.cs2" +$offdelim +/ +; diff --git a/modules/30_crop/endo_apr21/input/files b/modules/30_crop/endo_apr21/input/files index d0cfbda228..77cc6324da 100644 --- a/modules/30_crop/endo_apr21/input/files +++ b/modules/30_crop/endo_apr21/input/files @@ -7,3 +7,5 @@ f30_croparea_w_initialisation.cs3 avl_cropland_iso.cs3 SNVTargetCropland.cs3 SNVTargetCropland_0.5.mz +CroplandTreecover.cs2 +CroplandTreecover_0.5.mz diff --git a/modules/30_crop/endo_apr21/postsolve.gms b/modules/30_crop/endo_apr21/postsolve.gms index d15f95065c..e2fd3d3478 100644 --- a/modules/30_crop/endo_apr21/postsolve.gms +++ b/modules/30_crop/endo_apr21/postsolve.gms @@ -5,11 +5,13 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de +pc30_treecover(j,ac) = v30_treecover.l(j,ac); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_fallow(t,j,"marginal") = vm_fallow.m(j); ov_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w); ov_rotation_penalty(t,i,"marginal") = vm_rotation_penalty.m(i); + ov30_treecover(t,j,ac,"marginal") = v30_treecover.m(j,ac); oq30_cropland(t,j,"marginal") = q30_cropland.m(j); oq30_avl_cropland(t,j,"marginal") = q30_avl_cropland.m(j); oq30_rotation_max(t,j,crp30,w,"marginal") = q30_rotation_max.m(j,crp30,w); @@ -20,9 +22,11 @@ oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg); oq30_land_snv(t,j,"marginal") = q30_land_snv.m(j); oq30_land_snv_trans(t,j,"marginal") = q30_land_snv_trans.m(j); + oq30_bv_treecover(t,j,potnatveg,"marginal") = q30_bv_treecover.m(j,potnatveg); ov_fallow(t,j,"level") = vm_fallow.l(j); ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); ov_rotation_penalty(t,i,"level") = vm_rotation_penalty.l(i); + ov30_treecover(t,j,ac,"level") = v30_treecover.l(j,ac); oq30_cropland(t,j,"level") = q30_cropland.l(j); oq30_avl_cropland(t,j,"level") = q30_avl_cropland.l(j); oq30_rotation_max(t,j,crp30,w,"level") = q30_rotation_max.l(j,crp30,w); @@ -33,9 +37,11 @@ oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg); oq30_land_snv(t,j,"level") = q30_land_snv.l(j); oq30_land_snv_trans(t,j,"level") = q30_land_snv_trans.l(j); + oq30_bv_treecover(t,j,potnatveg,"level") = q30_bv_treecover.l(j,potnatveg); ov_fallow(t,j,"upper") = vm_fallow.up(j); ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); ov_rotation_penalty(t,i,"upper") = vm_rotation_penalty.up(i); + ov30_treecover(t,j,ac,"upper") = v30_treecover.up(j,ac); oq30_cropland(t,j,"upper") = q30_cropland.up(j); oq30_avl_cropland(t,j,"upper") = q30_avl_cropland.up(j); oq30_rotation_max(t,j,crp30,w,"upper") = q30_rotation_max.up(j,crp30,w); @@ -46,9 +52,11 @@ oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg); oq30_land_snv(t,j,"upper") = q30_land_snv.up(j); oq30_land_snv_trans(t,j,"upper") = q30_land_snv_trans.up(j); + oq30_bv_treecover(t,j,potnatveg,"upper") = q30_bv_treecover.up(j,potnatveg); ov_fallow(t,j,"lower") = vm_fallow.lo(j); ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); ov_rotation_penalty(t,i,"lower") = vm_rotation_penalty.lo(i); + ov30_treecover(t,j,ac,"lower") = v30_treecover.lo(j,ac); oq30_cropland(t,j,"lower") = q30_cropland.lo(j); oq30_avl_cropland(t,j,"lower") = q30_avl_cropland.lo(j); oq30_rotation_max(t,j,crp30,w,"lower") = q30_rotation_max.lo(j,crp30,w); @@ -59,4 +67,5 @@ oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg); oq30_land_snv(t,j,"lower") = q30_land_snv.lo(j); oq30_land_snv_trans(t,j,"lower") = q30_land_snv_trans.lo(j); + oq30_bv_treecover(t,j,potnatveg,"lower") = q30_bv_treecover.lo(j,potnatveg); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/30_crop/endo_apr21/preloop.gms b/modules/30_crop/endo_apr21/preloop.gms index 12c01058e1..a4017421f1 100644 --- a/modules/30_crop/endo_apr21/preloop.gms +++ b/modules/30_crop/endo_apr21/preloop.gms @@ -37,3 +37,23 @@ p30_country_dummy(policy_countries30) = 1; * Countries are weighted by available cropland area. i30_avl_cropland_iso(iso) = f30_avl_cropland_iso(iso,"%c30_marginal_land%"); p30_country_snv_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * i30_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i30_avl_cropland_iso(iso)); + +* Initial tree cover on cropland is assumed to be equally distributed among all age-classes +pc30_treecover(j,ac) = f30_treecover(j)/card(ac); + +*' Switch for tree cover on cropland: +*' 0 = Use natveg growth curve towards LPJmL natural vegetation +*' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation +if(s30_treecover_plantation = 0, + p30_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); +elseif s30_treecover_plantation = 1, + p30_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools); +); + +** set bii coefficients +p30_treecover_bii_coeff(bii_class_secd,potnatveg) = 0; +if(s30_treecover_bii_coeff = 0, + p30_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff(bii_class_secd,potnatveg) +elseif s30_treecover_bii_coeff = 1, + p30_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff("timber",potnatveg) +); diff --git a/modules/30_crop/endo_apr21/presolve.gms b/modules/30_crop/endo_apr21/presolve.gms index b88ac26965..eacbee0043 100644 --- a/modules/30_crop/endo_apr21/presolve.gms +++ b/modules/30_crop/endo_apr21/presolve.gms @@ -50,3 +50,14 @@ p30_snv_relocation(t,j)$(p30_snv_relocation(t, j) > p30_max_snv_relocation(t,j)) *' Area potentially available for cropping p30_avl_cropland(t,j) = f30_avl_cropland(j,"%c30_marginal_land%") * (1 - p30_snv_shr(t,j)); *' @stop + +* Growth of trees on cropland is modelled by shifting age-classes according to time step length. +s30_shift = m_timestep_length_forestry/5; +* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s30_shift = 1) + p30_treecover(t,j,ac)$(ord(ac) > s30_shift) = pc30_treecover(j,ac-s30_shift); +* account for cases at the end of the age class set (s30_shift > 1) which are not shifted by the above calculation + p30_treecover(t,j,"acx") = p30_treecover(t,j,"acx") + + sum(ac$(ord(ac) > card(ac)-s30_shift), pc30_treecover(j,ac)); + +pc30_treecover(j,ac) = p30_treecover(t,j,ac); +v30_treecover.l(j,ac) = p30_treecover(t,j,ac); diff --git a/modules/44_biodiversity/bii_target/sets.gms b/modules/44_biodiversity/bii_target/sets.gms index 0a826f7791..feed8500b3 100644 --- a/modules/44_biodiversity/bii_target/sets.gms +++ b/modules/44_biodiversity/bii_target/sets.gms @@ -8,10 +8,10 @@ sets landcover44 land cover classes used in bii calculation - / crop_ann, crop_per, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / + / crop_ann, crop_per, crop_tree, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / bii_class44 bii coefficent land cover classes - / crop_ann, crop_per, manpast, rangeland, urban, primary, secd_mature, secd_young, timber / + / crop_ann, crop_per, crop_tree, manpast, rangeland, urban, primary, secd_mature, secd_young, timber / bii_class_secd(bii_class44) bii coefficent land cover classes secondary vegetation / secd_mature, secd_young / diff --git a/modules/44_biodiversity/bv_btc_mar21/sets.gms b/modules/44_biodiversity/bv_btc_mar21/sets.gms index 14323240b8..4d75f058b6 100644 --- a/modules/44_biodiversity/bv_btc_mar21/sets.gms +++ b/modules/44_biodiversity/bv_btc_mar21/sets.gms @@ -8,10 +8,10 @@ sets landcover44 land cover classes used in bii calculation - / crop_ann, crop_per, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / + / crop_ann, crop_per, crop_tree, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / bii_class44 bii coefficent land cover classes - / crop_ann, crop_per, manpast, rangeland, urban, primary, secd_mature, secd_young, timber / + / crop_ann, crop_per, crop_tree, manpast, rangeland, urban, primary, secd_mature, secd_young, timber / bii_class_secd(bii_class44) bii coefficent land cover classes secondary vegetation / secd_mature, secd_young / From aecdaffe273e791fe8a6c84719aff32d86c897ca Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 11 Mar 2024 13:55:57 +0100 Subject: [PATCH 002/280] treecover and betr scenario --- modules/30_crop/endo_apr21/declarations.gms | 10 +++++++ modules/30_crop/endo_apr21/equations.gms | 13 +++++++++ modules/30_crop/endo_apr21/input.gms | 9 ++++++ modules/30_crop/endo_apr21/postsolve.gms | 12 ++++++++ modules/30_crop/endo_apr21/preloop.gms | 2 ++ modules/30_crop/endo_apr21/presolve.gms | 29 +++++++++++++++++++ .../32_forestry/dynamic_feb21/presolve.gms | 7 ----- 7 files changed, 75 insertions(+), 7 deletions(-) diff --git a/modules/30_crop/endo_apr21/declarations.gms b/modules/30_crop/endo_apr21/declarations.gms index d945f199fb..460e861628 100644 --- a/modules/30_crop/endo_apr21/declarations.gms +++ b/modules/30_crop/endo_apr21/declarations.gms @@ -24,6 +24,10 @@ parameters pc30_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) p30_carbon_density_ac(t,j,ac,ag_pools) Carbon density cropland tree cover (tC per ha) p30_treecover_bii_coeff(bii_class_secd,potnatveg) bii coeff (1) + p30_treecover_shr(t,j) Share of treecover on cropland (1) + p30_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) + p30_betr_shr(t,j) Share of betr on cropland (1) + p30_betr_scenario_fader(t_all) betr scenario fader (1) ; positive variables @@ -45,6 +49,9 @@ equations q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) q30_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) q30_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) + q30_treecover(j) Land constraint cropland treecover (mio. ha) + q30_treecover_est(j,ac) Land constraint cropland treecover (mio. ha) + q30_betr(j) Land constraint betr (mio. ha) q30_bv_treecover(j,potnatveg) Biodiversity value for cropland treecover (Mha) ; @@ -64,6 +71,9 @@ parameters oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (mio. ha) oq30_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) oq30_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) + oq30_treecover(t,j,type) Land constraint cropland treecover (mio. ha) + oq30_treecover_est(t,j,ac,type) Land constraint cropland treecover (mio. ha) + oq30_betr(t,j,type) Land constraint betr (mio. ha) oq30_bv_treecover(t,j,potnatveg,type) Biodiversity value for cropland treecover (Mha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/30_crop/endo_apr21/equations.gms b/modules/30_crop/endo_apr21/equations.gms index 11e3f6add8..6009272a16 100644 --- a/modules/30_crop/endo_apr21/equations.gms +++ b/modules/30_crop/endo_apr21/equations.gms @@ -40,6 +40,19 @@ q30_land_snv_trans(j2) .. sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p30_snv_relocation(ct,j2)); + q30_treecover(j2) .. + sum(ac, v30_treecover(j2,ac)) =g= sum(ct, p30_treecover_shr(ct,j2)) * vm_land(j2,"crop"); + + q30_betr(j2) .. + sum(w, vm_area(j2,"betr",w)) =g= + vm_land(j2,"crop") * sum(ct, p30_betr_shr(ct,j2)); + +*' This constraint distributes additions to forestry land over ac_est, +*' which depends on the time step length (e.g. ac0 and ac5 for a 10 year time step). + + q30_treecover_est(j2,ac_est) .. + v30_treecover(j2,ac_est) =e= sum(ac_est2, v30_treecover(j2,ac_est2))/card(ac_est2); + *' As additional constraints minimum and maximum rotational constraints limit *' the placing of crops. On the one hand, these rotational constraints reflect *' crop rotations limiting the share a specific crop can cover of the total area diff --git a/modules/30_crop/endo_apr21/input.gms b/modules/30_crop/endo_apr21/input.gms index b5dbb6f6d7..1b797df00a 100644 --- a/modules/30_crop/endo_apr21/input.gms +++ b/modules/30_crop/endo_apr21/input.gms @@ -31,6 +31,15 @@ s30_rotation_scenario_start Rotation scenario start year / 2020 / s30_rotation_scenario_target Rotation scenario target year / 2050 / s30_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / s30_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=natural vegetation 1=plantation (1) / 0 / +s30_treecover_shr Share of treecover on cropland (1) / 0 / +s30_treecover_shr_noselect Share of treecover on cropland (1) / 0 / +s30_treecover_scenario_start Cropland treecover scenario start year / 2020 / +s30_treecover_scenario_target Cropland treecover scenario target year / 2030 / +s30_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / +s30_betr_shr Share of bioenergy trees on cropland (1) / 0.25 / +s30_betr_shr_noselect Share of betr on cropland (1) / 0 / +s30_betr_scenario_start betr scenario start year / 2020 / +s30_betr_scenario_target betr scenario target year / 2030 / ; * Set-switch for countries affected by regional SNV policy diff --git a/modules/30_crop/endo_apr21/postsolve.gms b/modules/30_crop/endo_apr21/postsolve.gms index e2fd3d3478..1f5f5279aa 100644 --- a/modules/30_crop/endo_apr21/postsolve.gms +++ b/modules/30_crop/endo_apr21/postsolve.gms @@ -22,6 +22,9 @@ pc30_treecover(j,ac) = v30_treecover.l(j,ac); oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg); oq30_land_snv(t,j,"marginal") = q30_land_snv.m(j); oq30_land_snv_trans(t,j,"marginal") = q30_land_snv_trans.m(j); + oq30_treecover(t,j,"marginal") = q30_treecover.m(j); + oq30_treecover_est(t,j,ac,"marginal") = q30_treecover_est.m(j,ac); + oq30_betr(t,j,"marginal") = q30_betr.m(j); oq30_bv_treecover(t,j,potnatveg,"marginal") = q30_bv_treecover.m(j,potnatveg); ov_fallow(t,j,"level") = vm_fallow.l(j); ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); @@ -37,6 +40,9 @@ pc30_treecover(j,ac) = v30_treecover.l(j,ac); oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg); oq30_land_snv(t,j,"level") = q30_land_snv.l(j); oq30_land_snv_trans(t,j,"level") = q30_land_snv_trans.l(j); + oq30_treecover(t,j,"level") = q30_treecover.l(j); + oq30_treecover_est(t,j,ac,"level") = q30_treecover_est.l(j,ac); + oq30_betr(t,j,"level") = q30_betr.l(j); oq30_bv_treecover(t,j,potnatveg,"level") = q30_bv_treecover.l(j,potnatveg); ov_fallow(t,j,"upper") = vm_fallow.up(j); ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); @@ -52,6 +58,9 @@ pc30_treecover(j,ac) = v30_treecover.l(j,ac); oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg); oq30_land_snv(t,j,"upper") = q30_land_snv.up(j); oq30_land_snv_trans(t,j,"upper") = q30_land_snv_trans.up(j); + oq30_treecover(t,j,"upper") = q30_treecover.up(j); + oq30_treecover_est(t,j,ac,"upper") = q30_treecover_est.up(j,ac); + oq30_betr(t,j,"upper") = q30_betr.up(j); oq30_bv_treecover(t,j,potnatveg,"upper") = q30_bv_treecover.up(j,potnatveg); ov_fallow(t,j,"lower") = vm_fallow.lo(j); ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); @@ -67,5 +76,8 @@ pc30_treecover(j,ac) = v30_treecover.l(j,ac); oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg); oq30_land_snv(t,j,"lower") = q30_land_snv.lo(j); oq30_land_snv_trans(t,j,"lower") = q30_land_snv_trans.lo(j); + oq30_treecover(t,j,"lower") = q30_treecover.lo(j); + oq30_treecover_est(t,j,ac,"lower") = q30_treecover_est.lo(j,ac); + oq30_betr(t,j,"lower") = q30_betr.lo(j); oq30_bv_treecover(t,j,potnatveg,"lower") = q30_bv_treecover.lo(j,potnatveg); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/30_crop/endo_apr21/preloop.gms b/modules/30_crop/endo_apr21/preloop.gms index a4017421f1..167ce4300f 100644 --- a/modules/30_crop/endo_apr21/preloop.gms +++ b/modules/30_crop/endo_apr21/preloop.gms @@ -9,6 +9,8 @@ * sigmoidal interpolation between start year and target year m_sigmoid_time_interpol(p30_snv_scenario_fader,s30_snv_scenario_start,s30_snv_scenario_target,0,1); m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); +m_sigmoid_time_interpol(p30_treecover_scenario_fader,s30_treecover_scenario_start,s30_treecover_scenario_target,0,1); +m_sigmoid_time_interpol(p30_betr_scenario_fader,s30_betr_scenario_start,s30_betr_scenario_target,0,1); * linear interpolation to estimate the cropland that * requires relocation due to SNV policy diff --git a/modules/30_crop/endo_apr21/presolve.gms b/modules/30_crop/endo_apr21/presolve.gms index eacbee0043..c8ba583062 100644 --- a/modules/30_crop/endo_apr21/presolve.gms +++ b/modules/30_crop/endo_apr21/presolve.gms @@ -61,3 +61,32 @@ s30_shift = m_timestep_length_forestry/5; pc30_treecover(j,ac) = p30_treecover(t,j,ac); v30_treecover.l(j,ac) = p30_treecover(t,j,ac); + +p30_treecover_shr(t,j) = p30_treecover_scenario_fader(t) * + (s30_treecover_shr * sum(cell(i,j), p30_country_snv_weight(i)) + + s30_treecover_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); + +*define ac_est and ac_sub +ac_est(ac) = no; +ac_est(ac) = yes$(ord(ac) <= (m_yeardiff_forestry(t)/5)); + +ac_sub(ac) = no; +ac_sub(ac) = yes$(ord(ac) > (m_yeardiff_forestry(t)/5)); + +* fix before s30_treecover_scenario_start to pc30_treecover(j,ac)? +if(m_year(t) <= s30_treecover_scenario_start, + v30_treecover.fx(j,ac) = pc30_treecover(j,ac); +else + v30_treecover.lo(j,ac_est) = 0; + v30_treecover.up(j,ac_est) = Inf; + if(s30_treecover_decrease = 1, + v30_treecover.lo(j,ac_sub) = 0; + v30_treecover.up(j,ac_sub) = pc30_treecover(j,ac_sub); + else + v30_treecover.fx(j,ac_sub) = pc30_treecover(j,ac_sub); + ); +); + +p30_betr_shr(t,j) = p30_betr_scenario_fader(t) * + (s30_betr_shr * sum(cell(i,j), p30_country_snv_weight(i)) + + s30_betr_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); diff --git a/modules/32_forestry/dynamic_feb21/presolve.gms b/modules/32_forestry/dynamic_feb21/presolve.gms index 97b4f3db0b..9bd762216c 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_feb21/presolve.gms @@ -5,13 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*define ac_est and ac_sub -ac_est(ac) = no; -ac_est(ac) = yes$(ord(ac) <= (m_yeardiff_forestry(t)/5)); - -ac_sub(ac) = no; -ac_sub(ac) = yes$(ord(ac) > (m_yeardiff_forestry(t)/5)); - *Reduction of ac_est is not possible. v32_hvarea_forestry.fx(j,ac_est) = 0; v32_land_reduction.fx(j,type32,ac_est) = 0; From 3ea3246c1c822360fe2b0c90d886be1108dae5ad Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 12 Mar 2024 09:52:36 +0100 Subject: [PATCH 003/280] code revisions --- modules/30_crop/endo_apr21/declarations.gms | 12 ++++++------ modules/30_crop/endo_apr21/equations.gms | 4 ++-- modules/30_crop/endo_apr21/input.gms | 20 ++++++++++---------- modules/30_crop/endo_apr21/presolve.gms | 12 ++++++------ 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/modules/30_crop/endo_apr21/declarations.gms b/modules/30_crop/endo_apr21/declarations.gms index 460e861628..f13886f1d0 100644 --- a/modules/30_crop/endo_apr21/declarations.gms +++ b/modules/30_crop/endo_apr21/declarations.gms @@ -22,12 +22,12 @@ parameters p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) p30_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) pc30_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) - p30_carbon_density_ac(t,j,ac,ag_pools) Carbon density cropland tree cover (tC per ha) - p30_treecover_bii_coeff(bii_class_secd,potnatveg) bii coeff (1) - p30_treecover_shr(t,j) Share of treecover on cropland (1) - p30_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) - p30_betr_shr(t,j) Share of betr on cropland (1) - p30_betr_scenario_fader(t_all) betr scenario fader (1) + p30_carbon_density_ac(t,j,ac,ag_pools) Carbon density cropland tree cover (tC per ha) + p30_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) + p30_treecover_min_shr(t,j) Minimum share of treecover on cropland (1) + p30_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) + p30_betr_min_shr(t,j) Minimum share of bioenergy trees on cropland (1) + p30_betr_scenario_fader(t_all) Bioenergy trees scenario fader (1) ; positive variables diff --git a/modules/30_crop/endo_apr21/equations.gms b/modules/30_crop/endo_apr21/equations.gms index 6009272a16..e2cda3e18c 100644 --- a/modules/30_crop/endo_apr21/equations.gms +++ b/modules/30_crop/endo_apr21/equations.gms @@ -41,11 +41,11 @@ sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p30_snv_relocation(ct,j2)); q30_treecover(j2) .. - sum(ac, v30_treecover(j2,ac)) =g= sum(ct, p30_treecover_shr(ct,j2)) * vm_land(j2,"crop"); + sum(ac, v30_treecover(j2,ac)) =g= sum(ct, p30_treecover_min_shr(ct,j2)) * vm_land(j2,"crop"); q30_betr(j2) .. sum(w, vm_area(j2,"betr",w)) =g= - vm_land(j2,"crop") * sum(ct, p30_betr_shr(ct,j2)); + vm_land(j2,"crop") * sum(ct, p30_betr_min_shr(ct,j2)); *' This constraint distributes additions to forestry land over ac_est, *' which depends on the time step length (e.g. ac0 and ac5 for a 10 year time step). diff --git a/modules/30_crop/endo_apr21/input.gms b/modules/30_crop/endo_apr21/input.gms index 1b797df00a..90aac4cc9f 100644 --- a/modules/30_crop/endo_apr21/input.gms +++ b/modules/30_crop/endo_apr21/input.gms @@ -30,16 +30,16 @@ s30_snv_relocation_data_x2 Second reference value in SNV target cropland da s30_rotation_scenario_start Rotation scenario start year / 2020 / s30_rotation_scenario_target Rotation scenario target year / 2050 / s30_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / -s30_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=natural vegetation 1=plantation (1) / 0 / -s30_treecover_shr Share of treecover on cropland (1) / 0 / -s30_treecover_shr_noselect Share of treecover on cropland (1) / 0 / -s30_treecover_scenario_start Cropland treecover scenario start year / 2020 / -s30_treecover_scenario_target Cropland treecover scenario target year / 2030 / -s30_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / -s30_betr_shr Share of bioenergy trees on cropland (1) / 0.25 / -s30_betr_shr_noselect Share of betr on cropland (1) / 0 / -s30_betr_scenario_start betr scenario start year / 2020 / -s30_betr_scenario_target betr scenario target year / 2030 / +s30_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / +s30_treecover_min_shr Share of treecover on cropland (1) / 0 / +s30_treecover_min_shr_noselect Share of treecover on cropland (1) / 0 / +s30_treecover_scenario_start Cropland treecover scenario start year / 2020 / +s30_treecover_scenario_target Cropland treecover scenario target year / 2030 / +s30_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / +s30_betr_min_shr Minimum share of bioenergy trees on cropland (1) / 0 / +s30_betr_min_shr_noselect Minimum share of bioenergy trees on cropland (1) / 0 / +s30_betr_scenario_start Bioenergy trees scenario start year / 2020 / +s30_betr_scenario_target Bioenergy trees scenario target year / 2050 / ; * Set-switch for countries affected by regional SNV policy diff --git a/modules/30_crop/endo_apr21/presolve.gms b/modules/30_crop/endo_apr21/presolve.gms index c8ba583062..7b22389795 100644 --- a/modules/30_crop/endo_apr21/presolve.gms +++ b/modules/30_crop/endo_apr21/presolve.gms @@ -62,9 +62,9 @@ s30_shift = m_timestep_length_forestry/5; pc30_treecover(j,ac) = p30_treecover(t,j,ac); v30_treecover.l(j,ac) = p30_treecover(t,j,ac); -p30_treecover_shr(t,j) = p30_treecover_scenario_fader(t) * - (s30_treecover_shr * sum(cell(i,j), p30_country_snv_weight(i)) - + s30_treecover_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); +p30_treecover_min_shr(t,j) = p30_treecover_scenario_fader(t) * + (s30_treecover_min_shr * sum(cell(i,j), p30_country_snv_weight(i)) + + s30_treecover_min_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); *define ac_est and ac_sub ac_est(ac) = no; @@ -87,6 +87,6 @@ else ); ); -p30_betr_shr(t,j) = p30_betr_scenario_fader(t) * - (s30_betr_shr * sum(cell(i,j), p30_country_snv_weight(i)) - + s30_betr_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); +p30_betr_min_shr(t,j) = p30_betr_scenario_fader(t) * + (s30_betr_min_shr * sum(cell(i,j), p30_country_snv_weight(i)) + + s30_betr_min_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); From aa676cfd022adc255d1c754b2a96156759aea3eb Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 13 Mar 2024 10:56:56 +0100 Subject: [PATCH 004/280] new module 61_agroforestry. reverted code in 30_crop --- modules/10_land/input/files | 2 + .../10_land/landmatrix_dec18/declarations.gms | 1 + modules/10_land/landmatrix_dec18/input.gms | 15 ++++ modules/10_land/landmatrix_dec18/start.gms | 8 +- modules/11_costs/default/equations.gms | 1 + modules/29_ageclass/feb21/presolve.gms | 13 +++ modules/29_ageclass/feb21/realization.gms | 1 + modules/30_crop/endo_apr21/declarations.gms | 22 ------ modules/30_crop/endo_apr21/equations.gms | 25 +----- modules/30_crop/endo_apr21/input.gms | 21 ----- modules/30_crop/endo_apr21/input/files | 2 - modules/30_crop/endo_apr21/postsolve.gms | 21 ----- modules/30_crop/endo_apr21/preloop.gms | 22 ------ modules/30_crop/endo_apr21/presolve.gms | 40 ---------- modules/30_crop/penalty_apr22/equations.gms | 6 +- modules/30_crop/rotation_apr22/equations.gms | 6 +- modules/61_agroforestry/endo/declarations.gms | 67 ++++++++++++++++ modules/61_agroforestry/endo/equations.gms | 55 +++++++++++++ modules/61_agroforestry/endo/input.gms | 18 +++++ modules/61_agroforestry/endo/not_used.txt | 3 + modules/61_agroforestry/endo/postsolve.gms | 79 +++++++++++++++++++ modules/61_agroforestry/endo/preloop.gms | 26 ++++++ modules/61_agroforestry/endo/presolve.gms | 34 ++++++++ modules/61_agroforestry/endo/realization.gms | 21 +++++ modules/61_agroforestry/exo/declarations.gms | 65 +++++++++++++++ modules/61_agroforestry/exo/equations.gms | 54 +++++++++++++ modules/61_agroforestry/exo/input.gms | 20 +++++ modules/61_agroforestry/exo/postsolve.gms | 71 +++++++++++++++++ modules/61_agroforestry/exo/preloop.gms | 29 +++++++ modules/61_agroforestry/exo/presolve.gms | 36 +++++++++ modules/61_agroforestry/exo/realization.gms | 21 +++++ modules/61_agroforestry/module.gms | 22 ++++++ modules/61_agroforestry/off/declarations.gms | 25 ++++++ modules/61_agroforestry/off/not_used.txt | 10 +++ modules/61_agroforestry/off/postsolve.gms | 22 ++++++ modules/61_agroforestry/off/preloop.gms | 11 +++ modules/61_agroforestry/off/realization.gms | 17 ++++ modules/include.gms | 1 + 38 files changed, 753 insertions(+), 160 deletions(-) create mode 100644 modules/29_ageclass/feb21/presolve.gms create mode 100644 modules/61_agroforestry/endo/declarations.gms create mode 100644 modules/61_agroforestry/endo/equations.gms create mode 100644 modules/61_agroforestry/endo/input.gms create mode 100644 modules/61_agroforestry/endo/not_used.txt create mode 100644 modules/61_agroforestry/endo/postsolve.gms create mode 100644 modules/61_agroforestry/endo/preloop.gms create mode 100644 modules/61_agroforestry/endo/presolve.gms create mode 100644 modules/61_agroforestry/endo/realization.gms create mode 100644 modules/61_agroforestry/exo/declarations.gms create mode 100644 modules/61_agroforestry/exo/equations.gms create mode 100644 modules/61_agroforestry/exo/input.gms create mode 100644 modules/61_agroforestry/exo/postsolve.gms create mode 100644 modules/61_agroforestry/exo/preloop.gms create mode 100644 modules/61_agroforestry/exo/presolve.gms create mode 100644 modules/61_agroforestry/exo/realization.gms create mode 100644 modules/61_agroforestry/module.gms create mode 100644 modules/61_agroforestry/off/declarations.gms create mode 100644 modules/61_agroforestry/off/not_used.txt create mode 100644 modules/61_agroforestry/off/postsolve.gms create mode 100644 modules/61_agroforestry/off/preloop.gms create mode 100644 modules/61_agroforestry/off/realization.gms diff --git a/modules/10_land/input/files b/modules/10_land/input/files index 27b769596d..d6124da3a7 100644 --- a/modules/10_land/input/files +++ b/modules/10_land/input/files @@ -3,3 +3,5 @@ avl_land_t.cs3 avl_land_t_0.5.mz luh2_side_layers.cs3 avl_land_t_iso.cs3 +CroplandTreecover.cs2 +CroplandTreecover_0.5.mz diff --git a/modules/10_land/landmatrix_dec18/declarations.gms b/modules/10_land/landmatrix_dec18/declarations.gms index 7b53d1b487..03199d7f26 100644 --- a/modules/10_land/landmatrix_dec18/declarations.gms +++ b/modules/10_land/landmatrix_dec18/declarations.gms @@ -8,6 +8,7 @@ parameters pm_land_start(j,land) Land initialization area (mio. ha) pcm_land(j,land) Land area in previous time step including possible changes after optimization (mio. ha) + pm_treecover_shr(j) Cropland tree cover share (1) ; variables diff --git a/modules/10_land/landmatrix_dec18/input.gms b/modules/10_land/landmatrix_dec18/input.gms index 56f4edb78c..a90961d614 100644 --- a/modules/10_land/landmatrix_dec18/input.gms +++ b/modules/10_land/landmatrix_dec18/input.gms @@ -14,6 +14,11 @@ $ondelim $include "./modules/10_land/input/avl_land_t.cs3" $offdelim ; +*due to some rounding errors the input data currently may contain in some cases +*very small, negative numbers. These numbers have to be set to 0 as area +*cannot be smaller than 0! +f10_land(t_ini10,j,land)$(f10_land(t_ini10,j,land)<0) = 0; + table fm_luh2_side_layers(j,luh2_side_layers10) luh2 side layers (grid cell share) $ondelim @@ -26,3 +31,13 @@ $ondelim $include "./modules/10_land/input/avl_land_t_iso.cs3" $offdelim ; + +********* Cropland tree cover ******************************************* + +parameter f10_treecover(j) Tree cover on cropland in 2019 (mio. ha) +/ +$ondelim +$include "./modules/10_land/input/CroplandTreecover.cs2" +$offdelim +/ +; diff --git a/modules/10_land/landmatrix_dec18/start.gms b/modules/10_land/landmatrix_dec18/start.gms index 2211b09058..2da9a6f646 100644 --- a/modules/10_land/landmatrix_dec18/start.gms +++ b/modules/10_land/landmatrix_dec18/start.gms @@ -5,13 +5,13 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*due to some rounding errors the input data currently may contain in some cases -*very small, negative numbers. These numbers have to be set to 0 as area -*cannot be smaller than 0! pm_land_start(j,land) = f10_land("y1995",j,land); -pm_land_start(j,land)$(pm_land_start(j,land)<0) = 0; pcm_land(j,land) = pm_land_start(j,land); vm_land.l(j,land) = pcm_land(j,land); +pm_treecover_shr(j) = 0; +pm_treecover_shr(j)$(f10_land("y2015",j,"crop") > 1e-10) = + (f10_treecover(j)/f10_land("y2015",j,"crop")); + *** EOF pre.gms *** diff --git a/modules/11_costs/default/equations.gms b/modules/11_costs/default/equations.gms index ce57618e07..616bfdd8fa 100644 --- a/modules/11_costs/default/equations.gms +++ b/modules/11_costs/default/equations.gms @@ -37,6 +37,7 @@ + vm_costs_additional_mon(i2) + sum(cell(i2,j2),vm_cost_land_transition(j2)) + sum(cell(i2,j2), vm_peatland_cost(j2)) + + sum(cell(i2,j2), vm_cost_agroforestry(j2)) + sum(cell(i2,j2),vm_cost_bv_loss(j2)) + sum(cell(i2,j2),vm_cost_urban(j2)) + sum(cell(i2,j2),vm_water_cost(i2)) diff --git a/modules/29_ageclass/feb21/presolve.gms b/modules/29_ageclass/feb21/presolve.gms new file mode 100644 index 0000000000..ae9b575c01 --- /dev/null +++ b/modules/29_ageclass/feb21/presolve.gms @@ -0,0 +1,13 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*define ac_est and ac_sub +ac_est(ac) = no; +ac_est(ac) = yes$(ord(ac) <= (m_yeardiff_forestry(t)/5)); + +ac_sub(ac) = no; +ac_sub(ac) = yes$(ord(ac) > (m_yeardiff_forestry(t)/5)); diff --git a/modules/29_ageclass/feb21/realization.gms b/modules/29_ageclass/feb21/realization.gms index 7fe7990889..59ad5ce66c 100644 --- a/modules/29_ageclass/feb21/realization.gms +++ b/modules/29_ageclass/feb21/realization.gms @@ -22,4 +22,5 @@ $Ifi "%phase%" == "sets" $include "./modules/29_ageclass/feb21/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/29_ageclass/feb21/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/29_ageclass/feb21/input.gms" $Ifi "%phase%" == "preloop" $include "./modules/29_ageclass/feb21/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/29_ageclass/feb21/presolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/30_crop/endo_apr21/declarations.gms b/modules/30_crop/endo_apr21/declarations.gms index f13886f1d0..0ab0da5cad 100644 --- a/modules/30_crop/endo_apr21/declarations.gms +++ b/modules/30_crop/endo_apr21/declarations.gms @@ -5,10 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -scalars - s30_shift number of 5-year age-classes corresponding to current time step length (1) -; - parameters p30_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) p30_country_snv_weight(i) SNV policy country weight per region (1) @@ -20,14 +16,6 @@ parameters i30_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) p30_snv_scenario_fader(t_all) SNV scenario fader (1) p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) - p30_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) - pc30_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) - p30_carbon_density_ac(t,j,ac,ag_pools) Carbon density cropland tree cover (tC per ha) - p30_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) - p30_treecover_min_shr(t,j) Minimum share of treecover on cropland (1) - p30_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) - p30_betr_min_shr(t,j) Minimum share of bioenergy trees on cropland (1) - p30_betr_scenario_fader(t_all) Bioenergy trees scenario fader (1) ; positive variables @@ -35,7 +23,6 @@ positive variables vm_fallow(j) Fallow land (mio. ha) vm_area(j,kcr,w) Agricultural production area (mio. ha) vm_rotation_penalty(i) Penalty for violating rotational constraints (USD05MER) - v30_treecover(j,ac) Cropland tree cover per age class (mio. ha) ; equations @@ -49,10 +36,6 @@ equations q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) q30_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) q30_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) - q30_treecover(j) Land constraint cropland treecover (mio. ha) - q30_treecover_est(j,ac) Land constraint cropland treecover (mio. ha) - q30_betr(j) Land constraint betr (mio. ha) - q30_bv_treecover(j,potnatveg) Biodiversity value for cropland treecover (Mha) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### @@ -60,7 +43,6 @@ parameters ov_fallow(t,j,type) Fallow land (mio. ha) ov_area(t,j,kcr,w,type) Agricultural production area (mio. ha) ov_rotation_penalty(t,i,type) Penalty for violating rotational constraints (USD05MER) - ov30_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) oq30_cropland(t,j,type) Total cropland calculation (mio. ha) oq30_avl_cropland(t,j,type) Available cropland constraint (mio. ha) oq30_rotation_max(t,j,crp30,w,type) Local maximum rotational constraints (mio. ha) @@ -71,10 +53,6 @@ parameters oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (mio. ha) oq30_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) oq30_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) - oq30_treecover(t,j,type) Land constraint cropland treecover (mio. ha) - oq30_treecover_est(t,j,ac,type) Land constraint cropland treecover (mio. ha) - oq30_betr(t,j,type) Land constraint betr (mio. ha) - oq30_bv_treecover(t,j,potnatveg,type) Biodiversity value for cropland treecover (Mha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/30_crop/endo_apr21/equations.gms b/modules/30_crop/endo_apr21/equations.gms index e2cda3e18c..539c3a61a0 100644 --- a/modules/30_crop/endo_apr21/equations.gms +++ b/modules/30_crop/endo_apr21/equations.gms @@ -10,7 +10,7 @@ *' the sum of crop and water supply type specific land requirements: q30_cropland(j2) .. - sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + sum(ac, v30_treecover(j2,ac)) =e= vm_land(j2,"crop"); + sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + vm_treecover_area(j2) =e= vm_land(j2,"crop"); *' We assume that crop production can only take place on suitable cropland area. *' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas @@ -40,19 +40,6 @@ q30_land_snv_trans(j2) .. sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p30_snv_relocation(ct,j2)); - q30_treecover(j2) .. - sum(ac, v30_treecover(j2,ac)) =g= sum(ct, p30_treecover_min_shr(ct,j2)) * vm_land(j2,"crop"); - - q30_betr(j2) .. - sum(w, vm_area(j2,"betr",w)) =g= - vm_land(j2,"crop") * sum(ct, p30_betr_min_shr(ct,j2)); - -*' This constraint distributes additions to forestry land over ac_est, -*' which depends on the time step length (e.g. ac0 and ac5 for a 10 year time step). - - q30_treecover_est(j2,ac_est) .. - v30_treecover(j2,ac_est) =e= sum(ac_est2, v30_treecover(j2,ac_est2))/card(ac_est2); - *' As additional constraints minimum and maximum rotational constraints limit *' the placing of crops. On the one hand, these rotational constraints reflect *' crop rotations limiting the share a specific crop can cover of the total area @@ -80,9 +67,8 @@ *' for all cropland : q30_carbon(j2,ag_pools,stockType) .. - vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= - m_carbon_stock(vm_land,fm_carbon_density,"crop") + - m_carbon_stock_ac(v30_treecover,p30_carbon_density_ac,"ac","ac_sub"); + vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= + m_carbon_stock(vm_land,fm_carbon_density,"crop") + vm_treecover_carbon(j2,ag_pools,stockType); *' The biodiversity value for cropland is calculated separately for annual and perennial crops: q30_bv_ann(j2,potnatveg) .. vm_bv(j2,"crop_ann",potnatveg) @@ -93,8 +79,3 @@ =e= (vm_land(j2,"crop") - sum((crop_ann30,w), vm_area(j2,crop_ann30,w))) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); - - q30_bv_treecover(j2,potnatveg) .. vm_bv(j2,"crop_tree",potnatveg) - =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v30_treecover(j2,ac)) * - p30_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/30_crop/endo_apr21/input.gms b/modules/30_crop/endo_apr21/input.gms index 90aac4cc9f..a8c1656d83 100644 --- a/modules/30_crop/endo_apr21/input.gms +++ b/modules/30_crop/endo_apr21/input.gms @@ -29,17 +29,6 @@ s30_snv_relocation_data_x1 First reference value in SNV target cropland dat s30_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / s30_rotation_scenario_start Rotation scenario start year / 2020 / s30_rotation_scenario_target Rotation scenario target year / 2050 / -s30_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / -s30_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / -s30_treecover_min_shr Share of treecover on cropland (1) / 0 / -s30_treecover_min_shr_noselect Share of treecover on cropland (1) / 0 / -s30_treecover_scenario_start Cropland treecover scenario start year / 2020 / -s30_treecover_scenario_target Cropland treecover scenario target year / 2030 / -s30_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / -s30_betr_min_shr Minimum share of bioenergy trees on cropland (1) / 0 / -s30_betr_min_shr_noselect Minimum share of bioenergy trees on cropland (1) / 0 / -s30_betr_scenario_start Bioenergy trees scenario start year / 2020 / -s30_betr_scenario_target Bioenergy trees scenario target year / 2050 / ; * Set-switch for countries affected by regional SNV policy @@ -133,13 +122,3 @@ $ondelim $include "./modules/30_crop/endo_apr21/input/SNVTargetCropland.cs3" $offdelim ; - -********* Cropland tree cover ******************************************* - -parameter f30_treecover(j) Tree cover on cropland in 2019 (mio. ha) -/ -$ondelim -$include "./modules/30_crop/endo_apr21/input/CroplandTreecover.cs2" -$offdelim -/ -; diff --git a/modules/30_crop/endo_apr21/input/files b/modules/30_crop/endo_apr21/input/files index 77cc6324da..d0cfbda228 100644 --- a/modules/30_crop/endo_apr21/input/files +++ b/modules/30_crop/endo_apr21/input/files @@ -7,5 +7,3 @@ f30_croparea_w_initialisation.cs3 avl_cropland_iso.cs3 SNVTargetCropland.cs3 SNVTargetCropland_0.5.mz -CroplandTreecover.cs2 -CroplandTreecover_0.5.mz diff --git a/modules/30_crop/endo_apr21/postsolve.gms b/modules/30_crop/endo_apr21/postsolve.gms index 1f5f5279aa..d15f95065c 100644 --- a/modules/30_crop/endo_apr21/postsolve.gms +++ b/modules/30_crop/endo_apr21/postsolve.gms @@ -5,13 +5,11 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -pc30_treecover(j,ac) = v30_treecover.l(j,ac); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_fallow(t,j,"marginal") = vm_fallow.m(j); ov_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w); ov_rotation_penalty(t,i,"marginal") = vm_rotation_penalty.m(i); - ov30_treecover(t,j,ac,"marginal") = v30_treecover.m(j,ac); oq30_cropland(t,j,"marginal") = q30_cropland.m(j); oq30_avl_cropland(t,j,"marginal") = q30_avl_cropland.m(j); oq30_rotation_max(t,j,crp30,w,"marginal") = q30_rotation_max.m(j,crp30,w); @@ -22,14 +20,9 @@ pc30_treecover(j,ac) = v30_treecover.l(j,ac); oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg); oq30_land_snv(t,j,"marginal") = q30_land_snv.m(j); oq30_land_snv_trans(t,j,"marginal") = q30_land_snv_trans.m(j); - oq30_treecover(t,j,"marginal") = q30_treecover.m(j); - oq30_treecover_est(t,j,ac,"marginal") = q30_treecover_est.m(j,ac); - oq30_betr(t,j,"marginal") = q30_betr.m(j); - oq30_bv_treecover(t,j,potnatveg,"marginal") = q30_bv_treecover.m(j,potnatveg); ov_fallow(t,j,"level") = vm_fallow.l(j); ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); ov_rotation_penalty(t,i,"level") = vm_rotation_penalty.l(i); - ov30_treecover(t,j,ac,"level") = v30_treecover.l(j,ac); oq30_cropland(t,j,"level") = q30_cropland.l(j); oq30_avl_cropland(t,j,"level") = q30_avl_cropland.l(j); oq30_rotation_max(t,j,crp30,w,"level") = q30_rotation_max.l(j,crp30,w); @@ -40,14 +33,9 @@ pc30_treecover(j,ac) = v30_treecover.l(j,ac); oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg); oq30_land_snv(t,j,"level") = q30_land_snv.l(j); oq30_land_snv_trans(t,j,"level") = q30_land_snv_trans.l(j); - oq30_treecover(t,j,"level") = q30_treecover.l(j); - oq30_treecover_est(t,j,ac,"level") = q30_treecover_est.l(j,ac); - oq30_betr(t,j,"level") = q30_betr.l(j); - oq30_bv_treecover(t,j,potnatveg,"level") = q30_bv_treecover.l(j,potnatveg); ov_fallow(t,j,"upper") = vm_fallow.up(j); ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); ov_rotation_penalty(t,i,"upper") = vm_rotation_penalty.up(i); - ov30_treecover(t,j,ac,"upper") = v30_treecover.up(j,ac); oq30_cropland(t,j,"upper") = q30_cropland.up(j); oq30_avl_cropland(t,j,"upper") = q30_avl_cropland.up(j); oq30_rotation_max(t,j,crp30,w,"upper") = q30_rotation_max.up(j,crp30,w); @@ -58,14 +46,9 @@ pc30_treecover(j,ac) = v30_treecover.l(j,ac); oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg); oq30_land_snv(t,j,"upper") = q30_land_snv.up(j); oq30_land_snv_trans(t,j,"upper") = q30_land_snv_trans.up(j); - oq30_treecover(t,j,"upper") = q30_treecover.up(j); - oq30_treecover_est(t,j,ac,"upper") = q30_treecover_est.up(j,ac); - oq30_betr(t,j,"upper") = q30_betr.up(j); - oq30_bv_treecover(t,j,potnatveg,"upper") = q30_bv_treecover.up(j,potnatveg); ov_fallow(t,j,"lower") = vm_fallow.lo(j); ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); ov_rotation_penalty(t,i,"lower") = vm_rotation_penalty.lo(i); - ov30_treecover(t,j,ac,"lower") = v30_treecover.lo(j,ac); oq30_cropland(t,j,"lower") = q30_cropland.lo(j); oq30_avl_cropland(t,j,"lower") = q30_avl_cropland.lo(j); oq30_rotation_max(t,j,crp30,w,"lower") = q30_rotation_max.lo(j,crp30,w); @@ -76,8 +59,4 @@ pc30_treecover(j,ac) = v30_treecover.l(j,ac); oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg); oq30_land_snv(t,j,"lower") = q30_land_snv.lo(j); oq30_land_snv_trans(t,j,"lower") = q30_land_snv_trans.lo(j); - oq30_treecover(t,j,"lower") = q30_treecover.lo(j); - oq30_treecover_est(t,j,ac,"lower") = q30_treecover_est.lo(j,ac); - oq30_betr(t,j,"lower") = q30_betr.lo(j); - oq30_bv_treecover(t,j,potnatveg,"lower") = q30_bv_treecover.lo(j,potnatveg); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/30_crop/endo_apr21/preloop.gms b/modules/30_crop/endo_apr21/preloop.gms index 167ce4300f..12c01058e1 100644 --- a/modules/30_crop/endo_apr21/preloop.gms +++ b/modules/30_crop/endo_apr21/preloop.gms @@ -9,8 +9,6 @@ * sigmoidal interpolation between start year and target year m_sigmoid_time_interpol(p30_snv_scenario_fader,s30_snv_scenario_start,s30_snv_scenario_target,0,1); m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); -m_sigmoid_time_interpol(p30_treecover_scenario_fader,s30_treecover_scenario_start,s30_treecover_scenario_target,0,1); -m_sigmoid_time_interpol(p30_betr_scenario_fader,s30_betr_scenario_start,s30_betr_scenario_target,0,1); * linear interpolation to estimate the cropland that * requires relocation due to SNV policy @@ -39,23 +37,3 @@ p30_country_dummy(policy_countries30) = 1; * Countries are weighted by available cropland area. i30_avl_cropland_iso(iso) = f30_avl_cropland_iso(iso,"%c30_marginal_land%"); p30_country_snv_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * i30_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i30_avl_cropland_iso(iso)); - -* Initial tree cover on cropland is assumed to be equally distributed among all age-classes -pc30_treecover(j,ac) = f30_treecover(j)/card(ac); - -*' Switch for tree cover on cropland: -*' 0 = Use natveg growth curve towards LPJmL natural vegetation -*' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation -if(s30_treecover_plantation = 0, - p30_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); -elseif s30_treecover_plantation = 1, - p30_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools); -); - -** set bii coefficients -p30_treecover_bii_coeff(bii_class_secd,potnatveg) = 0; -if(s30_treecover_bii_coeff = 0, - p30_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff(bii_class_secd,potnatveg) -elseif s30_treecover_bii_coeff = 1, - p30_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff("timber",potnatveg) -); diff --git a/modules/30_crop/endo_apr21/presolve.gms b/modules/30_crop/endo_apr21/presolve.gms index 7b22389795..b88ac26965 100644 --- a/modules/30_crop/endo_apr21/presolve.gms +++ b/modules/30_crop/endo_apr21/presolve.gms @@ -50,43 +50,3 @@ p30_snv_relocation(t,j)$(p30_snv_relocation(t, j) > p30_max_snv_relocation(t,j)) *' Area potentially available for cropping p30_avl_cropland(t,j) = f30_avl_cropland(j,"%c30_marginal_land%") * (1 - p30_snv_shr(t,j)); *' @stop - -* Growth of trees on cropland is modelled by shifting age-classes according to time step length. -s30_shift = m_timestep_length_forestry/5; -* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s30_shift = 1) - p30_treecover(t,j,ac)$(ord(ac) > s30_shift) = pc30_treecover(j,ac-s30_shift); -* account for cases at the end of the age class set (s30_shift > 1) which are not shifted by the above calculation - p30_treecover(t,j,"acx") = p30_treecover(t,j,"acx") - + sum(ac$(ord(ac) > card(ac)-s30_shift), pc30_treecover(j,ac)); - -pc30_treecover(j,ac) = p30_treecover(t,j,ac); -v30_treecover.l(j,ac) = p30_treecover(t,j,ac); - -p30_treecover_min_shr(t,j) = p30_treecover_scenario_fader(t) * - (s30_treecover_min_shr * sum(cell(i,j), p30_country_snv_weight(i)) - + s30_treecover_min_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); - -*define ac_est and ac_sub -ac_est(ac) = no; -ac_est(ac) = yes$(ord(ac) <= (m_yeardiff_forestry(t)/5)); - -ac_sub(ac) = no; -ac_sub(ac) = yes$(ord(ac) > (m_yeardiff_forestry(t)/5)); - -* fix before s30_treecover_scenario_start to pc30_treecover(j,ac)? -if(m_year(t) <= s30_treecover_scenario_start, - v30_treecover.fx(j,ac) = pc30_treecover(j,ac); -else - v30_treecover.lo(j,ac_est) = 0; - v30_treecover.up(j,ac_est) = Inf; - if(s30_treecover_decrease = 1, - v30_treecover.lo(j,ac_sub) = 0; - v30_treecover.up(j,ac_sub) = pc30_treecover(j,ac_sub); - else - v30_treecover.fx(j,ac_sub) = pc30_treecover(j,ac_sub); - ); -); - -p30_betr_min_shr(t,j) = p30_betr_scenario_fader(t) * - (s30_betr_min_shr * sum(cell(i,j), p30_country_snv_weight(i)) - + s30_betr_min_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); diff --git a/modules/30_crop/penalty_apr22/equations.gms b/modules/30_crop/penalty_apr22/equations.gms index 5dd3f2c2bc..edcf6d8dd3 100644 --- a/modules/30_crop/penalty_apr22/equations.gms +++ b/modules/30_crop/penalty_apr22/equations.gms @@ -12,7 +12,7 @@ *' the land area for crops vm_land and the croparea vm_area q30_cropland(j2) .. - sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) =e= vm_land(j2,"crop"); + sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + vm_treecover_area(j2) =e= vm_land(j2,"crop"); *' We assume that crop production can only take place on suitable cropland area. *' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas @@ -95,8 +95,8 @@ q30_rotation_penalty(i2) .. *' for all cropland : q30_carbon(j2,ag_pools,stockType) .. - vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= - m_carbon_stock(vm_land,fm_carbon_density,"crop"); + vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= + m_carbon_stock(vm_land,fm_carbon_density,"crop") + vm_treecover_carbon(j2,ag_pools,stockType); *' The biodiversity value for cropland is calculated separately for annual and perennial crops: q30_bv_ann(j2,potnatveg) .. diff --git a/modules/30_crop/rotation_apr22/equations.gms b/modules/30_crop/rotation_apr22/equations.gms index c208b6e5b3..3e429ab9da 100644 --- a/modules/30_crop/rotation_apr22/equations.gms +++ b/modules/30_crop/rotation_apr22/equations.gms @@ -12,7 +12,7 @@ *' the land area for crops vm_land and the croparea vm_area q30_cropland(j2) .. - sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) =e= vm_land(j2,"crop"); + sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + vm_treecover_area(j2) =e= vm_land(j2,"crop"); *' We assume that crop production can only take place on suitable cropland area. *' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas @@ -76,8 +76,8 @@ *' for all cropland : q30_carbon(j2,ag_pools,stockType) .. - vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= - m_carbon_stock(vm_land,fm_carbon_density,"crop"); + vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= + m_carbon_stock(vm_land,fm_carbon_density,"crop") + vm_treecover_carbon(j2,ag_pools,stockType); *' The biodiversity value for cropland is calculated separately for annual and perennial crops: q30_bv_ann(j2,potnatveg) .. diff --git a/modules/61_agroforestry/endo/declarations.gms b/modules/61_agroforestry/endo/declarations.gms new file mode 100644 index 0000000000..5503ad7181 --- /dev/null +++ b/modules/61_agroforestry/endo/declarations.gms @@ -0,0 +1,67 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +scalars + s61_shift number of 5-year age-classes corresponding to current time step length (1) +; + +parameters + p61_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) + p61_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) + p61_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) + pc61_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) + i61_reward_treecover Area reward for cropland treecover (USD per ha) + i61_reward_betr Area reward for bioenergy trees (USD per ha) +; + +equations + q61_cost_agroforestry(j) Costs and benefits related to agroforestry (mio. USD05MER per yr) + q61_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) + q61_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + q61_treecover_area(j) Cropland treecover interface (mio. ha) + q61_reward_treecover(j) Reward for cropland treecover (mio. USD05MER per yr) + q61_reward_betr(j) Reward for bioenergy trees (mio. USD05MER per yr) + q61_treecover_est(j,ac) Cropland treecover establishment (mio. ha) + q61_treecover_carbon(j,ag_pools,stockType) Cropland tree cover above ground carbon content (mio. tC) + q61_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (Mha) +; + +variables + vm_cost_agroforestry(j) Cost and rewards related to agroforestry (mio. USD05MER per yr) +; + +positive variables + v61_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) + v61_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + v61_reward_treecover(j) Reward for cropland treecover (mio. USD05MER per yr) + v61_reward_betr(j) Reward for bioenergy trees (mio. USD05MER per yr) + vm_treecover_area(j) Cropland tree cover (mio. ha) + v61_treecover(j,ac) Cropland tree cover per age class (mio. ha) + vm_treecover_carbon(j,ag_pools,stockType) Cropland tree cover above ground carbon content (mio. tC) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_cost_agroforestry(t,j,type) Cost and rewards related to agroforestry (mio. USD05MER per yr) + ov61_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) + ov61_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + ov61_reward_treecover(t,j,type) Reward for cropland treecover (mio. USD05MER per yr) + ov61_reward_betr(t,j,type) Reward for bioenergy trees (mio. USD05MER per yr) + ov_treecover_area(t,j,type) Cropland tree cover (mio. ha) + ov61_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) + ov_treecover_carbon(t,j,ag_pools,stockType,type) Cropland tree cover above ground carbon content (mio. tC) + oq61_cost_agroforestry(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr) + oq61_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) + oq61_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + oq61_treecover_area(t,j,type) Cropland treecover interface (mio. ha) + oq61_reward_treecover(t,j,type) Reward for cropland treecover (mio. USD05MER per yr) + oq61_reward_betr(t,j,type) Reward for bioenergy trees (mio. USD05MER per yr) + oq61_treecover_est(t,j,ac,type) Cropland treecover establishment (mio. ha) + oq61_treecover_carbon(t,j,ag_pools,stockType,type) Cropland tree cover above ground carbon content (mio. tC) + oq61_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (Mha) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/61_agroforestry/endo/equations.gms b/modules/61_agroforestry/endo/equations.gms new file mode 100644 index 0000000000..c1cda77e71 --- /dev/null +++ b/modules/61_agroforestry/endo/equations.gms @@ -0,0 +1,55 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @equations + +*' Total agroforestry cost. +*' Cost for bioenergy trees are accounted for in the [30_crop] module. +q61_cost_agroforestry(j2) .. + vm_cost_agroforestry(j2) =e= + v61_cost_treecover_est(j2) + v61_cost_treecover_recur(j2) + - v61_reward_treecover(j2) - v61_reward_betr(j2); + +*' Tree cover establishment cost +q61_cost_treecover_est(j2) .. + v61_cost_treecover_est(j2) =e= + sum(ac_est, v61_treecover(j2,ac_est)) * s61_cost_treecover_est * + sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); + +*' Tree cover recurring cost +q61_cost_treecover_recur(j2) .. + v61_cost_treecover_recur(j2) =e= + sum(ac_sub, v61_treecover(j2,ac_sub)) * s61_cost_treecover_recur; + +*' Tree cover reward +q61_reward_treecover(j2) .. + v61_reward_treecover(j2) =e= + sum(ac, v61_treecover(j2,ac)) * i61_reward_treecover; + +*' Bioenergy tree reward +q61_reward_betr(j2) .. + v61_reward_betr(j2) =e= + sum(ac, v61_treecover(j2,ac)) * i61_reward_betr; + +*' Tree cover establishment +q61_treecover_est(j2,ac_est) .. + v61_treecover(j2,ac_est) =e= sum(ac_est2, v61_treecover(j2,ac_est2))/card(ac_est2); + +*' Tree cover area interface +q61_treecover_area(j2) .. + vm_treecover_area(j2) =e= sum(ac, v61_treecover(j2,ac)); + +*' Tree cover carbon stock interface +q61_treecover_carbon(j2,ag_pools,stockType) .. + vm_treecover_carbon(j2,ag_pools,stockType) =e= + m_carbon_stock_ac(v61_treecover,p61_carbon_density_ac,"ac","ac_sub"); + +*' Tree cover biodiversity value +q61_treecover_bv(j2,potnatveg) .. + vm_bv(j2,"crop_tree",potnatveg) =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v61_treecover(j2,ac)) * + p61_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/61_agroforestry/endo/input.gms b/modules/61_agroforestry/endo/input.gms new file mode 100644 index 0000000000..f7969d71dd --- /dev/null +++ b/modules/61_agroforestry/endo/input.gms @@ -0,0 +1,18 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +scalars + s61_cost_treecover_est Tree cover establishment cost (USD per ha) / 2000 / + s61_cost_treecover_recur Tree cover recurring cost (USD per ha) / 500 / + s61_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / + s61_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / + s61_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / + s61_reward_treecover Area reward for cropland treecover (USD per ha) / 5000 / + s61_reward_betr Area reward for bioenergy trees on cropland (USD per ha) / 5000 / + s61_treecover_scenario_start Cropland treecover scenario start year / 2020 / + s61_betr_scenario_start Bioenergy trees scenario start year / 2020 / +; diff --git a/modules/61_agroforestry/endo/not_used.txt b/modules/61_agroforestry/endo/not_used.txt new file mode 100644 index 0000000000..9747c9f19b --- /dev/null +++ b/modules/61_agroforestry/endo/not_used.txt @@ -0,0 +1,3 @@ +name,type,reason +vm_land,input,not used +vm_area,input,not used diff --git a/modules/61_agroforestry/endo/postsolve.gms b/modules/61_agroforestry/endo/postsolve.gms new file mode 100644 index 0000000000..1afb2c367e --- /dev/null +++ b/modules/61_agroforestry/endo/postsolve.gms @@ -0,0 +1,79 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +pc61_treecover(j,ac) = v61_treecover.l(j,ac); + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov_cost_agroforestry(t,j,"marginal") = vm_cost_agroforestry.m(j); + ov61_cost_treecover_est(t,j,"marginal") = v61_cost_treecover_est.m(j); + ov61_cost_treecover_recur(t,j,"marginal") = v61_cost_treecover_recur.m(j); + ov61_reward_treecover(t,j,"marginal") = v61_reward_treecover.m(j); + ov61_reward_betr(t,j,"marginal") = v61_reward_betr.m(j); + ov_treecover_area(t,j,"marginal") = vm_treecover_area.m(j); + ov61_treecover(t,j,ac,"marginal") = v61_treecover.m(j,ac); + ov_treecover_carbon(t,j,ag_pools,stockType,"marginal") = vm_treecover_carbon.m(j,ag_pools,stockType); + oq61_cost_agroforestry(t,j,"marginal") = q61_cost_agroforestry.m(j); + oq61_cost_treecover_est(t,j,"marginal") = q61_cost_treecover_est.m(j); + oq61_cost_treecover_recur(t,j,"marginal") = q61_cost_treecover_recur.m(j); + oq61_treecover_area(t,j,"marginal") = q61_treecover_area.m(j); + oq61_reward_treecover(t,j,"marginal") = q61_reward_treecover.m(j); + oq61_reward_betr(t,j,"marginal") = q61_reward_betr.m(j); + oq61_treecover_est(t,j,ac,"marginal") = q61_treecover_est.m(j,ac); + oq61_treecover_carbon(t,j,ag_pools,stockType,"marginal") = q61_treecover_carbon.m(j,ag_pools,stockType); + oq61_treecover_bv(t,j,potnatveg,"marginal") = q61_treecover_bv.m(j,potnatveg); + ov_cost_agroforestry(t,j,"level") = vm_cost_agroforestry.l(j); + ov61_cost_treecover_est(t,j,"level") = v61_cost_treecover_est.l(j); + ov61_cost_treecover_recur(t,j,"level") = v61_cost_treecover_recur.l(j); + ov61_reward_treecover(t,j,"level") = v61_reward_treecover.l(j); + ov61_reward_betr(t,j,"level") = v61_reward_betr.l(j); + ov_treecover_area(t,j,"level") = vm_treecover_area.l(j); + ov61_treecover(t,j,ac,"level") = v61_treecover.l(j,ac); + ov_treecover_carbon(t,j,ag_pools,stockType,"level") = vm_treecover_carbon.l(j,ag_pools,stockType); + oq61_cost_agroforestry(t,j,"level") = q61_cost_agroforestry.l(j); + oq61_cost_treecover_est(t,j,"level") = q61_cost_treecover_est.l(j); + oq61_cost_treecover_recur(t,j,"level") = q61_cost_treecover_recur.l(j); + oq61_treecover_area(t,j,"level") = q61_treecover_area.l(j); + oq61_reward_treecover(t,j,"level") = q61_reward_treecover.l(j); + oq61_reward_betr(t,j,"level") = q61_reward_betr.l(j); + oq61_treecover_est(t,j,ac,"level") = q61_treecover_est.l(j,ac); + oq61_treecover_carbon(t,j,ag_pools,stockType,"level") = q61_treecover_carbon.l(j,ag_pools,stockType); + oq61_treecover_bv(t,j,potnatveg,"level") = q61_treecover_bv.l(j,potnatveg); + ov_cost_agroforestry(t,j,"upper") = vm_cost_agroforestry.up(j); + ov61_cost_treecover_est(t,j,"upper") = v61_cost_treecover_est.up(j); + ov61_cost_treecover_recur(t,j,"upper") = v61_cost_treecover_recur.up(j); + ov61_reward_treecover(t,j,"upper") = v61_reward_treecover.up(j); + ov61_reward_betr(t,j,"upper") = v61_reward_betr.up(j); + ov_treecover_area(t,j,"upper") = vm_treecover_area.up(j); + ov61_treecover(t,j,ac,"upper") = v61_treecover.up(j,ac); + ov_treecover_carbon(t,j,ag_pools,stockType,"upper") = vm_treecover_carbon.up(j,ag_pools,stockType); + oq61_cost_agroforestry(t,j,"upper") = q61_cost_agroforestry.up(j); + oq61_cost_treecover_est(t,j,"upper") = q61_cost_treecover_est.up(j); + oq61_cost_treecover_recur(t,j,"upper") = q61_cost_treecover_recur.up(j); + oq61_treecover_area(t,j,"upper") = q61_treecover_area.up(j); + oq61_reward_treecover(t,j,"upper") = q61_reward_treecover.up(j); + oq61_reward_betr(t,j,"upper") = q61_reward_betr.up(j); + oq61_treecover_est(t,j,ac,"upper") = q61_treecover_est.up(j,ac); + oq61_treecover_carbon(t,j,ag_pools,stockType,"upper") = q61_treecover_carbon.up(j,ag_pools,stockType); + oq61_treecover_bv(t,j,potnatveg,"upper") = q61_treecover_bv.up(j,potnatveg); + ov_cost_agroforestry(t,j,"lower") = vm_cost_agroforestry.lo(j); + ov61_cost_treecover_est(t,j,"lower") = v61_cost_treecover_est.lo(j); + ov61_cost_treecover_recur(t,j,"lower") = v61_cost_treecover_recur.lo(j); + ov61_reward_treecover(t,j,"lower") = v61_reward_treecover.lo(j); + ov61_reward_betr(t,j,"lower") = v61_reward_betr.lo(j); + ov_treecover_area(t,j,"lower") = vm_treecover_area.lo(j); + ov61_treecover(t,j,ac,"lower") = v61_treecover.lo(j,ac); + ov_treecover_carbon(t,j,ag_pools,stockType,"lower") = vm_treecover_carbon.lo(j,ag_pools,stockType); + oq61_cost_agroforestry(t,j,"lower") = q61_cost_agroforestry.lo(j); + oq61_cost_treecover_est(t,j,"lower") = q61_cost_treecover_est.lo(j); + oq61_cost_treecover_recur(t,j,"lower") = q61_cost_treecover_recur.lo(j); + oq61_treecover_area(t,j,"lower") = q61_treecover_area.lo(j); + oq61_reward_treecover(t,j,"lower") = q61_reward_treecover.lo(j); + oq61_reward_betr(t,j,"lower") = q61_reward_betr.lo(j); + oq61_treecover_est(t,j,ac,"lower") = q61_treecover_est.lo(j,ac); + oq61_treecover_carbon(t,j,ag_pools,stockType,"lower") = q61_treecover_carbon.lo(j,ag_pools,stockType); + oq61_treecover_bv(t,j,potnatveg,"lower") = q61_treecover_bv.lo(j,potnatveg); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/61_agroforestry/endo/preloop.gms b/modules/61_agroforestry/endo/preloop.gms new file mode 100644 index 0000000000..a60e56e0b7 --- /dev/null +++ b/modules/61_agroforestry/endo/preloop.gms @@ -0,0 +1,26 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +* Initial tree cover on cropland is assumed to be equally distributed among all age-classes +pc61_treecover(j,ac) = (pm_treecover_shr(j)*pm_land_start(j,"crop"))/card(ac); + +*' Switch for tree cover on cropland: +*' 0 = Use natveg growth curve towards LPJmL natural vegetation +*' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation +if(s61_treecover_plantation = 0, + p61_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); +elseif s61_treecover_plantation = 1, + p61_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools); +); + +** set bii coefficients +p61_treecover_bii_coeff(bii_class_secd,potnatveg) = 0; +if(s61_treecover_bii_coeff = 0, + p61_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff(bii_class_secd,potnatveg) +elseif s61_treecover_bii_coeff = 1, + p61_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff("timber",potnatveg) +); diff --git a/modules/61_agroforestry/endo/presolve.gms b/modules/61_agroforestry/endo/presolve.gms new file mode 100644 index 0000000000..f123728309 --- /dev/null +++ b/modules/61_agroforestry/endo/presolve.gms @@ -0,0 +1,34 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +* Growth of trees on cropland is modelled by shifting age-classes according to time step length. +s61_shift = m_timestep_length_forestry/5; +* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s61_shift = 1) + p61_treecover(t,j,ac)$(ord(ac) > s61_shift) = pc61_treecover(j,ac-s61_shift); +* account for cases at the end of the age class set (s61_shift > 1) which are not shifted by the above calculation + p61_treecover(t,j,"acx") = p61_treecover(t,j,"acx") + + sum(ac$(ord(ac) > card(ac)-s61_shift), pc61_treecover(j,ac)); + +pc61_treecover(j,ac) = p61_treecover(t,j,ac); +v61_treecover.l(j,ac) = p61_treecover(t,j,ac); + +if(m_year(t) <= s61_treecover_scenario_start, + v61_treecover.fx(j,ac) = pc61_treecover(j,ac); + i61_reward_treecover = 0; + i61_reward_betr = 0; +else + i61_reward_treecover = s61_reward_treecover; + i61_reward_betr = s61_reward_betr; + v61_treecover.lo(j,ac_est) = 0; + v61_treecover.up(j,ac_est) = Inf; + if(s61_treecover_decrease = 1, + v61_treecover.lo(j,ac_sub) = 0; + v61_treecover.up(j,ac_sub) = pc61_treecover(j,ac_sub); + else + v61_treecover.fx(j,ac_sub) = pc61_treecover(j,ac_sub); + ); +); diff --git a/modules/61_agroforestry/endo/realization.gms b/modules/61_agroforestry/endo/realization.gms new file mode 100644 index 0000000000..7f22f40dff --- /dev/null +++ b/modules/61_agroforestry/endo/realization.gms @@ -0,0 +1,21 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @description In this realization, future shares of tree cover and bioenergy trees +*' on cropland at cluster level follow exogenous assumptions. +*' @stop +*' +*' @limitations There are currently no known limitations of this realization. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "declarations" $include "./modules/61_agroforestry/endo/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/61_agroforestry/endo/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/61_agroforestry/endo/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/61_agroforestry/endo/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/61_agroforestry/endo/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/61_agroforestry/endo/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/61_agroforestry/exo/declarations.gms b/modules/61_agroforestry/exo/declarations.gms new file mode 100644 index 0000000000..0262c0e59e --- /dev/null +++ b/modules/61_agroforestry/exo/declarations.gms @@ -0,0 +1,65 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +scalars + s61_shift number of 5-year age-classes corresponding to current time step length (1) +; + +parameters + p61_treecover_min_shr(t,j) Minimum share of treecover on cropland (1) + p61_betr_min_shr(t,j) Minimum share of bioenergy trees on cropland (1) + p61_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) + p61_betr_scenario_fader(t_all) Bioenergy trees scenario fader (1) + p61_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) + p61_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) + p61_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) + pc61_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) +; + +equations + q61_cost_agroforestry(j) Costs and benefits related to agroforestry (mio. USD05MER per yr) + q61_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) + q61_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + q61_treecover_area(j) Cropland treecover interface (mio. ha) + q61_treecover_shr(j) Cropland treecover minimum share (mio. ha) + q61_betr_shr(j) Bioenergy trees minimum share (mio. ha) + q61_treecover_est(j,ac) Cropland treecover establishment (mio. ha) + q61_treecover_carbon(j,ag_pools,stockType) Cropland tree cover above ground carbon content (mio. tC) + q61_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (Mha) +; + +variables + vm_cost_agroforestry(j) Cost and rewards related to agroforestry (mio. USD05MER per yr) +; + +positive variables + v61_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) + v61_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + vm_treecover_area(j) Cropland tree cover (mio. ha) + v61_treecover(j,ac) Cropland tree cover per age class (mio. ha) + vm_treecover_carbon(j,ag_pools,stockType) Cropland tree cover above ground carbon content (mio. tC) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_cost_agroforestry(t,j,type) Cost and rewards related to agroforestry (mio. USD05MER per yr) + ov61_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) + ov61_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + ov_treecover_area(t,j,type) Cropland tree cover (mio. ha) + ov61_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) + ov_treecover_carbon(t,j,ag_pools,stockType,type) Cropland tree cover above ground carbon content (mio. tC) + oq61_cost_agroforestry(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr) + oq61_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) + oq61_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + oq61_treecover_area(t,j,type) Cropland treecover interface (mio. ha) + oq61_treecover_shr(t,j,type) Cropland treecover minimum share (mio. ha) + oq61_betr_shr(t,j,type) Bioenergy trees minimum share (mio. ha) + oq61_treecover_est(t,j,ac,type) Cropland treecover establishment (mio. ha) + oq61_treecover_carbon(t,j,ag_pools,stockType,type) Cropland tree cover above ground carbon content (mio. tC) + oq61_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (Mha) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/61_agroforestry/exo/equations.gms b/modules/61_agroforestry/exo/equations.gms new file mode 100644 index 0000000000..6a052bea65 --- /dev/null +++ b/modules/61_agroforestry/exo/equations.gms @@ -0,0 +1,54 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @equations + +*' Total agroforestry cost. +*' Cost for bioenergy trees are accounted for in the [30_crop] module. +q61_cost_agroforestry(j2) .. + vm_cost_agroforestry(j2) =e= + v61_cost_treecover_est(j2) + v61_cost_treecover_recur(j2); + +*' Tree cover establishment cost +q61_cost_treecover_est(j2) .. + v61_cost_treecover_est(j2) =e= + sum(ac_est, v61_treecover(j2,ac_est)) * s61_cost_treecover_est * + sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); + +*' Tree cover recurring cost +q61_cost_treecover_recur(j2) .. + v61_cost_treecover_recur(j2) =e= + sum(ac_sub, v61_treecover(j2,ac_sub)) * s61_cost_treecover_recur; + +*' Tree cover minimum share +q61_treecover_shr(j2) .. + sum(ac, v61_treecover(j2,ac)) =g= + sum(ct, p61_treecover_min_shr(ct,j2)) * vm_land(j2,"crop"); + +*' Bioenergy tree minimum share +q61_betr_shr(j2) .. + sum(w, vm_area(j2,"betr",w)) =g= + sum(ct, p61_betr_min_shr(ct,j2)) * vm_land(j2,"crop"); + +*' Tree cover establishment +q61_treecover_est(j2,ac_est) .. + v61_treecover(j2,ac_est) =e= sum(ac_est2, v61_treecover(j2,ac_est2))/card(ac_est2); + +*' Tree cover area interface +q61_treecover_area(j2) .. + vm_treecover_area(j2) =e= sum(ac, v61_treecover(j2,ac)); + +*' Tree cover carbon stock interface +q61_treecover_carbon(j2,ag_pools,stockType) .. + vm_treecover_carbon(j2,ag_pools,stockType) =e= + m_carbon_stock_ac(v61_treecover,p61_carbon_density_ac,"ac","ac_sub"); + +*' Tree cover biodiversity value +q61_treecover_bv(j2,potnatveg) .. + vm_bv(j2,"crop_tree",potnatveg) =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v61_treecover(j2,ac)) * + p61_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/61_agroforestry/exo/input.gms b/modules/61_agroforestry/exo/input.gms new file mode 100644 index 0000000000..8d198c6bd0 --- /dev/null +++ b/modules/61_agroforestry/exo/input.gms @@ -0,0 +1,20 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +scalars + s61_cost_treecover_est Tree cover establishment cost (USD per ha) / 2000 / + s61_cost_treecover_recur Tree cover recurring cost (USD per ha) / 500 / + s61_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / + s61_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / + s61_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / + s61_treecover_scenario_start Cropland treecover scenario start year / 2020 / + s61_treecover_scenario_target Cropland treecover scenario target year / 2050 / + s61_treecover_min_shr Share of treecover on cropland (1) / 0.2 / + s61_betr_scenario_start Bioenergy trees scenario start year / 2020 / + s61_betr_scenario_target Bioenergy trees scenario target year / 2050 / + s61_betr_min_shr Minimum share of bioenergy trees on cropland (1) / 0 / +; diff --git a/modules/61_agroforestry/exo/postsolve.gms b/modules/61_agroforestry/exo/postsolve.gms new file mode 100644 index 0000000000..557cf4f306 --- /dev/null +++ b/modules/61_agroforestry/exo/postsolve.gms @@ -0,0 +1,71 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +pc61_treecover(j,ac) = v61_treecover.l(j,ac); + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov_cost_agroforestry(t,j,"marginal") = vm_cost_agroforestry.m(j); + ov61_cost_treecover_est(t,j,"marginal") = v61_cost_treecover_est.m(j); + ov61_cost_treecover_recur(t,j,"marginal") = v61_cost_treecover_recur.m(j); + ov_treecover_area(t,j,"marginal") = vm_treecover_area.m(j); + ov61_treecover(t,j,ac,"marginal") = v61_treecover.m(j,ac); + ov_treecover_carbon(t,j,ag_pools,stockType,"marginal") = vm_treecover_carbon.m(j,ag_pools,stockType); + oq61_cost_agroforestry(t,j,"marginal") = q61_cost_agroforestry.m(j); + oq61_cost_treecover_est(t,j,"marginal") = q61_cost_treecover_est.m(j); + oq61_cost_treecover_recur(t,j,"marginal") = q61_cost_treecover_recur.m(j); + oq61_treecover_area(t,j,"marginal") = q61_treecover_area.m(j); + oq61_treecover_shr(t,j,"marginal") = q61_treecover_shr.m(j); + oq61_betr_shr(t,j,"marginal") = q61_betr_shr.m(j); + oq61_treecover_est(t,j,ac,"marginal") = q61_treecover_est.m(j,ac); + oq61_treecover_carbon(t,j,ag_pools,stockType,"marginal") = q61_treecover_carbon.m(j,ag_pools,stockType); + oq61_treecover_bv(t,j,potnatveg,"marginal") = q61_treecover_bv.m(j,potnatveg); + ov_cost_agroforestry(t,j,"level") = vm_cost_agroforestry.l(j); + ov61_cost_treecover_est(t,j,"level") = v61_cost_treecover_est.l(j); + ov61_cost_treecover_recur(t,j,"level") = v61_cost_treecover_recur.l(j); + ov_treecover_area(t,j,"level") = vm_treecover_area.l(j); + ov61_treecover(t,j,ac,"level") = v61_treecover.l(j,ac); + ov_treecover_carbon(t,j,ag_pools,stockType,"level") = vm_treecover_carbon.l(j,ag_pools,stockType); + oq61_cost_agroforestry(t,j,"level") = q61_cost_agroforestry.l(j); + oq61_cost_treecover_est(t,j,"level") = q61_cost_treecover_est.l(j); + oq61_cost_treecover_recur(t,j,"level") = q61_cost_treecover_recur.l(j); + oq61_treecover_area(t,j,"level") = q61_treecover_area.l(j); + oq61_treecover_shr(t,j,"level") = q61_treecover_shr.l(j); + oq61_betr_shr(t,j,"level") = q61_betr_shr.l(j); + oq61_treecover_est(t,j,ac,"level") = q61_treecover_est.l(j,ac); + oq61_treecover_carbon(t,j,ag_pools,stockType,"level") = q61_treecover_carbon.l(j,ag_pools,stockType); + oq61_treecover_bv(t,j,potnatveg,"level") = q61_treecover_bv.l(j,potnatveg); + ov_cost_agroforestry(t,j,"upper") = vm_cost_agroforestry.up(j); + ov61_cost_treecover_est(t,j,"upper") = v61_cost_treecover_est.up(j); + ov61_cost_treecover_recur(t,j,"upper") = v61_cost_treecover_recur.up(j); + ov_treecover_area(t,j,"upper") = vm_treecover_area.up(j); + ov61_treecover(t,j,ac,"upper") = v61_treecover.up(j,ac); + ov_treecover_carbon(t,j,ag_pools,stockType,"upper") = vm_treecover_carbon.up(j,ag_pools,stockType); + oq61_cost_agroforestry(t,j,"upper") = q61_cost_agroforestry.up(j); + oq61_cost_treecover_est(t,j,"upper") = q61_cost_treecover_est.up(j); + oq61_cost_treecover_recur(t,j,"upper") = q61_cost_treecover_recur.up(j); + oq61_treecover_area(t,j,"upper") = q61_treecover_area.up(j); + oq61_treecover_shr(t,j,"upper") = q61_treecover_shr.up(j); + oq61_betr_shr(t,j,"upper") = q61_betr_shr.up(j); + oq61_treecover_est(t,j,ac,"upper") = q61_treecover_est.up(j,ac); + oq61_treecover_carbon(t,j,ag_pools,stockType,"upper") = q61_treecover_carbon.up(j,ag_pools,stockType); + oq61_treecover_bv(t,j,potnatveg,"upper") = q61_treecover_bv.up(j,potnatveg); + ov_cost_agroforestry(t,j,"lower") = vm_cost_agroforestry.lo(j); + ov61_cost_treecover_est(t,j,"lower") = v61_cost_treecover_est.lo(j); + ov61_cost_treecover_recur(t,j,"lower") = v61_cost_treecover_recur.lo(j); + ov_treecover_area(t,j,"lower") = vm_treecover_area.lo(j); + ov61_treecover(t,j,ac,"lower") = v61_treecover.lo(j,ac); + ov_treecover_carbon(t,j,ag_pools,stockType,"lower") = vm_treecover_carbon.lo(j,ag_pools,stockType); + oq61_cost_agroforestry(t,j,"lower") = q61_cost_agroforestry.lo(j); + oq61_cost_treecover_est(t,j,"lower") = q61_cost_treecover_est.lo(j); + oq61_cost_treecover_recur(t,j,"lower") = q61_cost_treecover_recur.lo(j); + oq61_treecover_area(t,j,"lower") = q61_treecover_area.lo(j); + oq61_treecover_shr(t,j,"lower") = q61_treecover_shr.lo(j); + oq61_betr_shr(t,j,"lower") = q61_betr_shr.lo(j); + oq61_treecover_est(t,j,ac,"lower") = q61_treecover_est.lo(j,ac); + oq61_treecover_carbon(t,j,ag_pools,stockType,"lower") = q61_treecover_carbon.lo(j,ag_pools,stockType); + oq61_treecover_bv(t,j,potnatveg,"lower") = q61_treecover_bv.lo(j,potnatveg); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/61_agroforestry/exo/preloop.gms b/modules/61_agroforestry/exo/preloop.gms new file mode 100644 index 0000000000..382d670b01 --- /dev/null +++ b/modules/61_agroforestry/exo/preloop.gms @@ -0,0 +1,29 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +m_sigmoid_time_interpol(p61_treecover_scenario_fader,s61_treecover_scenario_start,s61_treecover_scenario_target,0,1); +m_sigmoid_time_interpol(p61_betr_scenario_fader,s61_betr_scenario_start,s61_betr_scenario_target,0,1); + +* Initial tree cover on cropland is assumed to be equally distributed among all age-classes +pc61_treecover(j,ac) = (pm_treecover_shr(j)*pm_land_start(j,"crop"))/card(ac); + +*' Switch for tree cover on cropland: +*' 0 = Use natveg growth curve towards LPJmL natural vegetation +*' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation +if(s61_treecover_plantation = 0, + p61_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); +elseif s61_treecover_plantation = 1, + p61_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools); +); + +** set bii coefficients +p61_treecover_bii_coeff(bii_class_secd,potnatveg) = 0; +if(s61_treecover_bii_coeff = 0, + p61_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff(bii_class_secd,potnatveg) +elseif s61_treecover_bii_coeff = 1, + p61_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff("timber",potnatveg) +); diff --git a/modules/61_agroforestry/exo/presolve.gms b/modules/61_agroforestry/exo/presolve.gms new file mode 100644 index 0000000000..40d24e22ea --- /dev/null +++ b/modules/61_agroforestry/exo/presolve.gms @@ -0,0 +1,36 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +* Growth of trees on cropland is modelled by shifting age-classes according to time step length. +s61_shift = m_timestep_length_forestry/5; +* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s61_shift = 1) + p61_treecover(t,j,ac)$(ord(ac) > s61_shift) = pc61_treecover(j,ac-s61_shift); +* account for cases at the end of the age class set (s61_shift > 1) which are not shifted by the above calculation + p61_treecover(t,j,"acx") = p61_treecover(t,j,"acx") + + sum(ac$(ord(ac) > card(ac)-s61_shift), pc61_treecover(j,ac)); + +pc61_treecover(j,ac) = p61_treecover(t,j,ac); +v61_treecover.l(j,ac) = p61_treecover(t,j,ac); + +if(m_year(t) <= s61_treecover_scenario_start, + v61_treecover.fx(j,ac) = pc61_treecover(j,ac); +else + v61_treecover.lo(j,ac_est) = 0; + v61_treecover.up(j,ac_est) = Inf; + if(s61_treecover_decrease = 1, + v61_treecover.lo(j,ac_sub) = 0; + v61_treecover.up(j,ac_sub) = pc61_treecover(j,ac_sub); + else + v61_treecover.fx(j,ac_sub) = pc61_treecover(j,ac_sub); + ); +); + +p61_treecover_min_shr(t,j) = + ((1-p61_treecover_scenario_fader(t)) * pm_treecover_shr(j)) + + (p61_treecover_scenario_fader(t) * s61_treecover_min_shr); + +p61_betr_min_shr(t,j) = p61_betr_scenario_fader(t) * s61_betr_min_shr; diff --git a/modules/61_agroforestry/exo/realization.gms b/modules/61_agroforestry/exo/realization.gms new file mode 100644 index 0000000000..09b54d0aa4 --- /dev/null +++ b/modules/61_agroforestry/exo/realization.gms @@ -0,0 +1,21 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @description In this realization, future shares of tree cover and bioenergy trees +*' on cropland at cluster level follow exogenous assumptions. +*' @stop +*' +*' @limitations There are currently no known limitations of this realization. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "declarations" $include "./modules/61_agroforestry/exo/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/61_agroforestry/exo/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/61_agroforestry/exo/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/61_agroforestry/exo/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/61_agroforestry/exo/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/61_agroforestry/exo/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/61_agroforestry/module.gms b/modules/61_agroforestry/module.gms new file mode 100644 index 0000000000..a1f82ca32e --- /dev/null +++ b/modules/61_agroforestry/module.gms @@ -0,0 +1,22 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @title Agroforestry +*' +*' @description The purpose of the agroforestry module is to model different agroforestry +*' systems such as bioenergy trees and tree cover on cropland (hedgerows). +*' The agroforestry module interacts via the interfaces $vm\_area$ and $vm\_land$ with +*' the [30_crop] module. Furthermore, the agroforestry module provides cropland tree cover +*' ($vm\_treecover\_area$) and corresponding carbon stocks $vm\_treecover\_carbon$ to the [30_crop] module. +*' +*' @authors Florian Humpenöder + +*###################### R SECTION START (MODULETYPES) ########################## +$Ifi "%agroforestry%" == "endo" $include "./modules/61_agroforestry/endo/realization.gms" +$Ifi "%agroforestry%" == "exo" $include "./modules/61_agroforestry/exo/realization.gms" +$Ifi "%agroforestry%" == "off" $include "./modules/61_agroforestry/off/realization.gms" +*###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/61_agroforestry/off/declarations.gms b/modules/61_agroforestry/off/declarations.gms new file mode 100644 index 0000000000..c60ff969c2 --- /dev/null +++ b/modules/61_agroforestry/off/declarations.gms @@ -0,0 +1,25 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +variables + vm_cost_agroforestry(j) Cost and rewards related to agroforestry (mio. USD05MER per yr) +; + +positive variables + vm_treecover_area(j) Cropland tree cover (mio. ha) + vm_treecover_carbon(j,ag_pools,stockType) Cropland tree cover above ground carbon content (mio. tC) +; + + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_cost_agroforestry(t,j,type) Cost and rewards related to agroforestry (mio. USD05MER per yr) + ov_treecover_area(t,j,type) Cropland tree cover (mio. ha) + ov_treecover_carbon(t,j,ag_pools,stockType,type) Cropland tree cover above ground carbon content (mio. tC) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + diff --git a/modules/61_agroforestry/off/not_used.txt b/modules/61_agroforestry/off/not_used.txt new file mode 100644 index 0000000000..2162d9dc96 --- /dev/null +++ b/modules/61_agroforestry/off/not_used.txt @@ -0,0 +1,10 @@ +name,type,reason +vm_land, input, not used +pm_interest, input, not used +pm_land_start,input,not used +pm_treecover_shr,input,not used +fm_luh2_side_layers,input,not used +vm_area,input,not used +fm_bii_coeff,input,not used +pm_carbon_density_ac,input,not used +pm_carbon_density_ac_forestry,input,not used diff --git a/modules/61_agroforestry/off/postsolve.gms b/modules/61_agroforestry/off/postsolve.gms new file mode 100644 index 0000000000..2f4f4d4362 --- /dev/null +++ b/modules/61_agroforestry/off/postsolve.gms @@ -0,0 +1,22 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov_cost_agroforestry(t,j,"marginal") = vm_cost_agroforestry.m(j); + ov_treecover_area(t,j,"marginal") = vm_treecover_area.m(j); + ov_treecover_carbon(t,j,ag_pools,stockType,"marginal") = vm_treecover_carbon.m(j,ag_pools,stockType); + ov_cost_agroforestry(t,j,"level") = vm_cost_agroforestry.l(j); + ov_treecover_area(t,j,"level") = vm_treecover_area.l(j); + ov_treecover_carbon(t,j,ag_pools,stockType,"level") = vm_treecover_carbon.l(j,ag_pools,stockType); + ov_cost_agroforestry(t,j,"upper") = vm_cost_agroforestry.up(j); + ov_treecover_area(t,j,"upper") = vm_treecover_area.up(j); + ov_treecover_carbon(t,j,ag_pools,stockType,"upper") = vm_treecover_carbon.up(j,ag_pools,stockType); + ov_cost_agroforestry(t,j,"lower") = vm_cost_agroforestry.lo(j); + ov_treecover_area(t,j,"lower") = vm_treecover_area.lo(j); + ov_treecover_carbon(t,j,ag_pools,stockType,"lower") = vm_treecover_carbon.lo(j,ag_pools,stockType); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + diff --git a/modules/61_agroforestry/off/preloop.gms b/modules/61_agroforestry/off/preloop.gms new file mode 100644 index 0000000000..a03dad3015 --- /dev/null +++ b/modules/61_agroforestry/off/preloop.gms @@ -0,0 +1,11 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +vm_cost_agroforestry.fx(j) = 0; +vm_treecover_area.fx(j) = 0; +vm_treecover_carbon.fx(j,ag_pools,stockType) = 0; +vm_bv(j,"crop_tree",potnatveg) = 0; diff --git a/modules/61_agroforestry/off/realization.gms b/modules/61_agroforestry/off/realization.gms new file mode 100644 index 0000000000..58dab000af --- /dev/null +++ b/modules/61_agroforestry/off/realization.gms @@ -0,0 +1,17 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @description In this realization, agroforestry does not exist. Therefore, +*' cropland tree cover and corresponding carbon stocks are fixed to zero. + +*' @limitations Cropland tree cover and corresponding carbon stocks are fixed to zero. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "declarations" $include "./modules/61_agroforestry/off/declarations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/61_agroforestry/off/preloop.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/61_agroforestry/off/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/include.gms b/modules/include.gms index 0729ba1b54..bfac547e0a 100644 --- a/modules/include.gms +++ b/modules/include.gms @@ -49,6 +49,7 @@ $include "./modules/57_maccs/module.gms" $include "./modules/58_peatland/module.gms" $include "./modules/59_som/module.gms" $include "./modules/60_bioenergy/module.gms" +$include "./modules/61_agroforestry/module.gms" $include "./modules/62_material/module.gms" $include "./modules/70_livestock/module.gms" $include "./modules/71_disagg_lvst/module.gms" From 39738dfd09919cab210d30e54e25a4be006da619 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 13 Mar 2024 12:34:52 +0100 Subject: [PATCH 005/280] missing code --- main.gms | 1 + 1 file changed, 1 insertion(+) diff --git a/main.gms b/main.gms index a758d51937..c6770fc572 100644 --- a/main.gms +++ b/main.gms @@ -281,6 +281,7 @@ $setglobal peatland v2 $setglobal som static_jan19 $setglobal bioenergy 1stgen_priced_dec18 +$setglobal agroforestry exo $setglobal material exo_flexreg_apr16 $setglobal livestock fbask_jan16 From 41cdffe1cc87448c5193b9530aef263d5617597f Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 13 Mar 2024 15:07:26 +0100 Subject: [PATCH 006/280] bugfix --- modules/61_agroforestry/endo/equations.gms | 2 +- modules/61_agroforestry/endo/input.gms | 4 ++-- modules/61_agroforestry/endo/not_used.txt | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/61_agroforestry/endo/equations.gms b/modules/61_agroforestry/endo/equations.gms index c1cda77e71..6a4d138b1d 100644 --- a/modules/61_agroforestry/endo/equations.gms +++ b/modules/61_agroforestry/endo/equations.gms @@ -33,7 +33,7 @@ q61_reward_treecover(j2) .. *' Bioenergy tree reward q61_reward_betr(j2) .. v61_reward_betr(j2) =e= - sum(ac, v61_treecover(j2,ac)) * i61_reward_betr; + sum(w, vm_area(j2,"betr",w)) * i61_reward_betr; *' Tree cover establishment q61_treecover_est(j2,ac_est) .. diff --git a/modules/61_agroforestry/endo/input.gms b/modules/61_agroforestry/endo/input.gms index f7969d71dd..875fb470ad 100644 --- a/modules/61_agroforestry/endo/input.gms +++ b/modules/61_agroforestry/endo/input.gms @@ -11,8 +11,8 @@ scalars s61_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / s61_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / s61_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / - s61_reward_treecover Area reward for cropland treecover (USD per ha) / 5000 / - s61_reward_betr Area reward for bioenergy trees on cropland (USD per ha) / 5000 / + s61_reward_treecover Area reward for cropland treecover (USD per ha) / 250 / + s61_reward_betr Area reward for bioenergy trees on cropland (USD per ha) / 250 / s61_treecover_scenario_start Cropland treecover scenario start year / 2020 / s61_betr_scenario_start Bioenergy trees scenario start year / 2020 / ; diff --git a/modules/61_agroforestry/endo/not_used.txt b/modules/61_agroforestry/endo/not_used.txt index 9747c9f19b..c3c4a63e3d 100644 --- a/modules/61_agroforestry/endo/not_used.txt +++ b/modules/61_agroforestry/endo/not_used.txt @@ -1,3 +1,2 @@ name,type,reason vm_land,input,not used -vm_area,input,not used From 6725072f545d65a52be3c2cea31e62e39e7c4a4b Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 15 Mar 2024 10:12:53 +0100 Subject: [PATCH 007/280] bugfix --- main.gms | 2 +- modules/61_agroforestry/endo/input.gms | 4 ++-- modules/61_agroforestry/off/preloop.gms | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/main.gms b/main.gms index c6770fc572..2058df4375 100644 --- a/main.gms +++ b/main.gms @@ -281,7 +281,7 @@ $setglobal peatland v2 $setglobal som static_jan19 $setglobal bioenergy 1stgen_priced_dec18 -$setglobal agroforestry exo +$setglobal agroforestry off $setglobal material exo_flexreg_apr16 $setglobal livestock fbask_jan16 diff --git a/modules/61_agroforestry/endo/input.gms b/modules/61_agroforestry/endo/input.gms index 875fb470ad..b9aa3f15e0 100644 --- a/modules/61_agroforestry/endo/input.gms +++ b/modules/61_agroforestry/endo/input.gms @@ -11,8 +11,8 @@ scalars s61_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / s61_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / s61_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / - s61_reward_treecover Area reward for cropland treecover (USD per ha) / 250 / - s61_reward_betr Area reward for bioenergy trees on cropland (USD per ha) / 250 / + s61_reward_treecover Area reward for cropland treecover (USD per ha) / 0 / + s61_reward_betr Area reward for bioenergy trees on cropland (USD per ha) / 0 / s61_treecover_scenario_start Cropland treecover scenario start year / 2020 / s61_betr_scenario_start Bioenergy trees scenario start year / 2020 / ; diff --git a/modules/61_agroforestry/off/preloop.gms b/modules/61_agroforestry/off/preloop.gms index a03dad3015..46c7e61bb3 100644 --- a/modules/61_agroforestry/off/preloop.gms +++ b/modules/61_agroforestry/off/preloop.gms @@ -8,4 +8,4 @@ vm_cost_agroforestry.fx(j) = 0; vm_treecover_area.fx(j) = 0; vm_treecover_carbon.fx(j,ag_pools,stockType) = 0; -vm_bv(j,"crop_tree",potnatveg) = 0; +vm_bv.fx(j,"crop_tree",potnatveg) = 0; From d2e21cea412d44d02dce4908c65dc17780758d9d Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 11 Apr 2024 13:43:56 +0200 Subject: [PATCH 008/280] partial commit to save work --- config/default.cfg | 11 ++- .../10_land/landmatrix_dec18/declarations.gms | 1 + modules/10_land/landmatrix_dec18/input.gms | 10 -- modules/10_land/landmatrix_dec18/start.gms | 5 +- .../feb21/declarations.gms | 0 .../feb21/input.gms | 4 +- .../feb21/preloop.gms | 4 +- .../feb21/presolve.gms | 0 .../feb21/realization.gms | 10 +- .../feb21/sets.gms | 0 .../{29_ageclass => 28_ageclass}/input/files | 0 .../{29_ageclass => 28_ageclass}/module.gms | 2 +- modules/29_cropland/input/files | 8 ++ modules/29_cropland/module.gms | 18 ++++ .../29_cropland/rulebased/declarations.gms | 52 +++++++++++ modules/29_cropland/rulebased/equations.gms | 91 +++++++++++++++++++ modules/29_cropland/rulebased/input.gms | 52 +++++++++++ modules/29_cropland/rulebased/postsolve.gms | 8 ++ modules/29_cropland/rulebased/preloop.gms | 52 +++++++++++ modules/29_cropland/rulebased/presolve.gms | 61 +++++++++++++ modules/29_cropland/rulebased/realization.gms | 18 ++++ modules/29_cropland/rulebased/sets.gms | 19 ++++ modules/30_crop/endo_apr21/declarations.gms | 22 +---- modules/30_crop/endo_apr21/equations.gms | 66 +++++--------- modules/30_crop/endo_apr21/input.gms | 23 ----- modules/30_crop/endo_apr21/preloop.gms | 13 --- modules/30_crop/endo_apr21/presolve.gms | 27 +----- modules/30_crop/endo_apr21/sets.gms | 9 -- .../30_crop/penalty_apr22/declarations.gms | 17 +--- modules/30_crop/penalty_apr22/equations.gms | 55 ++--------- modules/30_crop/penalty_apr22/preloop.gms | 14 --- modules/30_crop/penalty_apr22/presolve.gms | 24 ----- modules/30_crop/penalty_apr22/sets.gms | 8 -- .../30_crop/rotation_apr22/declarations.gms | 17 +--- modules/30_crop/rotation_apr22/equations.gms | 46 +--------- modules/30_crop/rotation_apr22/preloop.gms | 13 --- modules/30_crop/rotation_apr22/presolve.gms | 23 ----- modules/30_crop/rotation_apr22/sets.gms | 8 -- modules/61_agroforestry/exo/input.gms | 13 --- modules/61_agroforestry/exo/postsolve.gms | 1 - modules/61_agroforestry/exo/preloop.gms | 21 ----- modules/61_agroforestry/exo/presolve.gms | 29 ------ modules/include.gms | 2 +- 43 files changed, 444 insertions(+), 433 deletions(-) rename modules/{29_ageclass => 28_ageclass}/feb21/declarations.gms (100%) rename modules/{29_ageclass => 28_ageclass}/feb21/input.gms (77%) rename modules/{29_ageclass => 28_ageclass}/feb21/preloop.gms (88%) rename modules/{29_ageclass => 28_ageclass}/feb21/presolve.gms (100%) rename modules/{29_ageclass => 28_ageclass}/feb21/realization.gms (82%) rename modules/{29_ageclass => 28_ageclass}/feb21/sets.gms (100%) rename modules/{29_ageclass => 28_ageclass}/input/files (100%) rename modules/{29_ageclass => 28_ageclass}/module.gms (93%) create mode 100644 modules/29_cropland/input/files create mode 100644 modules/29_cropland/module.gms create mode 100644 modules/29_cropland/rulebased/declarations.gms create mode 100644 modules/29_cropland/rulebased/equations.gms create mode 100644 modules/29_cropland/rulebased/input.gms create mode 100644 modules/29_cropland/rulebased/postsolve.gms create mode 100644 modules/29_cropland/rulebased/preloop.gms create mode 100644 modules/29_cropland/rulebased/presolve.gms create mode 100644 modules/29_cropland/rulebased/realization.gms create mode 100644 modules/29_cropland/rulebased/sets.gms diff --git a/config/default.cfg b/config/default.cfg index 7d519e85f4..6a64d3aed1 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -664,11 +664,20 @@ cfg$gms$s22_conservation_start <- 2020 # def = 2020 # * Target year (year when full protection is reached): cfg$gms$s22_conservation_target <- 2030 # def = 2030 -# ***--------------------- 29_ageclass ----------------------------------- +# ***--------------------- 28_ageclass ----------------------------------- # * (feb21): Distribution of age-classes according to Poulter et al 2018 cfg$gms$ageclass <- "feb21" # def = feb21 +# ***--------------------- 29_cropland ----------------------------------- +# * Cropland is the sum of croparea, fallow land and tree cover +# * Croparea is proved from 30_crop. +# * Fallow land and tree cover are defined by 29_cropland, either exogenous via prescribed rules or endognous via monetary incentives. +# * (rulebased_apr24): Fallow land and tree cover are prescribed by rules. +# * (incentive_apr24): Fallow land and tree cover develop endogenously based on monetary incentives +cfg$gms$cropland <- "rulebased_apr24" # def = rulebased_apr24 + # ***--------------------- 30_crop --------------------------------------- +# * 30_crop defines the croparea, which is a subcomponent of total cropland defined in 29_cropland. # * (endo_apr21): Hard rotational constraints. Dynamic cropland and detailed cropland availability data at grid cell level. # * (rotation_apr22): hard rotational constraints and fallow constraints with the option of different future scenarios. Dynamic cropland and detailed cropland availability data at grid cell level. # * (penalty_apr22): rotational and fallow constraints are incentivized via penalty payments. Dynamic cropland and detailed cropland availability data at grid cell level. diff --git a/modules/10_land/landmatrix_dec18/declarations.gms b/modules/10_land/landmatrix_dec18/declarations.gms index 78886c1063..8ac9b52b8f 100644 --- a/modules/10_land/landmatrix_dec18/declarations.gms +++ b/modules/10_land/landmatrix_dec18/declarations.gms @@ -7,6 +7,7 @@ parameters pm_land_start(j,land) Land initialization area (mio. ha) + pm_land_hist(t_ini10,j,land) Land area for historial time steps (mio. ha) pcm_land(j,land) Land area in previous time step including possible changes after optimization (mio. ha) pm_treecover_shr(j) Cropland tree cover share (1) ; diff --git a/modules/10_land/landmatrix_dec18/input.gms b/modules/10_land/landmatrix_dec18/input.gms index 0e1fc99de1..092ae72b41 100644 --- a/modules/10_land/landmatrix_dec18/input.gms +++ b/modules/10_land/landmatrix_dec18/input.gms @@ -31,13 +31,3 @@ $ondelim $include "./modules/10_land/input/avl_land_t_iso.cs3" $offdelim ; - -********* Cropland tree cover ******************************************* - -parameter f10_treecover(j) Tree cover on cropland in 2019 (mio. ha) -/ -$ondelim -$include "./modules/10_land/input/CroplandTreecover.cs2" -$offdelim -/ -; diff --git a/modules/10_land/landmatrix_dec18/start.gms b/modules/10_land/landmatrix_dec18/start.gms index fd3ac13b7e..b8d25847d5 100644 --- a/modules/10_land/landmatrix_dec18/start.gms +++ b/modules/10_land/landmatrix_dec18/start.gms @@ -6,12 +6,9 @@ *** | Contact: magpie@pik-potsdam.de pm_land_start(j,land) = f10_land("y1995",j,land); +pm_land_hist(t_ini10,j,land) = f10_land(t_ini10,j,land); pcm_land(j,land) = pm_land_start(j,land); vm_land.l(j,land) = pcm_land(j,land); -pm_treecover_shr(j) = 0; -pm_treecover_shr(j)$(f10_land("y2015",j,"crop") > 1e-10) = - (f10_treecover(j)/f10_land("y2015",j,"crop")); - *** EOF pre.gms *** diff --git a/modules/29_ageclass/feb21/declarations.gms b/modules/28_ageclass/feb21/declarations.gms similarity index 100% rename from modules/29_ageclass/feb21/declarations.gms rename to modules/28_ageclass/feb21/declarations.gms diff --git a/modules/29_ageclass/feb21/input.gms b/modules/28_ageclass/feb21/input.gms similarity index 77% rename from modules/29_ageclass/feb21/input.gms rename to modules/28_ageclass/feb21/input.gms index 5bfacde746..7e645fecdb 100644 --- a/modules/29_ageclass/feb21/input.gms +++ b/modules/28_ageclass/feb21/input.gms @@ -5,8 +5,8 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -table f29_forestageclasses(j,ac_poulter) Poulter age-class area in each cluster (1) +table f28_forestageclasses(j,ac_poulter) Poulter age-class area in each cluster (1) $ondelim -$include "./modules/29_ageclass/input/forestageclasses.cs3" +$include "./modules/28_ageclass/input/forestageclasses.cs3" $offdelim ; diff --git a/modules/29_ageclass/feb21/preloop.gms b/modules/28_ageclass/feb21/preloop.gms similarity index 88% rename from modules/29_ageclass/feb21/preloop.gms rename to modules/28_ageclass/feb21/preloop.gms index a8581ef8cd..12cffe2e9c 100644 --- a/modules/29_ageclass/feb21/preloop.gms +++ b/modules/28_ageclass/feb21/preloop.gms @@ -7,8 +7,8 @@ * Ben Poulter age class distribution im_plantedclass_ac(j,ac) = 0; -*im_plantedclass_ac(j,ac) = sum(ac_poulter_to_ac(ac_poulter,ac),f29_forestageclasses(j,ac_poulter)$(not sameas(ac_poulter,"class15"))); -im_plantedclass_ac(j,ac) = sum(ac_poulter_to_ac(ac_poulter,ac),f29_forestageclasses(j,ac_poulter)); +*im_plantedclass_ac(j,ac) = sum(ac_poulter_to_ac(ac_poulter,ac),f28_forestageclasses(j,ac_poulter)$(not sameas(ac_poulter,"class15"))); +im_plantedclass_ac(j,ac) = sum(ac_poulter_to_ac(ac_poulter,ac),f28_forestageclasses(j,ac_poulter)); * As summing over makes double counting (two magpie age classes in one poulter class) * We divide by 2 diff --git a/modules/29_ageclass/feb21/presolve.gms b/modules/28_ageclass/feb21/presolve.gms similarity index 100% rename from modules/29_ageclass/feb21/presolve.gms rename to modules/28_ageclass/feb21/presolve.gms diff --git a/modules/29_ageclass/feb21/realization.gms b/modules/28_ageclass/feb21/realization.gms similarity index 82% rename from modules/29_ageclass/feb21/realization.gms rename to modules/28_ageclass/feb21/realization.gms index 2ae4d5728a..f88a2c1b85 100644 --- a/modules/29_ageclass/feb21/realization.gms +++ b/modules/28_ageclass/feb21/realization.gms @@ -18,9 +18,9 @@ *' in MAgPIE and hence using these numbers directly in the model might generate biases. *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/29_ageclass/feb21/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/29_ageclass/feb21/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/29_ageclass/feb21/input.gms" -$Ifi "%phase%" == "preloop" $include "./modules/29_ageclass/feb21/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/29_ageclass/feb21/presolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/28_ageclass/feb21/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/28_ageclass/feb21/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/28_ageclass/feb21/input.gms" +$Ifi "%phase%" == "preloop" $include "./modules/28_ageclass/feb21/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/28_ageclass/feb21/presolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/29_ageclass/feb21/sets.gms b/modules/28_ageclass/feb21/sets.gms similarity index 100% rename from modules/29_ageclass/feb21/sets.gms rename to modules/28_ageclass/feb21/sets.gms diff --git a/modules/29_ageclass/input/files b/modules/28_ageclass/input/files similarity index 100% rename from modules/29_ageclass/input/files rename to modules/28_ageclass/input/files diff --git a/modules/29_ageclass/module.gms b/modules/28_ageclass/module.gms similarity index 93% rename from modules/29_ageclass/module.gms rename to modules/28_ageclass/module.gms index f196dbbbab..27f03a3081 100644 --- a/modules/29_ageclass/module.gms +++ b/modules/28_ageclass/module.gms @@ -14,5 +14,5 @@ *' @authors Abhijeet Mishra, Florian Humpenöder *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%ageclass%" == "feb21" $include "./modules/29_ageclass/feb21/realization.gms" +$Ifi "%ageclass%" == "feb21" $include "./modules/28_ageclass/feb21/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/29_cropland/input/files b/modules/29_cropland/input/files new file mode 100644 index 0000000000..c4a894d426 --- /dev/null +++ b/modules/29_cropland/input/files @@ -0,0 +1,8 @@ +* list of files that are required here +avl_cropland.cs3 +avl_cropland_0.5.mz +avl_cropland_iso.cs3 +SNVTargetCropland.cs3 +SNVTargetCropland_0.5.mz +CroplandTreecover.cs2 +CroplandTreecover_0.5.mz diff --git a/modules/29_cropland/module.gms b/modules/29_cropland/module.gms new file mode 100644 index 0000000000..2c03a898ba --- /dev/null +++ b/modules/29_cropland/module.gms @@ -0,0 +1,18 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @title Cropland + +*' @description Cropland is the sum of croparea, fallow land and tree cover. Croparea is provided from [30_crop]. +*' Fallow land and tree cover are defined in this module, either exogenous via prescribed rules or endognous via monetary incentives. + + +*' @authors Florian Humpenöder + +*###################### R SECTION START (MODULETYPES) ########################## +$Ifi "%ageclass%" == "feb21" $include "./modules/28_ageclass/feb21/realization.gms" +*###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/29_cropland/rulebased/declarations.gms b/modules/29_cropland/rulebased/declarations.gms new file mode 100644 index 0000000000..90d9bf2aa9 --- /dev/null +++ b/modules/29_cropland/rulebased/declarations.gms @@ -0,0 +1,52 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +scalars + s29_shift number of 5-year age-classes corresponding to current time step length (1) +; + + +parameters + p29_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) + p29_country_snv_weight(i) SNV policy country weight per region (1) + p29_snv_shr(t,j) Share of semi-natural vegetation in cropland areas (1) + i29_snv_relocation_target(j) Overall cropland area that requires relocation due to SNV policy (mio. ha) + p29_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha) + p29_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) + p29_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1) + i29_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) + p29_snv_scenario_fader(t_all) SNV scenario fader (1) + p29_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) + + + p29_treecover_min_shr(t,j) Minimum share of treecover on cropland (1) + p29_betr_min_shr(t,j) Minimum share of bioenergy trees on cropland (1) + p29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) + p29_betr_scenario_fader(t_all) Bioenergy trees scenario fader (1) + p29_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) + p29_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) + p29_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) + pc29_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) +; + +positive variables + vm_fallow(j) Fallow land is temporarily fallow cropland (mio. ha) + v29_treecover(j,ac) Cropland tree cover per age class (mio. ha) +; + +equations + q29_cropland(j) Total cropland calculation (mio. ha) + q29_avl_cropland(j) Available cropland constraint (mio. ha) + q29_rotation_max(j,crp29,w) Local maximum rotational constraints (mio. ha) + q29_rotation_min(j,crp29,w) Local minimum rotational constraints (mio. ha) + q29_prod(j,kcr) Production of cropped products (mio. tDM) + q29_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) + q29_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) + q29_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) + q29_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) + q29_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) +; diff --git a/modules/29_cropland/rulebased/equations.gms b/modules/29_cropland/rulebased/equations.gms new file mode 100644 index 0000000000..97bb93f8ad --- /dev/null +++ b/modules/29_cropland/rulebased/equations.gms @@ -0,0 +1,91 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @equations +*' Total cropland is calculated as the sum of croparea, fallow land and tree cover area. + + q29_cropland(j2) .. + vm_land(j2,"crop") =e= sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + sum(ac, v29_treecover(j2,ac)); + + +*' We assume that crop production can only take place on suitable cropland area. +*' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas +*' from cropland production that have a low suitability, e.g. due to steep slopes, +*' to estimate the available cropland area. The cultivated area therefore has +*' to be smaller than the available cropland area. Moreover, the available cropland +*' can be reduced by constraining the cropland area in favour of other land types, +*' in order to increase compositional heterogeneity of land types at the cell level. + + q29_avl_cropland(j2) .. + vm_land(j2,"crop") =l= sum(ct, p29_avl_cropland(ct,j2)); + + +*' The semi-natural land constraint in cropland areas for sustaining critical regulating NCP +*' for agricultural production is added on top of land conserved for other reasons +*' (e.g. conservation of intact ecosystems or protection of biodiversity hotspots). + + q29_land_snv(j2) .. + sum(land_snv, vm_land(j2,land_snv)) + =g= + sum(ct, p29_snv_shr(ct,j2)) * vm_land(j2,"crop") + + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); + + +*' The semi-natural vegetation constraint for cropland areas has been suggested at the per square +*' kilometer scale. The amount of cropland requiring relocation has therefore been derived from +*' exogeneous high-resolution land cover information from the Copernicus Global Land Service +*' (@buchhorn_copernicus_2020). + + q29_land_snv_trans(j2) .. + sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p29_snv_relocation(ct,j2)); + + +*' The carbon stocks of total cropland are calculated as the sum of carbon stocks in cropland, fallow land and tree cover area. + + q29_carbon(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= + vm_carbon_stock_crop(j2,ag_pools) + + vm_fallow(j2) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)) + + m_carbon_stock_ac(v29_treecover,p31_carbon_density_ac,"ac","ac_sub"); + + +*' Total agroforestry cost. +*' Cost for bioenergy trees are accounted for in the [30_crop] module. +q61_cost_cropland(j2) .. + vm_cost_cropland(j2) =e= + v61_cost_treecover_est(j2) + v61_cost_treecover_recur(j2); + +*' Tree cover establishment cost +q61_cost_treecover_est(j2) .. + v61_cost_treecover_est(j2) =e= + sum(ac_est, v61_treecover(j2,ac_est)) * s61_cost_treecover_est * + sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); + +*' Tree cover recurring cost +q61_cost_treecover_recur(j2) .. + v61_cost_treecover_recur(j2) =e= + sum(ac_sub, v61_treecover(j2,ac_sub)) * s61_cost_treecover_recur; + +*' Tree cover minimum share +q61_treecover_shr(j2) .. + sum(ac, v61_treecover(j2,ac)) =g= + sum(ct, p61_treecover_min_shr(ct,j2)) * vm_land(j2,"crop"); + +*' Bioenergy tree minimum share +q61_betr_shr(j2) .. + sum(w, vm_area(j2,"betr",w)) =g= + sum(ct, p61_betr_min_shr(ct,j2)) * vm_land(j2,"crop"); + +*' Tree cover establishment +q61_treecover_est(j2,ac_est) .. + v61_treecover(j2,ac_est) =e= sum(ac_est2, v61_treecover(j2,ac_est2))/card(ac_est2); + +*' Tree cover biodiversity value +q61_treecover_bv(j2,potnatveg) .. + vm_bv(j2,"crop_tree",potnatveg) =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v61_treecover(j2,ac)) * + p61_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/29_cropland/rulebased/input.gms b/modules/29_cropland/rulebased/input.gms new file mode 100644 index 0000000000..e8d7c5028a --- /dev/null +++ b/modules/29_cropland/rulebased/input.gms @@ -0,0 +1,52 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +scalars + s61_cost_treecover_est Tree cover establishment cost (USD per ha) / 2000 / + s61_cost_treecover_recur Tree cover recurring cost (USD per ha) / 500 / + s61_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / + s61_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / + s61_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / + s61_treecover_scenario_start Cropland treecover scenario start year / 2020 / + s61_treecover_scenario_target Cropland treecover scenario target year / 2050 / + s61_treecover_min_shr Share of treecover on cropland (1) / 0.2 / + s61_betr_scenario_start Bioenergy trees scenario start year / 2020 / + s61_betr_scenario_target Bioenergy trees scenario target year / 2050 / + s61_betr_min_shr Minimum share of bioenergy trees on cropland (1) / 0 / +; + +********* AVAILABLE CROPLAND ******************************************* + +table f29_avl_cropland(j,marginal_land29) Available land area for cropland (mio. ha) +$ondelim +$include "./modules/29_cropland/input/avl_cropland.cs3" +$offdelim +; + +table f29_avl_cropland_iso(iso,marginal_land29) Available land area for cropland at ISO level (mio. ha) +$ondelim +$include "./modules/29_cropland/input/avl_cropland_iso.cs3" +$offdelim +; + +********* SNV TARGET CROPLAND ******************************************* + +table f29_snv_target_cropland(j,relocation_target29) Cropland in 2019 requiring relocation due to SNV policy (mio. ha) +$ondelim +$include "./modules/29_cropland/input/SNVTargetCropland.cs3" +$offdelim +; + +********* Cropland tree cover ******************************************* + +parameter f29_treecover(j) Tree cover on cropland in 2019 (mio. ha) +/ +$ondelim +$include "./modules/29_cropland/input/CroplandTreecover.cs2" +$offdelim +/ +; diff --git a/modules/29_cropland/rulebased/postsolve.gms b/modules/29_cropland/rulebased/postsolve.gms new file mode 100644 index 0000000000..fe2b94164a --- /dev/null +++ b/modules/29_cropland/rulebased/postsolve.gms @@ -0,0 +1,8 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +pc29_treecover(j,ac) = v29_treecover.l(j,ac); diff --git a/modules/29_cropland/rulebased/preloop.gms b/modules/29_cropland/rulebased/preloop.gms new file mode 100644 index 0000000000..391e38fe5a --- /dev/null +++ b/modules/29_cropland/rulebased/preloop.gms @@ -0,0 +1,52 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +vm_fallow.fx(j) = 0; + +** Trajectory for cropland scenarios +* sigmoidal interpolation between start year and target year +m_sigmoid_time_interpol(p29_snv_scenario_fader,s29_snv_scenario_start,s29_snv_scenario_target,0,1); +m_sigmoid_time_interpol(p29_rotation_scenario_fader,s29_rotation_scenario_start,s29_rotation_scenario_target,0,1); + +* linear interpolation to estimate the cropland that +* requires relocation due to SNV policy +if (s29_snv_shr = 0, +i29_snv_relocation_target(j) = 0; + +elseif s29_snv_shr <= s29_snv_relocation_data_x1, +m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,0,s29_snv_relocation_data_x1,0, f29_snv_target_cropland(j, "SNV20TargetCropland")); + +elseif s29_snv_shr > s29_snv_relocation_data_x1, +m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,s29_snv_relocation_data_x1, s29_snv_relocation_data_x2,f29_snv_target_cropland(j, "SNV20TargetCropland"), f29_snv_target_cropland(j, "SNV50TargetCropland")); +); + + +m_sigmoid_time_interpol(p29_treecover_scenario_fader,s29_treecover_scenario_start,s29_treecover_scenario_target,0,1); +m_sigmoid_time_interpol(p29_betr_scenario_fader,s29_betr_scenario_start,s29_betr_scenario_target,0,1); + +* Initial tree cover on cropland is assumed to be equally distributed among all age-classes +pc29_treecover(j,ac) = 0; +pc29_treecover(j,ac)$(pm_land_hist("y2015",j,"crop") > 1e-10) = + (f29_treecover(j) / pm_land_hist("y2015",j,"crop") * pm_land_hist("y1995",j,"crop")) / card(ac); + + +*' Switch for tree cover on cropland: +*' 0 = Use natveg growth curve towards LPJmL natural vegetation +*' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation +if(s29_treecover_plantation = 0, + p29_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); +elseif s29_treecover_plantation = 1, + p29_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools); +); + +** set bii coefficients +p29_treecover_bii_coeff(bii_class_secd,potnatveg) = 0; +if(s29_treecover_bii_coeff = 0, + p29_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff(bii_class_secd,potnatveg) +elseif s29_treecover_bii_coeff = 1, + p29_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff("timber",potnatveg) +); diff --git a/modules/29_cropland/rulebased/presolve.gms b/modules/29_cropland/rulebased/presolve.gms new file mode 100644 index 0000000000..8c36c85212 --- /dev/null +++ b/modules/29_cropland/rulebased/presolve.gms @@ -0,0 +1,61 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @code +*' Minimum semi-natural vegetation (SNV) share is fading in after 2020 +p29_snv_shr(t,j) = p29_snv_scenario_fader(t) * + (s29_snv_shr * sum(cell(i,j), p29_country_snv_weight(i)) + + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_snv_weight(i))); + +*' Cropland relocation in response to SNV policy is based on exogeneous land +*' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). +*' The rate of the policy implementation is derived based +*' on the difference of scenario fader values in consecutive time steps +p29_snv_relocation(t,j) = (p29_snv_scenario_fader(t) - p29_snv_scenario_fader(t-1)) * + (i29_snv_relocation_target(j) * sum(cell(i,j), p29_country_snv_weight(i)) + + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_snv_weight(i))); +*' The following lines take care of mismatches in the input +*' data (derived from satellite imagery from the Copernicus +*' Global Land Service (@buchhorn_copernicus_2020)) and in +*' cases of cropland reduction +p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (p29_snv_scenario_fader(t) - p29_snv_scenario_fader(t-1)) * pcm_land(j,"crop"); +p29_snv_relocation(t,j)$(p29_snv_relocation(t, j) > p29_max_snv_relocation(t,j)) = p29_max_snv_relocation(t,j); + +*' Area potentially available for cropping +p29_avl_cropland(t,j) = f29_avl_cropland(j,"%c29_marginal_land%") * (1 - p29_snv_shr(t,j)); +*' @stop + + +* Growth of trees on cropland is modelled by shifting age-classes according to time step length. +s61_shift = m_timestep_length_forestry/5; +* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s61_shift = 1) + p61_treecover(t,j,ac)$(ord(ac) > s61_shift) = pc61_treecover(j,ac-s61_shift); +* account for cases at the end of the age class set (s61_shift > 1) which are not shifted by the above calculation + p61_treecover(t,j,"acx") = p61_treecover(t,j,"acx") + + sum(ac$(ord(ac) > card(ac)-s61_shift), pc61_treecover(j,ac)); + +pc61_treecover(j,ac) = p61_treecover(t,j,ac); +v61_treecover.l(j,ac) = p61_treecover(t,j,ac); + +if(m_year(t) <= s61_treecover_scenario_start, + v61_treecover.fx(j,ac) = pc61_treecover(j,ac); +else + v61_treecover.lo(j,ac_est) = 0; + v61_treecover.up(j,ac_est) = Inf; + if(s61_treecover_decrease = 1, + v61_treecover.lo(j,ac_sub) = 0; + v61_treecover.up(j,ac_sub) = pc61_treecover(j,ac_sub); + else + v61_treecover.fx(j,ac_sub) = pc61_treecover(j,ac_sub); + ); +); + +p61_treecover_min_shr(t,j) = + ((1-p61_treecover_scenario_fader(t)) * pm_treecover_shr(j)) + + (p61_treecover_scenario_fader(t) * s61_treecover_min_shr); + +p61_betr_min_shr(t,j) = p61_betr_scenario_fader(t) * s61_betr_min_shr; diff --git a/modules/29_cropland/rulebased/realization.gms b/modules/29_cropland/rulebased/realization.gms new file mode 100644 index 0000000000..4c07116378 --- /dev/null +++ b/modules/29_cropland/rulebased/realization.gms @@ -0,0 +1,18 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @description todo + +*' @limitations todo + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/28_ageclass/feb21/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/28_ageclass/feb21/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/28_ageclass/feb21/input.gms" +$Ifi "%phase%" == "preloop" $include "./modules/28_ageclass/feb21/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/28_ageclass/feb21/presolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/29_cropland/rulebased/sets.gms b/modules/29_cropland/rulebased/sets.gms new file mode 100644 index 0000000000..a74b51c7de --- /dev/null +++ b/modules/29_cropland/rulebased/sets.gms @@ -0,0 +1,19 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +sets + + marginal_land30 Marginal land scenarios + / all_marginal, q33_marginal, no_marginal / + + policy_target30 Target year for cropland policy + / none, by2030, by2050 / + + relocation_target30 Cropland requiring relocation based on different SNV targets + / SNV20TargetCropland, SNV50TargetCropland / + +; diff --git a/modules/30_crop/endo_apr21/declarations.gms b/modules/30_crop/endo_apr21/declarations.gms index ddea2ea686..07792a6246 100644 --- a/modules/30_crop/endo_apr21/declarations.gms +++ b/modules/30_crop/endo_apr21/declarations.gms @@ -6,36 +6,22 @@ *** | Contact: magpie@pik-potsdam.de parameters - p30_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) - p30_country_snv_weight(i) SNV policy country weight per region (1) - p30_snv_shr(t,j) Share of semi-natural vegetation in cropland areas (1) - i30_snv_relocation_target(j) Overall cropland area that requires relocation due to SNV policy (mio. ha) - p30_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha) - p30_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) - p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1) - i30_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) - p30_snv_scenario_fader(t_all) SNV scenario fader (1) p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) ; positive variables -* Fallow land is cropland which is temporarily fallow. Croparea+fallow=cropland - vm_fallow(j) Fallow land (mio. ha) - vm_area(j,kcr,w) Agricultural production area (mio. ha) - vm_rotation_penalty(i) Penalty for violating rotational constraints (USD05MER) + vm_area(j,kcr,w) Agricultural production area (mio. ha) + vm_rotation_penalty(i) Penalty for violating rotational constraints (USD05MER) + vm_carbon_stock_croparea(j,ag_pools) Carbon stock in croparea (tC) ; equations - q30_cropland(j) Total cropland calculation (mio. ha) - q30_avl_cropland(j) Available cropland constraint (mio. ha) q30_rotation_max(j,crp30,w) Local maximum rotational constraints (mio. ha) q30_rotation_min(j,crp30,w) Local minimum rotational constraints (mio. ha) q30_prod(j,kcr) Production of cropped products (mio. tDM) - q30_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) + q30_carbon(j,ag_pools) Croplarea above ground carbon content calculation (mio. tC) q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) - q30_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) - q30_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### diff --git a/modules/30_crop/endo_apr21/equations.gms b/modules/30_crop/endo_apr21/equations.gms index c240ddc8a8..ad815cdec0 100644 --- a/modules/30_crop/endo_apr21/equations.gms +++ b/modules/30_crop/endo_apr21/equations.gms @@ -6,39 +6,14 @@ *** | Contact: magpie@pik-potsdam.de *' @equations -*' The total land requirements for cropland are calculated as -*' the sum of crop and water supply type specific land requirements: - - q30_cropland(j2) .. - sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + vm_treecover_area(j2) =e= vm_land(j2,"crop"); - -*' We assume that crop production can only take place on suitable cropland area. -*' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas -*' from cropland production that have a low suitability, e.g. due to steep slopes, -*' to estimate the available cropland area. The cultivated area therefore has -*' to be smaller than the available cropland area. Moreover, the available cropland -*' can be reduced by constraining the cropland area in favour of other land types, -*' in order to increase compositional heterogeneity of land types at the cell level. - - q30_avl_cropland(j2) .. - vm_land(j2,"crop") =l= sum(ct, p30_avl_cropland(ct,j2)); - -*' The semi-natural land constraint in cropland areas for sustaining critical regulating NCP -*' for agricultural production is added on top of land conserved for other reasons -*' (e.g. conservation of intact ecosystems or protection of biodiversity hotspots). - q30_land_snv(j2) .. - sum(land_snv, vm_land(j2,land_snv)) - =g= - sum(ct, p30_snv_shr(ct,j2)) * vm_land(j2,"crop") - + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); - -*' The semi-natural vegetation constraint for cropland areas has been suggested at the per square -*' kilometer scale. The amount of cropland requiring relocation has therefore been derived from -*' exogeneous high-resolution land cover information from the Copernicus Global Land Service -*' (@buchhorn_copernicus_2020). - - q30_land_snv_trans(j2) .. - sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p30_snv_relocation(ct,j2)); + +*' Agricultural production is calculated by multiplying the area under +*' production with corresponding yields. Production from rainfed and irrigated +*' areas is summed up: + + q30_prod(j2,kcr) .. + vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); + *' As additional constraints minimum and maximum rotational constraints limit *' the placing of crops. On the one hand, these rotational constraints reflect @@ -49,6 +24,7 @@ sum((crp_kcr30(crpmax30,kcr)), vm_area(j2,kcr,w)) =l= sum(kcr, vm_area(j2,kcr,w)) * f30_rotation_max_shr(crpmax30); + *' On the other hand, it reflects boundary conditions such as minimum self *' sufficiency constraints: @@ -56,26 +32,26 @@ sum((crp_kcr30(crpmin30,kcr)), vm_area(j2,kcr,w)) =g= sum(kcr, vm_area(j2,kcr,w)) * f30_rotation_min_shr(crpmin30); -*' Agricultural production is calculated by multiplying the area under -*' production with corresponding yields. Production from rainfed and irrigated -*' areas is summed up: - q30_prod(j2,kcr) .. - vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); +*' Bioenergy tree minimum share +q30_betr_shr(j2) .. + sum(w, vm_area(j2,"betr",w)) =g= + sum(ct, p30_betr_min_shr(ct,j2)) * vm_land(j2,"crop"); + -*' The carbon content of the above ground carbon pools are calculated as a total -*' for all cropland : +*' The carbon stocks of the above ground carbon pools are calculated based on croparea and related carbon density. + + q30_carbon(j2,ag_pools) .. + vm_carbon_stock_croparea(j2,ag_pools) =e= + sum((kcr,w), vm_area(j2,kcr,w)) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)); - q30_carbon(j2,ag_pools,stockType) .. - vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= - m_carbon_stock(vm_land,fm_carbon_density,"crop") + vm_treecover_carbon(j2,ag_pools,stockType); *' The biodiversity value for cropland is calculated separately for annual and perennial crops: + q30_bv_ann(j2,potnatveg) .. vm_bv(j2,"crop_ann",potnatveg) =e= sum((crop_ann30,w), vm_area(j2,crop_ann30,w)) * fm_bii_coeff("crop_ann",potnatveg) * fm_luh2_side_layers(j2,potnatveg); q30_bv_per(j2,potnatveg) .. vm_bv(j2,"crop_per",potnatveg) =e= - (vm_land(j2,"crop") - sum((crop_ann30,w), vm_area(j2,crop_ann30,w))) - * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + sum((crop_per30,w), vm_area(j2,crop_per30,w)) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/30_crop/endo_apr21/input.gms b/modules/30_crop/endo_apr21/input.gms index cdd3e6f56a..2ccc267364 100644 --- a/modules/30_crop/endo_apr21/input.gms +++ b/modules/30_crop/endo_apr21/input.gms @@ -99,26 +99,3 @@ $offdelim /; $if "%c30_rotation_constraints%" == "off" f30_rotation_min_shr(crp30) = 0; - -********* AVAILABLE CROPLAND ******************************************* - - -table f30_avl_cropland(j,marginal_land30) Available land area for cropland (mio. ha) -$ondelim -$include "./modules/30_crop/endo_apr21/input/avl_cropland.cs3" -$offdelim -; - -table f30_avl_cropland_iso(iso,marginal_land30) Available land area for cropland at ISO level (mio. ha) -$ondelim -$include "./modules/30_crop/endo_apr21/input/avl_cropland_iso.cs3" -$offdelim -; - -********* SNV TARGET CROPLAND ******************************************* - -table f30_snv_target_cropland(j,relocation_target30) Cropland in 2019 requiring relocation due to SNV policy (mio. ha) -$ondelim -$include "./modules/30_crop/endo_apr21/input/SNVTargetCropland.cs3" -$offdelim -; diff --git a/modules/30_crop/endo_apr21/preloop.gms b/modules/30_crop/endo_apr21/preloop.gms index d121c0dbab..e4b01bc732 100644 --- a/modules/30_crop/endo_apr21/preloop.gms +++ b/modules/30_crop/endo_apr21/preloop.gms @@ -7,21 +7,8 @@ ** Trajectory for cropland scenarios * sigmoidal interpolation between start year and target year -m_sigmoid_time_interpol(p30_snv_scenario_fader,s30_snv_scenario_start,s30_snv_scenario_target,0,1); m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); -* linear interpolation to estimate the cropland that -* requires relocation due to SNV policy -if (s30_snv_shr = 0, -i30_snv_relocation_target(j) = 0; - -elseif s30_snv_shr <= s30_snv_relocation_data_x1, -m_linear_cell_data_interpol(i30_snv_relocation_target, s30_snv_shr,0,s30_snv_relocation_data_x1,0, f30_snv_target_cropland(j, "SNV20TargetCropland")); - -elseif s30_snv_shr > s30_snv_relocation_data_x1, -m_linear_cell_data_interpol(i30_snv_relocation_target, s30_snv_shr,s30_snv_relocation_data_x1, s30_snv_relocation_data_x2,f30_snv_target_cropland(j, "SNV20TargetCropland"), f30_snv_target_cropland(j, "SNV50TargetCropland")); -); - *due to some rounding errors the input data currently may contain in some cases *very small, negative numbers. These numbers have to be set to 0 as area *cannot be smaller than 0! diff --git a/modules/30_crop/endo_apr21/presolve.gms b/modules/30_crop/endo_apr21/presolve.gms index 528e492ec4..942042b0e9 100644 --- a/modules/30_crop/endo_apr21/presolve.gms +++ b/modules/30_crop/endo_apr21/presolve.gms @@ -20,33 +20,8 @@ else *' @stop -*' No penalties or fallows exist in this realization +*' No penalties exist in this realization vm_rotation_penalty.fx(i)=0; -vm_fallow.fx(j)=0; crpmax30(crp30) = yes$(f30_rotation_max_shr(crp30) < 1); crpmin30(crp30) = yes$(f30_rotation_min_shr(crp30) > 0); - -*' @code -*' Minimum semi-natural vegetation (SNV) share is fading in after 2020 -p30_snv_shr(t,j) = p30_snv_scenario_fader(t) * - (s30_snv_shr * sum(cell(i,j), p30_country_snv_weight(i)) - + s30_snv_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); - -*' Cropland relocation in response to SNV policy is based on exogeneous land -*' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). -*' The rate of the policy implementation is derived based -*' on the difference of scenario fader values in consecutive time steps -p30_snv_relocation(t,j) = (p30_snv_scenario_fader(t) - p30_snv_scenario_fader(t-1)) * - (i30_snv_relocation_target(j) * sum(cell(i,j), p30_country_snv_weight(i)) - + s30_snv_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); -*' The following lines take care of mismatches in the input -*' data (derived from satellite imagery from the Copernicus -*' Global Land Service (@buchhorn_copernicus_2020)) and in -*' cases of cropland reduction -p30_max_snv_relocation(t,j) = p30_snv_shr(t,j) * (p30_snv_scenario_fader(t) - p30_snv_scenario_fader(t-1)) * pcm_land(j,"crop"); -p30_snv_relocation(t,j)$(p30_snv_relocation(t, j) > p30_max_snv_relocation(t,j)) = p30_max_snv_relocation(t,j); - -*' Area potentially available for cropping -p30_avl_cropland(t,j) = f30_avl_cropland(j,"%c30_marginal_land%") * (1 - p30_snv_shr(t,j)); -*' @stop diff --git a/modules/30_crop/endo_apr21/sets.gms b/modules/30_crop/endo_apr21/sets.gms index 0c18871533..4d37950315 100644 --- a/modules/30_crop/endo_apr21/sets.gms +++ b/modules/30_crop/endo_apr21/sets.gms @@ -48,13 +48,4 @@ sets crop_per30(kcr) perennial crops / oilpalm, begr, sugr_cane, betr / - marginal_land30 Marginal land scenarios - / all_marginal, q33_marginal, no_marginal / - - policy_target30 Target year for cropland policy - / none, by2030, by2050 / - - relocation_target30 Cropland requiring relocation based on different SNV targets - / SNV20TargetCropland, SNV50TargetCropland / - ; diff --git a/modules/30_crop/penalty_apr22/declarations.gms b/modules/30_crop/penalty_apr22/declarations.gms index 9a06747dda..6c6ce00698 100644 --- a/modules/30_crop/penalty_apr22/declarations.gms +++ b/modules/30_crop/penalty_apr22/declarations.gms @@ -6,22 +6,11 @@ *** | Contact: magpie@pik-potsdam.de parameters - p30_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) - p30_country_snv_weight(i) SNV policy country weight per region (1) - p30_snv_shr(t,j) Share of semi-natural vegetation in cropland areas (1) - i30_snv_relocation_target(j) Overall cropland area that requires relocation due to SNV policy (mio. ha) - p30_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha) - p30_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) - p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1) - i30_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) i30_rotation_incentives(t_all,rota30) Penalty for violating rotational constraints (USD05MER per ha) - p30_snv_scenario_fader(t_all) SNV scenario fader (1) p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) ; positive variables -* Fallow land is cropland which is temporarily fallow. Croparea+fallow=cropland - vm_fallow(j) Fallow land (mio. ha) vm_area(j,kcr,w) Agricultural production area (mio. ha) vm_rotation_penalty(i) Penalty for violating rotational constraints (mio. USD05MER) v30_penalty_max_irrig(j,rotamax30) Penalty for violating max rotational constraints on irrigated land (mio. USD05MER) @@ -29,18 +18,14 @@ positive variables ; equations - q30_cropland(j) Total cropland calculation (mio. ha) - q30_avl_cropland(j) Available cropland constraint (mio. ha) q30_rotation_penalty(i) Total penalty for rotational constraint violations (mio. USD05MER) q30_rotation_max(j,rotamax30) Local maximum rotational constraints (mio. ha) q30_rotation_min(j,rotamin30) Local minimum rotational constraints (mio. ha) q30_rotation_max_irrig(j,rotamax30) Local maximum rotational constraints (mio. ha) q30_prod(j,kcr) Production of cropped products (mio. tDM) - q30_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) + q30_carbon(j,ag_pools) Croparea above ground carbon content calculation (mio. tC) q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) - q30_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) - q30_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### diff --git a/modules/30_crop/penalty_apr22/equations.gms b/modules/30_crop/penalty_apr22/equations.gms index 93d6b11164..669ed0fa84 100644 --- a/modules/30_crop/penalty_apr22/equations.gms +++ b/modules/30_crop/penalty_apr22/equations.gms @@ -6,41 +6,13 @@ *** | Contact: magpie@pik-potsdam.de *' @equations -*' The total land requirements for cropland are calculated as -*' the sum of crop and water supply type specific land requirements. -*' Fallow is no explicit landuse type, but the difference between -*' the land area for crops vm_land and the croparea vm_area - q30_cropland(j2) .. - sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + vm_treecover_area(j2) =e= vm_land(j2,"crop"); - -*' We assume that crop production can only take place on suitable cropland area. -*' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas -*' from cropland production that have a low suitability, e.g. due to steep slopes, -*' to estimate the available cropland area. The cultivated area therefore has -*' to be smaller than the available cropland area. Moreover, the available cropland -*' can be reduced by constraining the cropland area in favour of other land types, -*' in order to increase compositional heterogeneity of land types at the cell level. - - q30_avl_cropland(j2) .. - vm_land(j2,"crop") =l= sum(ct, p30_avl_cropland(ct,j2)); - -*' The semi-natural land constraint in cropland areas for sustaining critical regulating NCP -*' for agricultural production is added on top of land conserved for other reasons -*' (e.g. conservation of intact ecosystems or protection of biodiversity hotspots). - q30_land_snv(j2) .. - sum(land_snv, vm_land(j2,land_snv)) - =g= - sum(ct, p30_snv_shr(ct,j2)) * vm_land(j2,"crop") - + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); - -*' The semi-natural vegetation constraint for cropland areas has been suggested at the per square -*' kilometer scale. The amount of cropland requiring relocation has therefore been derived from -*' exogeneous high-resolution land cover information from the Copernicus Global Land Service -*' (@buchhorn_copernicus_2020). +*' Agricultural production is calculated by multiplying the area under +*' production with corresponding yields. Production from rainfed and irrigated +*' areas is summed up: - q30_land_snv_trans(j2) .. - sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p30_snv_relocation(ct,j2)); + q30_prod(j2,kcr) .. + vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); *' Rotational constraints prevent over-specialization. In this module realization, *' they are implemented via a penalty payment if the constraints are violated. @@ -83,20 +55,11 @@ q30_rotation_penalty(i2) .. sum((rota_kcr30(rotamax_red30,kcr)), vm_area(j2,kcr,"irrigated")) - vm_AEI(j2) * f30_rotation_rules(rotamax_red30); +*' The carbon stocks of the above ground carbon pools are calculated based on croparea and related carbon density. -*' Agricultural production is calculated by multiplying the area under -*' production with corresponding yields. Production from rainfed and irrigated -*' areas is summed up: - - q30_prod(j2,kcr) .. - vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); - -*' The carbon content of the above ground carbon pools are calculated as a total -*' for all cropland : - - q30_carbon(j2,ag_pools,stockType) .. - vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= - m_carbon_stock(vm_land,fm_carbon_density,"crop") + vm_treecover_carbon(j2,ag_pools,stockType); + q30_carbon(j2,ag_pools) .. + vm_carbon_stock_croparea(j2,ag_pools) =e= + sum((kcr,w), vm_area(j2,kcr,w)) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)); *' The biodiversity value for cropland is calculated separately for annual and perennial crops: q30_bv_ann(j2,potnatveg) .. diff --git a/modules/30_crop/penalty_apr22/preloop.gms b/modules/30_crop/penalty_apr22/preloop.gms index a5b75b7935..d628775aff 100644 --- a/modules/30_crop/penalty_apr22/preloop.gms +++ b/modules/30_crop/penalty_apr22/preloop.gms @@ -7,22 +7,8 @@ ** Trajectory for cropland scenarios * sigmoidal interpolation between start year and target year -m_sigmoid_time_interpol(p30_snv_scenario_fader,s30_snv_scenario_start,s30_snv_scenario_target,0,1); m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); -* linear interpolation to estimate the cropland that -* requires relocation due to SNV policy -if (s30_snv_shr = 0, -i30_snv_relocation_target(j) = 0; - -elseif s30_snv_shr <= s30_snv_relocation_data_x1, -m_linear_cell_data_interpol(i30_snv_relocation_target, s30_snv_shr,0,s30_snv_relocation_data_x1,0, f30_snv_target_cropland(j, "SNV20TargetCropland")); - -elseif s30_snv_shr > s30_snv_relocation_data_x1, -m_linear_cell_data_interpol(i30_snv_relocation_target, s30_snv_shr,s30_snv_relocation_data_x1, s30_snv_relocation_data_x2,f30_snv_target_cropland(j, "SNV20TargetCropland"), f30_snv_target_cropland(j, "SNV50TargetCropland")); -); - - ** create crop rotation scenario i30_rotation_incentives(t_all,rota30)= f30_rotation_incentives(rota30,"default") * (1-p30_rotation_scenario_fader(t_all)) + diff --git a/modules/30_crop/penalty_apr22/presolve.gms b/modules/30_crop/penalty_apr22/presolve.gms index 77ae685190..4c8d3a4fa8 100644 --- a/modules/30_crop/penalty_apr22/presolve.gms +++ b/modules/30_crop/penalty_apr22/presolve.gms @@ -19,30 +19,6 @@ else ); *' @stop -*' @code -*' Minimum semi-natural vegetation (SNV) share is fading in after 2020 -p30_snv_shr(t,j) = p30_snv_scenario_fader(t) * - (s30_snv_shr * sum(cell(i,j), p30_country_snv_weight(i)) - + s30_snv_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); - -*' Cropland relocation in response to SNV policy is based on exogeneous land -*' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). -*' The rate of the policy implementation is derived based -*' on the difference of scenario fader values in consecutive time steps -p30_snv_relocation(t,j) = (p30_snv_scenario_fader(t) - p30_snv_scenario_fader(t-1)) * - (i30_snv_relocation_target(j) * sum(cell(i,j), p30_country_snv_weight(i)) - + s30_snv_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); -*' The following lines take care of mismatches in the input -*' data (derived from satellite imagery from the Copernicus -*' Global Land Service (@buchhorn_copernicus_2020)) and in -*' cases of cropland reduction -p30_max_snv_relocation(t,j) = p30_snv_shr(t,j) * (p30_snv_scenario_fader(t) - p30_snv_scenario_fader(t-1)) * pcm_land(j,"crop"); -p30_snv_relocation(t,j)$(p30_snv_relocation(t, j) > p30_max_snv_relocation(t,j)) = p30_max_snv_relocation(t,j); - -*' Area potentially available for cropping -p30_avl_cropland(t,j) = f30_avl_cropland(j,"%c30_marginal_land%") * (1 - p30_snv_shr(t,j)); -*' @stop - * only activate constraints which are binding rotamax_red30(rotamax30) = yes$(i30_rotation_incentives(t,rotamax30) > 0); rotamin_red30(rotamin30) = yes$(i30_rotation_incentives(t,rotamin30) > 0); diff --git a/modules/30_crop/penalty_apr22/sets.gms b/modules/30_crop/penalty_apr22/sets.gms index 91881757d7..c03627a506 100644 --- a/modules/30_crop/penalty_apr22/sets.gms +++ b/modules/30_crop/penalty_apr22/sets.gms @@ -84,12 +84,4 @@ sets crop_per30(kcr) perennial crops / oilpalm, begr, sugr_cane, betr / - marginal_land30 Marginal land scenarios - / all_marginal, q33_marginal, no_marginal / - - policy_target30 Target year for cropland policy - / none, by2030, by2050 / - - relocation_target30 Cropland requiring relocation based on different SNV targets - / SNV20TargetCropland, SNV50TargetCropland / ; diff --git a/modules/30_crop/rotation_apr22/declarations.gms b/modules/30_crop/rotation_apr22/declarations.gms index 126d50b51e..93e3da8bfb 100644 --- a/modules/30_crop/rotation_apr22/declarations.gms +++ b/modules/30_crop/rotation_apr22/declarations.gms @@ -6,39 +6,24 @@ *** | Contact: magpie@pik-potsdam.de parameters - p30_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) - p30_country_snv_weight(i) SNV policy country weight per region (1) - p30_snv_shr(t,j) Share of semi-natural vegetation in cropland areas (1) - i30_snv_relocation_target(j) Overall cropland area that requires relocation due SNV policy (mio. ha) - p30_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha) - p30_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) - p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1) - i30_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) i30_rotation_max_shr(t_all,rotamax30) Maximum share of a certain crop group on cropland (ha per ha) i30_rotation_min_shr(t_all,rotamin30) Minimum share of a certain crop group on cropland (ha per ha) - p30_snv_scenario_fader(t_all) SNV scenario fader (1) p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) ; positive variables -* Fallow land is cropland which is temporarily fallow. Croparea+fallow=cropland - vm_fallow(j) Fallow land (mio. ha) vm_area(j,kcr,w) Agricultural production area (mio. ha) vm_rotation_penalty(i) Penalty for violating rotational constraints (USD05MER) ; equations - q30_cropland(j) Total cropland calculation (mio. ha) - q30_avl_cropland(j) Available cropland constraint (mio. ha) q30_rotation_max(j,rotamax30) Local maximum rotational constraints (mio. ha) q30_rotation_min(j,rotamin30) Local minimum rotational constraints (mio. ha) q30_rotation_max_irrig(j,rotamax30) Local maximum rotational constraints (mio. ha) q30_prod(j,kcr) Production of cropped products (mio. tDM) - q30_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) + q30_carbon(j,ag_pools) Croplarea above ground carbon content calculation (mio. tC) q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) - q30_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) - q30_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### diff --git a/modules/30_crop/rotation_apr22/equations.gms b/modules/30_crop/rotation_apr22/equations.gms index 379ed62cf6..fef0d2c511 100644 --- a/modules/30_crop/rotation_apr22/equations.gms +++ b/modules/30_crop/rotation_apr22/equations.gms @@ -6,41 +6,13 @@ *** | Contact: magpie@pik-potsdam.de *' @equations -*' The total land requirements for cropland are calculated as -*' the sum of crop and water supply type specific land requirements: -*' Fallow is no explicit landuse type, but the difference between -*' the land area for crops vm_land and the croparea vm_area - q30_cropland(j2) .. - sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + vm_treecover_area(j2) =e= vm_land(j2,"crop"); - -*' We assume that crop production can only take place on suitable cropland area. -*' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas -*' from cropland production that have a low suitability, e.g. due to steep slopes, -*' to estimate the available cropland area. The cultivated area therefore has -*' to be smaller than the available cropland area. Moreover, the available cropland -*' can be reduced by constraining the cropland area in favour of other land types, -*' in order to increase compositional heterogeneity of land types at the cell level. - - q30_avl_cropland(j2) .. - vm_land(j2,"crop") =l= sum(ct, p30_avl_cropland(ct,j2)); - -*' The semi-natural land constraint in cropland areas for sustaining critical regulating NCP -*' for agricultural production is added on top of land conserved for other reasons -*' (e.g. conservation of intact ecosystems or protection of biodiversity hotspots). - q30_land_snv(j2) .. - sum(land_snv, vm_land(j2,land_snv)) - =g= - sum(ct, p30_snv_shr(ct,j2)) * vm_land(j2,"crop") - + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); - -*' The semi-natural vegetation constraint for cropland areas has been suggested at the per square -*' kilometer scale. The amount of cropland requiring relocation has therefore been derived from -*' exogeneous high-resolution land cover information from the Copernicus Global Land Service -*' (@buchhorn_copernicus_2020). +*' Agricultural production is calculated by multiplying the area under +*' production with corresponding yields. Production from rainfed and irrigated +*' areas is summed up: - q30_land_snv_trans(j2) .. - sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p30_snv_relocation(ct,j2)); + q30_prod(j2,kcr) .. + vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); *' As additional constraints minimum and maximum rotational constraints limit *' the placing of crops. On the one hand, these rotational constraints reflect @@ -64,7 +36,6 @@ sum((rotamax_kcr30(rotamax_red30,kcr)), vm_area(j2,kcr,"irrigated")) =l= vm_AEI(j2) * sum(ct,i30_rotation_max_shr(ct,rotamax_red30)); - *' Agricultural production is calculated by multiplying the area under *' production with corresponding yields. Production from rainfed and irrigated *' areas is summed up: @@ -72,13 +43,6 @@ q30_prod(j2,kcr) .. vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); -*' The carbon content of the above ground carbon pools are calculated as a total -*' for all cropland : - - q30_carbon(j2,ag_pools,stockType) .. - vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= - m_carbon_stock(vm_land,fm_carbon_density,"crop") + vm_treecover_carbon(j2,ag_pools,stockType); - *' The biodiversity value for cropland is calculated separately for annual and perennial crops: q30_bv_ann(j2,potnatveg) .. vm_bv(j2,"crop_ann",potnatveg) diff --git a/modules/30_crop/rotation_apr22/preloop.gms b/modules/30_crop/rotation_apr22/preloop.gms index c6dd29d8d5..43fe8bdd10 100644 --- a/modules/30_crop/rotation_apr22/preloop.gms +++ b/modules/30_crop/rotation_apr22/preloop.gms @@ -8,21 +8,8 @@ ** Trajectory for cropland scenarios * sigmoidal interpolation between start year and target year -m_sigmoid_time_interpol(p30_snv_scenario_fader,s30_snv_scenario_start,s30_snv_scenario_target,0,1); m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); -* linear interpolation to estimate the cropland that -* requires relocation due to SNV policy -if (s30_snv_shr = 0, -i30_snv_relocation_target(j) = 0; - -elseif s30_snv_shr <= s30_snv_relocation_data_x1, -m_linear_cell_data_interpol(i30_snv_relocation_target, s30_snv_shr,0,s30_snv_relocation_data_x1,0, f30_snv_target_cropland(j, "SNV20TargetCropland")); - -elseif s30_snv_shr > s30_snv_relocation_data_x1, -m_linear_cell_data_interpol(i30_snv_relocation_target, s30_snv_shr,s30_snv_relocation_data_x1, s30_snv_relocation_data_x2,f30_snv_target_cropland(j, "SNV20TargetCropland"), f30_snv_target_cropland(j, "SNV50TargetCropland")); -); - ** create crop rotation scenario i30_rotation_max_shr(t_all,rotamax30)= f30_rotation_max_shr(rotamax30,"default") * (1-p30_rotation_scenario_fader(t_all))+ diff --git a/modules/30_crop/rotation_apr22/presolve.gms b/modules/30_crop/rotation_apr22/presolve.gms index 2c3fa21de2..1b847385d9 100644 --- a/modules/30_crop/rotation_apr22/presolve.gms +++ b/modules/30_crop/rotation_apr22/presolve.gms @@ -19,29 +19,6 @@ else ); *' @stop -*' @code -*' Minimum semi-natural vegetation (SNV) share is fading in after 2020 -p30_snv_shr(t,j) = p30_snv_scenario_fader(t) * - (s30_snv_shr * sum(cell(i,j), p30_country_snv_weight(i)) - + s30_snv_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); - -*' Cropland relocation in response to SNV policy is based on exogeneous land -*' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). -*' The rate of the policy implementation is derived based -*' on the difference of scenario fader values in consecutive time steps -p30_snv_relocation(t,j) = (p30_snv_scenario_fader(t) - p30_snv_scenario_fader(t-1)) * - (i30_snv_relocation_target(j) * sum(cell(i,j), p30_country_snv_weight(i)) - + s30_snv_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i))); -*' The following lines take care of mismatches in the input -*' data (derived from satellite imagery) and in -*' cases of cropland reduction -p30_max_snv_relocation(t,j) = p30_snv_shr(t,j) * (p30_snv_scenario_fader(t) - p30_snv_scenario_fader(t-1)) * pcm_land(j,"crop"); -p30_snv_relocation(t,j)$(p30_snv_relocation(t, j) > p30_max_snv_relocation(t,j)) = p30_max_snv_relocation(t,j); - -*' Area potentially available for cropping -p30_avl_cropland(t,j) = f30_avl_cropland(j,"%c30_marginal_land%") * (1 - p30_snv_shr(t,j)); -*' @stop - * only activate constraints which are binding rotamax_red30(rotamax30) = yes$(i30_rotation_max_shr(t,rotamax30) < 1); rotamin_red30(rotamin30) = yes$(i30_rotation_min_shr(t,rotamin30) > 0); diff --git a/modules/30_crop/rotation_apr22/sets.gms b/modules/30_crop/rotation_apr22/sets.gms index 72b3040f6a..e23397fecc 100644 --- a/modules/30_crop/rotation_apr22/sets.gms +++ b/modules/30_crop/rotation_apr22/sets.gms @@ -96,12 +96,4 @@ sets crop_per30(kcr) perennial crops / oilpalm, begr, sugr_cane, betr / - marginal_land30 Marginal land scenarios - / all_marginal, q33_marginal, no_marginal / - - policy_target30 Target year for cropland policy - / none, by2030, by2050 / - - relocation_target30 Cropland requiring relocation based on different SNV targets - / SNV20TargetCropland, SNV50TargetCropland / ; diff --git a/modules/61_agroforestry/exo/input.gms b/modules/61_agroforestry/exo/input.gms index 8d198c6bd0..c10a69cca2 100644 --- a/modules/61_agroforestry/exo/input.gms +++ b/modules/61_agroforestry/exo/input.gms @@ -5,16 +5,3 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -scalars - s61_cost_treecover_est Tree cover establishment cost (USD per ha) / 2000 / - s61_cost_treecover_recur Tree cover recurring cost (USD per ha) / 500 / - s61_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / - s61_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / - s61_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / - s61_treecover_scenario_start Cropland treecover scenario start year / 2020 / - s61_treecover_scenario_target Cropland treecover scenario target year / 2050 / - s61_treecover_min_shr Share of treecover on cropland (1) / 0.2 / - s61_betr_scenario_start Bioenergy trees scenario start year / 2020 / - s61_betr_scenario_target Bioenergy trees scenario target year / 2050 / - s61_betr_min_shr Minimum share of bioenergy trees on cropland (1) / 0 / -; diff --git a/modules/61_agroforestry/exo/postsolve.gms b/modules/61_agroforestry/exo/postsolve.gms index 557cf4f306..0f01d44bb7 100644 --- a/modules/61_agroforestry/exo/postsolve.gms +++ b/modules/61_agroforestry/exo/postsolve.gms @@ -5,7 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -pc61_treecover(j,ac) = v61_treecover.l(j,ac); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_cost_agroforestry(t,j,"marginal") = vm_cost_agroforestry.m(j); diff --git a/modules/61_agroforestry/exo/preloop.gms b/modules/61_agroforestry/exo/preloop.gms index 382d670b01..637d6609c8 100644 --- a/modules/61_agroforestry/exo/preloop.gms +++ b/modules/61_agroforestry/exo/preloop.gms @@ -5,25 +5,4 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -m_sigmoid_time_interpol(p61_treecover_scenario_fader,s61_treecover_scenario_start,s61_treecover_scenario_target,0,1); -m_sigmoid_time_interpol(p61_betr_scenario_fader,s61_betr_scenario_start,s61_betr_scenario_target,0,1); - -* Initial tree cover on cropland is assumed to be equally distributed among all age-classes -pc61_treecover(j,ac) = (pm_treecover_shr(j)*pm_land_start(j,"crop"))/card(ac); -*' Switch for tree cover on cropland: -*' 0 = Use natveg growth curve towards LPJmL natural vegetation -*' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation -if(s61_treecover_plantation = 0, - p61_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); -elseif s61_treecover_plantation = 1, - p61_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools); -); - -** set bii coefficients -p61_treecover_bii_coeff(bii_class_secd,potnatveg) = 0; -if(s61_treecover_bii_coeff = 0, - p61_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff(bii_class_secd,potnatveg) -elseif s61_treecover_bii_coeff = 1, - p61_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff("timber",potnatveg) -); diff --git a/modules/61_agroforestry/exo/presolve.gms b/modules/61_agroforestry/exo/presolve.gms index 40d24e22ea..c10a69cca2 100644 --- a/modules/61_agroforestry/exo/presolve.gms +++ b/modules/61_agroforestry/exo/presolve.gms @@ -5,32 +5,3 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -* Growth of trees on cropland is modelled by shifting age-classes according to time step length. -s61_shift = m_timestep_length_forestry/5; -* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s61_shift = 1) - p61_treecover(t,j,ac)$(ord(ac) > s61_shift) = pc61_treecover(j,ac-s61_shift); -* account for cases at the end of the age class set (s61_shift > 1) which are not shifted by the above calculation - p61_treecover(t,j,"acx") = p61_treecover(t,j,"acx") - + sum(ac$(ord(ac) > card(ac)-s61_shift), pc61_treecover(j,ac)); - -pc61_treecover(j,ac) = p61_treecover(t,j,ac); -v61_treecover.l(j,ac) = p61_treecover(t,j,ac); - -if(m_year(t) <= s61_treecover_scenario_start, - v61_treecover.fx(j,ac) = pc61_treecover(j,ac); -else - v61_treecover.lo(j,ac_est) = 0; - v61_treecover.up(j,ac_est) = Inf; - if(s61_treecover_decrease = 1, - v61_treecover.lo(j,ac_sub) = 0; - v61_treecover.up(j,ac_sub) = pc61_treecover(j,ac_sub); - else - v61_treecover.fx(j,ac_sub) = pc61_treecover(j,ac_sub); - ); -); - -p61_treecover_min_shr(t,j) = - ((1-p61_treecover_scenario_fader(t)) * pm_treecover_shr(j)) + - (p61_treecover_scenario_fader(t) * s61_treecover_min_shr); - -p61_betr_min_shr(t,j) = p61_betr_scenario_fader(t) * s61_betr_min_shr; diff --git a/modules/include.gms b/modules/include.gms index 8b99f45da2..13ff07c83e 100644 --- a/modules/include.gms +++ b/modules/include.gms @@ -22,7 +22,7 @@ $include "./modules/18_residues/module.gms" $include "./modules/20_processing/module.gms" $include "./modules/21_trade/module.gms" $include "./modules/22_land_conservation/module.gms" -$include "./modules/29_ageclass/module.gms" +$include "./modules/28_ageclass/module.gms" $include "./modules/30_crop/module.gms" $include "./modules/31_past/module.gms" $include "./modules/32_forestry/module.gms" From 531ffad5cd3d40062bdc0593f4a7f43d23880a33 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 16 Apr 2024 12:37:16 +0200 Subject: [PATCH 009/280] partial commit to save work --- config/default.cfg | 72 +++++++------- main.gms | 2 +- modules/11_costs/default/equations.gms | 2 +- modules/29_cropland/module.gms | 2 +- modules/29_cropland/rulebased/input.gms | 52 ---------- modules/29_cropland/rulebased/postsolve.gms | 8 -- modules/29_cropland/rulebased/realization.gms | 18 ---- .../declarations.gms | 38 ++++++-- .../equations.gms | 44 ++++----- modules/29_cropland/rulebased_apr24/input.gms | 94 +++++++++++++++++++ .../29_cropland/rulebased_apr24/postsolve.gms | 76 +++++++++++++++ .../preloop.gms | 15 ++- .../presolve.gms | 44 ++++----- .../rulebased_apr24/realization.gms | 20 ++++ .../{rulebased => rulebased_apr24}/sets.gms | 8 +- modules/30_crop/endo_apr21/declarations.gms | 28 +++--- modules/30_crop/endo_apr21/equations.gms | 3 +- modules/30_crop/endo_apr21/input.gms | 51 +--------- modules/30_crop/endo_apr21/input/files | 5 - modules/30_crop/endo_apr21/postsolve.gms | 92 ++++++++---------- modules/30_crop/endo_apr21/preloop.gms | 11 +-- modules/30_crop/endo_apr21/presolve.gms | 2 + .../30_crop/penalty_apr22/declarations.gms | 17 ++-- modules/30_crop/penalty_apr22/equations.gms | 16 ++-- modules/30_crop/penalty_apr22/input.gms | 69 +------------- modules/30_crop/penalty_apr22/input/files | 5 - modules/30_crop/penalty_apr22/postsolve.gms | 40 +++----- modules/30_crop/penalty_apr22/preloop.gms | 11 --- .../30_crop/rotation_apr22/declarations.gms | 17 ++-- modules/30_crop/rotation_apr22/equations.gms | 29 +++--- modules/30_crop/rotation_apr22/input.gms | 72 +------------- modules/30_crop/rotation_apr22/input/files | 5 - modules/30_crop/rotation_apr22/postsolve.gms | 44 ++++----- modules/30_crop/rotation_apr22/preloop.gms | 13 +-- modules/30_crop/rotation_apr22/presolve.gms | 2 + modules/61_agroforestry/endo/declarations.gms | 67 ------------- modules/61_agroforestry/endo/equations.gms | 55 ----------- modules/61_agroforestry/endo/input.gms | 18 ---- modules/61_agroforestry/endo/not_used.txt | 2 - modules/61_agroforestry/endo/postsolve.gms | 79 ---------------- modules/61_agroforestry/endo/preloop.gms | 26 ----- modules/61_agroforestry/endo/presolve.gms | 34 ------- modules/61_agroforestry/endo/realization.gms | 21 ----- modules/61_agroforestry/exo/declarations.gms | 65 ------------- modules/61_agroforestry/exo/equations.gms | 54 ----------- modules/61_agroforestry/exo/input.gms | 7 -- modules/61_agroforestry/exo/postsolve.gms | 70 -------------- modules/61_agroforestry/exo/preloop.gms | 8 -- modules/61_agroforestry/exo/presolve.gms | 7 -- modules/61_agroforestry/exo/realization.gms | 21 ----- modules/61_agroforestry/module.gms | 22 ----- modules/61_agroforestry/off/declarations.gms | 25 ----- modules/61_agroforestry/off/not_used.txt | 10 -- modules/61_agroforestry/off/postsolve.gms | 22 ----- modules/61_agroforestry/off/preloop.gms | 11 --- modules/61_agroforestry/off/realization.gms | 17 ---- modules/include.gms | 2 +- 57 files changed, 464 insertions(+), 1206 deletions(-) delete mode 100644 modules/29_cropland/rulebased/input.gms delete mode 100644 modules/29_cropland/rulebased/postsolve.gms delete mode 100644 modules/29_cropland/rulebased/realization.gms rename modules/29_cropland/{rulebased => rulebased_apr24}/declarations.gms (51%) rename modules/29_cropland/{rulebased => rulebased_apr24}/equations.gms (73%) create mode 100644 modules/29_cropland/rulebased_apr24/input.gms create mode 100644 modules/29_cropland/rulebased_apr24/postsolve.gms rename modules/29_cropland/{rulebased => rulebased_apr24}/preloop.gms (75%) rename modules/29_cropland/{rulebased => rulebased_apr24}/presolve.gms (67%) create mode 100644 modules/29_cropland/rulebased_apr24/realization.gms rename modules/29_cropland/{rulebased => rulebased_apr24}/sets.gms (73%) delete mode 100644 modules/61_agroforestry/endo/declarations.gms delete mode 100644 modules/61_agroforestry/endo/equations.gms delete mode 100644 modules/61_agroforestry/endo/input.gms delete mode 100644 modules/61_agroforestry/endo/not_used.txt delete mode 100644 modules/61_agroforestry/endo/postsolve.gms delete mode 100644 modules/61_agroforestry/endo/preloop.gms delete mode 100644 modules/61_agroforestry/endo/presolve.gms delete mode 100644 modules/61_agroforestry/endo/realization.gms delete mode 100644 modules/61_agroforestry/exo/declarations.gms delete mode 100644 modules/61_agroforestry/exo/equations.gms delete mode 100644 modules/61_agroforestry/exo/input.gms delete mode 100644 modules/61_agroforestry/exo/postsolve.gms delete mode 100644 modules/61_agroforestry/exo/preloop.gms delete mode 100644 modules/61_agroforestry/exo/presolve.gms delete mode 100644 modules/61_agroforestry/exo/realization.gms delete mode 100644 modules/61_agroforestry/module.gms delete mode 100644 modules/61_agroforestry/off/declarations.gms delete mode 100644 modules/61_agroforestry/off/not_used.txt delete mode 100644 modules/61_agroforestry/off/postsolve.gms delete mode 100644 modules/61_agroforestry/off/preloop.gms delete mode 100644 modules/61_agroforestry/off/realization.gms diff --git a/config/default.cfg b/config/default.cfg index 6a64d3aed1..65dac22111 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -676,6 +676,42 @@ cfg$gms$ageclass <- "feb21" # def = feb21 # * (incentive_apr24): Fallow land and tree cover develop endogenously based on monetary incentives cfg$gms$cropland <- "rulebased_apr24" # def = rulebased_apr24 +# * Switch to determine whether marginal land (suitability index below 0.33) should be included +# * in the total available cropland. Options are: +# * ("all_marginal"): All marginal land can be used for crop cultivation +# * ("q33_marginal"): The bottom tertile of marginal land is excluded +# * ("no_marginal"): Marginal land is completely excluded from crop cultivation +# * Note: Option "q33_marginal" produces the highest spatial correlation +# * with observed cropland patterns and is recommended for productive runs. +cfg$gms$c29_marginal_land <- "q33_marginal" # def = "q33_marginal" + +# * Share of available cropland that is withheld for maintaining semi-natural vegetation (SNV) +# * in each square km in cropland areas, including grassland, forest and other land. For example, +# * a share of 0.2 corresponds to 20 % of SNV in terms of the available cropland. +# * The amount of cropland relocation is estimated based on external high resolution +# * land cover information from the Copernicus Global Land Service for the year 2019. +# * Accepted sensible values are between 0 and 0.5 +# Note: s29_snv_shr applies to countries selected in policy_countries29 +# s29_snv_shr_noselect applies to all other countries. +cfg$gms$s29_snv_shr <- 0 # def = 0 +cfg$gms$s29_snv_shr_noselect <- 0 # def = 0 +# * Year by which SNV policy ('s29_snv_shr') is fully implemented. +# * Start year (should be close to 2019): +cfg$gms$s29_snv_scenario_start <- 2020 # def = 2020 +# * Target year (year when full implementation is reached): +cfg$gms$s29_snv_scenario_target <- 2029 # def = 2029 +# * Switch and specification of countries for which SNV policy in +# * s29_snv_shr apply. +# * Options: list of iso-codes of countries where SNV policy should be applied +# * Note: must be written in the format: "IND, BRA, DEU" +# * Default: all iso countries +cfg$gms$policy_countries29 <- all_iso_countries +# * Land types included in the SNV policy. This option allows for sensitivity analyses. +# * plausible options: "secdforest, forestry, past, other", +# * "secdforest, other", +# * "secdforest, past, other" etc. +cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other" + # ***--------------------- 30_crop --------------------------------------- # * 30_crop defines the croparea, which is a subcomponent of total cropland defined in 29_cropland. # * (endo_apr21): Hard rotational constraints. Dynamic cropland and detailed cropland availability data at grid cell level. @@ -705,42 +741,6 @@ cfg$gms$s30_rotation_scenario_start <- 2020 # def = 2020 cfg$gms$s30_rotation_scenario_target <- 2050 # def = 2050 -# * Switch to determine whether marginal land (suitability index below 0.33) should be included -# * in the total available cropland. Options are: -# * ("all_marginal"): All marginal land can be used for crop cultivation -# * ("q33_marginal"): The bottom tertile of marginal land is excluded -# * ("no_marginal"): Marginal land is completely excluded from crop cultivation -# * Note: Option "q33_marginal" produces the highest spatial correlation -# * with observed cropland patterns and is recommended for productive runs. -cfg$gms$c30_marginal_land <- "q33_marginal" # def = "q33_marginal" - -# * Share of available cropland that is withheld for maintaining semi-natural vegetation (SNV) -# * in each square km in cropland areas, including grassland, forest and other land. For example, -# * a share of 0.2 corresponds to 20 % of SNV in terms of the available cropland. -# * The amount of cropland relocation is estimated based on external high resolution -# * land cover information from the Copernicus Global Land Service for the year 2019. -# * Accepted sensible values are between 0 and 0.5 -# Note: s30_snv_shr applies to countries selected in policy_countries30 -# s30_snv_shr_noselect applies to all other countries. -cfg$gms$s30_snv_shr <- 0 # def = 0 -cfg$gms$s30_snv_shr_noselect <- 0 # def = 0 -# * Year by which SNV policy ('s30_snv_shr') is fully implemented. -# * Start year (should be close to 2019): -cfg$gms$s30_snv_scenario_start <- 2020 # def = 2020 -# * Target year (year when full implementation is reached): -cfg$gms$s30_snv_scenario_target <- 2030 # def = 2030 -# * Switch and specification of countries for which SNV policy in -# * s30_snv_shr apply. -# * Options: list of iso-codes of countries where SNV policy should be applied -# * Note: must be written in the format: "IND, BRA, DEU" -# * Default: all iso countries -cfg$gms$policy_countries30 <- all_iso_countries -# * Land types included in the SNV policy. This option allows for sensitivity analyses. -# * plausible options: "secdforest, forestry, past, other", -# * "secdforest, other", -# * "secdforest, past, other" etc. -cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other" - # ***--------------------- 31_past --------------------------------------- # * (static): static pasture # * (endo_jun13): dynamic pasture diff --git a/main.gms b/main.gms index fc45c7c121..c2a738f7b5 100644 --- a/main.gms +++ b/main.gms @@ -249,6 +249,7 @@ $setglobal land_conservation area_based_apr22 $setglobal ageclass feb21 +$setglobal cropland rulebased_apr24 $setglobal crop endo_apr21 $setglobal past endo_jun13 @@ -281,7 +282,6 @@ $setglobal peatland v2 $setglobal som static_jan19 $setglobal bioenergy 1stgen_priced_dec18 -$setglobal agroforestry off $setglobal material exo_flexreg_apr16 $setglobal livestock fbask_jan16 diff --git a/modules/11_costs/default/equations.gms b/modules/11_costs/default/equations.gms index 3c3a57f893..c3d758a20d 100644 --- a/modules/11_costs/default/equations.gms +++ b/modules/11_costs/default/equations.gms @@ -37,7 +37,7 @@ + vm_costs_additional_mon(i2) + sum(cell(i2,j2),vm_cost_land_transition(j2)) + sum(cell(i2,j2), vm_peatland_cost(j2)) - + sum(cell(i2,j2), vm_cost_agroforestry(j2)) + + sum(cell(i2,j2), vm_cost_cropland(j2)) + sum(cell(i2,j2),vm_cost_bv_loss(j2)) + sum(cell(i2,j2),vm_cost_urban(j2)) + sum(cell(i2,j2),vm_water_cost(i2)) diff --git a/modules/29_cropland/module.gms b/modules/29_cropland/module.gms index 2c03a898ba..7f406b8b7c 100644 --- a/modules/29_cropland/module.gms +++ b/modules/29_cropland/module.gms @@ -14,5 +14,5 @@ *' @authors Florian Humpenöder *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%ageclass%" == "feb21" $include "./modules/28_ageclass/feb21/realization.gms" +$Ifi "%cropland%" == "rulebased_apr24" $include "./modules/29_cropland/rulebased_apr24/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/29_cropland/rulebased/input.gms b/modules/29_cropland/rulebased/input.gms deleted file mode 100644 index e8d7c5028a..0000000000 --- a/modules/29_cropland/rulebased/input.gms +++ /dev/null @@ -1,52 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -scalars - s61_cost_treecover_est Tree cover establishment cost (USD per ha) / 2000 / - s61_cost_treecover_recur Tree cover recurring cost (USD per ha) / 500 / - s61_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / - s61_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / - s61_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / - s61_treecover_scenario_start Cropland treecover scenario start year / 2020 / - s61_treecover_scenario_target Cropland treecover scenario target year / 2050 / - s61_treecover_min_shr Share of treecover on cropland (1) / 0.2 / - s61_betr_scenario_start Bioenergy trees scenario start year / 2020 / - s61_betr_scenario_target Bioenergy trees scenario target year / 2050 / - s61_betr_min_shr Minimum share of bioenergy trees on cropland (1) / 0 / -; - -********* AVAILABLE CROPLAND ******************************************* - -table f29_avl_cropland(j,marginal_land29) Available land area for cropland (mio. ha) -$ondelim -$include "./modules/29_cropland/input/avl_cropland.cs3" -$offdelim -; - -table f29_avl_cropland_iso(iso,marginal_land29) Available land area for cropland at ISO level (mio. ha) -$ondelim -$include "./modules/29_cropland/input/avl_cropland_iso.cs3" -$offdelim -; - -********* SNV TARGET CROPLAND ******************************************* - -table f29_snv_target_cropland(j,relocation_target29) Cropland in 2019 requiring relocation due to SNV policy (mio. ha) -$ondelim -$include "./modules/29_cropland/input/SNVTargetCropland.cs3" -$offdelim -; - -********* Cropland tree cover ******************************************* - -parameter f29_treecover(j) Tree cover on cropland in 2019 (mio. ha) -/ -$ondelim -$include "./modules/29_cropland/input/CroplandTreecover.cs2" -$offdelim -/ -; diff --git a/modules/29_cropland/rulebased/postsolve.gms b/modules/29_cropland/rulebased/postsolve.gms deleted file mode 100644 index fe2b94164a..0000000000 --- a/modules/29_cropland/rulebased/postsolve.gms +++ /dev/null @@ -1,8 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -pc29_treecover(j,ac) = v29_treecover.l(j,ac); diff --git a/modules/29_cropland/rulebased/realization.gms b/modules/29_cropland/rulebased/realization.gms deleted file mode 100644 index 4c07116378..0000000000 --- a/modules/29_cropland/rulebased/realization.gms +++ /dev/null @@ -1,18 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description todo - -*' @limitations todo - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/28_ageclass/feb21/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/28_ageclass/feb21/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/28_ageclass/feb21/input.gms" -$Ifi "%phase%" == "preloop" $include "./modules/28_ageclass/feb21/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/28_ageclass/feb21/presolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/29_cropland/rulebased/declarations.gms b/modules/29_cropland/rulebased_apr24/declarations.gms similarity index 51% rename from modules/29_cropland/rulebased/declarations.gms rename to modules/29_cropland/rulebased_apr24/declarations.gms index 90d9bf2aa9..de1325dffa 100644 --- a/modules/29_cropland/rulebased/declarations.gms +++ b/modules/29_cropland/rulebased_apr24/declarations.gms @@ -24,9 +24,7 @@ parameters p29_treecover_min_shr(t,j) Minimum share of treecover on cropland (1) - p29_betr_min_shr(t,j) Minimum share of bioenergy trees on cropland (1) p29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) - p29_betr_scenario_fader(t_all) Bioenergy trees scenario fader (1) p29_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) p29_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) p29_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) @@ -36,17 +34,43 @@ parameters positive variables vm_fallow(j) Fallow land is temporarily fallow cropland (mio. ha) v29_treecover(j,ac) Cropland tree cover per age class (mio. ha) + vm_cost_cropland(j) + v29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) + v29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) ; equations q29_cropland(j) Total cropland calculation (mio. ha) q29_avl_cropland(j) Available cropland constraint (mio. ha) - q29_rotation_max(j,crp29,w) Local maximum rotational constraints (mio. ha) - q29_rotation_min(j,crp29,w) Local minimum rotational constraints (mio. ha) - q29_prod(j,kcr) Production of cropped products (mio. tDM) q29_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) - q29_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) - q29_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) q29_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) q29_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) + q29_cost_cropland(j) Costs and benefits related to agroforestry (mio. USD05MER per yr) + q29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) + q29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + q29_treecover_shr(j) Cropland treecover minimum share (mio. ha) + q29_treecover_est(j,ac) Cropland treecover establishment (mio. ha) + q29_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (Mha) ; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_fallow(t,j,type) Fallow land is temporarily fallow cropland (mio. ha) + ov29_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) + ov_cost_cropland(t,j,type) + ov29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) + ov29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + oq29_cropland(t,j,type) Total cropland calculation (mio. ha) + oq29_avl_cropland(t,j,type) Available cropland constraint (mio. ha) + oq29_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) + oq29_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) + oq29_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) + oq29_cost_cropland(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr) + oq29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) + oq29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + oq29_treecover_shr(t,j,type) Cropland treecover minimum share (mio. ha) + oq29_treecover_est(t,j,ac,type) Cropland treecover establishment (mio. ha) + oq29_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (Mha) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + diff --git a/modules/29_cropland/rulebased/equations.gms b/modules/29_cropland/rulebased_apr24/equations.gms similarity index 73% rename from modules/29_cropland/rulebased/equations.gms rename to modules/29_cropland/rulebased_apr24/equations.gms index 97bb93f8ad..311a61051c 100644 --- a/modules/29_cropland/rulebased/equations.gms +++ b/modules/29_cropland/rulebased_apr24/equations.gms @@ -48,44 +48,36 @@ q29_carbon(j2,ag_pools,stockType) .. vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= - vm_carbon_stock_crop(j2,ag_pools) + vm_carbon_stock_croparea(j2,ag_pools) + vm_fallow(j2) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)) - + m_carbon_stock_ac(v29_treecover,p31_carbon_density_ac,"ac","ac_sub"); + + m_carbon_stock_ac(v29_treecover,p29_carbon_density_ac,"ac","ac_sub"); - -*' Total agroforestry cost. -*' Cost for bioenergy trees are accounted for in the [30_crop] module. -q61_cost_cropland(j2) .. +q29_cost_cropland(j2) .. vm_cost_cropland(j2) =e= - v61_cost_treecover_est(j2) + v61_cost_treecover_recur(j2); + v29_cost_treecover_est(j2) + v29_cost_treecover_recur(j2); *' Tree cover establishment cost -q61_cost_treecover_est(j2) .. - v61_cost_treecover_est(j2) =e= - sum(ac_est, v61_treecover(j2,ac_est)) * s61_cost_treecover_est * +q29_cost_treecover_est(j2) .. + v29_cost_treecover_est(j2) =e= + sum(ac_est, v29_treecover(j2,ac_est)) * s29_cost_treecover_est * sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); *' Tree cover recurring cost -q61_cost_treecover_recur(j2) .. - v61_cost_treecover_recur(j2) =e= - sum(ac_sub, v61_treecover(j2,ac_sub)) * s61_cost_treecover_recur; +q29_cost_treecover_recur(j2) .. + v29_cost_treecover_recur(j2) =e= + sum(ac_sub, v29_treecover(j2,ac_sub)) * s29_cost_treecover_recur; *' Tree cover minimum share -q61_treecover_shr(j2) .. - sum(ac, v61_treecover(j2,ac)) =g= - sum(ct, p61_treecover_min_shr(ct,j2)) * vm_land(j2,"crop"); - -*' Bioenergy tree minimum share -q61_betr_shr(j2) .. - sum(w, vm_area(j2,"betr",w)) =g= - sum(ct, p61_betr_min_shr(ct,j2)) * vm_land(j2,"crop"); +q29_treecover_shr(j2) .. + sum(ac, v29_treecover(j2,ac)) =g= + sum(ct, p29_treecover_min_shr(ct,j2)) * vm_land(j2,"crop"); *' Tree cover establishment -q61_treecover_est(j2,ac_est) .. - v61_treecover(j2,ac_est) =e= sum(ac_est2, v61_treecover(j2,ac_est2))/card(ac_est2); +q29_treecover_est(j2,ac_est) .. + v29_treecover(j2,ac_est) =e= sum(ac_est2, v29_treecover(j2,ac_est2))/card(ac_est2); *' Tree cover biodiversity value -q61_treecover_bv(j2,potnatveg) .. +q29_treecover_bv(j2,potnatveg) .. vm_bv(j2,"crop_tree",potnatveg) =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v61_treecover(j2,ac)) * - p61_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v29_treecover(j2,ac)) * + p29_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/29_cropland/rulebased_apr24/input.gms b/modules/29_cropland/rulebased_apr24/input.gms new file mode 100644 index 0000000000..658dcd38c1 --- /dev/null +++ b/modules/29_cropland/rulebased_apr24/input.gms @@ -0,0 +1,94 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +* $setglobal c29_snv_target none +* options: none, by2030, by2020 + +$setglobal c29_marginal_land q33_marginal +* options: all_marginal, q33_marginal, no_marginal + +scalars +s29_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / +s29_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / +s29_snv_scenario_start SNV scenario start year / 2020 / +s29_snv_scenario_target SNV scenario target year / 2029 / +s29_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / +s29_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / + s29_cost_treecover_est Tree cover establishment cost (USD per ha) / 2000 / + s29_cost_treecover_recur Tree cover recurring cost (USD per ha) / 500 / + s29_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / + s29_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / + s29_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / + s29_treecover_scenario_start Cropland treecover scenario start year / 2020 / + s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / + s29_treecover_min_shr Share of treecover on cropland (1) / 0.2 / +; + + +* Set-switch for countries affected by regional SNV policy +* Default: all iso countries selected +sets + policy_countries29(iso) countries to be affected by SNV policy / ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, + ASM,ATA,ATF,ATG,AUS,AUT,AZE,BDI,BEL,BEN, + BES,BFA,BGD,BGR,BHR,BHS,BIH,BLM,BLR,BLZ, + BMU,BOL,BRA,BRB,BRN,BTN,BVT,BWA,CAF,CAN, + CCK,CHN,CHE,CHL,CIV,CMR,COD,COG,COK,COL, + COM,CPV,CRI,CUB,CUW,CXR,CYM,CYP,CZE,DEU, + DJI,DMA,DNK,DOM,DZA,ECU,EGY,ERI,ESH,ESP, + EST,ETH,FIN,FJI,FLK,FRA,FRO,FSM,GAB,GBR, + GEO,GGY,GHA,GIB,GIN,GLP,GMB,GNB,GNQ,GRC, + GRD,GRL,GTM,GUF,GUM,GUY,HKG,HMD,HND,HRV, + HTI,HUN,IDN,IMN,IND,IOT,IRL,IRN,IRQ,ISL, + ISR,ITA,JAM,JEY,JOR,JPN,KAZ,KEN,KGZ,KHM, + KIR,KNA,KOR,KWT,LAO,LBN,LBR,LBY,LCA,LIE, + LKA,LSO,LTU,LUX,LVA,MAC,MAF,MAR,MCO,MDA, + MDG,MDV,MEX,MHL,MKD,MLI,MLT,MMR,MNE,MNG, + MNP,MOZ,MRT,MSR,MTQ,MUS,MWI,MYS,MYT,NAM, + NCL,NER,NFK,NGA,NIC,NIU,NLD,NOR,NPL,NRU, + NZL,OMN,PAK,PAN,PCN,PER,PHL,PLW,PNG,POL, + PRI,PRK,PRT,PRY,PSE,PYF,QAT,REU,ROU,RUS, + RWA,SAU,SDN,SEN,SGP,SGS,SHN,SJM,SLB,SLE, + SLV,SMR,SOM,SPM,SRB,SSD,STP,SUR,SVK,SVN, + SWE,SWZ,SXM,SYC,SYR,TCA,TCD,TGO,THA,TJK, + TKL,TKM,TLS,TON,TTO,TUN,TUR,TUV,TWN,TZA, + UGA,UKR,UMI,URY,USA,UZB,VAT,VCT,VEN,VGB, + VIR,VNM,VUT,WLF,WSM,YEM,ZAF,ZMB,ZWE / + +land_snv(land) land types allowed in the SNV policy / secdforest, forestry, past, other / +; + +********* AVAILABLE CROPLAND ******************************************* + +table f29_avl_cropland(j,marginal_land29) Available land area for cropland (mio. ha) +$ondelim +$include "./modules/29_cropland/input/avl_cropland.cs3" +$offdelim +; + +table f29_avl_cropland_iso(iso,marginal_land29) Available land area for cropland at ISO level (mio. ha) +$ondelim +$include "./modules/29_cropland/input/avl_cropland_iso.cs3" +$offdelim +; + +********* SNV TARGET CROPLAND ******************************************* + +table f29_snv_target_cropland(j,relocation_target29) Cropland in 2019 requiring relocation due to SNV policy (mio. ha) +$ondelim +$include "./modules/29_cropland/input/SNVTargetCropland.cs3" +$offdelim +; + +********* Cropland tree cover ******************************************* + +parameter f29_treecover(j) Tree cover on cropland in 2019 (mio. ha) +/ +$ondelim +$include "./modules/29_cropland/input/CroplandTreecover.cs2" +$offdelim +/ +; diff --git a/modules/29_cropland/rulebased_apr24/postsolve.gms b/modules/29_cropland/rulebased_apr24/postsolve.gms new file mode 100644 index 0000000000..eaad1f7dbd --- /dev/null +++ b/modules/29_cropland/rulebased_apr24/postsolve.gms @@ -0,0 +1,76 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +pc29_treecover(j,ac) = v29_treecover.l(j,ac); + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov_fallow(t,j,"marginal") = vm_fallow.m(j); + ov29_treecover(t,j,ac,"marginal") = v29_treecover.m(j,ac); + ov_cost_cropland(t,j,"marginal") = vm_cost_cropland.m(j); + ov29_cost_treecover_est(t,j,"marginal") = v29_cost_treecover_est.m(j); + ov29_cost_treecover_recur(t,j,"marginal") = v29_cost_treecover_recur.m(j); + oq29_cropland(t,j,"marginal") = q29_cropland.m(j); + oq29_avl_cropland(t,j,"marginal") = q29_avl_cropland.m(j); + oq29_carbon(t,j,ag_pools,stockType,"marginal") = q29_carbon.m(j,ag_pools,stockType); + oq29_land_snv(t,j,"marginal") = q29_land_snv.m(j); + oq29_land_snv_trans(t,j,"marginal") = q29_land_snv_trans.m(j); + oq29_cost_cropland(t,j,"marginal") = q29_cost_cropland.m(j); + oq29_cost_treecover_est(t,j,"marginal") = q29_cost_treecover_est.m(j); + oq29_cost_treecover_recur(t,j,"marginal") = q29_cost_treecover_recur.m(j); + oq29_treecover_shr(t,j,"marginal") = q29_treecover_shr.m(j); + oq29_treecover_est(t,j,ac,"marginal") = q29_treecover_est.m(j,ac); + oq29_treecover_bv(t,j,potnatveg,"marginal") = q29_treecover_bv.m(j,potnatveg); + ov_fallow(t,j,"level") = vm_fallow.l(j); + ov29_treecover(t,j,ac,"level") = v29_treecover.l(j,ac); + ov_cost_cropland(t,j,"level") = vm_cost_cropland.l(j); + ov29_cost_treecover_est(t,j,"level") = v29_cost_treecover_est.l(j); + ov29_cost_treecover_recur(t,j,"level") = v29_cost_treecover_recur.l(j); + oq29_cropland(t,j,"level") = q29_cropland.l(j); + oq29_avl_cropland(t,j,"level") = q29_avl_cropland.l(j); + oq29_carbon(t,j,ag_pools,stockType,"level") = q29_carbon.l(j,ag_pools,stockType); + oq29_land_snv(t,j,"level") = q29_land_snv.l(j); + oq29_land_snv_trans(t,j,"level") = q29_land_snv_trans.l(j); + oq29_cost_cropland(t,j,"level") = q29_cost_cropland.l(j); + oq29_cost_treecover_est(t,j,"level") = q29_cost_treecover_est.l(j); + oq29_cost_treecover_recur(t,j,"level") = q29_cost_treecover_recur.l(j); + oq29_treecover_shr(t,j,"level") = q29_treecover_shr.l(j); + oq29_treecover_est(t,j,ac,"level") = q29_treecover_est.l(j,ac); + oq29_treecover_bv(t,j,potnatveg,"level") = q29_treecover_bv.l(j,potnatveg); + ov_fallow(t,j,"upper") = vm_fallow.up(j); + ov29_treecover(t,j,ac,"upper") = v29_treecover.up(j,ac); + ov_cost_cropland(t,j,"upper") = vm_cost_cropland.up(j); + ov29_cost_treecover_est(t,j,"upper") = v29_cost_treecover_est.up(j); + ov29_cost_treecover_recur(t,j,"upper") = v29_cost_treecover_recur.up(j); + oq29_cropland(t,j,"upper") = q29_cropland.up(j); + oq29_avl_cropland(t,j,"upper") = q29_avl_cropland.up(j); + oq29_carbon(t,j,ag_pools,stockType,"upper") = q29_carbon.up(j,ag_pools,stockType); + oq29_land_snv(t,j,"upper") = q29_land_snv.up(j); + oq29_land_snv_trans(t,j,"upper") = q29_land_snv_trans.up(j); + oq29_cost_cropland(t,j,"upper") = q29_cost_cropland.up(j); + oq29_cost_treecover_est(t,j,"upper") = q29_cost_treecover_est.up(j); + oq29_cost_treecover_recur(t,j,"upper") = q29_cost_treecover_recur.up(j); + oq29_treecover_shr(t,j,"upper") = q29_treecover_shr.up(j); + oq29_treecover_est(t,j,ac,"upper") = q29_treecover_est.up(j,ac); + oq29_treecover_bv(t,j,potnatveg,"upper") = q29_treecover_bv.up(j,potnatveg); + ov_fallow(t,j,"lower") = vm_fallow.lo(j); + ov29_treecover(t,j,ac,"lower") = v29_treecover.lo(j,ac); + ov_cost_cropland(t,j,"lower") = vm_cost_cropland.lo(j); + ov29_cost_treecover_est(t,j,"lower") = v29_cost_treecover_est.lo(j); + ov29_cost_treecover_recur(t,j,"lower") = v29_cost_treecover_recur.lo(j); + oq29_cropland(t,j,"lower") = q29_cropland.lo(j); + oq29_avl_cropland(t,j,"lower") = q29_avl_cropland.lo(j); + oq29_carbon(t,j,ag_pools,stockType,"lower") = q29_carbon.lo(j,ag_pools,stockType); + oq29_land_snv(t,j,"lower") = q29_land_snv.lo(j); + oq29_land_snv_trans(t,j,"lower") = q29_land_snv_trans.lo(j); + oq29_cost_cropland(t,j,"lower") = q29_cost_cropland.lo(j); + oq29_cost_treecover_est(t,j,"lower") = q29_cost_treecover_est.lo(j); + oq29_cost_treecover_recur(t,j,"lower") = q29_cost_treecover_recur.lo(j); + oq29_treecover_shr(t,j,"lower") = q29_treecover_shr.lo(j); + oq29_treecover_est(t,j,ac,"lower") = q29_treecover_est.lo(j,ac); + oq29_treecover_bv(t,j,potnatveg,"lower") = q29_treecover_bv.lo(j,potnatveg); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + diff --git a/modules/29_cropland/rulebased/preloop.gms b/modules/29_cropland/rulebased_apr24/preloop.gms similarity index 75% rename from modules/29_cropland/rulebased/preloop.gms rename to modules/29_cropland/rulebased_apr24/preloop.gms index 391e38fe5a..3405958479 100644 --- a/modules/29_cropland/rulebased/preloop.gms +++ b/modules/29_cropland/rulebased_apr24/preloop.gms @@ -10,7 +10,6 @@ vm_fallow.fx(j) = 0; ** Trajectory for cropland scenarios * sigmoidal interpolation between start year and target year m_sigmoid_time_interpol(p29_snv_scenario_fader,s29_snv_scenario_start,s29_snv_scenario_target,0,1); -m_sigmoid_time_interpol(p29_rotation_scenario_fader,s29_rotation_scenario_start,s29_rotation_scenario_target,0,1); * linear interpolation to estimate the cropland that * requires relocation due to SNV policy @@ -26,7 +25,7 @@ m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,s29_snv_reloc m_sigmoid_time_interpol(p29_treecover_scenario_fader,s29_treecover_scenario_start,s29_treecover_scenario_target,0,1); -m_sigmoid_time_interpol(p29_betr_scenario_fader,s29_betr_scenario_start,s29_betr_scenario_target,0,1); + * Initial tree cover on cropland is assumed to be equally distributed among all age-classes pc29_treecover(j,ac) = 0; @@ -50,3 +49,15 @@ if(s29_treecover_bii_coeff = 0, elseif s29_treecover_bii_coeff = 1, p29_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff("timber",potnatveg) ); + + +****** Regional share of semi-natural vegetation (SNV) in cropland areas for selective countries: +* Country switch to determine countries for which a SNV policy shall be applied. +* In the default case, the SNV policy affects all countries when activated. +p29_country_dummy(iso) = 0; +p29_country_dummy(policy_countries29) = 1; +* Because MAgPIE is not run at country-level, but at region level, a region +* share is calculated that translates the countries' influence to regional level. +* Countries are weighted by available cropland area. +i29_avl_cropland_iso(iso) = f29_avl_cropland_iso(iso,"%c29_marginal_land%"); +p29_country_snv_weight(i) = sum(i_to_iso(i,iso), p29_country_dummy(iso) * i29_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i29_avl_cropland_iso(iso)); diff --git a/modules/29_cropland/rulebased/presolve.gms b/modules/29_cropland/rulebased_apr24/presolve.gms similarity index 67% rename from modules/29_cropland/rulebased/presolve.gms rename to modules/29_cropland/rulebased_apr24/presolve.gms index 8c36c85212..19a3b0a657 100644 --- a/modules/29_cropland/rulebased/presolve.gms +++ b/modules/29_cropland/rulebased_apr24/presolve.gms @@ -31,31 +31,31 @@ p29_avl_cropland(t,j) = f29_avl_cropland(j,"%c29_marginal_land%") * (1 - p29_snv * Growth of trees on cropland is modelled by shifting age-classes according to time step length. -s61_shift = m_timestep_length_forestry/5; -* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s61_shift = 1) - p61_treecover(t,j,ac)$(ord(ac) > s61_shift) = pc61_treecover(j,ac-s61_shift); -* account for cases at the end of the age class set (s61_shift > 1) which are not shifted by the above calculation - p61_treecover(t,j,"acx") = p61_treecover(t,j,"acx") - + sum(ac$(ord(ac) > card(ac)-s61_shift), pc61_treecover(j,ac)); - -pc61_treecover(j,ac) = p61_treecover(t,j,ac); -v61_treecover.l(j,ac) = p61_treecover(t,j,ac); - -if(m_year(t) <= s61_treecover_scenario_start, - v61_treecover.fx(j,ac) = pc61_treecover(j,ac); +s29_shift = m_timestep_length_forestry/5; +* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s29_shift = 1) + p29_treecover(t,j,ac)$(ord(ac) > s29_shift) = pc29_treecover(j,ac-s29_shift); +* account for cases at the end of the age class set (s29_shift > 1) which are not shifted by the above calculation + p29_treecover(t,j,"acx") = p29_treecover(t,j,"acx") + + sum(ac$(ord(ac) > card(ac)-s29_shift), pc29_treecover(j,ac)); + +pc29_treecover(j,ac) = p29_treecover(t,j,ac); +v29_treecover.l(j,ac) = p29_treecover(t,j,ac); + +if(m_year(t) <= s29_treecover_scenario_start, + v29_treecover.fx(j,ac) = pc29_treecover(j,ac); else - v61_treecover.lo(j,ac_est) = 0; - v61_treecover.up(j,ac_est) = Inf; - if(s61_treecover_decrease = 1, - v61_treecover.lo(j,ac_sub) = 0; - v61_treecover.up(j,ac_sub) = pc61_treecover(j,ac_sub); + v29_treecover.lo(j,ac_est) = 0; + v29_treecover.up(j,ac_est) = Inf; + if(s29_treecover_decrease = 1, + v29_treecover.lo(j,ac_sub) = 0; + v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); else - v61_treecover.fx(j,ac_sub) = pc61_treecover(j,ac_sub); + v29_treecover.fx(j,ac_sub) = pc29_treecover(j,ac_sub); ); ); -p61_treecover_min_shr(t,j) = - ((1-p61_treecover_scenario_fader(t)) * pm_treecover_shr(j)) + - (p61_treecover_scenario_fader(t) * s61_treecover_min_shr); +p29_treecover_min_shr(t,j) = + ((1-p29_treecover_scenario_fader(t)) * sum(ac, pc29_treecover(j,ac))/pcm_land(j,"crop"))$(pcm_land(j,"crop") > 1e-10) + + (p29_treecover_scenario_fader(t) * s29_treecover_min_shr); + -p61_betr_min_shr(t,j) = p61_betr_scenario_fader(t) * s61_betr_min_shr; diff --git a/modules/29_cropland/rulebased_apr24/realization.gms b/modules/29_cropland/rulebased_apr24/realization.gms new file mode 100644 index 0000000000..cec1ad89fc --- /dev/null +++ b/modules/29_cropland/rulebased_apr24/realization.gms @@ -0,0 +1,20 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @description todo + +*' @limitations todo + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/29_cropland/rulebased_apr24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/29_cropland/rulebased_apr24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/29_cropland/rulebased_apr24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/29_cropland/rulebased_apr24/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/29_cropland/rulebased_apr24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/29_cropland/rulebased_apr24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/29_cropland/rulebased_apr24/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/29_cropland/rulebased/sets.gms b/modules/29_cropland/rulebased_apr24/sets.gms similarity index 73% rename from modules/29_cropland/rulebased/sets.gms rename to modules/29_cropland/rulebased_apr24/sets.gms index a74b51c7de..e5d8286326 100644 --- a/modules/29_cropland/rulebased/sets.gms +++ b/modules/29_cropland/rulebased_apr24/sets.gms @@ -7,13 +7,13 @@ sets - marginal_land30 Marginal land scenarios + marginal_land29 Marginal land scenarios / all_marginal, q33_marginal, no_marginal / - policy_target30 Target year for cropland policy - / none, by2030, by2050 / + policy_target29 Target year for cropland policy + / none, by2029, by2050 / - relocation_target30 Cropland requiring relocation based on different SNV targets + relocation_target29 Cropland requiring relocation based on different SNV targets / SNV20TargetCropland, SNV50TargetCropland / ; diff --git a/modules/30_crop/endo_apr21/declarations.gms b/modules/30_crop/endo_apr21/declarations.gms index 07792a6246..fe0f504c4d 100644 --- a/modules/30_crop/endo_apr21/declarations.gms +++ b/modules/30_crop/endo_apr21/declarations.gms @@ -7,6 +7,8 @@ parameters p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) + p30_betr_scenario_fader(t_all) Bioenergy trees scenario fader (1) + p30_betr_min_shr(t,j) Minimum share of bioenergy trees on cropland (1) ; positive variables @@ -16,9 +18,10 @@ positive variables ; equations + q30_prod(j,kcr) Production of cropped products (mio. tDM) q30_rotation_max(j,crp30,w) Local maximum rotational constraints (mio. ha) q30_rotation_min(j,crp30,w) Local minimum rotational constraints (mio. ha) - q30_prod(j,kcr) Production of cropped products (mio. tDM) + q30_betr_shr(j) Bioenergy trees minimum share (mio. ha) q30_carbon(j,ag_pools) Croplarea above ground carbon content calculation (mio. tC) q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) @@ -26,19 +29,16 @@ equations *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_fallow(t,j,type) Fallow land (mio. ha) - ov_area(t,j,kcr,w,type) Agricultural production area (mio. ha) - ov_rotation_penalty(t,i,type) Penalty for violating rotational constraints (USD05MER) - oq30_cropland(t,j,type) Total cropland calculation (mio. ha) - oq30_avl_cropland(t,j,type) Available cropland constraint (mio. ha) - oq30_rotation_max(t,j,crp30,w,type) Local maximum rotational constraints (mio. ha) - oq30_rotation_min(t,j,crp30,w,type) Local minimum rotational constraints (mio. ha) - oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) - oq30_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) - oq30_bv_ann(t,j,potnatveg,type) Biodiversity value of annual cropland (mio. ha) - oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (mio. ha) - oq30_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) - oq30_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) + ov_area(t,j,kcr,w,type) Agricultural production area (mio. ha) + ov_rotation_penalty(t,i,type) Penalty for violating rotational constraints (USD05MER) + ov_carbon_stock_croparea(t,j,ag_pools,type) Carbon stock in croparea (tC) + oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) + oq30_rotation_max(t,j,crp30,w,type) Local maximum rotational constraints (mio. ha) + oq30_rotation_min(t,j,crp30,w,type) Local minimum rotational constraints (mio. ha) + oq30_betr_shr(t,j,type) Bioenergy trees minimum share (mio. ha) + oq30_carbon(t,j,ag_pools,type) Croplarea above ground carbon content calculation (mio. tC) + oq30_bv_ann(t,j,potnatveg,type) Biodiversity value of annual cropland (mio. ha) + oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (mio. ha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/30_crop/endo_apr21/equations.gms b/modules/30_crop/endo_apr21/equations.gms index ad815cdec0..abb8d23f5e 100644 --- a/modules/30_crop/endo_apr21/equations.gms +++ b/modules/30_crop/endo_apr21/equations.gms @@ -33,7 +33,8 @@ sum(kcr, vm_area(j2,kcr,w)) * f30_rotation_min_shr(crpmin30); -*' Bioenergy tree minimum share +*' Bioenergy tree minimum share on cropland + q30_betr_shr(j2) .. sum(w, vm_area(j2,"betr",w)) =g= sum(ct, p30_betr_min_shr(ct,j2)) * vm_land(j2,"crop"); diff --git a/modules/30_crop/endo_apr21/input.gms b/modules/30_crop/endo_apr21/input.gms index 2ccc267364..1ae154a2a6 100644 --- a/modules/30_crop/endo_apr21/input.gms +++ b/modules/30_crop/endo_apr21/input.gms @@ -11,56 +11,15 @@ $setglobal c30_bioen_type all $setglobal c30_bioen_water rainfed * options: rainfed, irrigated, all -$setglobal c30_marginal_land q33_marginal -* options: all_marginal, q33_marginal, no_marginal - -$setglobal c30_snv_target none -* options: none, by2030, by2020 - $setglobal c30_rotation_constraints on *options: on, off scalars -s30_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / -s30_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / -s30_snv_scenario_start SNV scenario start year / 2020 / -s30_snv_scenario_target SNV scenario target year / 2030 / -s30_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / -s30_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / -s30_rotation_scenario_start Rotation scenario start year / 2020 / -s30_rotation_scenario_target Rotation scenario target year / 2050 / -; - -* Set-switch for countries affected by regional SNV policy -* Default: all iso countries selected -sets - policy_countries30(iso) countries to be affected by SNV policy / ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, - ASM,ATA,ATF,ATG,AUS,AUT,AZE,BDI,BEL,BEN, - BES,BFA,BGD,BGR,BHR,BHS,BIH,BLM,BLR,BLZ, - BMU,BOL,BRA,BRB,BRN,BTN,BVT,BWA,CAF,CAN, - CCK,CHN,CHE,CHL,CIV,CMR,COD,COG,COK,COL, - COM,CPV,CRI,CUB,CUW,CXR,CYM,CYP,CZE,DEU, - DJI,DMA,DNK,DOM,DZA,ECU,EGY,ERI,ESH,ESP, - EST,ETH,FIN,FJI,FLK,FRA,FRO,FSM,GAB,GBR, - GEO,GGY,GHA,GIB,GIN,GLP,GMB,GNB,GNQ,GRC, - GRD,GRL,GTM,GUF,GUM,GUY,HKG,HMD,HND,HRV, - HTI,HUN,IDN,IMN,IND,IOT,IRL,IRN,IRQ,ISL, - ISR,ITA,JAM,JEY,JOR,JPN,KAZ,KEN,KGZ,KHM, - KIR,KNA,KOR,KWT,LAO,LBN,LBR,LBY,LCA,LIE, - LKA,LSO,LTU,LUX,LVA,MAC,MAF,MAR,MCO,MDA, - MDG,MDV,MEX,MHL,MKD,MLI,MLT,MMR,MNE,MNG, - MNP,MOZ,MRT,MSR,MTQ,MUS,MWI,MYS,MYT,NAM, - NCL,NER,NFK,NGA,NIC,NIU,NLD,NOR,NPL,NRU, - NZL,OMN,PAK,PAN,PCN,PER,PHL,PLW,PNG,POL, - PRI,PRK,PRT,PRY,PSE,PYF,QAT,REU,ROU,RUS, - RWA,SAU,SDN,SEN,SGP,SGS,SHN,SJM,SLB,SLE, - SLV,SMR,SOM,SPM,SRB,SSD,STP,SUR,SVK,SVN, - SWE,SWZ,SXM,SYC,SYR,TCA,TCD,TGO,THA,TJK, - TKL,TKM,TLS,TON,TTO,TUN,TUR,TUV,TWN,TZA, - UGA,UKR,UMI,URY,USA,UZB,VAT,VCT,VEN,VGB, - VIR,VNM,VUT,WLF,WSM,YEM,ZAF,ZMB,ZWE / - -land_snv(land) land types allowed in the SNV policy / secdforest, forestry, past, other / + s30_rotation_scenario_start Rotation scenario start year / 2020 / + s30_rotation_scenario_target Rotation scenario target year / 2050 / + s30_betr_min_shr Minimum share of bioenergy trees on cropland (1) / 0 / + s30_betr_scenario_start Bioenergy trees scenario start year / 2020 / + s30_betr_scenario_target Bioenergy trees scenario target year / 2050 / ; $ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes; diff --git a/modules/30_crop/endo_apr21/input/files b/modules/30_crop/endo_apr21/input/files index d0cfbda228..f87525bfbd 100644 --- a/modules/30_crop/endo_apr21/input/files +++ b/modules/30_crop/endo_apr21/input/files @@ -1,9 +1,4 @@ * list of files that are required here f30_rotation_max.csv f30_rotation_min.csv -avl_cropland.cs3 -avl_cropland_0.5.mz f30_croparea_w_initialisation.cs3 -avl_cropland_iso.cs3 -SNVTargetCropland.cs3 -SNVTargetCropland_0.5.mz diff --git a/modules/30_crop/endo_apr21/postsolve.gms b/modules/30_crop/endo_apr21/postsolve.gms index c423e44bba..99044317e0 100644 --- a/modules/30_crop/endo_apr21/postsolve.gms +++ b/modules/30_crop/endo_apr21/postsolve.gms @@ -7,56 +7,44 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_fallow(t,j,"marginal") = vm_fallow.m(j); - ov_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w); - ov_rotation_penalty(t,i,"marginal") = vm_rotation_penalty.m(i); - oq30_cropland(t,j,"marginal") = q30_cropland.m(j); - oq30_avl_cropland(t,j,"marginal") = q30_avl_cropland.m(j); - oq30_rotation_max(t,j,crp30,w,"marginal") = q30_rotation_max.m(j,crp30,w); - oq30_rotation_min(t,j,crp30,w,"marginal") = q30_rotation_min.m(j,crp30,w); - oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); - oq30_carbon(t,j,ag_pools,stockType,"marginal") = q30_carbon.m(j,ag_pools,stockType); - oq30_bv_ann(t,j,potnatveg,"marginal") = q30_bv_ann.m(j,potnatveg); - oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg); - oq30_land_snv(t,j,"marginal") = q30_land_snv.m(j); - oq30_land_snv_trans(t,j,"marginal") = q30_land_snv_trans.m(j); - ov_fallow(t,j,"level") = vm_fallow.l(j); - ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); - ov_rotation_penalty(t,i,"level") = vm_rotation_penalty.l(i); - oq30_cropland(t,j,"level") = q30_cropland.l(j); - oq30_avl_cropland(t,j,"level") = q30_avl_cropland.l(j); - oq30_rotation_max(t,j,crp30,w,"level") = q30_rotation_max.l(j,crp30,w); - oq30_rotation_min(t,j,crp30,w,"level") = q30_rotation_min.l(j,crp30,w); - oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); - oq30_carbon(t,j,ag_pools,stockType,"level") = q30_carbon.l(j,ag_pools,stockType); - oq30_bv_ann(t,j,potnatveg,"level") = q30_bv_ann.l(j,potnatveg); - oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg); - oq30_land_snv(t,j,"level") = q30_land_snv.l(j); - oq30_land_snv_trans(t,j,"level") = q30_land_snv_trans.l(j); - ov_fallow(t,j,"upper") = vm_fallow.up(j); - ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); - ov_rotation_penalty(t,i,"upper") = vm_rotation_penalty.up(i); - oq30_cropland(t,j,"upper") = q30_cropland.up(j); - oq30_avl_cropland(t,j,"upper") = q30_avl_cropland.up(j); - oq30_rotation_max(t,j,crp30,w,"upper") = q30_rotation_max.up(j,crp30,w); - oq30_rotation_min(t,j,crp30,w,"upper") = q30_rotation_min.up(j,crp30,w); - oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); - oq30_carbon(t,j,ag_pools,stockType,"upper") = q30_carbon.up(j,ag_pools,stockType); - oq30_bv_ann(t,j,potnatveg,"upper") = q30_bv_ann.up(j,potnatveg); - oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg); - oq30_land_snv(t,j,"upper") = q30_land_snv.up(j); - oq30_land_snv_trans(t,j,"upper") = q30_land_snv_trans.up(j); - ov_fallow(t,j,"lower") = vm_fallow.lo(j); - ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); - ov_rotation_penalty(t,i,"lower") = vm_rotation_penalty.lo(i); - oq30_cropland(t,j,"lower") = q30_cropland.lo(j); - oq30_avl_cropland(t,j,"lower") = q30_avl_cropland.lo(j); - oq30_rotation_max(t,j,crp30,w,"lower") = q30_rotation_max.lo(j,crp30,w); - oq30_rotation_min(t,j,crp30,w,"lower") = q30_rotation_min.lo(j,crp30,w); - oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); - oq30_carbon(t,j,ag_pools,stockType,"lower") = q30_carbon.lo(j,ag_pools,stockType); - oq30_bv_ann(t,j,potnatveg,"lower") = q30_bv_ann.lo(j,potnatveg); - oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg); - oq30_land_snv(t,j,"lower") = q30_land_snv.lo(j); - oq30_land_snv_trans(t,j,"lower") = q30_land_snv_trans.lo(j); + ov_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w); + ov_rotation_penalty(t,i,"marginal") = vm_rotation_penalty.m(i); + ov_carbon_stock_croparea(t,j,ag_pools,"marginal") = vm_carbon_stock_croparea.m(j,ag_pools); + oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); + oq30_rotation_max(t,j,crp30,w,"marginal") = q30_rotation_max.m(j,crp30,w); + oq30_rotation_min(t,j,crp30,w,"marginal") = q30_rotation_min.m(j,crp30,w); + oq30_betr_shr(t,j,"marginal") = q30_betr_shr.m(j); + oq30_carbon(t,j,ag_pools,"marginal") = q30_carbon.m(j,ag_pools); + oq30_bv_ann(t,j,potnatveg,"marginal") = q30_bv_ann.m(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg); + ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); + ov_rotation_penalty(t,i,"level") = vm_rotation_penalty.l(i); + ov_carbon_stock_croparea(t,j,ag_pools,"level") = vm_carbon_stock_croparea.l(j,ag_pools); + oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); + oq30_rotation_max(t,j,crp30,w,"level") = q30_rotation_max.l(j,crp30,w); + oq30_rotation_min(t,j,crp30,w,"level") = q30_rotation_min.l(j,crp30,w); + oq30_betr_shr(t,j,"level") = q30_betr_shr.l(j); + oq30_carbon(t,j,ag_pools,"level") = q30_carbon.l(j,ag_pools); + oq30_bv_ann(t,j,potnatveg,"level") = q30_bv_ann.l(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg); + ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); + ov_rotation_penalty(t,i,"upper") = vm_rotation_penalty.up(i); + ov_carbon_stock_croparea(t,j,ag_pools,"upper") = vm_carbon_stock_croparea.up(j,ag_pools); + oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); + oq30_rotation_max(t,j,crp30,w,"upper") = q30_rotation_max.up(j,crp30,w); + oq30_rotation_min(t,j,crp30,w,"upper") = q30_rotation_min.up(j,crp30,w); + oq30_betr_shr(t,j,"upper") = q30_betr_shr.up(j); + oq30_carbon(t,j,ag_pools,"upper") = q30_carbon.up(j,ag_pools); + oq30_bv_ann(t,j,potnatveg,"upper") = q30_bv_ann.up(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg); + ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); + ov_rotation_penalty(t,i,"lower") = vm_rotation_penalty.lo(i); + ov_carbon_stock_croparea(t,j,ag_pools,"lower") = vm_carbon_stock_croparea.lo(j,ag_pools); + oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); + oq30_rotation_max(t,j,crp30,w,"lower") = q30_rotation_max.lo(j,crp30,w); + oq30_rotation_min(t,j,crp30,w,"lower") = q30_rotation_min.lo(j,crp30,w); + oq30_betr_shr(t,j,"lower") = q30_betr_shr.lo(j); + oq30_carbon(t,j,ag_pools,"lower") = q30_carbon.lo(j,ag_pools); + oq30_bv_ann(t,j,potnatveg,"lower") = q30_bv_ann.lo(j,potnatveg); + oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/30_crop/endo_apr21/preloop.gms b/modules/30_crop/endo_apr21/preloop.gms index e4b01bc732..a837359f18 100644 --- a/modules/30_crop/endo_apr21/preloop.gms +++ b/modules/30_crop/endo_apr21/preloop.gms @@ -8,19 +8,10 @@ ** Trajectory for cropland scenarios * sigmoidal interpolation between start year and target year m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); +m_sigmoid_time_interpol(p30_betr_scenario_fader,s30_betr_scenario_start,s30_betr_scenario_target,0,1); *due to some rounding errors the input data currently may contain in some cases *very small, negative numbers. These numbers have to be set to 0 as area *cannot be smaller than 0! fm_croparea(t_past,j,w,kcr)$(fm_croparea(t_past,j,w,kcr)<0) = 0; -****** Regional share of semi-natural vegetation (SNV) in cropland areas for selective countries: -* Country switch to determine countries for which a SNV policy shall be applied. -* In the default case, the SNV policy affects all countries when activated. -p30_country_dummy(iso) = 0; -p30_country_dummy(policy_countries30) = 1; -* Because MAgPIE is not run at country-level, but at region level, a region -* share is calculated that translates the countries' influence to regional level. -* Countries are weighted by available cropland area. -i30_avl_cropland_iso(iso) = f30_avl_cropland_iso(iso,"%c30_marginal_land%"); -p30_country_snv_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * i30_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i30_avl_cropland_iso(iso)); diff --git a/modules/30_crop/endo_apr21/presolve.gms b/modules/30_crop/endo_apr21/presolve.gms index 942042b0e9..57661d9303 100644 --- a/modules/30_crop/endo_apr21/presolve.gms +++ b/modules/30_crop/endo_apr21/presolve.gms @@ -25,3 +25,5 @@ vm_rotation_penalty.fx(i)=0; crpmax30(crp30) = yes$(f30_rotation_max_shr(crp30) < 1); crpmin30(crp30) = yes$(f30_rotation_min_shr(crp30) > 0); + +p30_betr_min_shr(t,j) = p30_betr_scenario_fader(t) * s30_betr_min_shr; diff --git a/modules/30_crop/penalty_apr22/declarations.gms b/modules/30_crop/penalty_apr22/declarations.gms index 6c6ce00698..2d3d2eeebe 100644 --- a/modules/30_crop/penalty_apr22/declarations.gms +++ b/modules/30_crop/penalty_apr22/declarations.gms @@ -13,40 +13,37 @@ parameters positive variables vm_area(j,kcr,w) Agricultural production area (mio. ha) vm_rotation_penalty(i) Penalty for violating rotational constraints (mio. USD05MER) + vm_carbon_stock_croparea(j,ag_pools) Carbon stock in croparea (tC) v30_penalty_max_irrig(j,rotamax30) Penalty for violating max rotational constraints on irrigated land (mio. USD05MER) - v30_penalty(j,rota30) Penalty for violating rotational constraints (mio. USD05MER) + v30_penalty(j,rota30) Penalty for violating rotational constraints (mio. USD05MER) ; equations + q30_prod(j,kcr) Production of cropped products (mio. tDM) q30_rotation_penalty(i) Total penalty for rotational constraint violations (mio. USD05MER) q30_rotation_max(j,rotamax30) Local maximum rotational constraints (mio. ha) q30_rotation_min(j,rotamin30) Local minimum rotational constraints (mio. ha) q30_rotation_max_irrig(j,rotamax30) Local maximum rotational constraints (mio. ha) - q30_prod(j,kcr) Production of cropped products (mio. tDM) - q30_carbon(j,ag_pools) Croparea above ground carbon content calculation (mio. tC) + q30_carbon(j,ag_pools) Croplarea above ground carbon content calculation (mio. tC) q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_fallow(t,j,type) Fallow land (mio. ha) ov_area(t,j,kcr,w,type) Agricultural production area (mio. ha) ov_rotation_penalty(t,i,type) Penalty for violating rotational constraints (mio. USD05MER) + ov_carbon_stock_croparea(t,j,ag_pools,type) Carbon stock in croparea (tC) ov30_penalty_max_irrig(t,j,rotamax30,type) Penalty for violating max rotational constraints on irrigated land (mio. USD05MER) ov30_penalty(t,j,rota30,type) Penalty for violating rotational constraints (mio. USD05MER) - oq30_cropland(t,j,type) Total cropland calculation (mio. ha) - oq30_avl_cropland(t,j,type) Available cropland constraint (mio. ha) + oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) oq30_rotation_penalty(t,i,type) Total penalty for rotational constraint violations (mio. USD05MER) oq30_rotation_max(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) oq30_rotation_min(t,j,rotamin30,type) Local minimum rotational constraints (mio. ha) oq30_rotation_max_irrig(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) - oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) - oq30_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) + oq30_carbon(t,j,ag_pools,type) Croplarea above ground carbon content calculation (mio. tC) oq30_bv_ann(t,j,potnatveg,type) Biodiversity value of annual cropland (mio. ha) oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (mio. ha) - oq30_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) - oq30_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/30_crop/penalty_apr22/equations.gms b/modules/30_crop/penalty_apr22/equations.gms index 669ed0fa84..a44fe1e809 100644 --- a/modules/30_crop/penalty_apr22/equations.gms +++ b/modules/30_crop/penalty_apr22/equations.gms @@ -14,6 +14,7 @@ q30_prod(j2,kcr) .. vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); + *' Rotational constraints prevent over-specialization. In this module realization, *' they are implemented via a penalty payment if the constraints are violated. @@ -25,6 +26,7 @@ q30_rotation_penalty(i2) .. + sum(rotamax_red30, v30_penalty_max_irrig(j2,rotamax_red30) * sum(ct, i30_rotation_incentives(ct,rotamax_red30))) ); + *' The penalty applies to the areas which exceed a certain maximum *' share of the land. Below this share, negative benefits are *' avoided by defining the penalty to be positive. @@ -35,6 +37,7 @@ q30_rotation_penalty(i2) .. sum((rota_kcr30(rotamax_red30,kcr),w),vm_area(j2,kcr,w)) - vm_land(j2,"crop") * f30_rotation_rules(rotamax_red30); + *' Minimum constraints apply penalties when a certain mimimum *' share of a group is not achieved. This is used to guarantee a minimum *' crop group diversity withing cells. @@ -45,6 +48,7 @@ q30_rotation_penalty(i2) .. vm_land(j2,"crop") * f30_rotation_rules(rotamin_red30) - sum((rota_kcr30(rotamin_red30,kcr),w), vm_area(j2,kcr,w)); + *' The following maximum constraint avoids over-specialization in irrigated systems. *' No minimum constraint is included for irrigated areas for computational *' reasons. Minimum constraints just need to be met on total areas. @@ -55,21 +59,21 @@ q30_rotation_penalty(i2) .. sum((rota_kcr30(rotamax_red30,kcr)), vm_area(j2,kcr,"irrigated")) - vm_AEI(j2) * f30_rotation_rules(rotamax_red30); + *' The carbon stocks of the above ground carbon pools are calculated based on croparea and related carbon density. q30_carbon(j2,ag_pools) .. vm_carbon_stock_croparea(j2,ag_pools) =e= sum((kcr,w), vm_area(j2,kcr,w)) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)); + *' The biodiversity value for cropland is calculated separately for annual and perennial crops: + q30_bv_ann(j2,potnatveg) .. vm_bv(j2,"crop_ann",potnatveg) =e= sum((crop_ann30,w), vm_area(j2,crop_ann30,w)) * fm_bii_coeff("crop_ann",potnatveg) * fm_luh2_side_layers(j2,potnatveg); -*' perennial crops are calculated as difference, as they shall also include fallow land - q30_bv_per(j2,potnatveg) .. - vm_bv(j2,"crop_per",potnatveg) - =e= - (vm_land(j2,"crop") - sum((crop_ann30,w), vm_area(j2,crop_ann30,w))) - * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + q30_bv_per(j2,potnatveg) .. vm_bv(j2,"crop_per",potnatveg) + =e= + sum((crop_per30,w), vm_area(j2,crop_per30,w)) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/30_crop/penalty_apr22/input.gms b/modules/30_crop/penalty_apr22/input.gms index e2f9c2fbac..91befb168a 100644 --- a/modules/30_crop/penalty_apr22/input.gms +++ b/modules/30_crop/penalty_apr22/input.gms @@ -11,12 +11,6 @@ $setglobal c30_bioen_type all $setglobal c30_bioen_water rainfed * options: rainfed, irrigated, all -$setglobal c30_marginal_land q33_marginal -* options: all_marginal, q33_marginal, no_marginal - -$setglobal c30_snv_target none -* options: none, by2030, by2020 - $setglobal c30_rotation_constraints on *options: on, off @@ -27,47 +21,10 @@ $setglobal c30_rotation_scenario_speed by2050 * options: none, by2030, by2020 scalars -s30_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / -s30_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / -s30_snv_scenario_start SNV scenario start year / 2020 / -s30_snv_scenario_target SNV scenario target year / 2030 / -s30_rotation_scenario_start Rotation scenario start year / 2020 / -s30_rotation_scenario_target Rotation scenario target year / 2050 / -s30_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / -s30_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / + s30_rotation_scenario_start Rotation scenario start year / 2020 / + s30_rotation_scenario_target Rotation scenario target year / 2050 / ; -* Set-switch for countries affected by regional SNV policy -* Default: all iso countries selected -sets - policy_countries30(iso) countries to be affected by SNV policy / ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, - ASM,ATA,ATF,ATG,AUS,AUT,AZE,BDI,BEL,BEN, - BES,BFA,BGD,BGR,BHR,BHS,BIH,BLM,BLR,BLZ, - BMU,BOL,BRA,BRB,BRN,BTN,BVT,BWA,CAF,CAN, - CCK,CHN,CHE,CHL,CIV,CMR,COD,COG,COK,COL, - COM,CPV,CRI,CUB,CUW,CXR,CYM,CYP,CZE,DEU, - DJI,DMA,DNK,DOM,DZA,ECU,EGY,ERI,ESH,ESP, - EST,ETH,FIN,FJI,FLK,FRA,FRO,FSM,GAB,GBR, - GEO,GGY,GHA,GIB,GIN,GLP,GMB,GNB,GNQ,GRC, - GRD,GRL,GTM,GUF,GUM,GUY,HKG,HMD,HND,HRV, - HTI,HUN,IDN,IMN,IND,IOT,IRL,IRN,IRQ,ISL, - ISR,ITA,JAM,JEY,JOR,JPN,KAZ,KEN,KGZ,KHM, - KIR,KNA,KOR,KWT,LAO,LBN,LBR,LBY,LCA,LIE, - LKA,LSO,LTU,LUX,LVA,MAC,MAF,MAR,MCO,MDA, - MDG,MDV,MEX,MHL,MKD,MLI,MLT,MMR,MNE,MNG, - MNP,MOZ,MRT,MSR,MTQ,MUS,MWI,MYS,MYT,NAM, - NCL,NER,NFK,NGA,NIC,NIU,NLD,NOR,NPL,NRU, - NZL,OMN,PAK,PAN,PCN,PER,PHL,PLW,PNG,POL, - PRI,PRK,PRT,PRY,PSE,PYF,QAT,REU,ROU,RUS, - RWA,SAU,SDN,SEN,SGP,SGS,SHN,SJM,SLB,SLE, - SLV,SMR,SOM,SPM,SRB,SSD,STP,SUR,SVK,SVN, - SWE,SWZ,SXM,SYC,SYR,TCA,TCD,TGO,THA,TJK, - TKL,TKM,TLS,TON,TTO,TUN,TUR,TUV,TWN,TZA, - UGA,UKR,UMI,URY,USA,UZB,VAT,VCT,VEN,VGB, - VIR,VNM,VUT,WLF,WSM,YEM,ZAF,ZMB,ZWE / - -land_snv(land) land types allowed in the SNV policy / secdforest, forestry, past, other / -; $ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes; $else bioen_type_30("%c30_bioen_type%") = yes; @@ -102,25 +59,3 @@ $offdelim / ; - -********* AVAILABLE CROPLAND ******************************************* - -table f30_avl_cropland(j,marginal_land30) Available land area for cropland (mio. ha) -$ondelim -$include "./modules/30_crop/penalty_apr22/input/avl_cropland.cs3" -$offdelim -; - -table f30_avl_cropland_iso(iso,marginal_land30) Available land area for cropland at ISO level (mio. ha) -$ondelim -$include "./modules/30_crop/penalty_apr22/input/avl_cropland_iso.cs3" -$offdelim -; - -********* SNV TARGET CROPLAND ******************************************* - -table f30_snv_target_cropland(j,relocation_target30) Cropland in 2019 requiring relocation due to SNV policy (mio. ha) -$ondelim -$include "./modules/30_crop/penalty_apr22/input/SNVTargetCropland.cs3" -$offdelim -; diff --git a/modules/30_crop/penalty_apr22/input/files b/modules/30_crop/penalty_apr22/input/files index b1795d1c21..5f3d3ac1e2 100644 --- a/modules/30_crop/penalty_apr22/input/files +++ b/modules/30_crop/penalty_apr22/input/files @@ -1,9 +1,4 @@ * list of files that are required here f30_rotation_incentives.csv f30_rotation_rules.csv -avl_cropland.cs3 -avl_cropland_0.5.mz f30_croparea_w_initialisation.cs3 -avl_cropland_iso.cs3 -SNVTargetCropland.cs3 -SNVTargetCropland_0.5.mz diff --git a/modules/30_crop/penalty_apr22/postsolve.gms b/modules/30_crop/penalty_apr22/postsolve.gms index 9b690da029..84a11fd02a 100644 --- a/modules/30_crop/penalty_apr22/postsolve.gms +++ b/modules/30_crop/penalty_apr22/postsolve.gms @@ -7,72 +7,56 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_fallow(t,j,"marginal") = vm_fallow.m(j); ov_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w); ov_rotation_penalty(t,i,"marginal") = vm_rotation_penalty.m(i); + ov_carbon_stock_croparea(t,j,ag_pools,"marginal") = vm_carbon_stock_croparea.m(j,ag_pools); ov30_penalty_max_irrig(t,j,rotamax30,"marginal") = v30_penalty_max_irrig.m(j,rotamax30); ov30_penalty(t,j,rota30,"marginal") = v30_penalty.m(j,rota30); - oq30_cropland(t,j,"marginal") = q30_cropland.m(j); - oq30_avl_cropland(t,j,"marginal") = q30_avl_cropland.m(j); + oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); oq30_rotation_penalty(t,i,"marginal") = q30_rotation_penalty.m(i); oq30_rotation_max(t,j,rotamax30,"marginal") = q30_rotation_max.m(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"marginal") = q30_rotation_min.m(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"marginal") = q30_rotation_max_irrig.m(j,rotamax30); - oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); - oq30_carbon(t,j,ag_pools,stockType,"marginal") = q30_carbon.m(j,ag_pools,stockType); + oq30_carbon(t,j,ag_pools,"marginal") = q30_carbon.m(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"marginal") = q30_bv_ann.m(j,potnatveg); oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg); - oq30_land_snv(t,j,"marginal") = q30_land_snv.m(j); - oq30_land_snv_trans(t,j,"marginal") = q30_land_snv_trans.m(j); - ov_fallow(t,j,"level") = vm_fallow.l(j); ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); ov_rotation_penalty(t,i,"level") = vm_rotation_penalty.l(i); + ov_carbon_stock_croparea(t,j,ag_pools,"level") = vm_carbon_stock_croparea.l(j,ag_pools); ov30_penalty_max_irrig(t,j,rotamax30,"level") = v30_penalty_max_irrig.l(j,rotamax30); ov30_penalty(t,j,rota30,"level") = v30_penalty.l(j,rota30); - oq30_cropland(t,j,"level") = q30_cropland.l(j); - oq30_avl_cropland(t,j,"level") = q30_avl_cropland.l(j); + oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); oq30_rotation_penalty(t,i,"level") = q30_rotation_penalty.l(i); oq30_rotation_max(t,j,rotamax30,"level") = q30_rotation_max.l(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"level") = q30_rotation_min.l(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"level") = q30_rotation_max_irrig.l(j,rotamax30); - oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); - oq30_carbon(t,j,ag_pools,stockType,"level") = q30_carbon.l(j,ag_pools,stockType); + oq30_carbon(t,j,ag_pools,"level") = q30_carbon.l(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"level") = q30_bv_ann.l(j,potnatveg); oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg); - oq30_land_snv(t,j,"level") = q30_land_snv.l(j); - oq30_land_snv_trans(t,j,"level") = q30_land_snv_trans.l(j); - ov_fallow(t,j,"upper") = vm_fallow.up(j); ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); ov_rotation_penalty(t,i,"upper") = vm_rotation_penalty.up(i); + ov_carbon_stock_croparea(t,j,ag_pools,"upper") = vm_carbon_stock_croparea.up(j,ag_pools); ov30_penalty_max_irrig(t,j,rotamax30,"upper") = v30_penalty_max_irrig.up(j,rotamax30); ov30_penalty(t,j,rota30,"upper") = v30_penalty.up(j,rota30); - oq30_cropland(t,j,"upper") = q30_cropland.up(j); - oq30_avl_cropland(t,j,"upper") = q30_avl_cropland.up(j); + oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); oq30_rotation_penalty(t,i,"upper") = q30_rotation_penalty.up(i); oq30_rotation_max(t,j,rotamax30,"upper") = q30_rotation_max.up(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"upper") = q30_rotation_min.up(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"upper") = q30_rotation_max_irrig.up(j,rotamax30); - oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); - oq30_carbon(t,j,ag_pools,stockType,"upper") = q30_carbon.up(j,ag_pools,stockType); + oq30_carbon(t,j,ag_pools,"upper") = q30_carbon.up(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"upper") = q30_bv_ann.up(j,potnatveg); oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg); - oq30_land_snv(t,j,"upper") = q30_land_snv.up(j); - oq30_land_snv_trans(t,j,"upper") = q30_land_snv_trans.up(j); - ov_fallow(t,j,"lower") = vm_fallow.lo(j); ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); ov_rotation_penalty(t,i,"lower") = vm_rotation_penalty.lo(i); + ov_carbon_stock_croparea(t,j,ag_pools,"lower") = vm_carbon_stock_croparea.lo(j,ag_pools); ov30_penalty_max_irrig(t,j,rotamax30,"lower") = v30_penalty_max_irrig.lo(j,rotamax30); ov30_penalty(t,j,rota30,"lower") = v30_penalty.lo(j,rota30); - oq30_cropland(t,j,"lower") = q30_cropland.lo(j); - oq30_avl_cropland(t,j,"lower") = q30_avl_cropland.lo(j); + oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); oq30_rotation_penalty(t,i,"lower") = q30_rotation_penalty.lo(i); oq30_rotation_max(t,j,rotamax30,"lower") = q30_rotation_max.lo(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"lower") = q30_rotation_min.lo(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"lower") = q30_rotation_max_irrig.lo(j,rotamax30); - oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); - oq30_carbon(t,j,ag_pools,stockType,"lower") = q30_carbon.lo(j,ag_pools,stockType); + oq30_carbon(t,j,ag_pools,"lower") = q30_carbon.lo(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"lower") = q30_bv_ann.lo(j,potnatveg); oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg); - oq30_land_snv(t,j,"lower") = q30_land_snv.lo(j); - oq30_land_snv_trans(t,j,"lower") = q30_land_snv_trans.lo(j); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/30_crop/penalty_apr22/preloop.gms b/modules/30_crop/penalty_apr22/preloop.gms index d628775aff..075f0c5e82 100644 --- a/modules/30_crop/penalty_apr22/preloop.gms +++ b/modules/30_crop/penalty_apr22/preloop.gms @@ -19,14 +19,3 @@ i30_rotation_incentives(t_all,rota30)= *very small, negative numbers. These numbers have to be set to 0 as area *cannot be smaller than 0! fm_croparea(t_past,j,w,kcr)$(fm_croparea(t_past,j,w,kcr)<0) = 0; - -****** Regional share of semi-natural vegetation (SNV) in cropland areas for selective countries: -* Country switch to determine countries for which a SNV policy shall be applied. -* In the default case, the SNV policy affects all countries when activated. -p30_country_dummy(iso) = 0; -p30_country_dummy(policy_countries30) = 1; -* Because MAgPIE is not run at country-level, but at region level, a region -* share is calculated that translates the countries' influence to regional level. -* Countries are weighted by available cropland area. -i30_avl_cropland_iso(iso) = f30_avl_cropland_iso(iso,"%c30_marginal_land%"); -p30_country_snv_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * i30_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i30_avl_cropland_iso(iso)); diff --git a/modules/30_crop/rotation_apr22/declarations.gms b/modules/30_crop/rotation_apr22/declarations.gms index 93e3da8bfb..21611b7eb4 100644 --- a/modules/30_crop/rotation_apr22/declarations.gms +++ b/modules/30_crop/rotation_apr22/declarations.gms @@ -9,18 +9,22 @@ parameters i30_rotation_max_shr(t_all,rotamax30) Maximum share of a certain crop group on cropland (ha per ha) i30_rotation_min_shr(t_all,rotamin30) Minimum share of a certain crop group on cropland (ha per ha) p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) + p30_betr_scenario_fader(t_all) Bioenergy trees scenario fader (1) + p30_betr_min_shr(t,j) Minimum share of bioenergy trees on cropland (1) ; positive variables vm_area(j,kcr,w) Agricultural production area (mio. ha) vm_rotation_penalty(i) Penalty for violating rotational constraints (USD05MER) + vm_carbon_stock_croparea(j,ag_pools) Carbon stock in croparea (tC) ; equations + q30_prod(j,kcr) Production of cropped products (mio. tDM) q30_rotation_max(j,rotamax30) Local maximum rotational constraints (mio. ha) q30_rotation_min(j,rotamin30) Local minimum rotational constraints (mio. ha) q30_rotation_max_irrig(j,rotamax30) Local maximum rotational constraints (mio. ha) - q30_prod(j,kcr) Production of cropped products (mio. tDM) + q30_betr_shr(j) Bioenergy trees minimum share (mio. ha) q30_carbon(j,ag_pools) Croplarea above ground carbon content calculation (mio. tC) q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) @@ -28,20 +32,17 @@ equations *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_fallow(t,j,type) Fallow land (mio. ha) ov_area(t,j,kcr,w,type) Agricultural production area (mio. ha) ov_rotation_penalty(t,i,type) Penalty for violating rotational constraints (USD05MER) - oq30_cropland(t,j,type) Total cropland calculation (mio. ha) - oq30_avl_cropland(t,j,type) Available cropland constraint (mio. ha) + ov_carbon_stock_croparea(t,j,ag_pools,type) Carbon stock in croparea (tC) + oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) oq30_rotation_max(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) oq30_rotation_min(t,j,rotamin30,type) Local minimum rotational constraints (mio. ha) oq30_rotation_max_irrig(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) - oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) - oq30_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) + oq30_betr_shr(t,j,type) Bioenergy trees minimum share (mio. ha) + oq30_carbon(t,j,ag_pools,type) Croplarea above ground carbon content calculation (mio. tC) oq30_bv_ann(t,j,potnatveg,type) Biodiversity value of annual cropland (mio. ha) oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (mio. ha) - oq30_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) - oq30_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/30_crop/rotation_apr22/equations.gms b/modules/30_crop/rotation_apr22/equations.gms index fef0d2c511..6f0eda73d1 100644 --- a/modules/30_crop/rotation_apr22/equations.gms +++ b/modules/30_crop/rotation_apr22/equations.gms @@ -14,6 +14,7 @@ q30_prod(j2,kcr) .. vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); + *' As additional constraints minimum and maximum rotational constraints limit *' the placing of crops. On the one hand, these rotational constraints reflect *' crop rotations limiting the share a specific crop can cover of the total area @@ -23,11 +24,11 @@ sum((rotamax_kcr30(rotamax_red30,kcr),w), vm_area(j2,kcr,w)) =l= vm_land(j2,"crop") * sum(ct,i30_rotation_max_shr(ct,rotamax_red30)); - q30_rotation_min(j2,rotamin_red30) .. sum((rotamin_kcr30(rotamin_red30,kcr),w), vm_area(j2,kcr,w)) =g= vm_land(j2,"crop") * sum(ct,i30_rotation_min_shr(ct,rotamin_red30)); + * The following maximum constraint avoids over-specialization in irrigated systems. * No minimum constraint is included for irrigated areas for computational * reasons. Minimum constraints just need to be met on total areas. @@ -36,22 +37,28 @@ sum((rotamax_kcr30(rotamax_red30,kcr)), vm_area(j2,kcr,"irrigated")) =l= vm_AEI(j2) * sum(ct,i30_rotation_max_shr(ct,rotamax_red30)); -*' Agricultural production is calculated by multiplying the area under -*' production with corresponding yields. Production from rainfed and irrigated -*' areas is summed up: - q30_prod(j2,kcr) .. - vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); +*' Bioenergy tree minimum share on cropland + +q30_betr_shr(j2) .. + sum(w, vm_area(j2,"betr",w)) =g= + sum(ct, p30_betr_min_shr(ct,j2)) * vm_land(j2,"crop"); + + +*' The carbon stocks of the above ground carbon pools are calculated based on croparea and related carbon density. + + q30_carbon(j2,ag_pools) .. + vm_carbon_stock_croparea(j2,ag_pools) =e= + sum((kcr,w), vm_area(j2,kcr,w)) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)); + *' The biodiversity value for cropland is calculated separately for annual and perennial crops: + q30_bv_ann(j2,potnatveg) .. vm_bv(j2,"crop_ann",potnatveg) =e= sum((crop_ann30,w), vm_area(j2,crop_ann30,w)) * fm_bii_coeff("crop_ann",potnatveg) * fm_luh2_side_layers(j2,potnatveg); -* perennial crops are calculated as difference, as they shall also include fallow land - q30_bv_per(j2,potnatveg) .. - vm_bv(j2,"crop_per",potnatveg) + q30_bv_per(j2,potnatveg) .. vm_bv(j2,"crop_per",potnatveg) =e= - (vm_land(j2,"crop") - sum((crop_ann30,w), vm_area(j2,crop_ann30,w))) - * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + sum((crop_per30,w), vm_area(j2,crop_per30,w)) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/30_crop/rotation_apr22/input.gms b/modules/30_crop/rotation_apr22/input.gms index da0b8f80b6..8d0f252920 100644 --- a/modules/30_crop/rotation_apr22/input.gms +++ b/modules/30_crop/rotation_apr22/input.gms @@ -11,12 +11,6 @@ $setglobal c30_bioen_type all $setglobal c30_bioen_water rainfed * options: rainfed, irrigated, all -$setglobal c30_marginal_land q33_marginal -* options: all_marginal, q33_marginal, no_marginal - -$setglobal c30_snv_target none -* options: none, by2030, by2020 - $setglobal c30_rotation_constraints on *options: on, off @@ -27,47 +21,13 @@ $setglobal c30_rotation_scenario_speed by2050 * options: none, by2030, by2020 scalars -s30_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / -s30_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / -s30_snv_scenario_start SNV scenario start year / 2020 / -s30_snv_scenario_target SNV scenario target year / 2030 / -s30_rotation_scenario_start Rotation scenario start year / 2020 / -s30_rotation_scenario_target Rotation scenario target year / 2050 / -s30_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / -s30_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / + s30_rotation_scenario_start Rotation scenario start year / 2020 / + s30_rotation_scenario_target Rotation scenario target year / 2050 / + s30_betr_min_shr Minimum share of bioenergy trees on cropland (1) / 0 / + s30_betr_scenario_start Bioenergy trees scenario start year / 2020 / + s30_betr_scenario_target Bioenergy trees scenario target year / 2050 / ; -* Set-switch for countries affected by regional SNV policy -* Default: all iso countries selected -sets - policy_countries30(iso) countries to be affected by SNV policy / ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, - ASM,ATA,ATF,ATG,AUS,AUT,AZE,BDI,BEL,BEN, - BES,BFA,BGD,BGR,BHR,BHS,BIH,BLM,BLR,BLZ, - BMU,BOL,BRA,BRB,BRN,BTN,BVT,BWA,CAF,CAN, - CCK,CHN,CHE,CHL,CIV,CMR,COD,COG,COK,COL, - COM,CPV,CRI,CUB,CUW,CXR,CYM,CYP,CZE,DEU, - DJI,DMA,DNK,DOM,DZA,ECU,EGY,ERI,ESH,ESP, - EST,ETH,FIN,FJI,FLK,FRA,FRO,FSM,GAB,GBR, - GEO,GGY,GHA,GIB,GIN,GLP,GMB,GNB,GNQ,GRC, - GRD,GRL,GTM,GUF,GUM,GUY,HKG,HMD,HND,HRV, - HTI,HUN,IDN,IMN,IND,IOT,IRL,IRN,IRQ,ISL, - ISR,ITA,JAM,JEY,JOR,JPN,KAZ,KEN,KGZ,KHM, - KIR,KNA,KOR,KWT,LAO,LBN,LBR,LBY,LCA,LIE, - LKA,LSO,LTU,LUX,LVA,MAC,MAF,MAR,MCO,MDA, - MDG,MDV,MEX,MHL,MKD,MLI,MLT,MMR,MNE,MNG, - MNP,MOZ,MRT,MSR,MTQ,MUS,MWI,MYS,MYT,NAM, - NCL,NER,NFK,NGA,NIC,NIU,NLD,NOR,NPL,NRU, - NZL,OMN,PAK,PAN,PCN,PER,PHL,PLW,PNG,POL, - PRI,PRK,PRT,PRY,PSE,PYF,QAT,REU,ROU,RUS, - RWA,SAU,SDN,SEN,SGP,SGS,SHN,SJM,SLB,SLE, - SLV,SMR,SOM,SPM,SRB,SSD,STP,SUR,SVK,SVN, - SWE,SWZ,SXM,SYC,SYR,TCA,TCD,TGO,THA,TJK, - TKL,TKM,TLS,TON,TTO,TUN,TUR,TUV,TWN,TZA, - UGA,UKR,UMI,URY,USA,UZB,VAT,VCT,VEN,VGB, - VIR,VNM,VUT,WLF,WSM,YEM,ZAF,ZMB,ZWE / - -land_snv(land) land types allowed in the SNV policy / secdforest, forestry, past, other / -; $ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes; $else bioen_type_30("%c30_bioen_type%") = yes; @@ -103,25 +63,3 @@ $offdelim ; $if "%c30_rotation_constraints%" == "off" f30_rotation_min_shr(crp30) = 0; - -********* AVAILABLE CROPLAND ******************************************* - -table f30_avl_cropland(j,marginal_land30) Available land area for cropland (mio. ha) -$ondelim -$include "./modules/30_crop/rotation_apr22/input/avl_cropland.cs3" -$offdelim -; - -table f30_avl_cropland_iso(iso,marginal_land30) Available land area for cropland at ISO level (mio. ha) -$ondelim -$include "./modules/30_crop/rotation_apr22/input/avl_cropland_iso.cs3" -$offdelim -; - -********* SNV TARGET CROPLAND ******************************************* - -table f30_snv_target_cropland(j,relocation_target30) Cropland in 2019 requiring relocation due to SNV policy (mio. ha) -$ondelim -$include "./modules/30_crop/rotation_apr22/input/SNVTargetCropland.cs3" -$offdelim -; diff --git a/modules/30_crop/rotation_apr22/input/files b/modules/30_crop/rotation_apr22/input/files index 6fe1594cf5..c20b7be222 100644 --- a/modules/30_crop/rotation_apr22/input/files +++ b/modules/30_crop/rotation_apr22/input/files @@ -1,9 +1,4 @@ * list of files that are required here f30_rotation_max_scen.csv f30_rotation_min_scen.csv -avl_cropland.cs3 -avl_cropland_0.5.mz f30_croparea_w_initialisation.cs3 -avl_cropland_iso.cs3 -SNVTargetCropland.cs3 -SNVTargetCropland_0.5.mz diff --git a/modules/30_crop/rotation_apr22/postsolve.gms b/modules/30_crop/rotation_apr22/postsolve.gms index 52d998a6e7..66c916304c 100644 --- a/modules/30_crop/rotation_apr22/postsolve.gms +++ b/modules/30_crop/rotation_apr22/postsolve.gms @@ -7,60 +7,48 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_fallow(t,j,"marginal") = vm_fallow.m(j); ov_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w); ov_rotation_penalty(t,i,"marginal") = vm_rotation_penalty.m(i); - oq30_cropland(t,j,"marginal") = q30_cropland.m(j); - oq30_avl_cropland(t,j,"marginal") = q30_avl_cropland.m(j); + ov_carbon_stock_croparea(t,j,ag_pools,"marginal") = vm_carbon_stock_croparea.m(j,ag_pools); + oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); oq30_rotation_max(t,j,rotamax30,"marginal") = q30_rotation_max.m(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"marginal") = q30_rotation_min.m(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"marginal") = q30_rotation_max_irrig.m(j,rotamax30); - oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); - oq30_carbon(t,j,ag_pools,stockType,"marginal") = q30_carbon.m(j,ag_pools,stockType); + oq30_betr_shr(t,j,"marginal") = q30_betr_shr.m(j); + oq30_carbon(t,j,ag_pools,"marginal") = q30_carbon.m(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"marginal") = q30_bv_ann.m(j,potnatveg); oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg); - oq30_land_snv(t,j,"marginal") = q30_land_snv.m(j); - oq30_land_snv_trans(t,j,"marginal") = q30_land_snv_trans.m(j); - ov_fallow(t,j,"level") = vm_fallow.l(j); ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); ov_rotation_penalty(t,i,"level") = vm_rotation_penalty.l(i); - oq30_cropland(t,j,"level") = q30_cropland.l(j); - oq30_avl_cropland(t,j,"level") = q30_avl_cropland.l(j); + ov_carbon_stock_croparea(t,j,ag_pools,"level") = vm_carbon_stock_croparea.l(j,ag_pools); + oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); oq30_rotation_max(t,j,rotamax30,"level") = q30_rotation_max.l(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"level") = q30_rotation_min.l(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"level") = q30_rotation_max_irrig.l(j,rotamax30); - oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); - oq30_carbon(t,j,ag_pools,stockType,"level") = q30_carbon.l(j,ag_pools,stockType); + oq30_betr_shr(t,j,"level") = q30_betr_shr.l(j); + oq30_carbon(t,j,ag_pools,"level") = q30_carbon.l(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"level") = q30_bv_ann.l(j,potnatveg); oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg); - oq30_land_snv(t,j,"level") = q30_land_snv.l(j); - oq30_land_snv_trans(t,j,"level") = q30_land_snv_trans.l(j); - ov_fallow(t,j,"upper") = vm_fallow.up(j); ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); ov_rotation_penalty(t,i,"upper") = vm_rotation_penalty.up(i); - oq30_cropland(t,j,"upper") = q30_cropland.up(j); - oq30_avl_cropland(t,j,"upper") = q30_avl_cropland.up(j); + ov_carbon_stock_croparea(t,j,ag_pools,"upper") = vm_carbon_stock_croparea.up(j,ag_pools); + oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); oq30_rotation_max(t,j,rotamax30,"upper") = q30_rotation_max.up(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"upper") = q30_rotation_min.up(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"upper") = q30_rotation_max_irrig.up(j,rotamax30); - oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); - oq30_carbon(t,j,ag_pools,stockType,"upper") = q30_carbon.up(j,ag_pools,stockType); + oq30_betr_shr(t,j,"upper") = q30_betr_shr.up(j); + oq30_carbon(t,j,ag_pools,"upper") = q30_carbon.up(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"upper") = q30_bv_ann.up(j,potnatveg); oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg); - oq30_land_snv(t,j,"upper") = q30_land_snv.up(j); - oq30_land_snv_trans(t,j,"upper") = q30_land_snv_trans.up(j); - ov_fallow(t,j,"lower") = vm_fallow.lo(j); ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); ov_rotation_penalty(t,i,"lower") = vm_rotation_penalty.lo(i); - oq30_cropland(t,j,"lower") = q30_cropland.lo(j); - oq30_avl_cropland(t,j,"lower") = q30_avl_cropland.lo(j); + ov_carbon_stock_croparea(t,j,ag_pools,"lower") = vm_carbon_stock_croparea.lo(j,ag_pools); + oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); oq30_rotation_max(t,j,rotamax30,"lower") = q30_rotation_max.lo(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"lower") = q30_rotation_min.lo(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"lower") = q30_rotation_max_irrig.lo(j,rotamax30); - oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); - oq30_carbon(t,j,ag_pools,stockType,"lower") = q30_carbon.lo(j,ag_pools,stockType); + oq30_betr_shr(t,j,"lower") = q30_betr_shr.lo(j); + oq30_carbon(t,j,ag_pools,"lower") = q30_carbon.lo(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"lower") = q30_bv_ann.lo(j,potnatveg); oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg); - oq30_land_snv(t,j,"lower") = q30_land_snv.lo(j); - oq30_land_snv_trans(t,j,"lower") = q30_land_snv_trans.lo(j); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/30_crop/rotation_apr22/preloop.gms b/modules/30_crop/rotation_apr22/preloop.gms index 43fe8bdd10..7c4e100664 100644 --- a/modules/30_crop/rotation_apr22/preloop.gms +++ b/modules/30_crop/rotation_apr22/preloop.gms @@ -9,6 +9,7 @@ ** Trajectory for cropland scenarios * sigmoidal interpolation between start year and target year m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); +m_sigmoid_time_interpol(p30_betr_scenario_fader,s30_betr_scenario_start,s30_betr_scenario_target,0,1); ** create crop rotation scenario i30_rotation_max_shr(t_all,rotamax30)= @@ -24,15 +25,3 @@ i30_rotation_min_shr(t_all,rotamin30)= *very small, negative numbers. These numbers have to be set to 0 as area *cannot be smaller than 0! fm_croparea(t_past,j,w,kcr)$(fm_croparea(t_past,j,w,kcr)<0) = 0; - -****** Regional share of semi-natural vegetation (SNV) in cropland areas for selective countries: -* Country switch to determine countries for which a SNV policy shall be applied. -* In the default case, the SNV policy affects all countries when activated. -p30_country_dummy(iso) = 0; -p30_country_dummy(policy_countries30) = 1; -* Because MAgPIE is not run at country-level, but at region level, a region -* share is calculated that translates the countries' influence to regional level. -* Countries are weighted by available cropland area. -i30_avl_cropland_iso(iso) = f30_avl_cropland_iso(iso,"%c30_marginal_land%"); -p30_country_snv_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * i30_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i30_avl_cropland_iso(iso)); - diff --git a/modules/30_crop/rotation_apr22/presolve.gms b/modules/30_crop/rotation_apr22/presolve.gms index 1b847385d9..97a83f26a8 100644 --- a/modules/30_crop/rotation_apr22/presolve.gms +++ b/modules/30_crop/rotation_apr22/presolve.gms @@ -24,3 +24,5 @@ rotamax_red30(rotamax30) = yes$(i30_rotation_max_shr(t,rotamax30) < 1); rotamin_red30(rotamin30) = yes$(i30_rotation_min_shr(t,rotamin30) > 0); vm_rotation_penalty.fx(i)=0; + +p30_betr_min_shr(t,j) = p30_betr_scenario_fader(t) * s30_betr_min_shr; diff --git a/modules/61_agroforestry/endo/declarations.gms b/modules/61_agroforestry/endo/declarations.gms deleted file mode 100644 index 5503ad7181..0000000000 --- a/modules/61_agroforestry/endo/declarations.gms +++ /dev/null @@ -1,67 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -scalars - s61_shift number of 5-year age-classes corresponding to current time step length (1) -; - -parameters - p61_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) - p61_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) - p61_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) - pc61_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) - i61_reward_treecover Area reward for cropland treecover (USD per ha) - i61_reward_betr Area reward for bioenergy trees (USD per ha) -; - -equations - q61_cost_agroforestry(j) Costs and benefits related to agroforestry (mio. USD05MER per yr) - q61_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) - q61_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) - q61_treecover_area(j) Cropland treecover interface (mio. ha) - q61_reward_treecover(j) Reward for cropland treecover (mio. USD05MER per yr) - q61_reward_betr(j) Reward for bioenergy trees (mio. USD05MER per yr) - q61_treecover_est(j,ac) Cropland treecover establishment (mio. ha) - q61_treecover_carbon(j,ag_pools,stockType) Cropland tree cover above ground carbon content (mio. tC) - q61_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (Mha) -; - -variables - vm_cost_agroforestry(j) Cost and rewards related to agroforestry (mio. USD05MER per yr) -; - -positive variables - v61_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) - v61_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) - v61_reward_treecover(j) Reward for cropland treecover (mio. USD05MER per yr) - v61_reward_betr(j) Reward for bioenergy trees (mio. USD05MER per yr) - vm_treecover_area(j) Cropland tree cover (mio. ha) - v61_treecover(j,ac) Cropland tree cover per age class (mio. ha) - vm_treecover_carbon(j,ag_pools,stockType) Cropland tree cover above ground carbon content (mio. tC) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_cost_agroforestry(t,j,type) Cost and rewards related to agroforestry (mio. USD05MER per yr) - ov61_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) - ov61_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) - ov61_reward_treecover(t,j,type) Reward for cropland treecover (mio. USD05MER per yr) - ov61_reward_betr(t,j,type) Reward for bioenergy trees (mio. USD05MER per yr) - ov_treecover_area(t,j,type) Cropland tree cover (mio. ha) - ov61_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) - ov_treecover_carbon(t,j,ag_pools,stockType,type) Cropland tree cover above ground carbon content (mio. tC) - oq61_cost_agroforestry(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr) - oq61_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) - oq61_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) - oq61_treecover_area(t,j,type) Cropland treecover interface (mio. ha) - oq61_reward_treecover(t,j,type) Reward for cropland treecover (mio. USD05MER per yr) - oq61_reward_betr(t,j,type) Reward for bioenergy trees (mio. USD05MER per yr) - oq61_treecover_est(t,j,ac,type) Cropland treecover establishment (mio. ha) - oq61_treecover_carbon(t,j,ag_pools,stockType,type) Cropland tree cover above ground carbon content (mio. tC) - oq61_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (Mha) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/61_agroforestry/endo/equations.gms b/modules/61_agroforestry/endo/equations.gms deleted file mode 100644 index 6a4d138b1d..0000000000 --- a/modules/61_agroforestry/endo/equations.gms +++ /dev/null @@ -1,55 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @equations - -*' Total agroforestry cost. -*' Cost for bioenergy trees are accounted for in the [30_crop] module. -q61_cost_agroforestry(j2) .. - vm_cost_agroforestry(j2) =e= - v61_cost_treecover_est(j2) + v61_cost_treecover_recur(j2) - - v61_reward_treecover(j2) - v61_reward_betr(j2); - -*' Tree cover establishment cost -q61_cost_treecover_est(j2) .. - v61_cost_treecover_est(j2) =e= - sum(ac_est, v61_treecover(j2,ac_est)) * s61_cost_treecover_est * - sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); - -*' Tree cover recurring cost -q61_cost_treecover_recur(j2) .. - v61_cost_treecover_recur(j2) =e= - sum(ac_sub, v61_treecover(j2,ac_sub)) * s61_cost_treecover_recur; - -*' Tree cover reward -q61_reward_treecover(j2) .. - v61_reward_treecover(j2) =e= - sum(ac, v61_treecover(j2,ac)) * i61_reward_treecover; - -*' Bioenergy tree reward -q61_reward_betr(j2) .. - v61_reward_betr(j2) =e= - sum(w, vm_area(j2,"betr",w)) * i61_reward_betr; - -*' Tree cover establishment -q61_treecover_est(j2,ac_est) .. - v61_treecover(j2,ac_est) =e= sum(ac_est2, v61_treecover(j2,ac_est2))/card(ac_est2); - -*' Tree cover area interface -q61_treecover_area(j2) .. - vm_treecover_area(j2) =e= sum(ac, v61_treecover(j2,ac)); - -*' Tree cover carbon stock interface -q61_treecover_carbon(j2,ag_pools,stockType) .. - vm_treecover_carbon(j2,ag_pools,stockType) =e= - m_carbon_stock_ac(v61_treecover,p61_carbon_density_ac,"ac","ac_sub"); - -*' Tree cover biodiversity value -q61_treecover_bv(j2,potnatveg) .. - vm_bv(j2,"crop_tree",potnatveg) =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v61_treecover(j2,ac)) * - p61_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/61_agroforestry/endo/input.gms b/modules/61_agroforestry/endo/input.gms deleted file mode 100644 index b9aa3f15e0..0000000000 --- a/modules/61_agroforestry/endo/input.gms +++ /dev/null @@ -1,18 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -scalars - s61_cost_treecover_est Tree cover establishment cost (USD per ha) / 2000 / - s61_cost_treecover_recur Tree cover recurring cost (USD per ha) / 500 / - s61_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / - s61_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / - s61_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / - s61_reward_treecover Area reward for cropland treecover (USD per ha) / 0 / - s61_reward_betr Area reward for bioenergy trees on cropland (USD per ha) / 0 / - s61_treecover_scenario_start Cropland treecover scenario start year / 2020 / - s61_betr_scenario_start Bioenergy trees scenario start year / 2020 / -; diff --git a/modules/61_agroforestry/endo/not_used.txt b/modules/61_agroforestry/endo/not_used.txt deleted file mode 100644 index c3c4a63e3d..0000000000 --- a/modules/61_agroforestry/endo/not_used.txt +++ /dev/null @@ -1,2 +0,0 @@ -name,type,reason -vm_land,input,not used diff --git a/modules/61_agroforestry/endo/postsolve.gms b/modules/61_agroforestry/endo/postsolve.gms deleted file mode 100644 index 1afb2c367e..0000000000 --- a/modules/61_agroforestry/endo/postsolve.gms +++ /dev/null @@ -1,79 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -pc61_treecover(j,ac) = v61_treecover.l(j,ac); - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_cost_agroforestry(t,j,"marginal") = vm_cost_agroforestry.m(j); - ov61_cost_treecover_est(t,j,"marginal") = v61_cost_treecover_est.m(j); - ov61_cost_treecover_recur(t,j,"marginal") = v61_cost_treecover_recur.m(j); - ov61_reward_treecover(t,j,"marginal") = v61_reward_treecover.m(j); - ov61_reward_betr(t,j,"marginal") = v61_reward_betr.m(j); - ov_treecover_area(t,j,"marginal") = vm_treecover_area.m(j); - ov61_treecover(t,j,ac,"marginal") = v61_treecover.m(j,ac); - ov_treecover_carbon(t,j,ag_pools,stockType,"marginal") = vm_treecover_carbon.m(j,ag_pools,stockType); - oq61_cost_agroforestry(t,j,"marginal") = q61_cost_agroforestry.m(j); - oq61_cost_treecover_est(t,j,"marginal") = q61_cost_treecover_est.m(j); - oq61_cost_treecover_recur(t,j,"marginal") = q61_cost_treecover_recur.m(j); - oq61_treecover_area(t,j,"marginal") = q61_treecover_area.m(j); - oq61_reward_treecover(t,j,"marginal") = q61_reward_treecover.m(j); - oq61_reward_betr(t,j,"marginal") = q61_reward_betr.m(j); - oq61_treecover_est(t,j,ac,"marginal") = q61_treecover_est.m(j,ac); - oq61_treecover_carbon(t,j,ag_pools,stockType,"marginal") = q61_treecover_carbon.m(j,ag_pools,stockType); - oq61_treecover_bv(t,j,potnatveg,"marginal") = q61_treecover_bv.m(j,potnatveg); - ov_cost_agroforestry(t,j,"level") = vm_cost_agroforestry.l(j); - ov61_cost_treecover_est(t,j,"level") = v61_cost_treecover_est.l(j); - ov61_cost_treecover_recur(t,j,"level") = v61_cost_treecover_recur.l(j); - ov61_reward_treecover(t,j,"level") = v61_reward_treecover.l(j); - ov61_reward_betr(t,j,"level") = v61_reward_betr.l(j); - ov_treecover_area(t,j,"level") = vm_treecover_area.l(j); - ov61_treecover(t,j,ac,"level") = v61_treecover.l(j,ac); - ov_treecover_carbon(t,j,ag_pools,stockType,"level") = vm_treecover_carbon.l(j,ag_pools,stockType); - oq61_cost_agroforestry(t,j,"level") = q61_cost_agroforestry.l(j); - oq61_cost_treecover_est(t,j,"level") = q61_cost_treecover_est.l(j); - oq61_cost_treecover_recur(t,j,"level") = q61_cost_treecover_recur.l(j); - oq61_treecover_area(t,j,"level") = q61_treecover_area.l(j); - oq61_reward_treecover(t,j,"level") = q61_reward_treecover.l(j); - oq61_reward_betr(t,j,"level") = q61_reward_betr.l(j); - oq61_treecover_est(t,j,ac,"level") = q61_treecover_est.l(j,ac); - oq61_treecover_carbon(t,j,ag_pools,stockType,"level") = q61_treecover_carbon.l(j,ag_pools,stockType); - oq61_treecover_bv(t,j,potnatveg,"level") = q61_treecover_bv.l(j,potnatveg); - ov_cost_agroforestry(t,j,"upper") = vm_cost_agroforestry.up(j); - ov61_cost_treecover_est(t,j,"upper") = v61_cost_treecover_est.up(j); - ov61_cost_treecover_recur(t,j,"upper") = v61_cost_treecover_recur.up(j); - ov61_reward_treecover(t,j,"upper") = v61_reward_treecover.up(j); - ov61_reward_betr(t,j,"upper") = v61_reward_betr.up(j); - ov_treecover_area(t,j,"upper") = vm_treecover_area.up(j); - ov61_treecover(t,j,ac,"upper") = v61_treecover.up(j,ac); - ov_treecover_carbon(t,j,ag_pools,stockType,"upper") = vm_treecover_carbon.up(j,ag_pools,stockType); - oq61_cost_agroforestry(t,j,"upper") = q61_cost_agroforestry.up(j); - oq61_cost_treecover_est(t,j,"upper") = q61_cost_treecover_est.up(j); - oq61_cost_treecover_recur(t,j,"upper") = q61_cost_treecover_recur.up(j); - oq61_treecover_area(t,j,"upper") = q61_treecover_area.up(j); - oq61_reward_treecover(t,j,"upper") = q61_reward_treecover.up(j); - oq61_reward_betr(t,j,"upper") = q61_reward_betr.up(j); - oq61_treecover_est(t,j,ac,"upper") = q61_treecover_est.up(j,ac); - oq61_treecover_carbon(t,j,ag_pools,stockType,"upper") = q61_treecover_carbon.up(j,ag_pools,stockType); - oq61_treecover_bv(t,j,potnatveg,"upper") = q61_treecover_bv.up(j,potnatveg); - ov_cost_agroforestry(t,j,"lower") = vm_cost_agroforestry.lo(j); - ov61_cost_treecover_est(t,j,"lower") = v61_cost_treecover_est.lo(j); - ov61_cost_treecover_recur(t,j,"lower") = v61_cost_treecover_recur.lo(j); - ov61_reward_treecover(t,j,"lower") = v61_reward_treecover.lo(j); - ov61_reward_betr(t,j,"lower") = v61_reward_betr.lo(j); - ov_treecover_area(t,j,"lower") = vm_treecover_area.lo(j); - ov61_treecover(t,j,ac,"lower") = v61_treecover.lo(j,ac); - ov_treecover_carbon(t,j,ag_pools,stockType,"lower") = vm_treecover_carbon.lo(j,ag_pools,stockType); - oq61_cost_agroforestry(t,j,"lower") = q61_cost_agroforestry.lo(j); - oq61_cost_treecover_est(t,j,"lower") = q61_cost_treecover_est.lo(j); - oq61_cost_treecover_recur(t,j,"lower") = q61_cost_treecover_recur.lo(j); - oq61_treecover_area(t,j,"lower") = q61_treecover_area.lo(j); - oq61_reward_treecover(t,j,"lower") = q61_reward_treecover.lo(j); - oq61_reward_betr(t,j,"lower") = q61_reward_betr.lo(j); - oq61_treecover_est(t,j,ac,"lower") = q61_treecover_est.lo(j,ac); - oq61_treecover_carbon(t,j,ag_pools,stockType,"lower") = q61_treecover_carbon.lo(j,ag_pools,stockType); - oq61_treecover_bv(t,j,potnatveg,"lower") = q61_treecover_bv.lo(j,potnatveg); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/61_agroforestry/endo/preloop.gms b/modules/61_agroforestry/endo/preloop.gms deleted file mode 100644 index a60e56e0b7..0000000000 --- a/modules/61_agroforestry/endo/preloop.gms +++ /dev/null @@ -1,26 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -* Initial tree cover on cropland is assumed to be equally distributed among all age-classes -pc61_treecover(j,ac) = (pm_treecover_shr(j)*pm_land_start(j,"crop"))/card(ac); - -*' Switch for tree cover on cropland: -*' 0 = Use natveg growth curve towards LPJmL natural vegetation -*' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation -if(s61_treecover_plantation = 0, - p61_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); -elseif s61_treecover_plantation = 1, - p61_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools); -); - -** set bii coefficients -p61_treecover_bii_coeff(bii_class_secd,potnatveg) = 0; -if(s61_treecover_bii_coeff = 0, - p61_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff(bii_class_secd,potnatveg) -elseif s61_treecover_bii_coeff = 1, - p61_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff("timber",potnatveg) -); diff --git a/modules/61_agroforestry/endo/presolve.gms b/modules/61_agroforestry/endo/presolve.gms deleted file mode 100644 index f123728309..0000000000 --- a/modules/61_agroforestry/endo/presolve.gms +++ /dev/null @@ -1,34 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -* Growth of trees on cropland is modelled by shifting age-classes according to time step length. -s61_shift = m_timestep_length_forestry/5; -* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s61_shift = 1) - p61_treecover(t,j,ac)$(ord(ac) > s61_shift) = pc61_treecover(j,ac-s61_shift); -* account for cases at the end of the age class set (s61_shift > 1) which are not shifted by the above calculation - p61_treecover(t,j,"acx") = p61_treecover(t,j,"acx") - + sum(ac$(ord(ac) > card(ac)-s61_shift), pc61_treecover(j,ac)); - -pc61_treecover(j,ac) = p61_treecover(t,j,ac); -v61_treecover.l(j,ac) = p61_treecover(t,j,ac); - -if(m_year(t) <= s61_treecover_scenario_start, - v61_treecover.fx(j,ac) = pc61_treecover(j,ac); - i61_reward_treecover = 0; - i61_reward_betr = 0; -else - i61_reward_treecover = s61_reward_treecover; - i61_reward_betr = s61_reward_betr; - v61_treecover.lo(j,ac_est) = 0; - v61_treecover.up(j,ac_est) = Inf; - if(s61_treecover_decrease = 1, - v61_treecover.lo(j,ac_sub) = 0; - v61_treecover.up(j,ac_sub) = pc61_treecover(j,ac_sub); - else - v61_treecover.fx(j,ac_sub) = pc61_treecover(j,ac_sub); - ); -); diff --git a/modules/61_agroforestry/endo/realization.gms b/modules/61_agroforestry/endo/realization.gms deleted file mode 100644 index 7f22f40dff..0000000000 --- a/modules/61_agroforestry/endo/realization.gms +++ /dev/null @@ -1,21 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description In this realization, future shares of tree cover and bioenergy trees -*' on cropland at cluster level follow exogenous assumptions. -*' @stop -*' -*' @limitations There are currently no known limitations of this realization. - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "declarations" $include "./modules/61_agroforestry/endo/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/61_agroforestry/endo/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/61_agroforestry/endo/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/61_agroforestry/endo/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/61_agroforestry/endo/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/61_agroforestry/endo/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/61_agroforestry/exo/declarations.gms b/modules/61_agroforestry/exo/declarations.gms deleted file mode 100644 index 0262c0e59e..0000000000 --- a/modules/61_agroforestry/exo/declarations.gms +++ /dev/null @@ -1,65 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -scalars - s61_shift number of 5-year age-classes corresponding to current time step length (1) -; - -parameters - p61_treecover_min_shr(t,j) Minimum share of treecover on cropland (1) - p61_betr_min_shr(t,j) Minimum share of bioenergy trees on cropland (1) - p61_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) - p61_betr_scenario_fader(t_all) Bioenergy trees scenario fader (1) - p61_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) - p61_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) - p61_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) - pc61_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) -; - -equations - q61_cost_agroforestry(j) Costs and benefits related to agroforestry (mio. USD05MER per yr) - q61_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) - q61_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) - q61_treecover_area(j) Cropland treecover interface (mio. ha) - q61_treecover_shr(j) Cropland treecover minimum share (mio. ha) - q61_betr_shr(j) Bioenergy trees minimum share (mio. ha) - q61_treecover_est(j,ac) Cropland treecover establishment (mio. ha) - q61_treecover_carbon(j,ag_pools,stockType) Cropland tree cover above ground carbon content (mio. tC) - q61_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (Mha) -; - -variables - vm_cost_agroforestry(j) Cost and rewards related to agroforestry (mio. USD05MER per yr) -; - -positive variables - v61_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) - v61_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) - vm_treecover_area(j) Cropland tree cover (mio. ha) - v61_treecover(j,ac) Cropland tree cover per age class (mio. ha) - vm_treecover_carbon(j,ag_pools,stockType) Cropland tree cover above ground carbon content (mio. tC) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_cost_agroforestry(t,j,type) Cost and rewards related to agroforestry (mio. USD05MER per yr) - ov61_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) - ov61_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) - ov_treecover_area(t,j,type) Cropland tree cover (mio. ha) - ov61_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) - ov_treecover_carbon(t,j,ag_pools,stockType,type) Cropland tree cover above ground carbon content (mio. tC) - oq61_cost_agroforestry(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr) - oq61_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) - oq61_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) - oq61_treecover_area(t,j,type) Cropland treecover interface (mio. ha) - oq61_treecover_shr(t,j,type) Cropland treecover minimum share (mio. ha) - oq61_betr_shr(t,j,type) Bioenergy trees minimum share (mio. ha) - oq61_treecover_est(t,j,ac,type) Cropland treecover establishment (mio. ha) - oq61_treecover_carbon(t,j,ag_pools,stockType,type) Cropland tree cover above ground carbon content (mio. tC) - oq61_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (Mha) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/61_agroforestry/exo/equations.gms b/modules/61_agroforestry/exo/equations.gms deleted file mode 100644 index 6a052bea65..0000000000 --- a/modules/61_agroforestry/exo/equations.gms +++ /dev/null @@ -1,54 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @equations - -*' Total agroforestry cost. -*' Cost for bioenergy trees are accounted for in the [30_crop] module. -q61_cost_agroforestry(j2) .. - vm_cost_agroforestry(j2) =e= - v61_cost_treecover_est(j2) + v61_cost_treecover_recur(j2); - -*' Tree cover establishment cost -q61_cost_treecover_est(j2) .. - v61_cost_treecover_est(j2) =e= - sum(ac_est, v61_treecover(j2,ac_est)) * s61_cost_treecover_est * - sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); - -*' Tree cover recurring cost -q61_cost_treecover_recur(j2) .. - v61_cost_treecover_recur(j2) =e= - sum(ac_sub, v61_treecover(j2,ac_sub)) * s61_cost_treecover_recur; - -*' Tree cover minimum share -q61_treecover_shr(j2) .. - sum(ac, v61_treecover(j2,ac)) =g= - sum(ct, p61_treecover_min_shr(ct,j2)) * vm_land(j2,"crop"); - -*' Bioenergy tree minimum share -q61_betr_shr(j2) .. - sum(w, vm_area(j2,"betr",w)) =g= - sum(ct, p61_betr_min_shr(ct,j2)) * vm_land(j2,"crop"); - -*' Tree cover establishment -q61_treecover_est(j2,ac_est) .. - v61_treecover(j2,ac_est) =e= sum(ac_est2, v61_treecover(j2,ac_est2))/card(ac_est2); - -*' Tree cover area interface -q61_treecover_area(j2) .. - vm_treecover_area(j2) =e= sum(ac, v61_treecover(j2,ac)); - -*' Tree cover carbon stock interface -q61_treecover_carbon(j2,ag_pools,stockType) .. - vm_treecover_carbon(j2,ag_pools,stockType) =e= - m_carbon_stock_ac(v61_treecover,p61_carbon_density_ac,"ac","ac_sub"); - -*' Tree cover biodiversity value -q61_treecover_bv(j2,potnatveg) .. - vm_bv(j2,"crop_tree",potnatveg) =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v61_treecover(j2,ac)) * - p61_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/61_agroforestry/exo/input.gms b/modules/61_agroforestry/exo/input.gms deleted file mode 100644 index c10a69cca2..0000000000 --- a/modules/61_agroforestry/exo/input.gms +++ /dev/null @@ -1,7 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - diff --git a/modules/61_agroforestry/exo/postsolve.gms b/modules/61_agroforestry/exo/postsolve.gms deleted file mode 100644 index 0f01d44bb7..0000000000 --- a/modules/61_agroforestry/exo/postsolve.gms +++ /dev/null @@ -1,70 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_cost_agroforestry(t,j,"marginal") = vm_cost_agroforestry.m(j); - ov61_cost_treecover_est(t,j,"marginal") = v61_cost_treecover_est.m(j); - ov61_cost_treecover_recur(t,j,"marginal") = v61_cost_treecover_recur.m(j); - ov_treecover_area(t,j,"marginal") = vm_treecover_area.m(j); - ov61_treecover(t,j,ac,"marginal") = v61_treecover.m(j,ac); - ov_treecover_carbon(t,j,ag_pools,stockType,"marginal") = vm_treecover_carbon.m(j,ag_pools,stockType); - oq61_cost_agroforestry(t,j,"marginal") = q61_cost_agroforestry.m(j); - oq61_cost_treecover_est(t,j,"marginal") = q61_cost_treecover_est.m(j); - oq61_cost_treecover_recur(t,j,"marginal") = q61_cost_treecover_recur.m(j); - oq61_treecover_area(t,j,"marginal") = q61_treecover_area.m(j); - oq61_treecover_shr(t,j,"marginal") = q61_treecover_shr.m(j); - oq61_betr_shr(t,j,"marginal") = q61_betr_shr.m(j); - oq61_treecover_est(t,j,ac,"marginal") = q61_treecover_est.m(j,ac); - oq61_treecover_carbon(t,j,ag_pools,stockType,"marginal") = q61_treecover_carbon.m(j,ag_pools,stockType); - oq61_treecover_bv(t,j,potnatveg,"marginal") = q61_treecover_bv.m(j,potnatveg); - ov_cost_agroforestry(t,j,"level") = vm_cost_agroforestry.l(j); - ov61_cost_treecover_est(t,j,"level") = v61_cost_treecover_est.l(j); - ov61_cost_treecover_recur(t,j,"level") = v61_cost_treecover_recur.l(j); - ov_treecover_area(t,j,"level") = vm_treecover_area.l(j); - ov61_treecover(t,j,ac,"level") = v61_treecover.l(j,ac); - ov_treecover_carbon(t,j,ag_pools,stockType,"level") = vm_treecover_carbon.l(j,ag_pools,stockType); - oq61_cost_agroforestry(t,j,"level") = q61_cost_agroforestry.l(j); - oq61_cost_treecover_est(t,j,"level") = q61_cost_treecover_est.l(j); - oq61_cost_treecover_recur(t,j,"level") = q61_cost_treecover_recur.l(j); - oq61_treecover_area(t,j,"level") = q61_treecover_area.l(j); - oq61_treecover_shr(t,j,"level") = q61_treecover_shr.l(j); - oq61_betr_shr(t,j,"level") = q61_betr_shr.l(j); - oq61_treecover_est(t,j,ac,"level") = q61_treecover_est.l(j,ac); - oq61_treecover_carbon(t,j,ag_pools,stockType,"level") = q61_treecover_carbon.l(j,ag_pools,stockType); - oq61_treecover_bv(t,j,potnatveg,"level") = q61_treecover_bv.l(j,potnatveg); - ov_cost_agroforestry(t,j,"upper") = vm_cost_agroforestry.up(j); - ov61_cost_treecover_est(t,j,"upper") = v61_cost_treecover_est.up(j); - ov61_cost_treecover_recur(t,j,"upper") = v61_cost_treecover_recur.up(j); - ov_treecover_area(t,j,"upper") = vm_treecover_area.up(j); - ov61_treecover(t,j,ac,"upper") = v61_treecover.up(j,ac); - ov_treecover_carbon(t,j,ag_pools,stockType,"upper") = vm_treecover_carbon.up(j,ag_pools,stockType); - oq61_cost_agroforestry(t,j,"upper") = q61_cost_agroforestry.up(j); - oq61_cost_treecover_est(t,j,"upper") = q61_cost_treecover_est.up(j); - oq61_cost_treecover_recur(t,j,"upper") = q61_cost_treecover_recur.up(j); - oq61_treecover_area(t,j,"upper") = q61_treecover_area.up(j); - oq61_treecover_shr(t,j,"upper") = q61_treecover_shr.up(j); - oq61_betr_shr(t,j,"upper") = q61_betr_shr.up(j); - oq61_treecover_est(t,j,ac,"upper") = q61_treecover_est.up(j,ac); - oq61_treecover_carbon(t,j,ag_pools,stockType,"upper") = q61_treecover_carbon.up(j,ag_pools,stockType); - oq61_treecover_bv(t,j,potnatveg,"upper") = q61_treecover_bv.up(j,potnatveg); - ov_cost_agroforestry(t,j,"lower") = vm_cost_agroforestry.lo(j); - ov61_cost_treecover_est(t,j,"lower") = v61_cost_treecover_est.lo(j); - ov61_cost_treecover_recur(t,j,"lower") = v61_cost_treecover_recur.lo(j); - ov_treecover_area(t,j,"lower") = vm_treecover_area.lo(j); - ov61_treecover(t,j,ac,"lower") = v61_treecover.lo(j,ac); - ov_treecover_carbon(t,j,ag_pools,stockType,"lower") = vm_treecover_carbon.lo(j,ag_pools,stockType); - oq61_cost_agroforestry(t,j,"lower") = q61_cost_agroforestry.lo(j); - oq61_cost_treecover_est(t,j,"lower") = q61_cost_treecover_est.lo(j); - oq61_cost_treecover_recur(t,j,"lower") = q61_cost_treecover_recur.lo(j); - oq61_treecover_area(t,j,"lower") = q61_treecover_area.lo(j); - oq61_treecover_shr(t,j,"lower") = q61_treecover_shr.lo(j); - oq61_betr_shr(t,j,"lower") = q61_betr_shr.lo(j); - oq61_treecover_est(t,j,ac,"lower") = q61_treecover_est.lo(j,ac); - oq61_treecover_carbon(t,j,ag_pools,stockType,"lower") = q61_treecover_carbon.lo(j,ag_pools,stockType); - oq61_treecover_bv(t,j,potnatveg,"lower") = q61_treecover_bv.lo(j,potnatveg); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/61_agroforestry/exo/preloop.gms b/modules/61_agroforestry/exo/preloop.gms deleted file mode 100644 index 637d6609c8..0000000000 --- a/modules/61_agroforestry/exo/preloop.gms +++ /dev/null @@ -1,8 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - - diff --git a/modules/61_agroforestry/exo/presolve.gms b/modules/61_agroforestry/exo/presolve.gms deleted file mode 100644 index c10a69cca2..0000000000 --- a/modules/61_agroforestry/exo/presolve.gms +++ /dev/null @@ -1,7 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - diff --git a/modules/61_agroforestry/exo/realization.gms b/modules/61_agroforestry/exo/realization.gms deleted file mode 100644 index 09b54d0aa4..0000000000 --- a/modules/61_agroforestry/exo/realization.gms +++ /dev/null @@ -1,21 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description In this realization, future shares of tree cover and bioenergy trees -*' on cropland at cluster level follow exogenous assumptions. -*' @stop -*' -*' @limitations There are currently no known limitations of this realization. - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "declarations" $include "./modules/61_agroforestry/exo/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/61_agroforestry/exo/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/61_agroforestry/exo/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/61_agroforestry/exo/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/61_agroforestry/exo/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/61_agroforestry/exo/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/61_agroforestry/module.gms b/modules/61_agroforestry/module.gms deleted file mode 100644 index a1f82ca32e..0000000000 --- a/modules/61_agroforestry/module.gms +++ /dev/null @@ -1,22 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @title Agroforestry -*' -*' @description The purpose of the agroforestry module is to model different agroforestry -*' systems such as bioenergy trees and tree cover on cropland (hedgerows). -*' The agroforestry module interacts via the interfaces $vm\_area$ and $vm\_land$ with -*' the [30_crop] module. Furthermore, the agroforestry module provides cropland tree cover -*' ($vm\_treecover\_area$) and corresponding carbon stocks $vm\_treecover\_carbon$ to the [30_crop] module. -*' -*' @authors Florian Humpenöder - -*###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%agroforestry%" == "endo" $include "./modules/61_agroforestry/endo/realization.gms" -$Ifi "%agroforestry%" == "exo" $include "./modules/61_agroforestry/exo/realization.gms" -$Ifi "%agroforestry%" == "off" $include "./modules/61_agroforestry/off/realization.gms" -*###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/61_agroforestry/off/declarations.gms b/modules/61_agroforestry/off/declarations.gms deleted file mode 100644 index c60ff969c2..0000000000 --- a/modules/61_agroforestry/off/declarations.gms +++ /dev/null @@ -1,25 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -variables - vm_cost_agroforestry(j) Cost and rewards related to agroforestry (mio. USD05MER per yr) -; - -positive variables - vm_treecover_area(j) Cropland tree cover (mio. ha) - vm_treecover_carbon(j,ag_pools,stockType) Cropland tree cover above ground carbon content (mio. tC) -; - - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_cost_agroforestry(t,j,type) Cost and rewards related to agroforestry (mio. USD05MER per yr) - ov_treecover_area(t,j,type) Cropland tree cover (mio. ha) - ov_treecover_carbon(t,j,ag_pools,stockType,type) Cropland tree cover above ground carbon content (mio. tC) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### - diff --git a/modules/61_agroforestry/off/not_used.txt b/modules/61_agroforestry/off/not_used.txt deleted file mode 100644 index 2162d9dc96..0000000000 --- a/modules/61_agroforestry/off/not_used.txt +++ /dev/null @@ -1,10 +0,0 @@ -name,type,reason -vm_land, input, not used -pm_interest, input, not used -pm_land_start,input,not used -pm_treecover_shr,input,not used -fm_luh2_side_layers,input,not used -vm_area,input,not used -fm_bii_coeff,input,not used -pm_carbon_density_ac,input,not used -pm_carbon_density_ac_forestry,input,not used diff --git a/modules/61_agroforestry/off/postsolve.gms b/modules/61_agroforestry/off/postsolve.gms deleted file mode 100644 index 2f4f4d4362..0000000000 --- a/modules/61_agroforestry/off/postsolve.gms +++ /dev/null @@ -1,22 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_cost_agroforestry(t,j,"marginal") = vm_cost_agroforestry.m(j); - ov_treecover_area(t,j,"marginal") = vm_treecover_area.m(j); - ov_treecover_carbon(t,j,ag_pools,stockType,"marginal") = vm_treecover_carbon.m(j,ag_pools,stockType); - ov_cost_agroforestry(t,j,"level") = vm_cost_agroforestry.l(j); - ov_treecover_area(t,j,"level") = vm_treecover_area.l(j); - ov_treecover_carbon(t,j,ag_pools,stockType,"level") = vm_treecover_carbon.l(j,ag_pools,stockType); - ov_cost_agroforestry(t,j,"upper") = vm_cost_agroforestry.up(j); - ov_treecover_area(t,j,"upper") = vm_treecover_area.up(j); - ov_treecover_carbon(t,j,ag_pools,stockType,"upper") = vm_treecover_carbon.up(j,ag_pools,stockType); - ov_cost_agroforestry(t,j,"lower") = vm_cost_agroforestry.lo(j); - ov_treecover_area(t,j,"lower") = vm_treecover_area.lo(j); - ov_treecover_carbon(t,j,ag_pools,stockType,"lower") = vm_treecover_carbon.lo(j,ag_pools,stockType); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### - diff --git a/modules/61_agroforestry/off/preloop.gms b/modules/61_agroforestry/off/preloop.gms deleted file mode 100644 index 46c7e61bb3..0000000000 --- a/modules/61_agroforestry/off/preloop.gms +++ /dev/null @@ -1,11 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -vm_cost_agroforestry.fx(j) = 0; -vm_treecover_area.fx(j) = 0; -vm_treecover_carbon.fx(j,ag_pools,stockType) = 0; -vm_bv.fx(j,"crop_tree",potnatveg) = 0; diff --git a/modules/61_agroforestry/off/realization.gms b/modules/61_agroforestry/off/realization.gms deleted file mode 100644 index 58dab000af..0000000000 --- a/modules/61_agroforestry/off/realization.gms +++ /dev/null @@ -1,17 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description In this realization, agroforestry does not exist. Therefore, -*' cropland tree cover and corresponding carbon stocks are fixed to zero. - -*' @limitations Cropland tree cover and corresponding carbon stocks are fixed to zero. - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "declarations" $include "./modules/61_agroforestry/off/declarations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/61_agroforestry/off/preloop.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/61_agroforestry/off/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/include.gms b/modules/include.gms index 13ff07c83e..e46128a47c 100644 --- a/modules/include.gms +++ b/modules/include.gms @@ -23,6 +23,7 @@ $include "./modules/20_processing/module.gms" $include "./modules/21_trade/module.gms" $include "./modules/22_land_conservation/module.gms" $include "./modules/28_ageclass/module.gms" +$include "./modules/29_cropland/module.gms" $include "./modules/30_crop/module.gms" $include "./modules/31_past/module.gms" $include "./modules/32_forestry/module.gms" @@ -49,7 +50,6 @@ $include "./modules/57_maccs/module.gms" $include "./modules/58_peatland/module.gms" $include "./modules/59_som/module.gms" $include "./modules/60_bioenergy/module.gms" -$include "./modules/61_agroforestry/module.gms" $include "./modules/62_material/module.gms" $include "./modules/70_livestock/module.gms" $include "./modules/71_disagg_lvst/module.gms" From 94679847e2713bb28d8b6061cba60d79520cc020 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 19 Apr 2024 15:43:56 +0200 Subject: [PATCH 010/280] partial commit to save work --- config/default.cfg | 16 +++++++++++++ .../10_land/landmatrix_dec18/declarations.gms | 1 - .../rulebased_apr24/declarations.gms | 24 +++++++++---------- .../29_cropland/rulebased_apr24/equations.gms | 5 ++++ modules/29_cropland/rulebased_apr24/input.gms | 7 ++---- modules/30_crop/endo_apr21/input.gms | 2 +- modules/44_biodiversity/bv_btc_mar21/sets.gms | 2 +- 7 files changed, 37 insertions(+), 20 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 65dac22111..d30443bc7a 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -712,6 +712,15 @@ cfg$gms$policy_countries29 <- all_iso_countries # * "secdforest, past, other" etc. cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other" +# * Minimum share of treecover on cropland reached in s29_treecover_scenario_target: +# * Minimum share of treecover on total cropland area (including croparea, fallow land and tree cover). +# * s29_treecover_min_shr is faded in linearly between s29_treecover_scenario_start and s29_treecover_scenario_target. +cfg$gms$s29_treecover_min_shr <- 0 #def = 0 +# * Start year of tree cover share fade-in: +cfg$gms$s29_treecover_scenario_start <- 2020 # def = 2020 +# * Target year (year when full implementation is reached): +cfg$gms$s29_treecover_scenario_target <- 2040 # def = 2040 + # ***--------------------- 30_crop --------------------------------------- # * 30_crop defines the croparea, which is a subcomponent of total cropland defined in 29_cropland. # * (endo_apr21): Hard rotational constraints. Dynamic cropland and detailed cropland availability data at grid cell level. @@ -740,6 +749,13 @@ cfg$gms$s30_rotation_scenario_start <- 2020 # def = 2020 # * Target year (year when full implementation is reached): cfg$gms$s30_rotation_scenario_target <- 2050 # def = 2050 +# * Minimum share of bioenergy trees on total cropland area (including croparea, fallow land and tree cover). +# * s30_betr_min_shr is faded in linearly between s30_betr_scenario_start and s30_betr_scenario_target. +cfg$gms$s30_betr_min_shr <- 0 #def = 0 +# * Start year of tree cover share fade-in: +cfg$gms$s30_betr_scenario_start <- 2020 # def = 2020 +# * Target year (year when full implementation is reached): +cfg$gms$s30_betr_scenario_target <- 2040 # def = 2040 # ***--------------------- 31_past --------------------------------------- # * (static): static pasture diff --git a/modules/10_land/landmatrix_dec18/declarations.gms b/modules/10_land/landmatrix_dec18/declarations.gms index 8ac9b52b8f..8a7737a301 100644 --- a/modules/10_land/landmatrix_dec18/declarations.gms +++ b/modules/10_land/landmatrix_dec18/declarations.gms @@ -9,7 +9,6 @@ parameters pm_land_start(j,land) Land initialization area (mio. ha) pm_land_hist(t_ini10,j,land) Land area for historial time steps (mio. ha) pcm_land(j,land) Land area in previous time step including possible changes after optimization (mio. ha) - pm_treecover_shr(j) Cropland tree cover share (1) ; variables diff --git a/modules/29_cropland/rulebased_apr24/declarations.gms b/modules/29_cropland/rulebased_apr24/declarations.gms index de1325dffa..aadfb3a404 100644 --- a/modules/29_cropland/rulebased_apr24/declarations.gms +++ b/modules/29_cropland/rulebased_apr24/declarations.gms @@ -23,8 +23,8 @@ parameters p29_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) - p29_treecover_min_shr(t,j) Minimum share of treecover on cropland (1) - p29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) + p29_treecover_min_shr(t,j) Minimum share of treecover on cropland (1) + p29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) p29_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) p29_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) p29_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) @@ -34,18 +34,18 @@ parameters positive variables vm_fallow(j) Fallow land is temporarily fallow cropland (mio. ha) v29_treecover(j,ac) Cropland tree cover per age class (mio. ha) - vm_cost_cropland(j) - v29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) - v29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + vm_cost_cropland(j) Cost for total cropland (mio. USD05MER per yr) + v29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) + v29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) ; equations - q29_cropland(j) Total cropland calculation (mio. ha) - q29_avl_cropland(j) Available cropland constraint (mio. ha) - q29_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) - q29_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) - q29_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) - q29_cost_cropland(j) Costs and benefits related to agroforestry (mio. USD05MER per yr) + q29_cropland(j) Total cropland calculation (mio. ha) + q29_avl_cropland(j) Available cropland constraint (mio. ha) + q29_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) + q29_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) + q29_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) + q29_cost_cropland(j) Costs and benefits related to agroforestry (mio. USD05MER per yr) q29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) q29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) q29_treecover_shr(j) Cropland treecover minimum share (mio. ha) @@ -57,7 +57,7 @@ equations parameters ov_fallow(t,j,type) Fallow land is temporarily fallow cropland (mio. ha) ov29_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) - ov_cost_cropland(t,j,type) + ov_cost_cropland(t,j,type) Cost for total cropland (mio. USD05MER per yr) ov29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) ov29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) oq29_cropland(t,j,type) Total cropland calculation (mio. ha) diff --git a/modules/29_cropland/rulebased_apr24/equations.gms b/modules/29_cropland/rulebased_apr24/equations.gms index 311a61051c..9b6cbac2de 100644 --- a/modules/29_cropland/rulebased_apr24/equations.gms +++ b/modules/29_cropland/rulebased_apr24/equations.gms @@ -81,3 +81,8 @@ q29_treecover_bv(j2,potnatveg) .. vm_bv(j2,"crop_tree",potnatveg) =e= sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v29_treecover(j2,ac)) * p29_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); + +*' Tree cover biodiversity value +q29_fallow_bv(j2,potnatveg) .. + vm_bv(j2,"crop_fallow",potnatveg) =e= + vm_fallow(j2) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/29_cropland/rulebased_apr24/input.gms b/modules/29_cropland/rulebased_apr24/input.gms index 658dcd38c1..416abde01d 100644 --- a/modules/29_cropland/rulebased_apr24/input.gms +++ b/modules/29_cropland/rulebased_apr24/input.gms @@ -5,9 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -* $setglobal c29_snv_target none -* options: none, by2030, by2020 - $setglobal c29_marginal_land q33_marginal * options: all_marginal, q33_marginal, no_marginal @@ -24,8 +21,8 @@ s29_snv_relocation_data_x2 Second reference value in SNV target cropland da s29_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / s29_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / s29_treecover_scenario_start Cropland treecover scenario start year / 2020 / - s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / - s29_treecover_min_shr Share of treecover on cropland (1) / 0.2 / + s29_treecover_scenario_target Cropland treecover scenario target year / 2040 / + s29_treecover_min_shr Share of treecover on cropland (1) / 0 / ; diff --git a/modules/30_crop/endo_apr21/input.gms b/modules/30_crop/endo_apr21/input.gms index 1ae154a2a6..9910b3c134 100644 --- a/modules/30_crop/endo_apr21/input.gms +++ b/modules/30_crop/endo_apr21/input.gms @@ -19,7 +19,7 @@ scalars s30_rotation_scenario_target Rotation scenario target year / 2050 / s30_betr_min_shr Minimum share of bioenergy trees on cropland (1) / 0 / s30_betr_scenario_start Bioenergy trees scenario start year / 2020 / - s30_betr_scenario_target Bioenergy trees scenario target year / 2050 / + s30_betr_scenario_target Bioenergy trees scenario target year / 2040 / ; $ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes; diff --git a/modules/44_biodiversity/bv_btc_mar21/sets.gms b/modules/44_biodiversity/bv_btc_mar21/sets.gms index 1e37a7898a..f5918dd210 100644 --- a/modules/44_biodiversity/bv_btc_mar21/sets.gms +++ b/modules/44_biodiversity/bv_btc_mar21/sets.gms @@ -11,7 +11,7 @@ sets / crop_ann, crop_per, crop_tree, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / bii_class44 bii coefficent land cover classes - / crop_ann, crop_per, crop_tree, manpast, rangeland, urban, primary, secd_mature, secd_young, timber / + / crop_ann, crop_per, crop_tree, crop_fallow, manpast, rangeland, urban, primary, secd_mature, secd_young, timber / bii_class_secd(bii_class44) bii coefficent land cover classes secondary vegetation / secd_mature, secd_young / From 20e42a29bd1f071defb38e496333606e86a5a5cf Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 19 Apr 2024 17:19:42 +0200 Subject: [PATCH 011/280] partial commit to save work --- modules/29_cropland/rulebased_apr24/declarations.gms | 6 ++++-- modules/29_cropland/rulebased_apr24/input.gms | 12 ++++++------ modules/29_cropland/rulebased_apr24/postsolve.gms | 4 ++++ modules/44_biodiversity/bii_target/sets.gms | 4 ++-- modules/44_biodiversity/bv_btc_mar21/sets.gms | 4 ++-- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/modules/29_cropland/rulebased_apr24/declarations.gms b/modules/29_cropland/rulebased_apr24/declarations.gms index aadfb3a404..ee142ef286 100644 --- a/modules/29_cropland/rulebased_apr24/declarations.gms +++ b/modules/29_cropland/rulebased_apr24/declarations.gms @@ -50,7 +50,8 @@ equations q29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) q29_treecover_shr(j) Cropland treecover minimum share (mio. ha) q29_treecover_est(j,ac) Cropland treecover establishment (mio. ha) - q29_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (Mha) + q29_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (mio. ha) + q29_fallow_bv(j,potnatveg) Biodiversity value for fallow land (mio. ha) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### @@ -70,7 +71,8 @@ parameters oq29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) oq29_treecover_shr(t,j,type) Cropland treecover minimum share (mio. ha) oq29_treecover_est(t,j,ac,type) Cropland treecover establishment (mio. ha) - oq29_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (Mha) + oq29_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (mio. ha) + oq29_fallow_bv(t,j,potnatveg,type) Biodiversity value for fallow land (mio. ha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/29_cropland/rulebased_apr24/input.gms b/modules/29_cropland/rulebased_apr24/input.gms index 416abde01d..da26e33c3d 100644 --- a/modules/29_cropland/rulebased_apr24/input.gms +++ b/modules/29_cropland/rulebased_apr24/input.gms @@ -9,12 +9,12 @@ $setglobal c29_marginal_land q33_marginal * options: all_marginal, q33_marginal, no_marginal scalars -s29_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / -s29_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / -s29_snv_scenario_start SNV scenario start year / 2020 / -s29_snv_scenario_target SNV scenario target year / 2029 / -s29_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / -s29_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / + s29_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / + s29_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / + s29_snv_scenario_start SNV scenario start year / 2020 / + s29_snv_scenario_target SNV scenario target year / 2029 / + s29_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / + s29_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / s29_cost_treecover_est Tree cover establishment cost (USD per ha) / 2000 / s29_cost_treecover_recur Tree cover recurring cost (USD per ha) / 500 / s29_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / diff --git a/modules/29_cropland/rulebased_apr24/postsolve.gms b/modules/29_cropland/rulebased_apr24/postsolve.gms index eaad1f7dbd..2fb2d6991f 100644 --- a/modules/29_cropland/rulebased_apr24/postsolve.gms +++ b/modules/29_cropland/rulebased_apr24/postsolve.gms @@ -24,6 +24,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_treecover_shr(t,j,"marginal") = q29_treecover_shr.m(j); oq29_treecover_est(t,j,ac,"marginal") = q29_treecover_est.m(j,ac); oq29_treecover_bv(t,j,potnatveg,"marginal") = q29_treecover_bv.m(j,potnatveg); + oq29_fallow_bv(t,j,potnatveg,"marginal") = q29_fallow_bv.m(j,potnatveg); ov_fallow(t,j,"level") = vm_fallow.l(j); ov29_treecover(t,j,ac,"level") = v29_treecover.l(j,ac); ov_cost_cropland(t,j,"level") = vm_cost_cropland.l(j); @@ -40,6 +41,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_treecover_shr(t,j,"level") = q29_treecover_shr.l(j); oq29_treecover_est(t,j,ac,"level") = q29_treecover_est.l(j,ac); oq29_treecover_bv(t,j,potnatveg,"level") = q29_treecover_bv.l(j,potnatveg); + oq29_fallow_bv(t,j,potnatveg,"level") = q29_fallow_bv.l(j,potnatveg); ov_fallow(t,j,"upper") = vm_fallow.up(j); ov29_treecover(t,j,ac,"upper") = v29_treecover.up(j,ac); ov_cost_cropland(t,j,"upper") = vm_cost_cropland.up(j); @@ -56,6 +58,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_treecover_shr(t,j,"upper") = q29_treecover_shr.up(j); oq29_treecover_est(t,j,ac,"upper") = q29_treecover_est.up(j,ac); oq29_treecover_bv(t,j,potnatveg,"upper") = q29_treecover_bv.up(j,potnatveg); + oq29_fallow_bv(t,j,potnatveg,"upper") = q29_fallow_bv.up(j,potnatveg); ov_fallow(t,j,"lower") = vm_fallow.lo(j); ov29_treecover(t,j,ac,"lower") = v29_treecover.lo(j,ac); ov_cost_cropland(t,j,"lower") = vm_cost_cropland.lo(j); @@ -72,5 +75,6 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_treecover_shr(t,j,"lower") = q29_treecover_shr.lo(j); oq29_treecover_est(t,j,ac,"lower") = q29_treecover_est.lo(j,ac); oq29_treecover_bv(t,j,potnatveg,"lower") = q29_treecover_bv.lo(j,potnatveg); + oq29_fallow_bv(t,j,potnatveg,"lower") = q29_fallow_bv.lo(j,potnatveg); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/44_biodiversity/bii_target/sets.gms b/modules/44_biodiversity/bii_target/sets.gms index 1c3ee18597..fb93906e40 100644 --- a/modules/44_biodiversity/bii_target/sets.gms +++ b/modules/44_biodiversity/bii_target/sets.gms @@ -8,10 +8,10 @@ sets landcover44 land cover classes used in bii calculation - / crop_ann, crop_per, crop_tree, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / + / crop_ann, crop_per, crop_tree, crop_fallow, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / bii_class44 bii coefficent land cover classes - / crop_ann, crop_per, crop_tree, manpast, rangeland, urban, primary, secd_mature, secd_young, timber / + / crop_ann, crop_per, manpast, rangeland, urban, primary, secd_mature, secd_young, timber / bii_class_secd(bii_class44) bii coefficent land cover classes secondary vegetation / secd_mature, secd_young / diff --git a/modules/44_biodiversity/bv_btc_mar21/sets.gms b/modules/44_biodiversity/bv_btc_mar21/sets.gms index f5918dd210..ebee4de5cf 100644 --- a/modules/44_biodiversity/bv_btc_mar21/sets.gms +++ b/modules/44_biodiversity/bv_btc_mar21/sets.gms @@ -8,10 +8,10 @@ sets landcover44 land cover classes used in bii calculation - / crop_ann, crop_per, crop_tree, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / + / crop_ann, crop_per, crop_tree, crop_fallow, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant / bii_class44 bii coefficent land cover classes - / crop_ann, crop_per, crop_tree, crop_fallow, manpast, rangeland, urban, primary, secd_mature, secd_young, timber / + / crop_ann, crop_per, manpast, rangeland, urban, primary, secd_mature, secd_young, timber / bii_class_secd(bii_class44) bii coefficent land cover classes secondary vegetation / secd_mature, secd_young / From f96fbb00b4f55c774cfdb41eb5cdb0e9ffc2fb5f Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 19 Apr 2024 18:16:48 +0200 Subject: [PATCH 012/280] partial commit to save work --- config/default.cfg | 13 +++-------- .../rulebased_apr24/declarations.gms | 7 +++++- .../29_cropland/rulebased_apr24/equations.gms | 10 ++++++++- modules/29_cropland/rulebased_apr24/input.gms | 5 ++++- .../29_cropland/rulebased_apr24/postsolve.gms | 4 ++++ .../29_cropland/rulebased_apr24/preloop.gms | 1 + .../29_cropland/rulebased_apr24/presolve.gms | 2 ++ modules/30_crop/endo_apr21/declarations.gms | 4 ---- modules/30_crop/endo_apr21/equations.gms | 7 ------ modules/30_crop/endo_apr21/input.gms | 3 --- modules/30_crop/endo_apr21/postsolve.gms | 4 ---- modules/30_crop/endo_apr21/preloop.gms | 1 - modules/30_crop/endo_apr21/presolve.gms | 2 -- modules/30_crop/penalty_apr22/sets.gms | 22 ++++++------------- .../30_crop/rotation_apr22/declarations.gms | 4 ---- modules/30_crop/rotation_apr22/equations.gms | 7 ------ modules/30_crop/rotation_apr22/input.gms | 6 ++--- modules/30_crop/rotation_apr22/postsolve.gms | 4 ---- modules/30_crop/rotation_apr22/preloop.gms | 1 - modules/30_crop/rotation_apr22/presolve.gms | 2 -- modules/30_crop/rotation_apr22/sets.gms | 8 ++++--- 21 files changed, 43 insertions(+), 74 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index d30443bc7a..65b72072a6 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -737,8 +737,9 @@ cfg$gms$c30_rotation_constraints <- "on" # def = "on" # * (c30_rotation_scenario): scenarios for constraints. # * In realization rotation_apr22: min (minimal constraints), default (best guess), good (good practice), # * good_20div (good practice - 20% for other crops), setaside (default plus fallow), -# * legumes (minimum share of legumes), agroforestry (minimum share of perennials), sixfoldrotation -# * (crops can only repeat after 6 years), agroecology (mix of previous scenarios) +# * legumes (minimum share of legumes), sixfoldrotation (crops can only repeat after 6 years), +# * agroecology (mix of previous scenarios), +# * betr0 (minimum share of short rotation agroforestry trees), betr10, betr20, betr25, betr30, betr40, betr50. # * In realization penalty_apr22: none (no incentives), default (best guess), fallow (increased fallow incentives), # * legumes (increased incentives for legumes), agroforestry (increased incentives for perennials), agroecology (mix) # * In realization endo_apr21: no scenarios exist. @@ -749,14 +750,6 @@ cfg$gms$s30_rotation_scenario_start <- 2020 # def = 2020 # * Target year (year when full implementation is reached): cfg$gms$s30_rotation_scenario_target <- 2050 # def = 2050 -# * Minimum share of bioenergy trees on total cropland area (including croparea, fallow land and tree cover). -# * s30_betr_min_shr is faded in linearly between s30_betr_scenario_start and s30_betr_scenario_target. -cfg$gms$s30_betr_min_shr <- 0 #def = 0 -# * Start year of tree cover share fade-in: -cfg$gms$s30_betr_scenario_start <- 2020 # def = 2020 -# * Target year (year when full implementation is reached): -cfg$gms$s30_betr_scenario_target <- 2040 # def = 2040 - # ***--------------------- 31_past --------------------------------------- # * (static): static pasture # * (endo_jun13): dynamic pasture diff --git a/modules/29_cropland/rulebased_apr24/declarations.gms b/modules/29_cropland/rulebased_apr24/declarations.gms index ee142ef286..86b2c02637 100644 --- a/modules/29_cropland/rulebased_apr24/declarations.gms +++ b/modules/29_cropland/rulebased_apr24/declarations.gms @@ -25,6 +25,9 @@ parameters p29_treecover_min_shr(t,j) Minimum share of treecover on cropland (1) p29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) + p29_fallow_min_shr(t,j) Minimum share of fallow land (1) + p29_fallow_scenario_fader(t_all) Fallow land scenario fader (1) + p29_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) p29_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) p29_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) @@ -48,10 +51,11 @@ equations q29_cost_cropland(j) Costs and benefits related to agroforestry (mio. USD05MER per yr) q29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) q29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + q29_fallow_shr(j) Fallow land share (mio. ha) q29_treecover_shr(j) Cropland treecover minimum share (mio. ha) q29_treecover_est(j,ac) Cropland treecover establishment (mio. ha) q29_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (mio. ha) - q29_fallow_bv(j,potnatveg) Biodiversity value for fallow land (mio. ha) + q29_fallow_bv(j,potnatveg) Biodiversity value for fallow land (mio. ha) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### @@ -69,6 +73,7 @@ parameters oq29_cost_cropland(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr) oq29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) oq29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + oq29_fallow_shr(t,j,type) Fallow land share (mio. ha) oq29_treecover_shr(t,j,type) Cropland treecover minimum share (mio. ha) oq29_treecover_est(t,j,ac,type) Cropland treecover establishment (mio. ha) oq29_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (mio. ha) diff --git a/modules/29_cropland/rulebased_apr24/equations.gms b/modules/29_cropland/rulebased_apr24/equations.gms index 9b6cbac2de..1f5649f9a2 100644 --- a/modules/29_cropland/rulebased_apr24/equations.gms +++ b/modules/29_cropland/rulebased_apr24/equations.gms @@ -34,7 +34,6 @@ sum(ct, p29_snv_shr(ct,j2)) * vm_land(j2,"crop") + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); - *' The semi-natural vegetation constraint for cropland areas has been suggested at the per square *' kilometer scale. The amount of cropland requiring relocation has therefore been derived from *' exogeneous high-resolution land cover information from the Copernicus Global Land Service @@ -52,10 +51,19 @@ + vm_fallow(j2) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)) + m_carbon_stock_ac(v29_treecover,p29_carbon_density_ac,"ac","ac_sub"); + +*' Total cost q29_cost_cropland(j2) .. vm_cost_cropland(j2) =e= v29_cost_treecover_est(j2) + v29_cost_treecover_recur(j2); + +*' Fallow land minimum share +q29_fallow_shr(j2) .. + vm_fallow(j2) =g= + sum(ct, p29_fallow_min_shr(ct,j2)) * vm_land(j2,"crop"); + + *' Tree cover establishment cost q29_cost_treecover_est(j2) .. v29_cost_treecover_est(j2) =e= diff --git a/modules/29_cropland/rulebased_apr24/input.gms b/modules/29_cropland/rulebased_apr24/input.gms index da26e33c3d..0cee55f7fa 100644 --- a/modules/29_cropland/rulebased_apr24/input.gms +++ b/modules/29_cropland/rulebased_apr24/input.gms @@ -21,8 +21,11 @@ scalars s29_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / s29_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / s29_treecover_scenario_start Cropland treecover scenario start year / 2020 / - s29_treecover_scenario_target Cropland treecover scenario target year / 2040 / + s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / s29_treecover_min_shr Share of treecover on cropland (1) / 0 / + s29_fallow_scenario_start Fallow land scenario start year / 2020 / + s29_fallow_scenario_target Fallow land scenario target year / 2050 / + s29_fallow_min_shr Share of fallow land (1) / 0 / ; diff --git a/modules/29_cropland/rulebased_apr24/postsolve.gms b/modules/29_cropland/rulebased_apr24/postsolve.gms index 2fb2d6991f..60c46e7c92 100644 --- a/modules/29_cropland/rulebased_apr24/postsolve.gms +++ b/modules/29_cropland/rulebased_apr24/postsolve.gms @@ -21,6 +21,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_cost_cropland(t,j,"marginal") = q29_cost_cropland.m(j); oq29_cost_treecover_est(t,j,"marginal") = q29_cost_treecover_est.m(j); oq29_cost_treecover_recur(t,j,"marginal") = q29_cost_treecover_recur.m(j); + oq29_fallow_shr(t,j,"marginal") = q29_fallow_shr.m(j); oq29_treecover_shr(t,j,"marginal") = q29_treecover_shr.m(j); oq29_treecover_est(t,j,ac,"marginal") = q29_treecover_est.m(j,ac); oq29_treecover_bv(t,j,potnatveg,"marginal") = q29_treecover_bv.m(j,potnatveg); @@ -38,6 +39,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_cost_cropland(t,j,"level") = q29_cost_cropland.l(j); oq29_cost_treecover_est(t,j,"level") = q29_cost_treecover_est.l(j); oq29_cost_treecover_recur(t,j,"level") = q29_cost_treecover_recur.l(j); + oq29_fallow_shr(t,j,"level") = q29_fallow_shr.l(j); oq29_treecover_shr(t,j,"level") = q29_treecover_shr.l(j); oq29_treecover_est(t,j,ac,"level") = q29_treecover_est.l(j,ac); oq29_treecover_bv(t,j,potnatveg,"level") = q29_treecover_bv.l(j,potnatveg); @@ -55,6 +57,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_cost_cropland(t,j,"upper") = q29_cost_cropland.up(j); oq29_cost_treecover_est(t,j,"upper") = q29_cost_treecover_est.up(j); oq29_cost_treecover_recur(t,j,"upper") = q29_cost_treecover_recur.up(j); + oq29_fallow_shr(t,j,"upper") = q29_fallow_shr.up(j); oq29_treecover_shr(t,j,"upper") = q29_treecover_shr.up(j); oq29_treecover_est(t,j,ac,"upper") = q29_treecover_est.up(j,ac); oq29_treecover_bv(t,j,potnatveg,"upper") = q29_treecover_bv.up(j,potnatveg); @@ -72,6 +75,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_cost_cropland(t,j,"lower") = q29_cost_cropland.lo(j); oq29_cost_treecover_est(t,j,"lower") = q29_cost_treecover_est.lo(j); oq29_cost_treecover_recur(t,j,"lower") = q29_cost_treecover_recur.lo(j); + oq29_fallow_shr(t,j,"lower") = q29_fallow_shr.lo(j); oq29_treecover_shr(t,j,"lower") = q29_treecover_shr.lo(j); oq29_treecover_est(t,j,ac,"lower") = q29_treecover_est.lo(j,ac); oq29_treecover_bv(t,j,potnatveg,"lower") = q29_treecover_bv.lo(j,potnatveg); diff --git a/modules/29_cropland/rulebased_apr24/preloop.gms b/modules/29_cropland/rulebased_apr24/preloop.gms index 3405958479..6ac9c3fee1 100644 --- a/modules/29_cropland/rulebased_apr24/preloop.gms +++ b/modules/29_cropland/rulebased_apr24/preloop.gms @@ -25,6 +25,7 @@ m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,s29_snv_reloc m_sigmoid_time_interpol(p29_treecover_scenario_fader,s29_treecover_scenario_start,s29_treecover_scenario_target,0,1); +m_sigmoid_time_interpol(p29_fallow_scenario_fader,s29_fallow_scenario_start,s29_fallow_scenario_target,0,1); * Initial tree cover on cropland is assumed to be equally distributed among all age-classes diff --git a/modules/29_cropland/rulebased_apr24/presolve.gms b/modules/29_cropland/rulebased_apr24/presolve.gms index 19a3b0a657..d53e7658cb 100644 --- a/modules/29_cropland/rulebased_apr24/presolve.gms +++ b/modules/29_cropland/rulebased_apr24/presolve.gms @@ -58,4 +58,6 @@ p29_treecover_min_shr(t,j) = ((1-p29_treecover_scenario_fader(t)) * sum(ac, pc29_treecover(j,ac))/pcm_land(j,"crop"))$(pcm_land(j,"crop") > 1e-10) + (p29_treecover_scenario_fader(t) * s29_treecover_min_shr); +p29_fallow_min_shr(t,j) = p29_fallow_scenario_fader(t) * s29_fallow_min_shr; + diff --git a/modules/30_crop/endo_apr21/declarations.gms b/modules/30_crop/endo_apr21/declarations.gms index fe0f504c4d..f3930b04c2 100644 --- a/modules/30_crop/endo_apr21/declarations.gms +++ b/modules/30_crop/endo_apr21/declarations.gms @@ -7,8 +7,6 @@ parameters p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) - p30_betr_scenario_fader(t_all) Bioenergy trees scenario fader (1) - p30_betr_min_shr(t,j) Minimum share of bioenergy trees on cropland (1) ; positive variables @@ -21,7 +19,6 @@ equations q30_prod(j,kcr) Production of cropped products (mio. tDM) q30_rotation_max(j,crp30,w) Local maximum rotational constraints (mio. ha) q30_rotation_min(j,crp30,w) Local minimum rotational constraints (mio. ha) - q30_betr_shr(j) Bioenergy trees minimum share (mio. ha) q30_carbon(j,ag_pools) Croplarea above ground carbon content calculation (mio. tC) q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) @@ -35,7 +32,6 @@ parameters oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) oq30_rotation_max(t,j,crp30,w,type) Local maximum rotational constraints (mio. ha) oq30_rotation_min(t,j,crp30,w,type) Local minimum rotational constraints (mio. ha) - oq30_betr_shr(t,j,type) Bioenergy trees minimum share (mio. ha) oq30_carbon(t,j,ag_pools,type) Croplarea above ground carbon content calculation (mio. tC) oq30_bv_ann(t,j,potnatveg,type) Biodiversity value of annual cropland (mio. ha) oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (mio. ha) diff --git a/modules/30_crop/endo_apr21/equations.gms b/modules/30_crop/endo_apr21/equations.gms index abb8d23f5e..626f0ce4a6 100644 --- a/modules/30_crop/endo_apr21/equations.gms +++ b/modules/30_crop/endo_apr21/equations.gms @@ -33,13 +33,6 @@ sum(kcr, vm_area(j2,kcr,w)) * f30_rotation_min_shr(crpmin30); -*' Bioenergy tree minimum share on cropland - -q30_betr_shr(j2) .. - sum(w, vm_area(j2,"betr",w)) =g= - sum(ct, p30_betr_min_shr(ct,j2)) * vm_land(j2,"crop"); - - *' The carbon stocks of the above ground carbon pools are calculated based on croparea and related carbon density. q30_carbon(j2,ag_pools) .. diff --git a/modules/30_crop/endo_apr21/input.gms b/modules/30_crop/endo_apr21/input.gms index 9910b3c134..aeacce22d7 100644 --- a/modules/30_crop/endo_apr21/input.gms +++ b/modules/30_crop/endo_apr21/input.gms @@ -17,9 +17,6 @@ $setglobal c30_rotation_constraints on scalars s30_rotation_scenario_start Rotation scenario start year / 2020 / s30_rotation_scenario_target Rotation scenario target year / 2050 / - s30_betr_min_shr Minimum share of bioenergy trees on cropland (1) / 0 / - s30_betr_scenario_start Bioenergy trees scenario start year / 2020 / - s30_betr_scenario_target Bioenergy trees scenario target year / 2040 / ; $ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes; diff --git a/modules/30_crop/endo_apr21/postsolve.gms b/modules/30_crop/endo_apr21/postsolve.gms index 99044317e0..a9ba060e13 100644 --- a/modules/30_crop/endo_apr21/postsolve.gms +++ b/modules/30_crop/endo_apr21/postsolve.gms @@ -13,7 +13,6 @@ oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); oq30_rotation_max(t,j,crp30,w,"marginal") = q30_rotation_max.m(j,crp30,w); oq30_rotation_min(t,j,crp30,w,"marginal") = q30_rotation_min.m(j,crp30,w); - oq30_betr_shr(t,j,"marginal") = q30_betr_shr.m(j); oq30_carbon(t,j,ag_pools,"marginal") = q30_carbon.m(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"marginal") = q30_bv_ann.m(j,potnatveg); oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg); @@ -23,7 +22,6 @@ oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); oq30_rotation_max(t,j,crp30,w,"level") = q30_rotation_max.l(j,crp30,w); oq30_rotation_min(t,j,crp30,w,"level") = q30_rotation_min.l(j,crp30,w); - oq30_betr_shr(t,j,"level") = q30_betr_shr.l(j); oq30_carbon(t,j,ag_pools,"level") = q30_carbon.l(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"level") = q30_bv_ann.l(j,potnatveg); oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg); @@ -33,7 +31,6 @@ oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); oq30_rotation_max(t,j,crp30,w,"upper") = q30_rotation_max.up(j,crp30,w); oq30_rotation_min(t,j,crp30,w,"upper") = q30_rotation_min.up(j,crp30,w); - oq30_betr_shr(t,j,"upper") = q30_betr_shr.up(j); oq30_carbon(t,j,ag_pools,"upper") = q30_carbon.up(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"upper") = q30_bv_ann.up(j,potnatveg); oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg); @@ -43,7 +40,6 @@ oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); oq30_rotation_max(t,j,crp30,w,"lower") = q30_rotation_max.lo(j,crp30,w); oq30_rotation_min(t,j,crp30,w,"lower") = q30_rotation_min.lo(j,crp30,w); - oq30_betr_shr(t,j,"lower") = q30_betr_shr.lo(j); oq30_carbon(t,j,ag_pools,"lower") = q30_carbon.lo(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"lower") = q30_bv_ann.lo(j,potnatveg); oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg); diff --git a/modules/30_crop/endo_apr21/preloop.gms b/modules/30_crop/endo_apr21/preloop.gms index a837359f18..4cfa6b7f3b 100644 --- a/modules/30_crop/endo_apr21/preloop.gms +++ b/modules/30_crop/endo_apr21/preloop.gms @@ -8,7 +8,6 @@ ** Trajectory for cropland scenarios * sigmoidal interpolation between start year and target year m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); -m_sigmoid_time_interpol(p30_betr_scenario_fader,s30_betr_scenario_start,s30_betr_scenario_target,0,1); *due to some rounding errors the input data currently may contain in some cases *very small, negative numbers. These numbers have to be set to 0 as area diff --git a/modules/30_crop/endo_apr21/presolve.gms b/modules/30_crop/endo_apr21/presolve.gms index 57661d9303..942042b0e9 100644 --- a/modules/30_crop/endo_apr21/presolve.gms +++ b/modules/30_crop/endo_apr21/presolve.gms @@ -25,5 +25,3 @@ vm_rotation_penalty.fx(i)=0; crpmax30(crp30) = yes$(f30_rotation_max_shr(crp30) < 1); crpmin30(crp30) = yes$(f30_rotation_min_shr(crp30) > 0); - -p30_betr_min_shr(t,j) = p30_betr_scenario_fader(t) * s30_betr_min_shr; diff --git a/modules/30_crop/penalty_apr22/sets.gms b/modules/30_crop/penalty_apr22/sets.gms index c03627a506..768e906278 100644 --- a/modules/30_crop/penalty_apr22/sets.gms +++ b/modules/30_crop/penalty_apr22/sets.gms @@ -7,22 +7,20 @@ sets rotascen30 rotation constraint scenarios - /none, default, fallow, legumes, agroforestry, agroecology/ + /none,default,legumes,betr500,betr1000,agroecology/ rota30 rotational rules - /all1_max, all2_max, - cereals1_max, cereals2_max, + /cereals1_max, cereals2_max, resistant_max, oilcrops_max, legumes_max, rootsrape_max, rice_pro_max, tece_max trce_max, maiz_max, biomass_min, legumes_min, - minor_min, cereals_min/ + minor_min, cereals_min, betr_min/ rotamax30(rota30) rotational maximum rules - /all1_max, all2_max, - cereals1_max, cereals2_max, + /cereals1_max, cereals2_max, resistant_max, oilcrops_max, legumes_max, rootsrape_max, rice_pro_max, tece_max @@ -30,7 +28,7 @@ sets / rotamin30(rota30) rotational minimum rules - /biomass_min, legumes_min, minor_min, cereals_min/ + /biomass_min, legumes_min, minor_min, cereals_min, betr_min/ rotamax_red30(rotamax30) Maximum crop rotation reduced set rotamin_red30(rotamin30) Minimum crop rotation reduced set @@ -49,13 +47,7 @@ sets * one percent fruits and vegs in each cell for regional demand rota_kcr30(rota30, kcr) Mapping of crop types into crop rotation types - / all1_max . (tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, - oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, - foddr, cottn_pro, begr, betr) - all2_max . (tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, - oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, - foddr, cottn_pro, begr, betr) - cereals1_max . (tece, maiz, trce, rice_pro) + / cereals1_max . (tece, maiz, trce, rice_pro) cereals2_max . (tece, maiz, trce, rice_pro) resistant_max . (begr,betr,foddr,sugr_cane,cottn_pro,oilpalm,others) oilcrops_max . (sunflower, rapeseed) @@ -69,9 +61,9 @@ sets legumes_min . (soybean, groundnut, puls_pro, foddr) minor_min . (sunflower, rapeseed, sugr_beet, cassav_sp, potato, others) cereals_min . (tece, maiz, trce, rice_pro) + betr_min . (betr) / - kbe30(kcr) bio energy activities / betr, begr / diff --git a/modules/30_crop/rotation_apr22/declarations.gms b/modules/30_crop/rotation_apr22/declarations.gms index 21611b7eb4..dc41cb568f 100644 --- a/modules/30_crop/rotation_apr22/declarations.gms +++ b/modules/30_crop/rotation_apr22/declarations.gms @@ -9,8 +9,6 @@ parameters i30_rotation_max_shr(t_all,rotamax30) Maximum share of a certain crop group on cropland (ha per ha) i30_rotation_min_shr(t_all,rotamin30) Minimum share of a certain crop group on cropland (ha per ha) p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) - p30_betr_scenario_fader(t_all) Bioenergy trees scenario fader (1) - p30_betr_min_shr(t,j) Minimum share of bioenergy trees on cropland (1) ; positive variables @@ -24,7 +22,6 @@ equations q30_rotation_max(j,rotamax30) Local maximum rotational constraints (mio. ha) q30_rotation_min(j,rotamin30) Local minimum rotational constraints (mio. ha) q30_rotation_max_irrig(j,rotamax30) Local maximum rotational constraints (mio. ha) - q30_betr_shr(j) Bioenergy trees minimum share (mio. ha) q30_carbon(j,ag_pools) Croplarea above ground carbon content calculation (mio. tC) q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) @@ -39,7 +36,6 @@ parameters oq30_rotation_max(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) oq30_rotation_min(t,j,rotamin30,type) Local minimum rotational constraints (mio. ha) oq30_rotation_max_irrig(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) - oq30_betr_shr(t,j,type) Bioenergy trees minimum share (mio. ha) oq30_carbon(t,j,ag_pools,type) Croplarea above ground carbon content calculation (mio. tC) oq30_bv_ann(t,j,potnatveg,type) Biodiversity value of annual cropland (mio. ha) oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (mio. ha) diff --git a/modules/30_crop/rotation_apr22/equations.gms b/modules/30_crop/rotation_apr22/equations.gms index 6f0eda73d1..3cd5ee574c 100644 --- a/modules/30_crop/rotation_apr22/equations.gms +++ b/modules/30_crop/rotation_apr22/equations.gms @@ -38,13 +38,6 @@ vm_AEI(j2) * sum(ct,i30_rotation_max_shr(ct,rotamax_red30)); -*' Bioenergy tree minimum share on cropland - -q30_betr_shr(j2) .. - sum(w, vm_area(j2,"betr",w)) =g= - sum(ct, p30_betr_min_shr(ct,j2)) * vm_land(j2,"crop"); - - *' The carbon stocks of the above ground carbon pools are calculated based on croparea and related carbon density. q30_carbon(j2,ag_pools) .. diff --git a/modules/30_crop/rotation_apr22/input.gms b/modules/30_crop/rotation_apr22/input.gms index 8d0f252920..97dfc19ca4 100644 --- a/modules/30_crop/rotation_apr22/input.gms +++ b/modules/30_crop/rotation_apr22/input.gms @@ -15,7 +15,8 @@ $setglobal c30_rotation_constraints on *options: on, off $setglobal c30_rotation_scenario default -*options: min,default,good,good_20div,setaside,legumes,agroforestry,sixfoldrotation,agroecology +*options: min,default,good,good_20div,setaside,legumes,betr0,betr10,betr20,betr25,betr30, +* betr40,betr50,sixfoldrotation,agroecology $setglobal c30_rotation_scenario_speed by2050 * options: none, by2030, by2020 @@ -23,9 +24,6 @@ $setglobal c30_rotation_scenario_speed by2050 scalars s30_rotation_scenario_start Rotation scenario start year / 2020 / s30_rotation_scenario_target Rotation scenario target year / 2050 / - s30_betr_min_shr Minimum share of bioenergy trees on cropland (1) / 0 / - s30_betr_scenario_start Bioenergy trees scenario start year / 2020 / - s30_betr_scenario_target Bioenergy trees scenario target year / 2050 / ; diff --git a/modules/30_crop/rotation_apr22/postsolve.gms b/modules/30_crop/rotation_apr22/postsolve.gms index 66c916304c..18031392c2 100644 --- a/modules/30_crop/rotation_apr22/postsolve.gms +++ b/modules/30_crop/rotation_apr22/postsolve.gms @@ -14,7 +14,6 @@ oq30_rotation_max(t,j,rotamax30,"marginal") = q30_rotation_max.m(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"marginal") = q30_rotation_min.m(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"marginal") = q30_rotation_max_irrig.m(j,rotamax30); - oq30_betr_shr(t,j,"marginal") = q30_betr_shr.m(j); oq30_carbon(t,j,ag_pools,"marginal") = q30_carbon.m(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"marginal") = q30_bv_ann.m(j,potnatveg); oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg); @@ -25,7 +24,6 @@ oq30_rotation_max(t,j,rotamax30,"level") = q30_rotation_max.l(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"level") = q30_rotation_min.l(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"level") = q30_rotation_max_irrig.l(j,rotamax30); - oq30_betr_shr(t,j,"level") = q30_betr_shr.l(j); oq30_carbon(t,j,ag_pools,"level") = q30_carbon.l(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"level") = q30_bv_ann.l(j,potnatveg); oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg); @@ -36,7 +34,6 @@ oq30_rotation_max(t,j,rotamax30,"upper") = q30_rotation_max.up(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"upper") = q30_rotation_min.up(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"upper") = q30_rotation_max_irrig.up(j,rotamax30); - oq30_betr_shr(t,j,"upper") = q30_betr_shr.up(j); oq30_carbon(t,j,ag_pools,"upper") = q30_carbon.up(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"upper") = q30_bv_ann.up(j,potnatveg); oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg); @@ -47,7 +44,6 @@ oq30_rotation_max(t,j,rotamax30,"lower") = q30_rotation_max.lo(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"lower") = q30_rotation_min.lo(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"lower") = q30_rotation_max_irrig.lo(j,rotamax30); - oq30_betr_shr(t,j,"lower") = q30_betr_shr.lo(j); oq30_carbon(t,j,ag_pools,"lower") = q30_carbon.lo(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"lower") = q30_bv_ann.lo(j,potnatveg); oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg); diff --git a/modules/30_crop/rotation_apr22/preloop.gms b/modules/30_crop/rotation_apr22/preloop.gms index 7c4e100664..df6a30816f 100644 --- a/modules/30_crop/rotation_apr22/preloop.gms +++ b/modules/30_crop/rotation_apr22/preloop.gms @@ -9,7 +9,6 @@ ** Trajectory for cropland scenarios * sigmoidal interpolation between start year and target year m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); -m_sigmoid_time_interpol(p30_betr_scenario_fader,s30_betr_scenario_start,s30_betr_scenario_target,0,1); ** create crop rotation scenario i30_rotation_max_shr(t_all,rotamax30)= diff --git a/modules/30_crop/rotation_apr22/presolve.gms b/modules/30_crop/rotation_apr22/presolve.gms index 97a83f26a8..1b847385d9 100644 --- a/modules/30_crop/rotation_apr22/presolve.gms +++ b/modules/30_crop/rotation_apr22/presolve.gms @@ -24,5 +24,3 @@ rotamax_red30(rotamax30) = yes$(i30_rotation_max_shr(t,rotamax30) < 1); rotamin_red30(rotamin30) = yes$(i30_rotation_min_shr(t,rotamin30) > 0); vm_rotation_penalty.fx(i)=0; - -p30_betr_min_shr(t,j) = p30_betr_scenario_fader(t) * s30_betr_min_shr; diff --git a/modules/30_crop/rotation_apr22/sets.gms b/modules/30_crop/rotation_apr22/sets.gms index e23397fecc..b8264aa0fd 100644 --- a/modules/30_crop/rotation_apr22/sets.gms +++ b/modules/30_crop/rotation_apr22/sets.gms @@ -7,7 +7,9 @@ sets rotascen30 rotation constraint scenarios - /min,default,good,good_20div,setaside,legumes,agroforestry,sixfoldrotation,agroecology/ + /min,default,good,good_20div,setaside,legumes, + betr0,betr10,betr20,betr25,betr30,betr40,betr50, + sixfoldrotation,agroecology/ rotamax30 Maximum crop rotation categories / all_max, cereals_excl_rice_max, stalk_max, @@ -22,7 +24,7 @@ sets rotamin30 Minimum crop rotation categories / all_min, stalk_min, biomass_min, - legume_min, others_min + legume_min, others_min, betr_min / rotamax_red30(rotamax30) Maximum crop rotation reduced set @@ -81,9 +83,9 @@ sets biomass_min . (sugr_cane, oilpalm, begr, betr) legume_min . (soybean, groundnut, puls_pro, foddr) others_min . (others) + betr_min . (betr) / - kbe30(kcr) bio energy activities / betr, begr / From 9b4b009d9a4c9f5f7bcb6397e0dcc0a253d8f3c6 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 20 Apr 2024 20:01:06 +0200 Subject: [PATCH 013/280] partial commit to save work --- modules/29_cropland/module.gms | 1 + .../penalty_apr24/declarations.gms | 96 ++++++++++++++ .../29_cropland/penalty_apr24/equations.gms | 124 ++++++++++++++++++ modules/29_cropland/penalty_apr24/input.gms | 96 ++++++++++++++ .../29_cropland/penalty_apr24/postsolve.gms | 108 +++++++++++++++ modules/29_cropland/penalty_apr24/preloop.gms | 58 ++++++++ .../29_cropland/penalty_apr24/presolve.gms | 66 ++++++++++ .../29_cropland/penalty_apr24/realization.gms | 20 +++ modules/29_cropland/penalty_apr24/sets.gms | 22 ++++ .../rulebased_apr24/declarations.gms | 17 ++- .../29_cropland/rulebased_apr24/equations.gms | 74 ++++++----- modules/29_cropland/rulebased_apr24/input.gms | 8 +- .../29_cropland/rulebased_apr24/preloop.gms | 19 +-- .../29_cropland/rulebased_apr24/presolve.gms | 18 +-- modules/30_crop/penalty_apr22/input.gms | 2 +- 15 files changed, 660 insertions(+), 69 deletions(-) create mode 100644 modules/29_cropland/penalty_apr24/declarations.gms create mode 100644 modules/29_cropland/penalty_apr24/equations.gms create mode 100644 modules/29_cropland/penalty_apr24/input.gms create mode 100644 modules/29_cropland/penalty_apr24/postsolve.gms create mode 100644 modules/29_cropland/penalty_apr24/preloop.gms create mode 100644 modules/29_cropland/penalty_apr24/presolve.gms create mode 100644 modules/29_cropland/penalty_apr24/realization.gms create mode 100644 modules/29_cropland/penalty_apr24/sets.gms diff --git a/modules/29_cropland/module.gms b/modules/29_cropland/module.gms index 7f406b8b7c..dc8cb77e50 100644 --- a/modules/29_cropland/module.gms +++ b/modules/29_cropland/module.gms @@ -14,5 +14,6 @@ *' @authors Florian Humpenöder *###################### R SECTION START (MODULETYPES) ########################## +$Ifi "%cropland%" == "penalty_apr24" $include "./modules/29_cropland/penalty_apr24/realization.gms" $Ifi "%cropland%" == "rulebased_apr24" $include "./modules/29_cropland/rulebased_apr24/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/29_cropland/penalty_apr24/declarations.gms b/modules/29_cropland/penalty_apr24/declarations.gms new file mode 100644 index 0000000000..86f165a043 --- /dev/null +++ b/modules/29_cropland/penalty_apr24/declarations.gms @@ -0,0 +1,96 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +scalars + s29_shift number of 5-year age-classes corresponding to current time step length (1) +; + + +parameters + p29_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) + p29_country_snv_weight(i) SNV policy country weight per region (1) + p29_snv_shr(t,j) Share of semi-natural vegetation in cropland areas (1) + i29_snv_relocation_target(j) Overall cropland area that requires relocation due to SNV policy (mio. ha) + p29_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha) + p29_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) + p29_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1) + i29_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) + i29_snv_scenario_fader(t_all) SNV scenario fader (1) + + i29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) + i29_treecover_target(t,j) Target share for treecover on total cropland (1) + i29_treecover_penalty(t_all) Penalty for violation of treecover target (USD05MER per ha) + + p29_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) + p29_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) + p29_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) + pc29_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) + + i29_fallow_scenario_fader(t_all) Fallow land scenario fader (1) + i29_fallow_target(t_all) Target share for fallow land on total cropland (1) + i29_fallow_penalty(t_all) Penalty for violation of fallow target (USD05MER per ha) +; + +positive variables + vm_fallow(j) Fallow land is temporarily fallow cropland (mio. ha) + v29_treecover(j,ac) Cropland tree cover per age class (mio. ha) + vm_cost_cropland(j) Cost for total cropland (mio. USD05MER per yr) + v29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) + v29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + v29_treecover_penalty(j) Penalty for violation of treecover target (mio. USD05MER per yr) + v29_treecover_missing(j) Missing treecover area towards target (mio. ha) + v29_fallow_penalty(j) Penalty for violation of fallow target (mio. USD05MER per yr) + v29_fallow_missing(j) Missing fallow land towards target (mio. ha) +; + +equations + q29_cropland(j) Total cropland calculation (mio. ha) + q29_avl_cropland(j) Available cropland constraint (mio. ha) + q29_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) + q29_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) + q29_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) + q29_cost_cropland(j) Costs and benefits related to agroforestry (mio. USD05MER per yr) + q29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) + q29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + q29_treecover_penalty(j) Penalty for violation of treecover target (mio. USD05MER per yr) + q29_treecover_missing(j) Missing treecover area towards target (mio. ha) + q29_treecover_est(j,ac) Cropland treecover establishment (mio. ha) + q29_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (mio. ha) + q29_fallow_bv(j,potnatveg) Biodiversity value for fallow land (mio. ha) + q29_fallow_penalty(j) Penalty for violation of fallow target (mio. USD05MER per yr) + q29_fallow_missing(j) Missing fallow land towards target (mio. ha) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_fallow(t,j,type) Fallow land is temporarily fallow cropland (mio. ha) + ov29_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) + ov_cost_cropland(t,j,type) Cost for total cropland (mio. USD05MER per yr) + ov29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) + ov29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + ov29_treecover_penalty(t,j,type) Penalty for violation of treecover target (mio. USD05MER per yr) + ov29_treecover_missing(t,j,type) Missing treecover area towards target (mio. ha) + ov29_fallow_penalty(t,j,type) Penalty for violation of fallow target (mio. USD05MER per yr) + ov29_fallow_missing(t,j,type) Missing fallow land towards target (mio. ha) + oq29_cropland(t,j,type) Total cropland calculation (mio. ha) + oq29_avl_cropland(t,j,type) Available cropland constraint (mio. ha) + oq29_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) + oq29_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) + oq29_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) + oq29_cost_cropland(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr) + oq29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) + oq29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + oq29_treecover_penalty(t,j,type) Penalty for violation of treecover target (mio. USD05MER per yr) + oq29_treecover_missing(t,j,type) Missing treecover area towards target (mio. ha) + oq29_treecover_est(t,j,ac,type) Cropland treecover establishment (mio. ha) + oq29_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (mio. ha) + oq29_fallow_bv(t,j,potnatveg,type) Biodiversity value for fallow land (mio. ha) + oq29_fallow_penalty(t,j,type) Penalty for violation of fallow target (mio. USD05MER per yr) + oq29_fallow_missing(t,j,type) Missing fallow land towards target (mio. ha) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + diff --git a/modules/29_cropland/penalty_apr24/equations.gms b/modules/29_cropland/penalty_apr24/equations.gms new file mode 100644 index 0000000000..8bfe211a1f --- /dev/null +++ b/modules/29_cropland/penalty_apr24/equations.gms @@ -0,0 +1,124 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @equations +*' Total cropland is calculated as the sum of croparea, fallow land and tree cover area. + + q29_cropland(j2) .. + vm_land(j2,"crop") =e= sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + sum(ac, v29_treecover(j2,ac)); + +*' We assume that crop production can only take place on suitable cropland area. +*' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas +*' from cropland production that have a low suitability, e.g. due to steep slopes, +*' to estimate the available cropland area. The cultivated area therefore has +*' to be smaller than the available cropland area. Moreover, the available cropland +*' can be reduced by constraining the cropland area in favour of other land types, +*' in order to increase compositional heterogeneity of land types at the cell level. + + q29_avl_cropland(j2) .. + vm_land(j2,"crop") =l= sum(ct, p29_avl_cropland(ct,j2)); + + +*' Total costs for the cropland module: + +q29_cost_cropland(j2) .. + vm_cost_cropland(j2) =e= + v29_cost_treecover_est(j2) + v29_cost_treecover_recur(j2) + + v29_fallow_penalty(j2) + v29_treecover_penalty(j2); + + +*' The carbon stocks of total cropland are calculated as the sum of carbon stocks in +*' cropland, fallow land and tree cover area. + + q29_carbon(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= + vm_carbon_stock_croparea(j2,ag_pools) + + vm_fallow(j2) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)) + + m_carbon_stock_ac(v29_treecover,p29_carbon_density_ac,"ac","ac_sub"); + + +*' The semi-natural land constraint in cropland areas for sustaining critical regulating NCP +*' for agricultural production is added on top of land conserved for other reasons +*' (e.g. conservation of intact ecosystems or protection of biodiversity hotspots). + + q29_land_snv(j2) .. + sum(land_snv, vm_land(j2,land_snv)) + =g= + sum(ct, p29_snv_shr(ct,j2)) * vm_land(j2,"crop") + + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); + +*' The semi-natural vegetation constraint for cropland areas has been suggested at the per square +*' kilometer scale. The amount of cropland requiring relocation has therefore been derived from +*' exogeneous high-resolution land cover information from the Copernicus Global Land Service +*' (@buchhorn_copernicus_2020). + + q29_land_snv_trans(j2) .. + sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p29_snv_relocation(ct,j2)); + + +*' A penalty is applied for the violation of fallow land rules. + +q29_fallow_penalty(j2) .. + v29_fallow_penalty(j2) + =g= + v29_fallow_missing(j2) * sum(ct, i29_fallow_penalty(ct)); + +*' The penalty applies to the missing fallow land, i.e. where fallow land +*' is lower than a certain fraction of total cropland. + + q29_fallow_missing(j2) .. + v29_fallow_missing(j2) + =g= + vm_land(j2,"crop") * sum(ct, i29_fallow_target(ct)) - vm_fallow(j2); + +*' Fallow land biodiversity value: + +q29_fallow_bv(j2,potnatveg) .. + vm_bv(j2,"crop_fallow",potnatveg) =e= + vm_fallow(j2) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + + +*' A penalty is applied for the violation of treecover rules. + +q29_treecover_penalty(j2) .. + v29_treecover_penalty(j2) + =g= + v29_treecover_missing(j2) * sum(ct, i29_treecover_penalty(ct)); + +*' The penalty applies to the missing treecover area, i.e. where treecover area +*' is lower than a certain fraction of total cropland. + + q29_treecover_missing(j2) .. + v29_treecover_missing(j2) + =g= + vm_land(j2,"crop") * sum(ct, i29_treecover_target(ct,j2)) - sum(ac, v29_treecover(j2,ac)); + + +*' Cropland tree cover biodiversity value: + +q29_treecover_bv(j2,potnatveg) .. + vm_bv(j2,"crop_tree",potnatveg) =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v29_treecover(j2,ac)) * + p29_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); + +*' Cropland tree cover annuity cost + +q29_cost_treecover_est(j2) .. + v29_cost_treecover_est(j2) =e= + sum(ac_est, v29_treecover(j2,ac_est)) * s29_cost_treecover_est * + sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); + +*' Cropland tree cover recurring cost + +q29_cost_treecover_recur(j2) .. + v29_cost_treecover_recur(j2) =e= + sum(ac_sub, v29_treecover(j2,ac_sub)) * s29_cost_treecover_recur; + +*' Cropland tree cover establishment rules: + +q29_treecover_est(j2,ac_est) .. + v29_treecover(j2,ac_est) =e= sum(ac_est2, v29_treecover(j2,ac_est2))/card(ac_est2); diff --git a/modules/29_cropland/penalty_apr24/input.gms b/modules/29_cropland/penalty_apr24/input.gms new file mode 100644 index 0000000000..ad8d2a60e8 --- /dev/null +++ b/modules/29_cropland/penalty_apr24/input.gms @@ -0,0 +1,96 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +$setglobal c29_marginal_land q33_marginal +* options: all_marginal, q33_marginal, no_marginal + +scalars + s29_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / + s29_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / + s29_snv_scenario_start SNV scenario start year / 2020 / + s29_snv_scenario_target SNV scenario target year / 2029 / + s29_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / + s29_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / + s29_cost_treecover_est Tree cover establishment cost (USD05MER per ha) / 2000 / + s29_cost_treecover_recur Tree cover recurring cost (USD05MER per ha) / 500 / + s29_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / + s29_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / + s29_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / + s29_treecover_scenario_start Cropland treecover scenario start year / 2020 / + s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / + s29_treecover_target Target share of treecover on total cropland (1) / 0.3 / + s29_treecover_penalty Penalty for violation of treecover target (USD05MER per ha) / 500 / + s29_fallow_scenario_start Fallow land scenario start year / 2020 / + s29_fallow_scenario_target Fallow land scenario target year / 2050 / + s29_fallow_target Target share of fallow land on total cropland (1) / 0.3 / + s29_fallow_penalty Penalty for violation of fallow target (USD05MER per ha) / 500 / +; + + +* Set-switch for countries affected by regional SNV policy +* Default: all iso countries selected +sets + policy_countries29(iso) countries to be affected by SNV policy / ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, + ASM,ATA,ATF,ATG,AUS,AUT,AZE,BDI,BEL,BEN, + BES,BFA,BGD,BGR,BHR,BHS,BIH,BLM,BLR,BLZ, + BMU,BOL,BRA,BRB,BRN,BTN,BVT,BWA,CAF,CAN, + CCK,CHN,CHE,CHL,CIV,CMR,COD,COG,COK,COL, + COM,CPV,CRI,CUB,CUW,CXR,CYM,CYP,CZE,DEU, + DJI,DMA,DNK,DOM,DZA,ECU,EGY,ERI,ESH,ESP, + EST,ETH,FIN,FJI,FLK,FRA,FRO,FSM,GAB,GBR, + GEO,GGY,GHA,GIB,GIN,GLP,GMB,GNB,GNQ,GRC, + GRD,GRL,GTM,GUF,GUM,GUY,HKG,HMD,HND,HRV, + HTI,HUN,IDN,IMN,IND,IOT,IRL,IRN,IRQ,ISL, + ISR,ITA,JAM,JEY,JOR,JPN,KAZ,KEN,KGZ,KHM, + KIR,KNA,KOR,KWT,LAO,LBN,LBR,LBY,LCA,LIE, + LKA,LSO,LTU,LUX,LVA,MAC,MAF,MAR,MCO,MDA, + MDG,MDV,MEX,MHL,MKD,MLI,MLT,MMR,MNE,MNG, + MNP,MOZ,MRT,MSR,MTQ,MUS,MWI,MYS,MYT,NAM, + NCL,NER,NFK,NGA,NIC,NIU,NLD,NOR,NPL,NRU, + NZL,OMN,PAK,PAN,PCN,PER,PHL,PLW,PNG,POL, + PRI,PRK,PRT,PRY,PSE,PYF,QAT,REU,ROU,RUS, + RWA,SAU,SDN,SEN,SGP,SGS,SHN,SJM,SLB,SLE, + SLV,SMR,SOM,SPM,SRB,SSD,STP,SUR,SVK,SVN, + SWE,SWZ,SXM,SYC,SYR,TCA,TCD,TGO,THA,TJK, + TKL,TKM,TLS,TON,TTO,TUN,TUR,TUV,TWN,TZA, + UGA,UKR,UMI,URY,USA,UZB,VAT,VCT,VEN,VGB, + VIR,VNM,VUT,WLF,WSM,YEM,ZAF,ZMB,ZWE / + +land_snv(land) land types allowed in the SNV policy / secdforest, forestry, past, other / +; + +********* AVAILABLE CROPLAND ******************************************* + +table f29_avl_cropland(j,marginal_land29) Available land area for cropland (mio. ha) +$ondelim +$include "./modules/29_cropland/input/avl_cropland.cs3" +$offdelim +; + +table f29_avl_cropland_iso(iso,marginal_land29) Available land area for cropland at ISO level (mio. ha) +$ondelim +$include "./modules/29_cropland/input/avl_cropland_iso.cs3" +$offdelim +; + +********* SNV TARGET CROPLAND ******************************************* + +table f29_snv_target_cropland(j,relocation_target29) Cropland in 2019 requiring relocation due to SNV policy (mio. ha) +$ondelim +$include "./modules/29_cropland/input/SNVTargetCropland.cs3" +$offdelim +; + +********* Cropland tree cover ******************************************* + +parameter f29_treecover(j) Tree cover on cropland in 2019 (mio. ha) +/ +$ondelim +$include "./modules/29_cropland/input/CroplandTreecover.cs2" +$offdelim +/ +; diff --git a/modules/29_cropland/penalty_apr24/postsolve.gms b/modules/29_cropland/penalty_apr24/postsolve.gms new file mode 100644 index 0000000000..32b9181e7d --- /dev/null +++ b/modules/29_cropland/penalty_apr24/postsolve.gms @@ -0,0 +1,108 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +pc29_treecover(j,ac) = v29_treecover.l(j,ac); + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov_fallow(t,j,"marginal") = vm_fallow.m(j); + ov29_treecover(t,j,ac,"marginal") = v29_treecover.m(j,ac); + ov_cost_cropland(t,j,"marginal") = vm_cost_cropland.m(j); + ov29_cost_treecover_est(t,j,"marginal") = v29_cost_treecover_est.m(j); + ov29_cost_treecover_recur(t,j,"marginal") = v29_cost_treecover_recur.m(j); + ov29_treecover_penalty(t,j,"marginal") = v29_treecover_penalty.m(j); + ov29_treecover_missing(t,j,"marginal") = v29_treecover_missing.m(j); + ov29_fallow_penalty(t,j,"marginal") = v29_fallow_penalty.m(j); + ov29_fallow_missing(t,j,"marginal") = v29_fallow_missing.m(j); + oq29_cropland(t,j,"marginal") = q29_cropland.m(j); + oq29_avl_cropland(t,j,"marginal") = q29_avl_cropland.m(j); + oq29_carbon(t,j,ag_pools,stockType,"marginal") = q29_carbon.m(j,ag_pools,stockType); + oq29_land_snv(t,j,"marginal") = q29_land_snv.m(j); + oq29_land_snv_trans(t,j,"marginal") = q29_land_snv_trans.m(j); + oq29_cost_cropland(t,j,"marginal") = q29_cost_cropland.m(j); + oq29_cost_treecover_est(t,j,"marginal") = q29_cost_treecover_est.m(j); + oq29_cost_treecover_recur(t,j,"marginal") = q29_cost_treecover_recur.m(j); + oq29_treecover_penalty(t,j,"marginal") = q29_treecover_penalty.m(j); + oq29_treecover_missing(t,j,"marginal") = q29_treecover_missing.m(j); + oq29_treecover_est(t,j,ac,"marginal") = q29_treecover_est.m(j,ac); + oq29_treecover_bv(t,j,potnatveg,"marginal") = q29_treecover_bv.m(j,potnatveg); + oq29_fallow_bv(t,j,potnatveg,"marginal") = q29_fallow_bv.m(j,potnatveg); + oq29_fallow_penalty(t,j,"marginal") = q29_fallow_penalty.m(j); + oq29_fallow_missing(t,j,"marginal") = q29_fallow_missing.m(j); + ov_fallow(t,j,"level") = vm_fallow.l(j); + ov29_treecover(t,j,ac,"level") = v29_treecover.l(j,ac); + ov_cost_cropland(t,j,"level") = vm_cost_cropland.l(j); + ov29_cost_treecover_est(t,j,"level") = v29_cost_treecover_est.l(j); + ov29_cost_treecover_recur(t,j,"level") = v29_cost_treecover_recur.l(j); + ov29_treecover_penalty(t,j,"level") = v29_treecover_penalty.l(j); + ov29_treecover_missing(t,j,"level") = v29_treecover_missing.l(j); + ov29_fallow_penalty(t,j,"level") = v29_fallow_penalty.l(j); + ov29_fallow_missing(t,j,"level") = v29_fallow_missing.l(j); + oq29_cropland(t,j,"level") = q29_cropland.l(j); + oq29_avl_cropland(t,j,"level") = q29_avl_cropland.l(j); + oq29_carbon(t,j,ag_pools,stockType,"level") = q29_carbon.l(j,ag_pools,stockType); + oq29_land_snv(t,j,"level") = q29_land_snv.l(j); + oq29_land_snv_trans(t,j,"level") = q29_land_snv_trans.l(j); + oq29_cost_cropland(t,j,"level") = q29_cost_cropland.l(j); + oq29_cost_treecover_est(t,j,"level") = q29_cost_treecover_est.l(j); + oq29_cost_treecover_recur(t,j,"level") = q29_cost_treecover_recur.l(j); + oq29_treecover_penalty(t,j,"level") = q29_treecover_penalty.l(j); + oq29_treecover_missing(t,j,"level") = q29_treecover_missing.l(j); + oq29_treecover_est(t,j,ac,"level") = q29_treecover_est.l(j,ac); + oq29_treecover_bv(t,j,potnatveg,"level") = q29_treecover_bv.l(j,potnatveg); + oq29_fallow_bv(t,j,potnatveg,"level") = q29_fallow_bv.l(j,potnatveg); + oq29_fallow_penalty(t,j,"level") = q29_fallow_penalty.l(j); + oq29_fallow_missing(t,j,"level") = q29_fallow_missing.l(j); + ov_fallow(t,j,"upper") = vm_fallow.up(j); + ov29_treecover(t,j,ac,"upper") = v29_treecover.up(j,ac); + ov_cost_cropland(t,j,"upper") = vm_cost_cropland.up(j); + ov29_cost_treecover_est(t,j,"upper") = v29_cost_treecover_est.up(j); + ov29_cost_treecover_recur(t,j,"upper") = v29_cost_treecover_recur.up(j); + ov29_treecover_penalty(t,j,"upper") = v29_treecover_penalty.up(j); + ov29_treecover_missing(t,j,"upper") = v29_treecover_missing.up(j); + ov29_fallow_penalty(t,j,"upper") = v29_fallow_penalty.up(j); + ov29_fallow_missing(t,j,"upper") = v29_fallow_missing.up(j); + oq29_cropland(t,j,"upper") = q29_cropland.up(j); + oq29_avl_cropland(t,j,"upper") = q29_avl_cropland.up(j); + oq29_carbon(t,j,ag_pools,stockType,"upper") = q29_carbon.up(j,ag_pools,stockType); + oq29_land_snv(t,j,"upper") = q29_land_snv.up(j); + oq29_land_snv_trans(t,j,"upper") = q29_land_snv_trans.up(j); + oq29_cost_cropland(t,j,"upper") = q29_cost_cropland.up(j); + oq29_cost_treecover_est(t,j,"upper") = q29_cost_treecover_est.up(j); + oq29_cost_treecover_recur(t,j,"upper") = q29_cost_treecover_recur.up(j); + oq29_treecover_penalty(t,j,"upper") = q29_treecover_penalty.up(j); + oq29_treecover_missing(t,j,"upper") = q29_treecover_missing.up(j); + oq29_treecover_est(t,j,ac,"upper") = q29_treecover_est.up(j,ac); + oq29_treecover_bv(t,j,potnatveg,"upper") = q29_treecover_bv.up(j,potnatveg); + oq29_fallow_bv(t,j,potnatveg,"upper") = q29_fallow_bv.up(j,potnatveg); + oq29_fallow_penalty(t,j,"upper") = q29_fallow_penalty.up(j); + oq29_fallow_missing(t,j,"upper") = q29_fallow_missing.up(j); + ov_fallow(t,j,"lower") = vm_fallow.lo(j); + ov29_treecover(t,j,ac,"lower") = v29_treecover.lo(j,ac); + ov_cost_cropland(t,j,"lower") = vm_cost_cropland.lo(j); + ov29_cost_treecover_est(t,j,"lower") = v29_cost_treecover_est.lo(j); + ov29_cost_treecover_recur(t,j,"lower") = v29_cost_treecover_recur.lo(j); + ov29_treecover_penalty(t,j,"lower") = v29_treecover_penalty.lo(j); + ov29_treecover_missing(t,j,"lower") = v29_treecover_missing.lo(j); + ov29_fallow_penalty(t,j,"lower") = v29_fallow_penalty.lo(j); + ov29_fallow_missing(t,j,"lower") = v29_fallow_missing.lo(j); + oq29_cropland(t,j,"lower") = q29_cropland.lo(j); + oq29_avl_cropland(t,j,"lower") = q29_avl_cropland.lo(j); + oq29_carbon(t,j,ag_pools,stockType,"lower") = q29_carbon.lo(j,ag_pools,stockType); + oq29_land_snv(t,j,"lower") = q29_land_snv.lo(j); + oq29_land_snv_trans(t,j,"lower") = q29_land_snv_trans.lo(j); + oq29_cost_cropland(t,j,"lower") = q29_cost_cropland.lo(j); + oq29_cost_treecover_est(t,j,"lower") = q29_cost_treecover_est.lo(j); + oq29_cost_treecover_recur(t,j,"lower") = q29_cost_treecover_recur.lo(j); + oq29_treecover_penalty(t,j,"lower") = q29_treecover_penalty.lo(j); + oq29_treecover_missing(t,j,"lower") = q29_treecover_missing.lo(j); + oq29_treecover_est(t,j,ac,"lower") = q29_treecover_est.lo(j,ac); + oq29_treecover_bv(t,j,potnatveg,"lower") = q29_treecover_bv.lo(j,potnatveg); + oq29_fallow_bv(t,j,potnatveg,"lower") = q29_fallow_bv.lo(j,potnatveg); + oq29_fallow_penalty(t,j,"lower") = q29_fallow_penalty.lo(j); + oq29_fallow_missing(t,j,"lower") = q29_fallow_missing.lo(j); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + diff --git a/modules/29_cropland/penalty_apr24/preloop.gms b/modules/29_cropland/penalty_apr24/preloop.gms new file mode 100644 index 0000000000..a7e39c8c8e --- /dev/null +++ b/modules/29_cropland/penalty_apr24/preloop.gms @@ -0,0 +1,58 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +** Trajectory for cropland scenarios +* sigmoidal interpolation between start year and target year +m_sigmoid_time_interpol(i29_snv_scenario_fader,s29_snv_scenario_start,s29_snv_scenario_target,0,1); +m_sigmoid_time_interpol(i29_treecover_scenario_fader,s29_treecover_scenario_start,s29_treecover_scenario_target,0,1); +m_sigmoid_time_interpol(i29_fallow_scenario_fader,s29_fallow_scenario_start,s29_fallow_scenario_target,0,1); + +* linear interpolation to estimate the cropland that +* requires relocation due to SNV policy +if (s29_snv_shr = 0, + i29_snv_relocation_target(j) = 0; +elseif s29_snv_shr <= s29_snv_relocation_data_x1, + m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,0,s29_snv_relocation_data_x1,0, f29_snv_target_cropland(j, "SNV20TargetCropland")); +elseif s29_snv_shr > s29_snv_relocation_data_x1, + m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,s29_snv_relocation_data_x1, s29_snv_relocation_data_x2,f29_snv_target_cropland(j, "SNV20TargetCropland"), f29_snv_target_cropland(j, "SNV50TargetCropland")); +); + + +* Initial tree cover on cropland is assumed to be equally distributed among all age-classes +pc29_treecover(j,ac) = 0; +pc29_treecover(j,ac)$(pm_land_hist("y2015",j,"crop") > 1e-10) = + (f29_treecover(j) / pm_land_hist("y2015",j,"crop") * pm_land_hist("y1995",j,"crop")) / card(ac); + + +*' Switch for tree cover on cropland: +*' 0 = Use natveg growth curve towards LPJmL natural vegetation +*' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation +if(s29_treecover_plantation = 0, + p29_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); +elseif s29_treecover_plantation = 1, + p29_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools); +); + +** set bii coefficients +p29_treecover_bii_coeff(bii_class_secd,potnatveg) = 0; +if(s29_treecover_bii_coeff = 0, + p29_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff(bii_class_secd,potnatveg) +elseif s29_treecover_bii_coeff = 1, + p29_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff("timber",potnatveg) +); + + +****** Regional share of semi-natural vegetation (SNV) in cropland areas for selective countries: +* Country switch to determine countries for which a SNV policy shall be applied. +* In the default case, the SNV policy affects all countries when activated. +p29_country_dummy(iso) = 0; +p29_country_dummy(policy_countries29) = 1; +* Because MAgPIE is not run at country-level, but at region level, a region +* share is calculated that translates the countries' influence to regional level. +* Countries are weighted by available cropland area. +i29_avl_cropland_iso(iso) = f29_avl_cropland_iso(iso,"%c29_marginal_land%"); +p29_country_snv_weight(i) = sum(i_to_iso(i,iso), p29_country_dummy(iso) * i29_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i29_avl_cropland_iso(iso)); diff --git a/modules/29_cropland/penalty_apr24/presolve.gms b/modules/29_cropland/penalty_apr24/presolve.gms new file mode 100644 index 0000000000..4fb606c500 --- /dev/null +++ b/modules/29_cropland/penalty_apr24/presolve.gms @@ -0,0 +1,66 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @code +*' Minimum semi-natural vegetation (SNV) share is fading in after 2020 +p29_snv_shr(t,j) = i29_snv_scenario_fader(t) * + (s29_snv_shr * sum(cell(i,j), p29_country_snv_weight(i)) + + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_snv_weight(i))); + +*' Cropland relocation in response to SNV policy is based on exogeneous land +*' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). +*' The rate of the policy implementation is derived based +*' on the difference of scenario fader values in consecutive time steps +p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * + (i29_snv_relocation_target(j) * sum(cell(i,j), p29_country_snv_weight(i)) + + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_snv_weight(i))); +*' The following lines take care of mismatches in the input +*' data (derived from satellite imagery from the Copernicus +*' Global Land Service (@buchhorn_copernicus_2020)) and in +*' cases of cropland reduction +p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * pcm_land(j,"crop"); +p29_snv_relocation(t,j)$(p29_snv_relocation(t, j) > p29_max_snv_relocation(t,j)) = p29_max_snv_relocation(t,j); + +*' Area potentially available for cropping +p29_avl_cropland(t,j) = f29_avl_cropland(j,"%c29_marginal_land%") * (1 - p29_snv_shr(t,j)); +*' @stop + + +* Growth of trees on cropland is modelled by shifting age-classes according to time step length. +s29_shift = m_timestep_length_forestry/5; +* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s29_shift = 1) + p29_treecover(t,j,ac)$(ord(ac) > s29_shift) = pc29_treecover(j,ac-s29_shift); +* account for cases at the end of the age class set (s29_shift > 1) which are not shifted by the above calculation + p29_treecover(t,j,"acx") = p29_treecover(t,j,"acx") + + sum(ac$(ord(ac) > card(ac)-s29_shift), pc29_treecover(j,ac)); + +pc29_treecover(j,ac) = p29_treecover(t,j,ac); +v29_treecover.l(j,ac) = p29_treecover(t,j,ac); + +if(m_year(t) <= s29_treecover_scenario_start, + v29_treecover.fx(j,ac) = pc29_treecover(j,ac); +else + v29_treecover.lo(j,ac_est) = 0; + v29_treecover.up(j,ac_est) = Inf; + if(s29_treecover_decrease = 1, + v29_treecover.lo(j,ac_sub) = 0; + v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); + else + v29_treecover.fx(j,ac_sub) = pc29_treecover(j,ac_sub); + ); +); + + +* create treecover target and penalty scenario +i29_treecover_target(t,j) = + ((1-i29_treecover_scenario_fader(t)) * sum(ac, pc29_treecover(j,ac))/pcm_land(j,"crop"))$(pcm_land(j,"crop") > 1e-10) + + (i29_treecover_scenario_fader(t) * s29_treecover_target); +i29_treecover_penalty(t_all) = s29_treecover_penalty * i29_treecover_scenario_fader(t_all); + +* create fallow land target and penalty scenario +i29_fallow_target(t_all) = s29_fallow_target * i29_fallow_scenario_fader(t_all); +i29_fallow_penalty(t_all) = s29_fallow_penalty * i29_fallow_scenario_fader(t_all); diff --git a/modules/29_cropland/penalty_apr24/realization.gms b/modules/29_cropland/penalty_apr24/realization.gms new file mode 100644 index 0000000000..3eaac0d2d8 --- /dev/null +++ b/modules/29_cropland/penalty_apr24/realization.gms @@ -0,0 +1,20 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @description todo + +*' @limitations todo + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/29_cropland/penalty_apr24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/29_cropland/penalty_apr24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/29_cropland/penalty_apr24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/29_cropland/penalty_apr24/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/29_cropland/penalty_apr24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/29_cropland/penalty_apr24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/29_cropland/penalty_apr24/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/29_cropland/penalty_apr24/sets.gms b/modules/29_cropland/penalty_apr24/sets.gms new file mode 100644 index 0000000000..ce67e81d5a --- /dev/null +++ b/modules/29_cropland/penalty_apr24/sets.gms @@ -0,0 +1,22 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +sets + + marginal_land29 Marginal land scenarios + / all_marginal, q33_marginal, no_marginal / + + policy_target29 Target year for cropland policy + / none, by2029, by2050 / + + relocation_target29 Cropland requiring relocation based on different SNV targets + / SNV20TargetCropland, SNV50TargetCropland / + + fallow29 fallow rules + / fallow20, fallow80 / + +; diff --git a/modules/29_cropland/rulebased_apr24/declarations.gms b/modules/29_cropland/rulebased_apr24/declarations.gms index 86b2c02637..bb538f8803 100644 --- a/modules/29_cropland/rulebased_apr24/declarations.gms +++ b/modules/29_cropland/rulebased_apr24/declarations.gms @@ -19,19 +19,18 @@ parameters p29_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) p29_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1) i29_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) - p29_snv_scenario_fader(t_all) SNV scenario fader (1) - p29_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) + i29_snv_scenario_fader(t_all) SNV scenario fader (1) - - p29_treecover_min_shr(t,j) Minimum share of treecover on cropland (1) - p29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) - p29_fallow_min_shr(t,j) Minimum share of fallow land (1) - p29_fallow_scenario_fader(t_all) Fallow land scenario fader (1) + i29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) + i29_treecover_target(t,j) Target share for treecover on total cropland (1) p29_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) p29_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) p29_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) pc29_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) + + i29_fallow_scenario_fader(t_all) Fallow land scenario fader (1) + i29_fallow_target(t_all) Target share for fallow land on total cropland (1) ; positive variables @@ -51,7 +50,7 @@ equations q29_cost_cropland(j) Costs and benefits related to agroforestry (mio. USD05MER per yr) q29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) q29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) - q29_fallow_shr(j) Fallow land share (mio. ha) + q29_fallow_shr(j) Fallow land minimum share (mio. ha) q29_treecover_shr(j) Cropland treecover minimum share (mio. ha) q29_treecover_est(j,ac) Cropland treecover establishment (mio. ha) q29_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (mio. ha) @@ -73,7 +72,7 @@ parameters oq29_cost_cropland(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr) oq29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) oq29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) - oq29_fallow_shr(t,j,type) Fallow land share (mio. ha) + oq29_fallow_shr(t,j,type) Fallow land minimum share (mio. ha) oq29_treecover_shr(t,j,type) Cropland treecover minimum share (mio. ha) oq29_treecover_est(t,j,ac,type) Cropland treecover establishment (mio. ha) oq29_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (mio. ha) diff --git a/modules/29_cropland/rulebased_apr24/equations.gms b/modules/29_cropland/rulebased_apr24/equations.gms index 1f5649f9a2..88f7bb1ab4 100644 --- a/modules/29_cropland/rulebased_apr24/equations.gms +++ b/modules/29_cropland/rulebased_apr24/equations.gms @@ -11,7 +11,6 @@ q29_cropland(j2) .. vm_land(j2,"crop") =e= sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + sum(ac, v29_treecover(j2,ac)); - *' We assume that crop production can only take place on suitable cropland area. *' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas *' from cropland production that have a low suitability, e.g. due to steep slopes, @@ -24,6 +23,23 @@ vm_land(j2,"crop") =l= sum(ct, p29_avl_cropland(ct,j2)); +*' Total costs for the cropland module: + +q29_cost_cropland(j2) .. + vm_cost_cropland(j2) =e= + v29_cost_treecover_est(j2) + v29_cost_treecover_recur(j2); + + +*' The carbon stocks of total cropland are calculated as the sum of carbon stocks in +*' cropland, fallow land and tree cover area. + + q29_carbon(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= + vm_carbon_stock_croparea(j2,ag_pools) + + vm_fallow(j2) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)) + + m_carbon_stock_ac(v29_treecover,p29_carbon_density_ac,"ac","ac_sub"); + + *' The semi-natural land constraint in cropland areas for sustaining critical regulating NCP *' for agricultural production is added on top of land conserved for other reasons *' (e.g. conservation of intact ecosystems or protection of biodiversity hotspots). @@ -43,54 +59,46 @@ sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p29_snv_relocation(ct,j2)); -*' The carbon stocks of total cropland are calculated as the sum of carbon stocks in cropland, fallow land and tree cover area. +*' Fallow land is greater or equal a certain share of total cropland: - q29_carbon(j2,ag_pools,stockType) .. - vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= - vm_carbon_stock_croparea(j2,ag_pools) - + vm_fallow(j2) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)) - + m_carbon_stock_ac(v29_treecover,p29_carbon_density_ac,"ac","ac_sub"); +q29_fallow_shr(j2) .. + vm_fallow(j2) =g= + sum(ct, i29_fallow_target(ct)) * vm_land(j2,"crop"); +*' Fallow land biodiversity value: -*' Total cost -q29_cost_cropland(j2) .. - vm_cost_cropland(j2) =e= - v29_cost_treecover_est(j2) + v29_cost_treecover_recur(j2); +q29_fallow_bv(j2,potnatveg) .. + vm_bv(j2,"crop_fallow",potnatveg) =e= + vm_fallow(j2) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); -*' Fallow land minimum share -q29_fallow_shr(j2) .. - vm_fallow(j2) =g= - sum(ct, p29_fallow_min_shr(ct,j2)) * vm_land(j2,"crop"); +*' Cropland tree cover is greater or equal a certain share of total cropland: + +q29_treecover_shr(j2) .. + sum(ac, v29_treecover(j2,ac)) =g= + sum(ct, i29_treecover_target(ct,j2)) * vm_land(j2,"crop"); + +*' Cropland tree cover biodiversity value: + +q29_treecover_bv(j2,potnatveg) .. + vm_bv(j2,"crop_tree",potnatveg) =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v29_treecover(j2,ac)) * + p29_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); +*' Cropland tree cover annuity cost -*' Tree cover establishment cost q29_cost_treecover_est(j2) .. v29_cost_treecover_est(j2) =e= sum(ac_est, v29_treecover(j2,ac_est)) * s29_cost_treecover_est * sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); -*' Tree cover recurring cost +*' Cropland tree cover recurring cost + q29_cost_treecover_recur(j2) .. v29_cost_treecover_recur(j2) =e= sum(ac_sub, v29_treecover(j2,ac_sub)) * s29_cost_treecover_recur; -*' Tree cover minimum share -q29_treecover_shr(j2) .. - sum(ac, v29_treecover(j2,ac)) =g= - sum(ct, p29_treecover_min_shr(ct,j2)) * vm_land(j2,"crop"); +*' Cropland tree cover establishment rules: -*' Tree cover establishment q29_treecover_est(j2,ac_est) .. v29_treecover(j2,ac_est) =e= sum(ac_est2, v29_treecover(j2,ac_est2))/card(ac_est2); - -*' Tree cover biodiversity value -q29_treecover_bv(j2,potnatveg) .. - vm_bv(j2,"crop_tree",potnatveg) =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v29_treecover(j2,ac)) * - p29_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); - -*' Tree cover biodiversity value -q29_fallow_bv(j2,potnatveg) .. - vm_bv(j2,"crop_fallow",potnatveg) =e= - vm_fallow(j2) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/29_cropland/rulebased_apr24/input.gms b/modules/29_cropland/rulebased_apr24/input.gms index 0cee55f7fa..232c4ceabc 100644 --- a/modules/29_cropland/rulebased_apr24/input.gms +++ b/modules/29_cropland/rulebased_apr24/input.gms @@ -15,17 +15,17 @@ scalars s29_snv_scenario_target SNV scenario target year / 2029 / s29_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / s29_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / - s29_cost_treecover_est Tree cover establishment cost (USD per ha) / 2000 / - s29_cost_treecover_recur Tree cover recurring cost (USD per ha) / 500 / + s29_cost_treecover_est Tree cover establishment cost (USD05MER per ha) / 2000 / + s29_cost_treecover_recur Tree cover recurring cost (USD05MER per ha) / 500 / s29_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / s29_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / s29_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / s29_treecover_scenario_start Cropland treecover scenario start year / 2020 / s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / - s29_treecover_min_shr Share of treecover on cropland (1) / 0 / + s29_treecover_target Target share of treecover on total cropland (1) / 0.3 / s29_fallow_scenario_start Fallow land scenario start year / 2020 / s29_fallow_scenario_target Fallow land scenario target year / 2050 / - s29_fallow_min_shr Share of fallow land (1) / 0 / + s29_fallow_target Target share of fallow land on total cropland (1) / 0.3 / ; diff --git a/modules/29_cropland/rulebased_apr24/preloop.gms b/modules/29_cropland/rulebased_apr24/preloop.gms index 6ac9c3fee1..cc295eccf7 100644 --- a/modules/29_cropland/rulebased_apr24/preloop.gms +++ b/modules/29_cropland/rulebased_apr24/preloop.gms @@ -5,29 +5,22 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -vm_fallow.fx(j) = 0; - ** Trajectory for cropland scenarios * sigmoidal interpolation between start year and target year -m_sigmoid_time_interpol(p29_snv_scenario_fader,s29_snv_scenario_start,s29_snv_scenario_target,0,1); +m_sigmoid_time_interpol(i29_snv_scenario_fader,s29_snv_scenario_start,s29_snv_scenario_target,0,1); +m_sigmoid_time_interpol(i29_treecover_scenario_fader,s29_treecover_scenario_start,s29_treecover_scenario_target,0,1); +m_sigmoid_time_interpol(i29_fallow_scenario_fader,s29_fallow_scenario_start,s29_fallow_scenario_target,0,1); * linear interpolation to estimate the cropland that * requires relocation due to SNV policy if (s29_snv_shr = 0, -i29_snv_relocation_target(j) = 0; - + i29_snv_relocation_target(j) = 0; elseif s29_snv_shr <= s29_snv_relocation_data_x1, -m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,0,s29_snv_relocation_data_x1,0, f29_snv_target_cropland(j, "SNV20TargetCropland")); - + m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,0,s29_snv_relocation_data_x1,0, f29_snv_target_cropland(j, "SNV20TargetCropland")); elseif s29_snv_shr > s29_snv_relocation_data_x1, -m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,s29_snv_relocation_data_x1, s29_snv_relocation_data_x2,f29_snv_target_cropland(j, "SNV20TargetCropland"), f29_snv_target_cropland(j, "SNV50TargetCropland")); + m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,s29_snv_relocation_data_x1, s29_snv_relocation_data_x2,f29_snv_target_cropland(j, "SNV20TargetCropland"), f29_snv_target_cropland(j, "SNV50TargetCropland")); ); - -m_sigmoid_time_interpol(p29_treecover_scenario_fader,s29_treecover_scenario_start,s29_treecover_scenario_target,0,1); -m_sigmoid_time_interpol(p29_fallow_scenario_fader,s29_fallow_scenario_start,s29_fallow_scenario_target,0,1); - - * Initial tree cover on cropland is assumed to be equally distributed among all age-classes pc29_treecover(j,ac) = 0; pc29_treecover(j,ac)$(pm_land_hist("y2015",j,"crop") > 1e-10) = diff --git a/modules/29_cropland/rulebased_apr24/presolve.gms b/modules/29_cropland/rulebased_apr24/presolve.gms index d53e7658cb..e4a8c98fc9 100644 --- a/modules/29_cropland/rulebased_apr24/presolve.gms +++ b/modules/29_cropland/rulebased_apr24/presolve.gms @@ -7,7 +7,7 @@ *' @code *' Minimum semi-natural vegetation (SNV) share is fading in after 2020 -p29_snv_shr(t,j) = p29_snv_scenario_fader(t) * +p29_snv_shr(t,j) = i29_snv_scenario_fader(t) * (s29_snv_shr * sum(cell(i,j), p29_country_snv_weight(i)) + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_snv_weight(i))); @@ -15,14 +15,14 @@ p29_snv_shr(t,j) = p29_snv_scenario_fader(t) * *' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). *' The rate of the policy implementation is derived based *' on the difference of scenario fader values in consecutive time steps -p29_snv_relocation(t,j) = (p29_snv_scenario_fader(t) - p29_snv_scenario_fader(t-1)) * +p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * (i29_snv_relocation_target(j) * sum(cell(i,j), p29_country_snv_weight(i)) + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_snv_weight(i))); *' The following lines take care of mismatches in the input *' data (derived from satellite imagery from the Copernicus *' Global Land Service (@buchhorn_copernicus_2020)) and in *' cases of cropland reduction -p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (p29_snv_scenario_fader(t) - p29_snv_scenario_fader(t-1)) * pcm_land(j,"crop"); +p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * pcm_land(j,"crop"); p29_snv_relocation(t,j)$(p29_snv_relocation(t, j) > p29_max_snv_relocation(t,j)) = p29_max_snv_relocation(t,j); *' Area potentially available for cropping @@ -54,10 +54,10 @@ else ); ); -p29_treecover_min_shr(t,j) = - ((1-p29_treecover_scenario_fader(t)) * sum(ac, pc29_treecover(j,ac))/pcm_land(j,"crop"))$(pcm_land(j,"crop") > 1e-10) + - (p29_treecover_scenario_fader(t) * s29_treecover_min_shr); - -p29_fallow_min_shr(t,j) = p29_fallow_scenario_fader(t) * s29_fallow_min_shr; - +* create treecover target and penalty scenario +i29_treecover_target(t,j) = + ((1-i29_treecover_scenario_fader(t)) * sum(ac, pc29_treecover(j,ac))/pcm_land(j,"crop"))$(pcm_land(j,"crop") > 1e-10) + + (i29_treecover_scenario_fader(t) * s29_treecover_target); +* create fallow land target and penalty scenario +i29_fallow_target(t_all) = s29_fallow_target * i29_fallow_scenario_fader(t_all); diff --git a/modules/30_crop/penalty_apr22/input.gms b/modules/30_crop/penalty_apr22/input.gms index 91befb168a..3cadd0b059 100644 --- a/modules/30_crop/penalty_apr22/input.gms +++ b/modules/30_crop/penalty_apr22/input.gms @@ -15,7 +15,7 @@ $setglobal c30_rotation_constraints on *options: on, off $setglobal c30_rotation_scenario default -*options: none, default, fallow, legumes, agroforestry, agroecology +*options: none, default, legumes, betr500, betr1000, agroecology $setglobal c30_rotation_scenario_speed by2050 * options: none, by2030, by2020 From 384526237f5c8fd2cd45b8a7e192f16cd948b515 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 20 Apr 2024 22:07:06 +0200 Subject: [PATCH 014/280] partial commit to save work --- config/default.cfg | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 65b72072a6..1e252da7fa 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -673,7 +673,7 @@ cfg$gms$ageclass <- "feb21" # def = feb21 # * Croparea is proved from 30_crop. # * Fallow land and tree cover are defined by 29_cropland, either exogenous via prescribed rules or endognous via monetary incentives. # * (rulebased_apr24): Fallow land and tree cover are prescribed by rules. -# * (incentive_apr24): Fallow land and tree cover develop endogenously based on monetary incentives +# * (penalty_apr24): Fallow land and tree cover are incentivized by penalties cfg$gms$cropland <- "rulebased_apr24" # def = rulebased_apr24 # * Switch to determine whether marginal land (suitability index below 0.33) should be included @@ -712,14 +712,25 @@ cfg$gms$policy_countries29 <- all_iso_countries # * "secdforest, past, other" etc. cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other" -# * Minimum share of treecover on cropland reached in s29_treecover_scenario_target: # * Minimum share of treecover on total cropland area (including croparea, fallow land and tree cover). -# * s29_treecover_min_shr is faded in linearly between s29_treecover_scenario_start and s29_treecover_scenario_target. -cfg$gms$s29_treecover_min_shr <- 0 #def = 0 +# * s29_treecover_target is faded in linearly between s29_treecover_scenario_start and s29_treecover_scenario_target. +cfg$gms$s29_treecover_target <- 0 #def = 0 # * Start year of tree cover share fade-in: cfg$gms$s29_treecover_scenario_start <- 2020 # def = 2020 # * Target year (year when full implementation is reached): -cfg$gms$s29_treecover_scenario_target <- 2040 # def = 2040 +cfg$gms$s29_treecover_scenario_target <- 2050 # def = 2050 +# * Penalty for violation of treecover target (only used in realization penalty_apr24) +cfg$gms$s29_treecover_penalty <- 0 #def = 0 + +# * Minimum share of fallow land on total cropland area (including croparea, fallow land and tree cover). +# * s29_fallow_target is faded in linearly between s29_fallow_scenario_start and s29_fallow_scenario_target. +cfg$gms$s29_fallow_target <- 0 #def = 0 +# * Start year of tree cover share fade-in: +cfg$gms$s29_fallow_scenario_start <- 2020 # def = 2020 +# * Target year (year when full implementation is reached): +cfg$gms$s29_fallow_scenario_target <- 2050 # def = 2050 +# * Penalty for violation of fallow target (only used in realization penalty_apr24) +cfg$gms$s29_fallow_penalty <- 0 #def = 0 # ***--------------------- 30_crop --------------------------------------- # * 30_crop defines the croparea, which is a subcomponent of total cropland defined in 29_cropland. @@ -740,8 +751,9 @@ cfg$gms$c30_rotation_constraints <- "on" # def = "on" # * legumes (minimum share of legumes), sixfoldrotation (crops can only repeat after 6 years), # * agroecology (mix of previous scenarios), # * betr0 (minimum share of short rotation agroforestry trees), betr10, betr20, betr25, betr30, betr40, betr50. -# * In realization penalty_apr22: none (no incentives), default (best guess), fallow (increased fallow incentives), -# * legumes (increased incentives for legumes), agroforestry (increased incentives for perennials), agroecology (mix) +# * In realization penalty_apr22: none (no incentives), default (best guess), +# * legumes (increased incentives for legumes), agroecology (mix), +# * betr500 and betr1000 (incentives for short rotation agroforestry trees) # * In realization endo_apr21: no scenarios exist. cfg$gms$c30_rotation_scenario <- "default" # def = "default" # * Year by which rotation scenario is fully implemented: From e7f8e4068e8bd5da3d46e1579b24de2bb5b2fbc8 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 20 Apr 2024 22:14:52 +0200 Subject: [PATCH 015/280] partial commit to save work --- config/scenario_config.csv | 6 +++--- config/scenario_fsec.csv | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config/scenario_config.csv b/config/scenario_config.csv index 4c1657a7d8..a514bfd165 100755 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -31,9 +31,9 @@ gms$c21_trade_liberalization;;;;l908080r807070;l909090r808080;l909090r808080;l90 gms$c22_protect_scenario;;;;none;none;none;none;none;none;BH;none;BH_IFL;BH;;;;;;;BH;;;;;BH_IFL;BH_IFL;BH_IFL;BH_IFL;BH_IFL;;;;;;;;;;;;;;;;;;; gms$c22_protect_scenario_noselect;;;;;;;;;;;;;;;;;;;;;;;;;none;none;BH_IFL;none;BH_IFL;;;;;;;;;;;;;;;;;;; gms$c30_bioen_water;;;;rainfed;rainfed;rainfed;rainfed;rainfed;rainfed;rainfed;all;rainfed;rainfed;;;;;;;rainfed;;;rainfed;all;;;;;;;;;;;;;;;;;;;;;;;; -gms$s30_snv_shr;;;;0;0;0;0;0;0;0;0;0;0.2;;;;;;;0;;;;;0.2;0.2;0.2;0.2;0.2;;;;;;;;;;;;;;;;;;; -gms$s30_snv_shr_noselect;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0.2;0;0.2;;;;;;;;;;;;;;;;;;; -gms$s30_snv_scenario_target;;;;;;;;;;;;;2030;;;;;;;;;;;;2030;2030;2030;2030;2030;;;;;;;;;;;;;;;;;;; +gms$s29_snv_shr;;;;0;0;0;0;0;0;0;0;0;0.2;;;;;;;0;;;;;0.2;0.2;0.2;0.2;0.2;;;;;;;;;;;;;;;;;;; +gms$s29_snv_shr_noselect;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0.2;0;0.2;;;;;;;;;;;;;;;;;;; +gms$s29_snv_scenario_target;;;;;;;;;;;;;2030;;;;;;;;;;;;2030;2030;2030;2030;2030;;;;;;;;;;;;;;;;;;; gms$c31_grassl_yld_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s32_aff_plantation;;;;0;0;0;0;0;0;0;1;0;0;;;;;;;0;;;0;1;;;;;;;;;;;;;;;;;;;;;;;; gms$s32_aff_bii_coeff;;;;0;0;0;0;0;0;0;1;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/config/scenario_fsec.csv b/config/scenario_fsec.csv index b4b96c2a90..8f6ee53db2 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -29,10 +29,10 @@ gms$c22_protect_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BH_IFL;;;;;;;;;;;;;;;;;;;;; gms$crop;penalty_apr22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c30_rotation_scenario;default;;;;;;;;;;;;;;;;;;;;;;;;;;;agroecology;;;;;;;;;;;;;;;;;;;;;;; gms$s30_rotation_scenario_target;2050;;;;;;;;;;;;;;;;;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;;;; -gms$c30_marginal_land;q33_marginal;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c29_marginal_land;q33_marginal;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c30_bioen_water;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rainfed;;;;;;;;;;;;;;;;;;;;; -gms$s30_snv_scenario_target;;;;;;;;;;;;;;;;;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;;;;; -gms$s30_snv_shr;;;;;;;;;;;;;;;;;;;;;;;;;;;0.2;;;;;;;;;;;;;;;;;;;;;;;; +gms$s29_snv_scenario_target;;;;;;;;;;;;;;;;;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;;;;; +gms$s29_snv_shr;;;;;;;;;;;;;;;;;;;;;;;;;;;0.2;;;;;;;;;;;;;;;;;;;;;;;; gms$past;endo_jun13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c32_aff_policy;ndc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c32_aff_mask;;;;;;;;;;;;;;;;;;;;;;;;;onlytropical;;;;;;;;;;;;;;;;;;;;;;;;;; From 3923e34c5d935e4f4afac374efb8bf78ca019d28 Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 21 Apr 2024 15:40:19 +0200 Subject: [PATCH 016/280] partial commit to save work --- config/default.cfg | 62 ++++++--- main.gms | 4 +- .../declarations.gms | 56 ++++---- .../29_cropland/detail_apr24/equations.gms | 131 ++++++++++++++++++ .../{penalty_apr24 => detail_apr24}/input.gms | 1 + .../postsolve.gms | 96 +++++++------ .../preloop.gms | 5 + .../presolve.gms | 0 .../29_cropland/detail_apr24/realization.gms | 31 +++++ .../{penalty_apr24 => detail_apr24}/sets.gms | 0 modules/29_cropland/module.gms | 9 +- .../29_cropland/penalty_apr24/equations.gms | 124 ----------------- .../29_cropland/penalty_apr24/realization.gms | 20 --- .../rulebased_apr24/declarations.gms | 82 ----------- .../29_cropland/rulebased_apr24/equations.gms | 104 -------------- modules/29_cropland/rulebased_apr24/input.gms | 94 ------------- .../29_cropland/rulebased_apr24/postsolve.gms | 84 ----------- .../29_cropland/rulebased_apr24/preloop.gms | 57 -------- .../29_cropland/rulebased_apr24/presolve.gms | 63 --------- .../rulebased_apr24/realization.gms | 20 --- .../29_cropland/simple_apr24/declarations.gms | 32 +++++ .../29_cropland/simple_apr24/equations.gms | 32 +++++ modules/29_cropland/simple_apr24/input.gms | 17 +++ modules/29_cropland/simple_apr24/not_used.txt | 11 ++ .../29_cropland/simple_apr24/postsolve.gms | 30 ++++ modules/29_cropland/simple_apr24/preloop.gms | 14 ++ modules/29_cropland/simple_apr24/presolve.gms | 6 + .../29_cropland/simple_apr24/realization.gms | 25 ++++ .../sets.gms | 6 - modules/30_crop/endo_apr21/realization.gms | 35 ----- modules/30_crop/penalty_apr22/equations.gms | 79 ----------- modules/30_crop/penalty_apr22/realization.gms | 40 ------ modules/30_crop/penalty_apr22/sets.gms | 79 ----------- .../30_crop/rotation_apr22/declarations.gms | 45 ------ modules/30_crop/rotation_apr22/equations.gms | 57 -------- modules/30_crop/rotation_apr22/input.gms | 63 --------- modules/30_crop/rotation_apr22/input/files | 4 - modules/30_crop/rotation_apr22/postsolve.gms | 50 ------- modules/30_crop/rotation_apr22/preloop.gms | 26 ---- modules/30_crop/rotation_apr22/presolve.gms | 26 ---- .../30_crop/rotation_apr22/realization.gms | 41 ------ modules/30_crop/rotation_apr22/sets.gms | 101 -------------- .../detail_apr24}/declarations.gms | 5 + .../30_croparea/detail_apr24/equations.gms | 83 +++++++++++ .../detail_apr24}/input.gms | 21 ++- .../detail_apr24}/input/files | 0 .../detail_apr24}/postsolve.gms | 8 ++ .../detail_apr24}/preloop.gms | 13 +- .../detail_apr24}/presolve.gms | 0 .../30_croparea/detail_apr24/realization.gms | 33 +++++ modules/30_croparea/detail_apr24/sets.gms | 114 +++++++++++++++ modules/{30_crop => 30_croparea}/module.gms | 5 +- .../simple_apr24}/declarations.gms | 0 .../simple_apr24}/equations.gms | 18 +-- .../simple_apr24}/input.gms | 6 +- .../simple_apr24}/input/files | 0 .../simple_apr24}/not_used.txt | 0 .../simple_apr24}/postsolve.gms | 0 .../simple_apr24}/preloop.gms | 0 .../simple_apr24}/presolve.gms | 0 .../30_croparea/simple_apr24/realization.gms | 28 ++++ .../simple_apr24}/sets.gms | 0 modules/include.gms | 2 +- 63 files changed, 771 insertions(+), 1427 deletions(-) rename modules/29_cropland/{penalty_apr24 => detail_apr24}/declarations.gms (92%) create mode 100644 modules/29_cropland/detail_apr24/equations.gms rename modules/29_cropland/{penalty_apr24 => detail_apr24}/input.gms (97%) rename modules/29_cropland/{penalty_apr24 => detail_apr24}/postsolve.gms (93%) rename modules/29_cropland/{penalty_apr24 => detail_apr24}/preloop.gms (97%) rename modules/29_cropland/{penalty_apr24 => detail_apr24}/presolve.gms (100%) create mode 100644 modules/29_cropland/detail_apr24/realization.gms rename modules/29_cropland/{penalty_apr24 => detail_apr24}/sets.gms (100%) delete mode 100644 modules/29_cropland/penalty_apr24/equations.gms delete mode 100644 modules/29_cropland/penalty_apr24/realization.gms delete mode 100644 modules/29_cropland/rulebased_apr24/declarations.gms delete mode 100644 modules/29_cropland/rulebased_apr24/equations.gms delete mode 100644 modules/29_cropland/rulebased_apr24/input.gms delete mode 100644 modules/29_cropland/rulebased_apr24/postsolve.gms delete mode 100644 modules/29_cropland/rulebased_apr24/preloop.gms delete mode 100644 modules/29_cropland/rulebased_apr24/presolve.gms delete mode 100644 modules/29_cropland/rulebased_apr24/realization.gms create mode 100644 modules/29_cropland/simple_apr24/declarations.gms create mode 100644 modules/29_cropland/simple_apr24/equations.gms create mode 100644 modules/29_cropland/simple_apr24/input.gms create mode 100644 modules/29_cropland/simple_apr24/not_used.txt create mode 100644 modules/29_cropland/simple_apr24/postsolve.gms create mode 100644 modules/29_cropland/simple_apr24/preloop.gms create mode 100644 modules/29_cropland/simple_apr24/presolve.gms create mode 100644 modules/29_cropland/simple_apr24/realization.gms rename modules/29_cropland/{rulebased_apr24 => simple_apr24}/sets.gms (70%) delete mode 100644 modules/30_crop/endo_apr21/realization.gms delete mode 100644 modules/30_crop/penalty_apr22/equations.gms delete mode 100644 modules/30_crop/penalty_apr22/realization.gms delete mode 100644 modules/30_crop/penalty_apr22/sets.gms delete mode 100644 modules/30_crop/rotation_apr22/declarations.gms delete mode 100644 modules/30_crop/rotation_apr22/equations.gms delete mode 100644 modules/30_crop/rotation_apr22/input.gms delete mode 100644 modules/30_crop/rotation_apr22/input/files delete mode 100644 modules/30_crop/rotation_apr22/postsolve.gms delete mode 100644 modules/30_crop/rotation_apr22/preloop.gms delete mode 100644 modules/30_crop/rotation_apr22/presolve.gms delete mode 100644 modules/30_crop/rotation_apr22/realization.gms delete mode 100644 modules/30_crop/rotation_apr22/sets.gms rename modules/{30_crop/penalty_apr22 => 30_croparea/detail_apr24}/declarations.gms (88%) create mode 100644 modules/30_croparea/detail_apr24/equations.gms rename modules/{30_crop/penalty_apr22 => 30_croparea/detail_apr24}/input.gms (66%) rename modules/{30_crop/penalty_apr22 => 30_croparea/detail_apr24}/input/files (100%) rename modules/{30_crop/penalty_apr22 => 30_croparea/detail_apr24}/postsolve.gms (87%) rename modules/{30_crop/penalty_apr22 => 30_croparea/detail_apr24}/preloop.gms (68%) rename modules/{30_crop/penalty_apr22 => 30_croparea/detail_apr24}/presolve.gms (100%) create mode 100644 modules/30_croparea/detail_apr24/realization.gms create mode 100644 modules/30_croparea/detail_apr24/sets.gms rename modules/{30_crop => 30_croparea}/module.gms (76%) rename modules/{30_crop/endo_apr21 => 30_croparea/simple_apr24}/declarations.gms (100%) rename modules/{30_crop/endo_apr21 => 30_croparea/simple_apr24}/equations.gms (73%) rename modules/{30_crop/endo_apr21 => 30_croparea/simple_apr24}/input.gms (87%) rename modules/{30_crop/endo_apr21 => 30_croparea/simple_apr24}/input/files (100%) rename modules/{30_crop/endo_apr21 => 30_croparea/simple_apr24}/not_used.txt (100%) rename modules/{30_crop/endo_apr21 => 30_croparea/simple_apr24}/postsolve.gms (100%) rename modules/{30_crop/endo_apr21 => 30_croparea/simple_apr24}/preloop.gms (100%) rename modules/{30_crop/endo_apr21 => 30_croparea/simple_apr24}/presolve.gms (100%) create mode 100644 modules/30_croparea/simple_apr24/realization.gms rename modules/{30_crop/endo_apr21 => 30_croparea/simple_apr24}/sets.gms (100%) diff --git a/config/default.cfg b/config/default.cfg index 1e252da7fa..22ec4d5252 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -669,12 +669,15 @@ cfg$gms$s22_conservation_target <- 2030 # def = 2030 cfg$gms$ageclass <- "feb21" # def = feb21 # ***--------------------- 29_cropland ----------------------------------- -# * Cropland is the sum of croparea, fallow land and tree cover -# * Croparea is proved from 30_crop. -# * Fallow land and tree cover are defined by 29_cropland, either exogenous via prescribed rules or endognous via monetary incentives. -# * (rulebased_apr24): Fallow land and tree cover are prescribed by rules. -# * (penalty_apr24): Fallow land and tree cover are incentivized by penalties -cfg$gms$cropland <- "rulebased_apr24" # def = rulebased_apr24 +# * Cropland is defined as the sum of croparea, fallow land and tree cover +# * Croparea is provided by 30_crop. +# * Fallow land and tree cover are defined by 29_cropland, +# * (simple_apr24): Fallow land is fixed to zero and tree cover on cropland does not exist, no SNV options +# * (detail_apr24): Fallow land and tree cover based on rules or incentives, SNV options included +# NOTE: It is recommended to recalibrate the model when changing this setting! +cfg$gms$cropland <- "detail_apr24" # def = detail_apr24 + +# *** Options for all cropland realizations *** # * Switch to determine whether marginal land (suitability index below 0.33) should be included # * in the total available cropland. Options are: @@ -685,6 +688,8 @@ cfg$gms$cropland <- "rulebased_apr24" # def = rulebased_apr24 # * with observed cropland patterns and is recommended for productive runs. cfg$gms$c29_marginal_land <- "q33_marginal" # def = "q33_marginal" +# *** Options only available for `detail_apr24` realization *** + # * Share of available cropland that is withheld for maintaining semi-natural vegetation (SNV) # * in each square km in cropland areas, including grassland, forest and other land. For example, # * a share of 0.2 corresponds to 20 % of SNV in terms of the available cropland. @@ -712,6 +717,9 @@ cfg$gms$policy_countries29 <- all_iso_countries # * "secdforest, past, other" etc. cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other" +# * Switch for rule-based (1) or penalty-based (0) implementation of fallow and treecover targets +cfg$gms$s29_implementation <- 1 # def = 1 + # * Minimum share of treecover on total cropland area (including croparea, fallow land and tree cover). # * s29_treecover_target is faded in linearly between s29_treecover_scenario_start and s29_treecover_scenario_target. cfg$gms$s29_treecover_target <- 0 #def = 0 @@ -719,7 +727,7 @@ cfg$gms$s29_treecover_target <- 0 #def = 0 cfg$gms$s29_treecover_scenario_start <- 2020 # def = 2020 # * Target year (year when full implementation is reached): cfg$gms$s29_treecover_scenario_target <- 2050 # def = 2050 -# * Penalty for violation of treecover target (only used in realization penalty_apr24) +# * Penalty for violation of treecover target cfg$gms$s29_treecover_penalty <- 0 #def = 0 # * Minimum share of fallow land on total cropland area (including croparea, fallow land and tree cover). @@ -729,33 +737,47 @@ cfg$gms$s29_fallow_target <- 0 #def = 0 cfg$gms$s29_fallow_scenario_start <- 2020 # def = 2020 # * Target year (year when full implementation is reached): cfg$gms$s29_fallow_scenario_target <- 2050 # def = 2050 -# * Penalty for violation of fallow target (only used in realization penalty_apr24) +# * Penalty for violation of fallow target cfg$gms$s29_fallow_penalty <- 0 #def = 0 -# ***--------------------- 30_crop --------------------------------------- -# * 30_crop defines the croparea, which is a subcomponent of total cropland defined in 29_cropland. -# * (endo_apr21): Hard rotational constraints. Dynamic cropland and detailed cropland availability data at grid cell level. -# * (rotation_apr22): hard rotational constraints and fallow constraints with the option of different future scenarios. Dynamic cropland and detailed cropland availability data at grid cell level. -# * (penalty_apr22): rotational and fallow constraints are incentivized via penalty payments. Dynamic cropland and detailed cropland availability data at grid cell level. +# ***--------------------- 30_croparea --------------------------------------- +# * 30_croparea defines the croparea, which is a subcomponent of total cropland defined in 29_cropland. +# * (simple_apr24): Dynamic croparea with simple rotational constraints +# * (detail_apr24): Dynamic croparea with detailed rules and incentives for rotational constraints # NOTE: It is recommended to recalibrate the model when changing this setting! -cfg$gms$crop <- "endo_apr21" # def = endo_apr21 +cfg$gms$croparea <- "simple_apr24" # def = simple_apr24 + +# *** Options for all croparea realizations *** + # * (c30_bioen_type): switch for type of bioenergy crops; options: begr, betr, all cfg$gms$c30_bioen_type <- "all" # def = "all" # * (c30_bioen_water): switch for irrigation of bioenergy crops; options: rainfed, irrigated, all cfg$gms$c30_bioen_water <- "rainfed" # def = "rainfed" + +# *** Options only available for `simple_apr24` realization *** + # * (c30_rotation_constraints): switch for rotational constraints: on, off cfg$gms$c30_rotation_constraints <- "on" # def = "on" -# * (c30_rotation_scenario): scenarios for constraints. -# * In realization rotation_apr22: min (minimal constraints), default (best guess), good (good practice), + +# *** Options only available for `detail_apr24` realization *** + +# * Switch for rule-based (1) or penalty-based (0) implementation of rotation scenarios +cfg$gms$s30_implementation <- 1 # def = 1 + +# * Rotation rules: +# * min (minimal constraints), default (best guess), good (good practice), # * good_20div (good practice - 20% for other crops), setaside (default plus fallow), # * legumes (minimum share of legumes), sixfoldrotation (crops can only repeat after 6 years), -# * agroecology (mix of previous scenarios), +# * agroecology (mix of previous scenarios), FSEC (similar to agroecology) # * betr0 (minimum share of short rotation agroforestry trees), betr10, betr20, betr25, betr30, betr40, betr50. -# * In realization penalty_apr22: none (no incentives), default (best guess), +cfg$gms$c30_rotation_rules <- "default" # def = "default" + +# * Rotation incentives: +# * none (no incentives), default (best guess), # * legumes (increased incentives for legumes), agroecology (mix), # * betr500 and betr1000 (incentives for short rotation agroforestry trees) -# * In realization endo_apr21: no scenarios exist. -cfg$gms$c30_rotation_scenario <- "default" # def = "default" +cfg$gms$c30_rotation_incentives <- "default" # def = "default" + # * Year by which rotation scenario is fully implemented: # * Start year: cfg$gms$s30_rotation_scenario_start <- 2020 # def = 2020 diff --git a/main.gms b/main.gms index c2a738f7b5..939c2a3839 100644 --- a/main.gms +++ b/main.gms @@ -249,8 +249,8 @@ $setglobal land_conservation area_based_apr22 $setglobal ageclass feb21 -$setglobal cropland rulebased_apr24 -$setglobal crop endo_apr21 +$setglobal cropland detail_apr24 +$setglobal croparea simple_apr24 $setglobal past endo_jun13 $setglobal forestry dynamic_feb21 diff --git a/modules/29_cropland/penalty_apr24/declarations.gms b/modules/29_cropland/detail_apr24/declarations.gms similarity index 92% rename from modules/29_cropland/penalty_apr24/declarations.gms rename to modules/29_cropland/detail_apr24/declarations.gms index 86f165a043..14405e207a 100644 --- a/modules/29_cropland/penalty_apr24/declarations.gms +++ b/modules/29_cropland/detail_apr24/declarations.gms @@ -9,7 +9,6 @@ scalars s29_shift number of 5-year age-classes corresponding to current time step length (1) ; - parameters p29_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) p29_country_snv_weight(i) SNV policy country weight per region (1) @@ -21,10 +20,9 @@ parameters i29_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) i29_snv_scenario_fader(t_all) SNV scenario fader (1) - i29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) - i29_treecover_target(t,j) Target share for treecover on total cropland (1) - i29_treecover_penalty(t_all) Penalty for violation of treecover target (USD05MER per ha) - + i29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) + i29_treecover_target(t,j) Target share for treecover on total cropland (1) + i29_treecover_penalty(t_all) Penalty for violation of treecover target (USD05MER per ha) p29_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) p29_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) p29_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) @@ -36,13 +34,13 @@ parameters ; positive variables - vm_fallow(j) Fallow land is temporarily fallow cropland (mio. ha) - v29_treecover(j,ac) Cropland tree cover per age class (mio. ha) vm_cost_cropland(j) Cost for total cropland (mio. USD05MER per yr) - v29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) - v29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + v29_treecover(j,ac) Cropland tree cover per age class (mio. ha) v29_treecover_penalty(j) Penalty for violation of treecover target (mio. USD05MER per yr) v29_treecover_missing(j) Missing treecover area towards target (mio. ha) + v29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) + v29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + vm_fallow(j) Fallow land is temporarily fallow cropland (mio. ha) v29_fallow_penalty(j) Penalty for violation of fallow target (mio. USD05MER per yr) v29_fallow_missing(j) Missing fallow land towards target (mio. ha) ; @@ -50,47 +48,51 @@ positive variables equations q29_cropland(j) Total cropland calculation (mio. ha) q29_avl_cropland(j) Available cropland constraint (mio. ha) + q29_cost_cropland(j) Costs and benefits related to agroforestry (mio. USD05MER per yr) q29_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) q29_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) q29_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) - q29_cost_cropland(j) Costs and benefits related to agroforestry (mio. USD05MER per yr) - q29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) - q29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + q29_fallow_shr(j) Fallow land minimum share (mio. ha) + q29_fallow_penalty(j) Penalty for violation of fallow target (mio. USD05MER per yr) + q29_fallow_missing(j) Missing fallow land towards target (mio. ha) + q29_fallow_bv(j,potnatveg) Biodiversity value for fallow land (mio. ha) + q29_treecover_shr(j) Cropland treecover minimum share (mio. ha) q29_treecover_penalty(j) Penalty for violation of treecover target (mio. USD05MER per yr) q29_treecover_missing(j) Missing treecover area towards target (mio. ha) - q29_treecover_est(j,ac) Cropland treecover establishment (mio. ha) q29_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (mio. ha) - q29_fallow_bv(j,potnatveg) Biodiversity value for fallow land (mio. ha) - q29_fallow_penalty(j) Penalty for violation of fallow target (mio. USD05MER per yr) - q29_fallow_missing(j) Missing fallow land towards target (mio. ha) + q29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) + q29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) + q29_treecover_est(j,ac) Cropland treecover establishment (mio. ha) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_fallow(t,j,type) Fallow land is temporarily fallow cropland (mio. ha) - ov29_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) ov_cost_cropland(t,j,type) Cost for total cropland (mio. USD05MER per yr) - ov29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) - ov29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + ov29_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) ov29_treecover_penalty(t,j,type) Penalty for violation of treecover target (mio. USD05MER per yr) ov29_treecover_missing(t,j,type) Missing treecover area towards target (mio. ha) + ov29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) + ov29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + ov_fallow(t,j,type) Fallow land is temporarily fallow cropland (mio. ha) ov29_fallow_penalty(t,j,type) Penalty for violation of fallow target (mio. USD05MER per yr) ov29_fallow_missing(t,j,type) Missing fallow land towards target (mio. ha) oq29_cropland(t,j,type) Total cropland calculation (mio. ha) oq29_avl_cropland(t,j,type) Available cropland constraint (mio. ha) + oq29_cost_cropland(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr) oq29_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) oq29_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) oq29_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) - oq29_cost_cropland(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr) - oq29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) - oq29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + oq29_fallow_shr(t,j,type) Fallow land minimum share (mio. ha) + oq29_fallow_penalty(t,j,type) Penalty for violation of fallow target (mio. USD05MER per yr) + oq29_fallow_missing(t,j,type) Missing fallow land towards target (mio. ha) + oq29_fallow_bv(t,j,potnatveg,type) Biodiversity value for fallow land (mio. ha) + oq29_treecover_shr(t,j,type) Cropland treecover minimum share (mio. ha) oq29_treecover_penalty(t,j,type) Penalty for violation of treecover target (mio. USD05MER per yr) oq29_treecover_missing(t,j,type) Missing treecover area towards target (mio. ha) - oq29_treecover_est(t,j,ac,type) Cropland treecover establishment (mio. ha) oq29_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (mio. ha) - oq29_fallow_bv(t,j,potnatveg,type) Biodiversity value for fallow land (mio. ha) - oq29_fallow_penalty(t,j,type) Penalty for violation of fallow target (mio. USD05MER per yr) - oq29_fallow_missing(t,j,type) Missing fallow land towards target (mio. ha) + oq29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) + oq29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) + oq29_treecover_est(t,j,ac,type) Cropland treecover establishment (mio. ha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/29_cropland/detail_apr24/equations.gms b/modules/29_cropland/detail_apr24/equations.gms new file mode 100644 index 0000000000..566441173f --- /dev/null +++ b/modules/29_cropland/detail_apr24/equations.gms @@ -0,0 +1,131 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @equations +*' Total cropland is calculated as the sum of croparea, fallow land and tree cover area. + + q29_cropland(j2) .. + vm_land(j2,"crop") =e= sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + sum(ac, v29_treecover(j2,ac)); + +*' We assume that crop production can only take place on suitable cropland area. +*' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas +*' from cropland production that have a low suitability, e.g. due to steep slopes, +*' to estimate the available cropland area. The cultivated area therefore has +*' to be smaller than the available cropland area. Moreover, the available cropland +*' can be reduced by constraining the cropland area in favour of other land types, +*' in order to increase compositional heterogeneity of land types at the cell level. + + q29_avl_cropland(j2) .. + vm_land(j2,"crop") =l= sum(ct, p29_avl_cropland(ct,j2)); + + +*' Total cost for the cropland module. + + q29_cost_cropland(j2) .. + vm_cost_cropland(j2) =e= + v29_cost_treecover_est(j2) + v29_cost_treecover_recur(j2) + + v29_fallow_penalty(j2) + v29_treecover_penalty(j2); + + +*' The carbon stocks of total cropland are calculated as the sum of carbon stocks in +*' cropland, fallow land and tree cover area. + + q29_carbon(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= + vm_carbon_stock_croparea(j2,ag_pools) + + vm_fallow(j2) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)) + + m_carbon_stock_ac(v29_treecover,p29_carbon_density_ac,"ac","ac_sub"); + + +*' The semi-natural land constraint in cropland areas for sustaining critical regulating NCP +*' for agricultural production is added on top of land conserved for other reasons +*' (e.g. conservation of intact ecosystems or protection of biodiversity hotspots). + + q29_land_snv(j2) .. + sum(land_snv, vm_land(j2,land_snv)) =g= + sum(ct, p29_snv_shr(ct,j2)) * vm_land(j2,"crop") + + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); + +*' The semi-natural vegetation constraint for cropland areas has been suggested at the per square +*' kilometer scale. The amount of cropland requiring relocation has therefore been derived from +*' exogeneous high-resolution land cover information from the Copernicus Global Land Service +*' (@buchhorn_copernicus_2020). + + q29_land_snv_trans(j2) .. + sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p29_snv_relocation(ct,j2)); + + +*' In case of no penalty, fallow land is greater or equal a certain fraction of total cropland: + + q29_fallow_shr(j2)$(s29_implementation = 1) .. + vm_fallow(j2) =g= + sum(ct, i29_fallow_target(ct)) * vm_land(j2,"crop"); + +*' Otherwise, a penalty is applied for the violation of fallow land rules. +*' The penalty applies to the missing fallow land, i.e. where fallow land +*' is lower than a certain fraction of total cropland. + + q29_fallow_missing(j2)$(s29_implementation = 0) .. + v29_fallow_missing(j2) =g= + vm_land(j2,"crop") * sum(ct, i29_fallow_target(ct)) - vm_fallow(j2); + + q29_fallow_penalty(j2) .. + v29_fallow_penalty(j2) =e= + v29_fallow_missing(j2) * sum(ct, i29_fallow_penalty(ct)); + + +*' Fallow land biodiversity value is based on perennial crops. + + q29_fallow_bv(j2,potnatveg) .. + vm_bv(j2,"crop_fallow",potnatveg) =e= + vm_fallow(j2) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + + +*' In case of no penalty, tree cover is greater or equal a certain fraction of total cropland. + + q29_treecover_shr(j2)$(s29_implementation = 1) .. + sum(ac, v29_treecover(j2,ac)) =g= + sum(ct, i29_treecover_target(ct,j2)) * vm_land(j2,"crop"); + +*' Otherwise, a penalty is applied for the violation of treecover rules. +*' The penalty applies to the missing treecover area, i.e. where treecover area +*' is lower than a certain fraction of total cropland. + + q29_treecover_missing(j2)$(s29_implementation = 0) .. + v29_treecover_missing(j2) =g= + vm_land(j2,"crop") * sum(ct, i29_treecover_target(ct,j2)) - sum(ac, v29_treecover(j2,ac)); + + q29_treecover_penalty(j2) .. + v29_treecover_penalty(j2) =e= + v29_treecover_missing(j2) * sum(ct, i29_treecover_penalty(ct)); + + +*' Depending on `s29_treecover_bii_coeff`, tree cover biodiversity value +*' is based on natural vegetation or plantation BII coefficients. + + q29_treecover_bv(j2,potnatveg) .. + vm_bv(j2,"crop_tree",potnatveg) =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v29_treecover(j2,ac)) * + p29_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); + +*' Cropland tree cover annuity cost. + + q29_cost_treecover_est(j2) .. + v29_cost_treecover_est(j2) =e= + sum(ac_est, v29_treecover(j2,ac_est)) * s29_cost_treecover_est * + sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); + +*' Cropland tree cover recurring cost. + + q29_cost_treecover_recur(j2) .. + v29_cost_treecover_recur(j2) =e= + sum(ac_sub, v29_treecover(j2,ac_sub)) * s29_cost_treecover_recur; + +*' Cropland tree cover establishment rules. + + q29_treecover_est(j2,ac_est) .. + v29_treecover(j2,ac_est) =e= sum(ac_est2, v29_treecover(j2,ac_est2))/card(ac_est2); diff --git a/modules/29_cropland/penalty_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms similarity index 97% rename from modules/29_cropland/penalty_apr24/input.gms rename to modules/29_cropland/detail_apr24/input.gms index ad8d2a60e8..f2458f3ece 100644 --- a/modules/29_cropland/penalty_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -28,6 +28,7 @@ scalars s29_fallow_scenario_target Fallow land scenario target year / 2050 / s29_fallow_target Target share of fallow land on total cropland (1) / 0.3 / s29_fallow_penalty Penalty for violation of fallow target (USD05MER per ha) / 500 / + s29_implementation Switch for rule-based (1) or penalty-based (0) implementation of fallow and treecover targets / 1 / ; diff --git a/modules/29_cropland/penalty_apr24/postsolve.gms b/modules/29_cropland/detail_apr24/postsolve.gms similarity index 93% rename from modules/29_cropland/penalty_apr24/postsolve.gms rename to modules/29_cropland/detail_apr24/postsolve.gms index 32b9181e7d..5070d341f2 100644 --- a/modules/29_cropland/penalty_apr24/postsolve.gms +++ b/modules/29_cropland/detail_apr24/postsolve.gms @@ -8,101 +8,109 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_fallow(t,j,"marginal") = vm_fallow.m(j); - ov29_treecover(t,j,ac,"marginal") = v29_treecover.m(j,ac); ov_cost_cropland(t,j,"marginal") = vm_cost_cropland.m(j); - ov29_cost_treecover_est(t,j,"marginal") = v29_cost_treecover_est.m(j); - ov29_cost_treecover_recur(t,j,"marginal") = v29_cost_treecover_recur.m(j); + ov29_treecover(t,j,ac,"marginal") = v29_treecover.m(j,ac); ov29_treecover_penalty(t,j,"marginal") = v29_treecover_penalty.m(j); ov29_treecover_missing(t,j,"marginal") = v29_treecover_missing.m(j); + ov29_cost_treecover_est(t,j,"marginal") = v29_cost_treecover_est.m(j); + ov29_cost_treecover_recur(t,j,"marginal") = v29_cost_treecover_recur.m(j); + ov_fallow(t,j,"marginal") = vm_fallow.m(j); ov29_fallow_penalty(t,j,"marginal") = v29_fallow_penalty.m(j); ov29_fallow_missing(t,j,"marginal") = v29_fallow_missing.m(j); oq29_cropland(t,j,"marginal") = q29_cropland.m(j); oq29_avl_cropland(t,j,"marginal") = q29_avl_cropland.m(j); + oq29_cost_cropland(t,j,"marginal") = q29_cost_cropland.m(j); oq29_carbon(t,j,ag_pools,stockType,"marginal") = q29_carbon.m(j,ag_pools,stockType); oq29_land_snv(t,j,"marginal") = q29_land_snv.m(j); oq29_land_snv_trans(t,j,"marginal") = q29_land_snv_trans.m(j); - oq29_cost_cropland(t,j,"marginal") = q29_cost_cropland.m(j); - oq29_cost_treecover_est(t,j,"marginal") = q29_cost_treecover_est.m(j); - oq29_cost_treecover_recur(t,j,"marginal") = q29_cost_treecover_recur.m(j); + oq29_fallow_shr(t,j,"marginal") = q29_fallow_shr.m(j); + oq29_fallow_penalty(t,j,"marginal") = q29_fallow_penalty.m(j); + oq29_fallow_missing(t,j,"marginal") = q29_fallow_missing.m(j); + oq29_fallow_bv(t,j,potnatveg,"marginal") = q29_fallow_bv.m(j,potnatveg); + oq29_treecover_shr(t,j,"marginal") = q29_treecover_shr.m(j); oq29_treecover_penalty(t,j,"marginal") = q29_treecover_penalty.m(j); oq29_treecover_missing(t,j,"marginal") = q29_treecover_missing.m(j); - oq29_treecover_est(t,j,ac,"marginal") = q29_treecover_est.m(j,ac); oq29_treecover_bv(t,j,potnatveg,"marginal") = q29_treecover_bv.m(j,potnatveg); - oq29_fallow_bv(t,j,potnatveg,"marginal") = q29_fallow_bv.m(j,potnatveg); - oq29_fallow_penalty(t,j,"marginal") = q29_fallow_penalty.m(j); - oq29_fallow_missing(t,j,"marginal") = q29_fallow_missing.m(j); - ov_fallow(t,j,"level") = vm_fallow.l(j); - ov29_treecover(t,j,ac,"level") = v29_treecover.l(j,ac); + oq29_cost_treecover_est(t,j,"marginal") = q29_cost_treecover_est.m(j); + oq29_cost_treecover_recur(t,j,"marginal") = q29_cost_treecover_recur.m(j); + oq29_treecover_est(t,j,ac,"marginal") = q29_treecover_est.m(j,ac); ov_cost_cropland(t,j,"level") = vm_cost_cropland.l(j); - ov29_cost_treecover_est(t,j,"level") = v29_cost_treecover_est.l(j); - ov29_cost_treecover_recur(t,j,"level") = v29_cost_treecover_recur.l(j); + ov29_treecover(t,j,ac,"level") = v29_treecover.l(j,ac); ov29_treecover_penalty(t,j,"level") = v29_treecover_penalty.l(j); ov29_treecover_missing(t,j,"level") = v29_treecover_missing.l(j); + ov29_cost_treecover_est(t,j,"level") = v29_cost_treecover_est.l(j); + ov29_cost_treecover_recur(t,j,"level") = v29_cost_treecover_recur.l(j); + ov_fallow(t,j,"level") = vm_fallow.l(j); ov29_fallow_penalty(t,j,"level") = v29_fallow_penalty.l(j); ov29_fallow_missing(t,j,"level") = v29_fallow_missing.l(j); oq29_cropland(t,j,"level") = q29_cropland.l(j); oq29_avl_cropland(t,j,"level") = q29_avl_cropland.l(j); + oq29_cost_cropland(t,j,"level") = q29_cost_cropland.l(j); oq29_carbon(t,j,ag_pools,stockType,"level") = q29_carbon.l(j,ag_pools,stockType); oq29_land_snv(t,j,"level") = q29_land_snv.l(j); oq29_land_snv_trans(t,j,"level") = q29_land_snv_trans.l(j); - oq29_cost_cropland(t,j,"level") = q29_cost_cropland.l(j); - oq29_cost_treecover_est(t,j,"level") = q29_cost_treecover_est.l(j); - oq29_cost_treecover_recur(t,j,"level") = q29_cost_treecover_recur.l(j); + oq29_fallow_shr(t,j,"level") = q29_fallow_shr.l(j); + oq29_fallow_penalty(t,j,"level") = q29_fallow_penalty.l(j); + oq29_fallow_missing(t,j,"level") = q29_fallow_missing.l(j); + oq29_fallow_bv(t,j,potnatveg,"level") = q29_fallow_bv.l(j,potnatveg); + oq29_treecover_shr(t,j,"level") = q29_treecover_shr.l(j); oq29_treecover_penalty(t,j,"level") = q29_treecover_penalty.l(j); oq29_treecover_missing(t,j,"level") = q29_treecover_missing.l(j); - oq29_treecover_est(t,j,ac,"level") = q29_treecover_est.l(j,ac); oq29_treecover_bv(t,j,potnatveg,"level") = q29_treecover_bv.l(j,potnatveg); - oq29_fallow_bv(t,j,potnatveg,"level") = q29_fallow_bv.l(j,potnatveg); - oq29_fallow_penalty(t,j,"level") = q29_fallow_penalty.l(j); - oq29_fallow_missing(t,j,"level") = q29_fallow_missing.l(j); - ov_fallow(t,j,"upper") = vm_fallow.up(j); - ov29_treecover(t,j,ac,"upper") = v29_treecover.up(j,ac); + oq29_cost_treecover_est(t,j,"level") = q29_cost_treecover_est.l(j); + oq29_cost_treecover_recur(t,j,"level") = q29_cost_treecover_recur.l(j); + oq29_treecover_est(t,j,ac,"level") = q29_treecover_est.l(j,ac); ov_cost_cropland(t,j,"upper") = vm_cost_cropland.up(j); - ov29_cost_treecover_est(t,j,"upper") = v29_cost_treecover_est.up(j); - ov29_cost_treecover_recur(t,j,"upper") = v29_cost_treecover_recur.up(j); + ov29_treecover(t,j,ac,"upper") = v29_treecover.up(j,ac); ov29_treecover_penalty(t,j,"upper") = v29_treecover_penalty.up(j); ov29_treecover_missing(t,j,"upper") = v29_treecover_missing.up(j); + ov29_cost_treecover_est(t,j,"upper") = v29_cost_treecover_est.up(j); + ov29_cost_treecover_recur(t,j,"upper") = v29_cost_treecover_recur.up(j); + ov_fallow(t,j,"upper") = vm_fallow.up(j); ov29_fallow_penalty(t,j,"upper") = v29_fallow_penalty.up(j); ov29_fallow_missing(t,j,"upper") = v29_fallow_missing.up(j); oq29_cropland(t,j,"upper") = q29_cropland.up(j); oq29_avl_cropland(t,j,"upper") = q29_avl_cropland.up(j); + oq29_cost_cropland(t,j,"upper") = q29_cost_cropland.up(j); oq29_carbon(t,j,ag_pools,stockType,"upper") = q29_carbon.up(j,ag_pools,stockType); oq29_land_snv(t,j,"upper") = q29_land_snv.up(j); oq29_land_snv_trans(t,j,"upper") = q29_land_snv_trans.up(j); - oq29_cost_cropland(t,j,"upper") = q29_cost_cropland.up(j); - oq29_cost_treecover_est(t,j,"upper") = q29_cost_treecover_est.up(j); - oq29_cost_treecover_recur(t,j,"upper") = q29_cost_treecover_recur.up(j); + oq29_fallow_shr(t,j,"upper") = q29_fallow_shr.up(j); + oq29_fallow_penalty(t,j,"upper") = q29_fallow_penalty.up(j); + oq29_fallow_missing(t,j,"upper") = q29_fallow_missing.up(j); + oq29_fallow_bv(t,j,potnatveg,"upper") = q29_fallow_bv.up(j,potnatveg); + oq29_treecover_shr(t,j,"upper") = q29_treecover_shr.up(j); oq29_treecover_penalty(t,j,"upper") = q29_treecover_penalty.up(j); oq29_treecover_missing(t,j,"upper") = q29_treecover_missing.up(j); - oq29_treecover_est(t,j,ac,"upper") = q29_treecover_est.up(j,ac); oq29_treecover_bv(t,j,potnatveg,"upper") = q29_treecover_bv.up(j,potnatveg); - oq29_fallow_bv(t,j,potnatveg,"upper") = q29_fallow_bv.up(j,potnatveg); - oq29_fallow_penalty(t,j,"upper") = q29_fallow_penalty.up(j); - oq29_fallow_missing(t,j,"upper") = q29_fallow_missing.up(j); - ov_fallow(t,j,"lower") = vm_fallow.lo(j); - ov29_treecover(t,j,ac,"lower") = v29_treecover.lo(j,ac); + oq29_cost_treecover_est(t,j,"upper") = q29_cost_treecover_est.up(j); + oq29_cost_treecover_recur(t,j,"upper") = q29_cost_treecover_recur.up(j); + oq29_treecover_est(t,j,ac,"upper") = q29_treecover_est.up(j,ac); ov_cost_cropland(t,j,"lower") = vm_cost_cropland.lo(j); - ov29_cost_treecover_est(t,j,"lower") = v29_cost_treecover_est.lo(j); - ov29_cost_treecover_recur(t,j,"lower") = v29_cost_treecover_recur.lo(j); + ov29_treecover(t,j,ac,"lower") = v29_treecover.lo(j,ac); ov29_treecover_penalty(t,j,"lower") = v29_treecover_penalty.lo(j); ov29_treecover_missing(t,j,"lower") = v29_treecover_missing.lo(j); + ov29_cost_treecover_est(t,j,"lower") = v29_cost_treecover_est.lo(j); + ov29_cost_treecover_recur(t,j,"lower") = v29_cost_treecover_recur.lo(j); + ov_fallow(t,j,"lower") = vm_fallow.lo(j); ov29_fallow_penalty(t,j,"lower") = v29_fallow_penalty.lo(j); ov29_fallow_missing(t,j,"lower") = v29_fallow_missing.lo(j); oq29_cropland(t,j,"lower") = q29_cropland.lo(j); oq29_avl_cropland(t,j,"lower") = q29_avl_cropland.lo(j); + oq29_cost_cropland(t,j,"lower") = q29_cost_cropland.lo(j); oq29_carbon(t,j,ag_pools,stockType,"lower") = q29_carbon.lo(j,ag_pools,stockType); oq29_land_snv(t,j,"lower") = q29_land_snv.lo(j); oq29_land_snv_trans(t,j,"lower") = q29_land_snv_trans.lo(j); - oq29_cost_cropland(t,j,"lower") = q29_cost_cropland.lo(j); - oq29_cost_treecover_est(t,j,"lower") = q29_cost_treecover_est.lo(j); - oq29_cost_treecover_recur(t,j,"lower") = q29_cost_treecover_recur.lo(j); + oq29_fallow_shr(t,j,"lower") = q29_fallow_shr.lo(j); + oq29_fallow_penalty(t,j,"lower") = q29_fallow_penalty.lo(j); + oq29_fallow_missing(t,j,"lower") = q29_fallow_missing.lo(j); + oq29_fallow_bv(t,j,potnatveg,"lower") = q29_fallow_bv.lo(j,potnatveg); + oq29_treecover_shr(t,j,"lower") = q29_treecover_shr.lo(j); oq29_treecover_penalty(t,j,"lower") = q29_treecover_penalty.lo(j); oq29_treecover_missing(t,j,"lower") = q29_treecover_missing.lo(j); - oq29_treecover_est(t,j,ac,"lower") = q29_treecover_est.lo(j,ac); oq29_treecover_bv(t,j,potnatveg,"lower") = q29_treecover_bv.lo(j,potnatveg); - oq29_fallow_bv(t,j,potnatveg,"lower") = q29_fallow_bv.lo(j,potnatveg); - oq29_fallow_penalty(t,j,"lower") = q29_fallow_penalty.lo(j); - oq29_fallow_missing(t,j,"lower") = q29_fallow_missing.lo(j); + oq29_cost_treecover_est(t,j,"lower") = q29_cost_treecover_est.lo(j); + oq29_cost_treecover_recur(t,j,"lower") = q29_cost_treecover_recur.lo(j); + oq29_treecover_est(t,j,ac,"lower") = q29_treecover_est.lo(j,ac); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/29_cropland/penalty_apr24/preloop.gms b/modules/29_cropland/detail_apr24/preloop.gms similarity index 97% rename from modules/29_cropland/penalty_apr24/preloop.gms rename to modules/29_cropland/detail_apr24/preloop.gms index a7e39c8c8e..e245094629 100644 --- a/modules/29_cropland/penalty_apr24/preloop.gms +++ b/modules/29_cropland/detail_apr24/preloop.gms @@ -56,3 +56,8 @@ p29_country_dummy(policy_countries29) = 1; * Countries are weighted by available cropland area. i29_avl_cropland_iso(iso) = f29_avl_cropland_iso(iso,"%c29_marginal_land%"); p29_country_snv_weight(i) = sum(i_to_iso(i,iso), p29_country_dummy(iso) * i29_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i29_avl_cropland_iso(iso)); + +if(s29_implementation = 1, + v29_treecover_missing.fx(j) = 0; + v29_fallow_missing.fx(j) = 0; +); diff --git a/modules/29_cropland/penalty_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms similarity index 100% rename from modules/29_cropland/penalty_apr24/presolve.gms rename to modules/29_cropland/detail_apr24/presolve.gms diff --git a/modules/29_cropland/detail_apr24/realization.gms b/modules/29_cropland/detail_apr24/realization.gms new file mode 100644 index 0000000000..071000bd1e --- /dev/null +++ b/modules/29_cropland/detail_apr24/realization.gms @@ -0,0 +1,31 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @description In this realization, total cropland equals the sum of croparea, +*' fallow land and tree cover on cropland. Correspondingly, cropland carbon stocks consist +*' of carbons stocks for croparea, fallow land and tree cover on cropland. +*' The development of fallow land and tree cover on cropland depends on targets defined +*' as a certain fraction of total cropland. These targets can be either exogenously enforced +*' (rule-based) or endogenously incentivized by a penalty term, which enters the objective function. + +*' This realisation also includes the option to reserve a minimum semi-natural +*' vegetation share within the total available cropland for other land cover +*' classes, including grassland, forest, and other land (by a given target year), +*' in order to provide species habitats and to benefit from ecosystem ervices in +*' agricultural landscapes. + +*' @limitations There are currently no known limitations of this realization. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/29_cropland/detail_apr24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/29_cropland/detail_apr24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/29_cropland/detail_apr24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/29_cropland/detail_apr24/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/29_cropland/detail_apr24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/29_cropland/detail_apr24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/29_cropland/detail_apr24/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/29_cropland/penalty_apr24/sets.gms b/modules/29_cropland/detail_apr24/sets.gms similarity index 100% rename from modules/29_cropland/penalty_apr24/sets.gms rename to modules/29_cropland/detail_apr24/sets.gms diff --git a/modules/29_cropland/module.gms b/modules/29_cropland/module.gms index dc8cb77e50..e330dbc7e6 100644 --- a/modules/29_cropland/module.gms +++ b/modules/29_cropland/module.gms @@ -7,13 +7,14 @@ *' @title Cropland -*' @description Cropland is the sum of croparea, fallow land and tree cover. Croparea is provided from [30_crop]. -*' Fallow land and tree cover are defined in this module, either exogenous via prescribed rules or endognous via monetary incentives. +*' @description Cropland is defined as the sum of croparea, fallow land and tree cover on cropland. +*' Croparea and corresponding carbon stocks are provided from [30_crop]. +*' Area and carbon stocks for fallow land and tree cover are defined in this module. *' @authors Florian Humpenöder *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%cropland%" == "penalty_apr24" $include "./modules/29_cropland/penalty_apr24/realization.gms" -$Ifi "%cropland%" == "rulebased_apr24" $include "./modules/29_cropland/rulebased_apr24/realization.gms" +$Ifi "%cropland%" == "detail_apr24" $include "./modules/29_cropland/detail_apr24/realization.gms" +$Ifi "%cropland%" == "simple_apr24" $include "./modules/29_cropland/simple_apr24/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/29_cropland/penalty_apr24/equations.gms b/modules/29_cropland/penalty_apr24/equations.gms deleted file mode 100644 index 8bfe211a1f..0000000000 --- a/modules/29_cropland/penalty_apr24/equations.gms +++ /dev/null @@ -1,124 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @equations -*' Total cropland is calculated as the sum of croparea, fallow land and tree cover area. - - q29_cropland(j2) .. - vm_land(j2,"crop") =e= sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + sum(ac, v29_treecover(j2,ac)); - -*' We assume that crop production can only take place on suitable cropland area. -*' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas -*' from cropland production that have a low suitability, e.g. due to steep slopes, -*' to estimate the available cropland area. The cultivated area therefore has -*' to be smaller than the available cropland area. Moreover, the available cropland -*' can be reduced by constraining the cropland area in favour of other land types, -*' in order to increase compositional heterogeneity of land types at the cell level. - - q29_avl_cropland(j2) .. - vm_land(j2,"crop") =l= sum(ct, p29_avl_cropland(ct,j2)); - - -*' Total costs for the cropland module: - -q29_cost_cropland(j2) .. - vm_cost_cropland(j2) =e= - v29_cost_treecover_est(j2) + v29_cost_treecover_recur(j2) - + v29_fallow_penalty(j2) + v29_treecover_penalty(j2); - - -*' The carbon stocks of total cropland are calculated as the sum of carbon stocks in -*' cropland, fallow land and tree cover area. - - q29_carbon(j2,ag_pools,stockType) .. - vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= - vm_carbon_stock_croparea(j2,ag_pools) - + vm_fallow(j2) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)) - + m_carbon_stock_ac(v29_treecover,p29_carbon_density_ac,"ac","ac_sub"); - - -*' The semi-natural land constraint in cropland areas for sustaining critical regulating NCP -*' for agricultural production is added on top of land conserved for other reasons -*' (e.g. conservation of intact ecosystems or protection of biodiversity hotspots). - - q29_land_snv(j2) .. - sum(land_snv, vm_land(j2,land_snv)) - =g= - sum(ct, p29_snv_shr(ct,j2)) * vm_land(j2,"crop") - + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); - -*' The semi-natural vegetation constraint for cropland areas has been suggested at the per square -*' kilometer scale. The amount of cropland requiring relocation has therefore been derived from -*' exogeneous high-resolution land cover information from the Copernicus Global Land Service -*' (@buchhorn_copernicus_2020). - - q29_land_snv_trans(j2) .. - sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p29_snv_relocation(ct,j2)); - - -*' A penalty is applied for the violation of fallow land rules. - -q29_fallow_penalty(j2) .. - v29_fallow_penalty(j2) - =g= - v29_fallow_missing(j2) * sum(ct, i29_fallow_penalty(ct)); - -*' The penalty applies to the missing fallow land, i.e. where fallow land -*' is lower than a certain fraction of total cropland. - - q29_fallow_missing(j2) .. - v29_fallow_missing(j2) - =g= - vm_land(j2,"crop") * sum(ct, i29_fallow_target(ct)) - vm_fallow(j2); - -*' Fallow land biodiversity value: - -q29_fallow_bv(j2,potnatveg) .. - vm_bv(j2,"crop_fallow",potnatveg) =e= - vm_fallow(j2) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); - - -*' A penalty is applied for the violation of treecover rules. - -q29_treecover_penalty(j2) .. - v29_treecover_penalty(j2) - =g= - v29_treecover_missing(j2) * sum(ct, i29_treecover_penalty(ct)); - -*' The penalty applies to the missing treecover area, i.e. where treecover area -*' is lower than a certain fraction of total cropland. - - q29_treecover_missing(j2) .. - v29_treecover_missing(j2) - =g= - vm_land(j2,"crop") * sum(ct, i29_treecover_target(ct,j2)) - sum(ac, v29_treecover(j2,ac)); - - -*' Cropland tree cover biodiversity value: - -q29_treecover_bv(j2,potnatveg) .. - vm_bv(j2,"crop_tree",potnatveg) =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v29_treecover(j2,ac)) * - p29_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); - -*' Cropland tree cover annuity cost - -q29_cost_treecover_est(j2) .. - v29_cost_treecover_est(j2) =e= - sum(ac_est, v29_treecover(j2,ac_est)) * s29_cost_treecover_est * - sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); - -*' Cropland tree cover recurring cost - -q29_cost_treecover_recur(j2) .. - v29_cost_treecover_recur(j2) =e= - sum(ac_sub, v29_treecover(j2,ac_sub)) * s29_cost_treecover_recur; - -*' Cropland tree cover establishment rules: - -q29_treecover_est(j2,ac_est) .. - v29_treecover(j2,ac_est) =e= sum(ac_est2, v29_treecover(j2,ac_est2))/card(ac_est2); diff --git a/modules/29_cropland/penalty_apr24/realization.gms b/modules/29_cropland/penalty_apr24/realization.gms deleted file mode 100644 index 3eaac0d2d8..0000000000 --- a/modules/29_cropland/penalty_apr24/realization.gms +++ /dev/null @@ -1,20 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description todo - -*' @limitations todo - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/29_cropland/penalty_apr24/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/29_cropland/penalty_apr24/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/29_cropland/penalty_apr24/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/29_cropland/penalty_apr24/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/29_cropland/penalty_apr24/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/29_cropland/penalty_apr24/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/29_cropland/penalty_apr24/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/29_cropland/rulebased_apr24/declarations.gms b/modules/29_cropland/rulebased_apr24/declarations.gms deleted file mode 100644 index bb538f8803..0000000000 --- a/modules/29_cropland/rulebased_apr24/declarations.gms +++ /dev/null @@ -1,82 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -scalars - s29_shift number of 5-year age-classes corresponding to current time step length (1) -; - - -parameters - p29_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) - p29_country_snv_weight(i) SNV policy country weight per region (1) - p29_snv_shr(t,j) Share of semi-natural vegetation in cropland areas (1) - i29_snv_relocation_target(j) Overall cropland area that requires relocation due to SNV policy (mio. ha) - p29_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha) - p29_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) - p29_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1) - i29_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) - i29_snv_scenario_fader(t_all) SNV scenario fader (1) - - i29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) - i29_treecover_target(t,j) Target share for treecover on total cropland (1) - - p29_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) - p29_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) - p29_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) - pc29_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) - - i29_fallow_scenario_fader(t_all) Fallow land scenario fader (1) - i29_fallow_target(t_all) Target share for fallow land on total cropland (1) -; - -positive variables - vm_fallow(j) Fallow land is temporarily fallow cropland (mio. ha) - v29_treecover(j,ac) Cropland tree cover per age class (mio. ha) - vm_cost_cropland(j) Cost for total cropland (mio. USD05MER per yr) - v29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) - v29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) -; - -equations - q29_cropland(j) Total cropland calculation (mio. ha) - q29_avl_cropland(j) Available cropland constraint (mio. ha) - q29_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) - q29_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) - q29_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) - q29_cost_cropland(j) Costs and benefits related to agroforestry (mio. USD05MER per yr) - q29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) - q29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) - q29_fallow_shr(j) Fallow land minimum share (mio. ha) - q29_treecover_shr(j) Cropland treecover minimum share (mio. ha) - q29_treecover_est(j,ac) Cropland treecover establishment (mio. ha) - q29_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (mio. ha) - q29_fallow_bv(j,potnatveg) Biodiversity value for fallow land (mio. ha) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_fallow(t,j,type) Fallow land is temporarily fallow cropland (mio. ha) - ov29_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) - ov_cost_cropland(t,j,type) Cost for total cropland (mio. USD05MER per yr) - ov29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) - ov29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) - oq29_cropland(t,j,type) Total cropland calculation (mio. ha) - oq29_avl_cropland(t,j,type) Available cropland constraint (mio. ha) - oq29_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) - oq29_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) - oq29_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) - oq29_cost_cropland(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr) - oq29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) - oq29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) - oq29_fallow_shr(t,j,type) Fallow land minimum share (mio. ha) - oq29_treecover_shr(t,j,type) Cropland treecover minimum share (mio. ha) - oq29_treecover_est(t,j,ac,type) Cropland treecover establishment (mio. ha) - oq29_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (mio. ha) - oq29_fallow_bv(t,j,potnatveg,type) Biodiversity value for fallow land (mio. ha) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### - diff --git a/modules/29_cropland/rulebased_apr24/equations.gms b/modules/29_cropland/rulebased_apr24/equations.gms deleted file mode 100644 index 88f7bb1ab4..0000000000 --- a/modules/29_cropland/rulebased_apr24/equations.gms +++ /dev/null @@ -1,104 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @equations -*' Total cropland is calculated as the sum of croparea, fallow land and tree cover area. - - q29_cropland(j2) .. - vm_land(j2,"crop") =e= sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + sum(ac, v29_treecover(j2,ac)); - -*' We assume that crop production can only take place on suitable cropland area. -*' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas -*' from cropland production that have a low suitability, e.g. due to steep slopes, -*' to estimate the available cropland area. The cultivated area therefore has -*' to be smaller than the available cropland area. Moreover, the available cropland -*' can be reduced by constraining the cropland area in favour of other land types, -*' in order to increase compositional heterogeneity of land types at the cell level. - - q29_avl_cropland(j2) .. - vm_land(j2,"crop") =l= sum(ct, p29_avl_cropland(ct,j2)); - - -*' Total costs for the cropland module: - -q29_cost_cropland(j2) .. - vm_cost_cropland(j2) =e= - v29_cost_treecover_est(j2) + v29_cost_treecover_recur(j2); - - -*' The carbon stocks of total cropland are calculated as the sum of carbon stocks in -*' cropland, fallow land and tree cover area. - - q29_carbon(j2,ag_pools,stockType) .. - vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= - vm_carbon_stock_croparea(j2,ag_pools) - + vm_fallow(j2) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)) - + m_carbon_stock_ac(v29_treecover,p29_carbon_density_ac,"ac","ac_sub"); - - -*' The semi-natural land constraint in cropland areas for sustaining critical regulating NCP -*' for agricultural production is added on top of land conserved for other reasons -*' (e.g. conservation of intact ecosystems or protection of biodiversity hotspots). - - q29_land_snv(j2) .. - sum(land_snv, vm_land(j2,land_snv)) - =g= - sum(ct, p29_snv_shr(ct,j2)) * vm_land(j2,"crop") - + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); - -*' The semi-natural vegetation constraint for cropland areas has been suggested at the per square -*' kilometer scale. The amount of cropland requiring relocation has therefore been derived from -*' exogeneous high-resolution land cover information from the Copernicus Global Land Service -*' (@buchhorn_copernicus_2020). - - q29_land_snv_trans(j2) .. - sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p29_snv_relocation(ct,j2)); - - -*' Fallow land is greater or equal a certain share of total cropland: - -q29_fallow_shr(j2) .. - vm_fallow(j2) =g= - sum(ct, i29_fallow_target(ct)) * vm_land(j2,"crop"); - -*' Fallow land biodiversity value: - -q29_fallow_bv(j2,potnatveg) .. - vm_bv(j2,"crop_fallow",potnatveg) =e= - vm_fallow(j2) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); - - -*' Cropland tree cover is greater or equal a certain share of total cropland: - -q29_treecover_shr(j2) .. - sum(ac, v29_treecover(j2,ac)) =g= - sum(ct, i29_treecover_target(ct,j2)) * vm_land(j2,"crop"); - -*' Cropland tree cover biodiversity value: - -q29_treecover_bv(j2,potnatveg) .. - vm_bv(j2,"crop_tree",potnatveg) =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v29_treecover(j2,ac)) * - p29_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); - -*' Cropland tree cover annuity cost - -q29_cost_treecover_est(j2) .. - v29_cost_treecover_est(j2) =e= - sum(ac_est, v29_treecover(j2,ac_est)) * s29_cost_treecover_est * - sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); - -*' Cropland tree cover recurring cost - -q29_cost_treecover_recur(j2) .. - v29_cost_treecover_recur(j2) =e= - sum(ac_sub, v29_treecover(j2,ac_sub)) * s29_cost_treecover_recur; - -*' Cropland tree cover establishment rules: - -q29_treecover_est(j2,ac_est) .. - v29_treecover(j2,ac_est) =e= sum(ac_est2, v29_treecover(j2,ac_est2))/card(ac_est2); diff --git a/modules/29_cropland/rulebased_apr24/input.gms b/modules/29_cropland/rulebased_apr24/input.gms deleted file mode 100644 index 232c4ceabc..0000000000 --- a/modules/29_cropland/rulebased_apr24/input.gms +++ /dev/null @@ -1,94 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -$setglobal c29_marginal_land q33_marginal -* options: all_marginal, q33_marginal, no_marginal - -scalars - s29_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / - s29_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / - s29_snv_scenario_start SNV scenario start year / 2020 / - s29_snv_scenario_target SNV scenario target year / 2029 / - s29_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / - s29_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / - s29_cost_treecover_est Tree cover establishment cost (USD05MER per ha) / 2000 / - s29_cost_treecover_recur Tree cover recurring cost (USD05MER per ha) / 500 / - s29_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / - s29_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / - s29_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / - s29_treecover_scenario_start Cropland treecover scenario start year / 2020 / - s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / - s29_treecover_target Target share of treecover on total cropland (1) / 0.3 / - s29_fallow_scenario_start Fallow land scenario start year / 2020 / - s29_fallow_scenario_target Fallow land scenario target year / 2050 / - s29_fallow_target Target share of fallow land on total cropland (1) / 0.3 / -; - - -* Set-switch for countries affected by regional SNV policy -* Default: all iso countries selected -sets - policy_countries29(iso) countries to be affected by SNV policy / ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, - ASM,ATA,ATF,ATG,AUS,AUT,AZE,BDI,BEL,BEN, - BES,BFA,BGD,BGR,BHR,BHS,BIH,BLM,BLR,BLZ, - BMU,BOL,BRA,BRB,BRN,BTN,BVT,BWA,CAF,CAN, - CCK,CHN,CHE,CHL,CIV,CMR,COD,COG,COK,COL, - COM,CPV,CRI,CUB,CUW,CXR,CYM,CYP,CZE,DEU, - DJI,DMA,DNK,DOM,DZA,ECU,EGY,ERI,ESH,ESP, - EST,ETH,FIN,FJI,FLK,FRA,FRO,FSM,GAB,GBR, - GEO,GGY,GHA,GIB,GIN,GLP,GMB,GNB,GNQ,GRC, - GRD,GRL,GTM,GUF,GUM,GUY,HKG,HMD,HND,HRV, - HTI,HUN,IDN,IMN,IND,IOT,IRL,IRN,IRQ,ISL, - ISR,ITA,JAM,JEY,JOR,JPN,KAZ,KEN,KGZ,KHM, - KIR,KNA,KOR,KWT,LAO,LBN,LBR,LBY,LCA,LIE, - LKA,LSO,LTU,LUX,LVA,MAC,MAF,MAR,MCO,MDA, - MDG,MDV,MEX,MHL,MKD,MLI,MLT,MMR,MNE,MNG, - MNP,MOZ,MRT,MSR,MTQ,MUS,MWI,MYS,MYT,NAM, - NCL,NER,NFK,NGA,NIC,NIU,NLD,NOR,NPL,NRU, - NZL,OMN,PAK,PAN,PCN,PER,PHL,PLW,PNG,POL, - PRI,PRK,PRT,PRY,PSE,PYF,QAT,REU,ROU,RUS, - RWA,SAU,SDN,SEN,SGP,SGS,SHN,SJM,SLB,SLE, - SLV,SMR,SOM,SPM,SRB,SSD,STP,SUR,SVK,SVN, - SWE,SWZ,SXM,SYC,SYR,TCA,TCD,TGO,THA,TJK, - TKL,TKM,TLS,TON,TTO,TUN,TUR,TUV,TWN,TZA, - UGA,UKR,UMI,URY,USA,UZB,VAT,VCT,VEN,VGB, - VIR,VNM,VUT,WLF,WSM,YEM,ZAF,ZMB,ZWE / - -land_snv(land) land types allowed in the SNV policy / secdforest, forestry, past, other / -; - -********* AVAILABLE CROPLAND ******************************************* - -table f29_avl_cropland(j,marginal_land29) Available land area for cropland (mio. ha) -$ondelim -$include "./modules/29_cropland/input/avl_cropland.cs3" -$offdelim -; - -table f29_avl_cropland_iso(iso,marginal_land29) Available land area for cropland at ISO level (mio. ha) -$ondelim -$include "./modules/29_cropland/input/avl_cropland_iso.cs3" -$offdelim -; - -********* SNV TARGET CROPLAND ******************************************* - -table f29_snv_target_cropland(j,relocation_target29) Cropland in 2019 requiring relocation due to SNV policy (mio. ha) -$ondelim -$include "./modules/29_cropland/input/SNVTargetCropland.cs3" -$offdelim -; - -********* Cropland tree cover ******************************************* - -parameter f29_treecover(j) Tree cover on cropland in 2019 (mio. ha) -/ -$ondelim -$include "./modules/29_cropland/input/CroplandTreecover.cs2" -$offdelim -/ -; diff --git a/modules/29_cropland/rulebased_apr24/postsolve.gms b/modules/29_cropland/rulebased_apr24/postsolve.gms deleted file mode 100644 index 60c46e7c92..0000000000 --- a/modules/29_cropland/rulebased_apr24/postsolve.gms +++ /dev/null @@ -1,84 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -pc29_treecover(j,ac) = v29_treecover.l(j,ac); - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_fallow(t,j,"marginal") = vm_fallow.m(j); - ov29_treecover(t,j,ac,"marginal") = v29_treecover.m(j,ac); - ov_cost_cropland(t,j,"marginal") = vm_cost_cropland.m(j); - ov29_cost_treecover_est(t,j,"marginal") = v29_cost_treecover_est.m(j); - ov29_cost_treecover_recur(t,j,"marginal") = v29_cost_treecover_recur.m(j); - oq29_cropland(t,j,"marginal") = q29_cropland.m(j); - oq29_avl_cropland(t,j,"marginal") = q29_avl_cropland.m(j); - oq29_carbon(t,j,ag_pools,stockType,"marginal") = q29_carbon.m(j,ag_pools,stockType); - oq29_land_snv(t,j,"marginal") = q29_land_snv.m(j); - oq29_land_snv_trans(t,j,"marginal") = q29_land_snv_trans.m(j); - oq29_cost_cropland(t,j,"marginal") = q29_cost_cropland.m(j); - oq29_cost_treecover_est(t,j,"marginal") = q29_cost_treecover_est.m(j); - oq29_cost_treecover_recur(t,j,"marginal") = q29_cost_treecover_recur.m(j); - oq29_fallow_shr(t,j,"marginal") = q29_fallow_shr.m(j); - oq29_treecover_shr(t,j,"marginal") = q29_treecover_shr.m(j); - oq29_treecover_est(t,j,ac,"marginal") = q29_treecover_est.m(j,ac); - oq29_treecover_bv(t,j,potnatveg,"marginal") = q29_treecover_bv.m(j,potnatveg); - oq29_fallow_bv(t,j,potnatveg,"marginal") = q29_fallow_bv.m(j,potnatveg); - ov_fallow(t,j,"level") = vm_fallow.l(j); - ov29_treecover(t,j,ac,"level") = v29_treecover.l(j,ac); - ov_cost_cropland(t,j,"level") = vm_cost_cropland.l(j); - ov29_cost_treecover_est(t,j,"level") = v29_cost_treecover_est.l(j); - ov29_cost_treecover_recur(t,j,"level") = v29_cost_treecover_recur.l(j); - oq29_cropland(t,j,"level") = q29_cropland.l(j); - oq29_avl_cropland(t,j,"level") = q29_avl_cropland.l(j); - oq29_carbon(t,j,ag_pools,stockType,"level") = q29_carbon.l(j,ag_pools,stockType); - oq29_land_snv(t,j,"level") = q29_land_snv.l(j); - oq29_land_snv_trans(t,j,"level") = q29_land_snv_trans.l(j); - oq29_cost_cropland(t,j,"level") = q29_cost_cropland.l(j); - oq29_cost_treecover_est(t,j,"level") = q29_cost_treecover_est.l(j); - oq29_cost_treecover_recur(t,j,"level") = q29_cost_treecover_recur.l(j); - oq29_fallow_shr(t,j,"level") = q29_fallow_shr.l(j); - oq29_treecover_shr(t,j,"level") = q29_treecover_shr.l(j); - oq29_treecover_est(t,j,ac,"level") = q29_treecover_est.l(j,ac); - oq29_treecover_bv(t,j,potnatveg,"level") = q29_treecover_bv.l(j,potnatveg); - oq29_fallow_bv(t,j,potnatveg,"level") = q29_fallow_bv.l(j,potnatveg); - ov_fallow(t,j,"upper") = vm_fallow.up(j); - ov29_treecover(t,j,ac,"upper") = v29_treecover.up(j,ac); - ov_cost_cropland(t,j,"upper") = vm_cost_cropland.up(j); - ov29_cost_treecover_est(t,j,"upper") = v29_cost_treecover_est.up(j); - ov29_cost_treecover_recur(t,j,"upper") = v29_cost_treecover_recur.up(j); - oq29_cropland(t,j,"upper") = q29_cropland.up(j); - oq29_avl_cropland(t,j,"upper") = q29_avl_cropland.up(j); - oq29_carbon(t,j,ag_pools,stockType,"upper") = q29_carbon.up(j,ag_pools,stockType); - oq29_land_snv(t,j,"upper") = q29_land_snv.up(j); - oq29_land_snv_trans(t,j,"upper") = q29_land_snv_trans.up(j); - oq29_cost_cropland(t,j,"upper") = q29_cost_cropland.up(j); - oq29_cost_treecover_est(t,j,"upper") = q29_cost_treecover_est.up(j); - oq29_cost_treecover_recur(t,j,"upper") = q29_cost_treecover_recur.up(j); - oq29_fallow_shr(t,j,"upper") = q29_fallow_shr.up(j); - oq29_treecover_shr(t,j,"upper") = q29_treecover_shr.up(j); - oq29_treecover_est(t,j,ac,"upper") = q29_treecover_est.up(j,ac); - oq29_treecover_bv(t,j,potnatveg,"upper") = q29_treecover_bv.up(j,potnatveg); - oq29_fallow_bv(t,j,potnatveg,"upper") = q29_fallow_bv.up(j,potnatveg); - ov_fallow(t,j,"lower") = vm_fallow.lo(j); - ov29_treecover(t,j,ac,"lower") = v29_treecover.lo(j,ac); - ov_cost_cropland(t,j,"lower") = vm_cost_cropland.lo(j); - ov29_cost_treecover_est(t,j,"lower") = v29_cost_treecover_est.lo(j); - ov29_cost_treecover_recur(t,j,"lower") = v29_cost_treecover_recur.lo(j); - oq29_cropland(t,j,"lower") = q29_cropland.lo(j); - oq29_avl_cropland(t,j,"lower") = q29_avl_cropland.lo(j); - oq29_carbon(t,j,ag_pools,stockType,"lower") = q29_carbon.lo(j,ag_pools,stockType); - oq29_land_snv(t,j,"lower") = q29_land_snv.lo(j); - oq29_land_snv_trans(t,j,"lower") = q29_land_snv_trans.lo(j); - oq29_cost_cropland(t,j,"lower") = q29_cost_cropland.lo(j); - oq29_cost_treecover_est(t,j,"lower") = q29_cost_treecover_est.lo(j); - oq29_cost_treecover_recur(t,j,"lower") = q29_cost_treecover_recur.lo(j); - oq29_fallow_shr(t,j,"lower") = q29_fallow_shr.lo(j); - oq29_treecover_shr(t,j,"lower") = q29_treecover_shr.lo(j); - oq29_treecover_est(t,j,ac,"lower") = q29_treecover_est.lo(j,ac); - oq29_treecover_bv(t,j,potnatveg,"lower") = q29_treecover_bv.lo(j,potnatveg); - oq29_fallow_bv(t,j,potnatveg,"lower") = q29_fallow_bv.lo(j,potnatveg); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### - diff --git a/modules/29_cropland/rulebased_apr24/preloop.gms b/modules/29_cropland/rulebased_apr24/preloop.gms deleted file mode 100644 index cc295eccf7..0000000000 --- a/modules/29_cropland/rulebased_apr24/preloop.gms +++ /dev/null @@ -1,57 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -** Trajectory for cropland scenarios -* sigmoidal interpolation between start year and target year -m_sigmoid_time_interpol(i29_snv_scenario_fader,s29_snv_scenario_start,s29_snv_scenario_target,0,1); -m_sigmoid_time_interpol(i29_treecover_scenario_fader,s29_treecover_scenario_start,s29_treecover_scenario_target,0,1); -m_sigmoid_time_interpol(i29_fallow_scenario_fader,s29_fallow_scenario_start,s29_fallow_scenario_target,0,1); - -* linear interpolation to estimate the cropland that -* requires relocation due to SNV policy -if (s29_snv_shr = 0, - i29_snv_relocation_target(j) = 0; -elseif s29_snv_shr <= s29_snv_relocation_data_x1, - m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,0,s29_snv_relocation_data_x1,0, f29_snv_target_cropland(j, "SNV20TargetCropland")); -elseif s29_snv_shr > s29_snv_relocation_data_x1, - m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,s29_snv_relocation_data_x1, s29_snv_relocation_data_x2,f29_snv_target_cropland(j, "SNV20TargetCropland"), f29_snv_target_cropland(j, "SNV50TargetCropland")); -); - -* Initial tree cover on cropland is assumed to be equally distributed among all age-classes -pc29_treecover(j,ac) = 0; -pc29_treecover(j,ac)$(pm_land_hist("y2015",j,"crop") > 1e-10) = - (f29_treecover(j) / pm_land_hist("y2015",j,"crop") * pm_land_hist("y1995",j,"crop")) / card(ac); - - -*' Switch for tree cover on cropland: -*' 0 = Use natveg growth curve towards LPJmL natural vegetation -*' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation -if(s29_treecover_plantation = 0, - p29_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); -elseif s29_treecover_plantation = 1, - p29_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools); -); - -** set bii coefficients -p29_treecover_bii_coeff(bii_class_secd,potnatveg) = 0; -if(s29_treecover_bii_coeff = 0, - p29_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff(bii_class_secd,potnatveg) -elseif s29_treecover_bii_coeff = 1, - p29_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff("timber",potnatveg) -); - - -****** Regional share of semi-natural vegetation (SNV) in cropland areas for selective countries: -* Country switch to determine countries for which a SNV policy shall be applied. -* In the default case, the SNV policy affects all countries when activated. -p29_country_dummy(iso) = 0; -p29_country_dummy(policy_countries29) = 1; -* Because MAgPIE is not run at country-level, but at region level, a region -* share is calculated that translates the countries' influence to regional level. -* Countries are weighted by available cropland area. -i29_avl_cropland_iso(iso) = f29_avl_cropland_iso(iso,"%c29_marginal_land%"); -p29_country_snv_weight(i) = sum(i_to_iso(i,iso), p29_country_dummy(iso) * i29_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i29_avl_cropland_iso(iso)); diff --git a/modules/29_cropland/rulebased_apr24/presolve.gms b/modules/29_cropland/rulebased_apr24/presolve.gms deleted file mode 100644 index e4a8c98fc9..0000000000 --- a/modules/29_cropland/rulebased_apr24/presolve.gms +++ /dev/null @@ -1,63 +0,0 @@ -*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @code -*' Minimum semi-natural vegetation (SNV) share is fading in after 2020 -p29_snv_shr(t,j) = i29_snv_scenario_fader(t) * - (s29_snv_shr * sum(cell(i,j), p29_country_snv_weight(i)) - + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_snv_weight(i))); - -*' Cropland relocation in response to SNV policy is based on exogeneous land -*' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). -*' The rate of the policy implementation is derived based -*' on the difference of scenario fader values in consecutive time steps -p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * - (i29_snv_relocation_target(j) * sum(cell(i,j), p29_country_snv_weight(i)) - + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_snv_weight(i))); -*' The following lines take care of mismatches in the input -*' data (derived from satellite imagery from the Copernicus -*' Global Land Service (@buchhorn_copernicus_2020)) and in -*' cases of cropland reduction -p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * pcm_land(j,"crop"); -p29_snv_relocation(t,j)$(p29_snv_relocation(t, j) > p29_max_snv_relocation(t,j)) = p29_max_snv_relocation(t,j); - -*' Area potentially available for cropping -p29_avl_cropland(t,j) = f29_avl_cropland(j,"%c29_marginal_land%") * (1 - p29_snv_shr(t,j)); -*' @stop - - -* Growth of trees on cropland is modelled by shifting age-classes according to time step length. -s29_shift = m_timestep_length_forestry/5; -* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s29_shift = 1) - p29_treecover(t,j,ac)$(ord(ac) > s29_shift) = pc29_treecover(j,ac-s29_shift); -* account for cases at the end of the age class set (s29_shift > 1) which are not shifted by the above calculation - p29_treecover(t,j,"acx") = p29_treecover(t,j,"acx") - + sum(ac$(ord(ac) > card(ac)-s29_shift), pc29_treecover(j,ac)); - -pc29_treecover(j,ac) = p29_treecover(t,j,ac); -v29_treecover.l(j,ac) = p29_treecover(t,j,ac); - -if(m_year(t) <= s29_treecover_scenario_start, - v29_treecover.fx(j,ac) = pc29_treecover(j,ac); -else - v29_treecover.lo(j,ac_est) = 0; - v29_treecover.up(j,ac_est) = Inf; - if(s29_treecover_decrease = 1, - v29_treecover.lo(j,ac_sub) = 0; - v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); - else - v29_treecover.fx(j,ac_sub) = pc29_treecover(j,ac_sub); - ); -); - -* create treecover target and penalty scenario -i29_treecover_target(t,j) = - ((1-i29_treecover_scenario_fader(t)) * sum(ac, pc29_treecover(j,ac))/pcm_land(j,"crop"))$(pcm_land(j,"crop") > 1e-10) + - (i29_treecover_scenario_fader(t) * s29_treecover_target); - -* create fallow land target and penalty scenario -i29_fallow_target(t_all) = s29_fallow_target * i29_fallow_scenario_fader(t_all); diff --git a/modules/29_cropland/rulebased_apr24/realization.gms b/modules/29_cropland/rulebased_apr24/realization.gms deleted file mode 100644 index cec1ad89fc..0000000000 --- a/modules/29_cropland/rulebased_apr24/realization.gms +++ /dev/null @@ -1,20 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description todo - -*' @limitations todo - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/29_cropland/rulebased_apr24/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/29_cropland/rulebased_apr24/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/29_cropland/rulebased_apr24/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/29_cropland/rulebased_apr24/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/29_cropland/rulebased_apr24/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/29_cropland/rulebased_apr24/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/29_cropland/rulebased_apr24/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/29_cropland/simple_apr24/declarations.gms b/modules/29_cropland/simple_apr24/declarations.gms new file mode 100644 index 0000000000..c63daf0be8 --- /dev/null +++ b/modules/29_cropland/simple_apr24/declarations.gms @@ -0,0 +1,32 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +parameters + p29_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) +; + +positive variables + vm_cost_cropland(j) Cost for total cropland (mio. USD05MER per yr) + vm_fallow(j) Fallow land is temporarily fallow cropland (mio. ha) +; + +equations + q29_cropland(j) Total cropland calculation (mio. ha) + q29_avl_cropland(j) Available cropland constraint (mio. ha) + q29_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_cost_cropland(t,j,type) Cost for total cropland (mio. USD05MER per yr) + ov_fallow(t,j,type) Fallow land is temporarily fallow cropland (mio. ha) + oq29_cropland(t,j,type) Total cropland calculation (mio. ha) + oq29_avl_cropland(t,j,type) Available cropland constraint (mio. ha) + oq29_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + diff --git a/modules/29_cropland/simple_apr24/equations.gms b/modules/29_cropland/simple_apr24/equations.gms new file mode 100644 index 0000000000..1088543e1c --- /dev/null +++ b/modules/29_cropland/simple_apr24/equations.gms @@ -0,0 +1,32 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @equations +*' Total cropland equals croparea, because fallow land is fixed to zero +*' and tree cover on cropland does not exist in this realization. + + q29_cropland(j2) .. + vm_land(j2,"crop") =e= sum((kcr,w), vm_area(j2,kcr,w)); + +*' We assume that crop production can only take place on suitable cropland area. +*' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas +*' from cropland production that have a low suitability, e.g. due to steep slopes, +*' to estimate the available cropland area. The cultivated area therefore has +*' to be smaller than the available cropland area. Moreover, the available cropland +*' can be reduced by constraining the cropland area in favour of other land types, +*' in order to increase compositional heterogeneity of land types at the cell level. + + q29_avl_cropland(j2) .. + vm_land(j2,"crop") =l= sum(ct, p29_avl_cropland(ct,j2)); + + +*' The carbon stocks of total cropland are calculated as the sum of carbon stocks in +*' cropland, fallow land and tree cover area. + + q29_carbon(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= + vm_carbon_stock_croparea(j2,ag_pools); diff --git a/modules/29_cropland/simple_apr24/input.gms b/modules/29_cropland/simple_apr24/input.gms new file mode 100644 index 0000000000..8780993d11 --- /dev/null +++ b/modules/29_cropland/simple_apr24/input.gms @@ -0,0 +1,17 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +$setglobal c29_marginal_land q33_marginal +* options: all_marginal, q33_marginal, no_marginal + +********* AVAILABLE CROPLAND ******************************************* + +table f29_avl_cropland(j,marginal_land29) Available land area for cropland (mio. ha) +$ondelim +$include "./modules/29_cropland/input/avl_cropland.cs3" +$offdelim +; diff --git a/modules/29_cropland/simple_apr24/not_used.txt b/modules/29_cropland/simple_apr24/not_used.txt new file mode 100644 index 0000000000..6102fa8d55 --- /dev/null +++ b/modules/29_cropland/simple_apr24/not_used.txt @@ -0,0 +1,11 @@ +name,type,reason +vm_lu_transitions,input,not needed +pm_land_hist,input,not needed +pcm_land,input,not needed +fm_luh2_side_layers,input,not needed +pm_interest,input,not needed +pm_land_conservation,input,not needed +fm_bii_coeff,input,not needed +pm_carbon_density_ac,input,not needed +pm_carbon_density_ac_forestry,input,not needed +fm_carbon_density,input,not needed diff --git a/modules/29_cropland/simple_apr24/postsolve.gms b/modules/29_cropland/simple_apr24/postsolve.gms new file mode 100644 index 0000000000..3a389fbe97 --- /dev/null +++ b/modules/29_cropland/simple_apr24/postsolve.gms @@ -0,0 +1,30 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov_cost_cropland(t,j,"marginal") = vm_cost_cropland.m(j); + ov_fallow(t,j,"marginal") = vm_fallow.m(j); + oq29_cropland(t,j,"marginal") = q29_cropland.m(j); + oq29_avl_cropland(t,j,"marginal") = q29_avl_cropland.m(j); + oq29_carbon(t,j,ag_pools,stockType,"marginal") = q29_carbon.m(j,ag_pools,stockType); + ov_cost_cropland(t,j,"level") = vm_cost_cropland.l(j); + ov_fallow(t,j,"level") = vm_fallow.l(j); + oq29_cropland(t,j,"level") = q29_cropland.l(j); + oq29_avl_cropland(t,j,"level") = q29_avl_cropland.l(j); + oq29_carbon(t,j,ag_pools,stockType,"level") = q29_carbon.l(j,ag_pools,stockType); + ov_cost_cropland(t,j,"upper") = vm_cost_cropland.up(j); + ov_fallow(t,j,"upper") = vm_fallow.up(j); + oq29_cropland(t,j,"upper") = q29_cropland.up(j); + oq29_avl_cropland(t,j,"upper") = q29_avl_cropland.up(j); + oq29_carbon(t,j,ag_pools,stockType,"upper") = q29_carbon.up(j,ag_pools,stockType); + ov_cost_cropland(t,j,"lower") = vm_cost_cropland.lo(j); + ov_fallow(t,j,"lower") = vm_fallow.lo(j); + oq29_cropland(t,j,"lower") = q29_cropland.lo(j); + oq29_avl_cropland(t,j,"lower") = q29_avl_cropland.lo(j); + oq29_carbon(t,j,ag_pools,stockType,"lower") = q29_carbon.lo(j,ag_pools,stockType); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + diff --git a/modules/29_cropland/simple_apr24/preloop.gms b/modules/29_cropland/simple_apr24/preloop.gms new file mode 100644 index 0000000000..9ac96ee8aa --- /dev/null +++ b/modules/29_cropland/simple_apr24/preloop.gms @@ -0,0 +1,14 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +vm_cost_cropland.fx(j) = 0; +vm_fallow.fx(j) = 0; +vm_bv.fx(j,"crop_fallow",potnatveg) = 0; +vm_bv.fx(j,"crop_tree",potnatveg) = 0; + +*' Area potentially available for cropping +p29_avl_cropland(t,j) = f29_avl_cropland(j,"%c29_marginal_land%"); diff --git a/modules/29_cropland/simple_apr24/presolve.gms b/modules/29_cropland/simple_apr24/presolve.gms new file mode 100644 index 0000000000..ae47145544 --- /dev/null +++ b/modules/29_cropland/simple_apr24/presolve.gms @@ -0,0 +1,6 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de diff --git a/modules/29_cropland/simple_apr24/realization.gms b/modules/29_cropland/simple_apr24/realization.gms new file mode 100644 index 0000000000..7abf5c89fa --- /dev/null +++ b/modules/29_cropland/simple_apr24/realization.gms @@ -0,0 +1,25 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @description In this realization, total cropland equals croparea because +*' fallow land is fixed to zero and tree cover on cropland does not exist. +*' Therefore, also cropland carbon stocks consist only of croparea carbon stocks. +*' Biodiversity BII values are fixed to zero. +*' Costs are fixed to zero. +*' No options for semi-natural land in cropland landscapes exist. + +*' @limitations Fallow land is fixed to zero and tree cover on cropland does not exist + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/29_cropland/simple_apr24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/29_cropland/simple_apr24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/29_cropland/simple_apr24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/29_cropland/simple_apr24/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/29_cropland/simple_apr24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/29_cropland/simple_apr24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/29_cropland/simple_apr24/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/29_cropland/rulebased_apr24/sets.gms b/modules/29_cropland/simple_apr24/sets.gms similarity index 70% rename from modules/29_cropland/rulebased_apr24/sets.gms rename to modules/29_cropland/simple_apr24/sets.gms index e5d8286326..6c56fcb13d 100644 --- a/modules/29_cropland/rulebased_apr24/sets.gms +++ b/modules/29_cropland/simple_apr24/sets.gms @@ -10,10 +10,4 @@ sets marginal_land29 Marginal land scenarios / all_marginal, q33_marginal, no_marginal / - policy_target29 Target year for cropland policy - / none, by2029, by2050 / - - relocation_target29 Cropland requiring relocation based on different SNV targets - / SNV20TargetCropland, SNV50TargetCropland / - ; diff --git a/modules/30_crop/endo_apr21/realization.gms b/modules/30_crop/endo_apr21/realization.gms deleted file mode 100644 index af702a13ba..0000000000 --- a/modules/30_crop/endo_apr21/realization.gms +++ /dev/null @@ -1,35 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description The endo_apr21 realization calculates the crop specific -*' agricultural land use endogenously based on yield data coming from the -*' module [14_yields] and the rotational as well as suitability constraints -*' stated in the input data of the module. -*' -*' Cropland areas are linked to the crop specific production and the carbon -*' content of the different land carbon pools. The crop specific land use areas -*' are also used in [18_residues], [38_factor_costs], -*' [41_area_equipped_for_irrigation], [42_water_demand], [50_nr_soil_budget], -*' [53_methane] and [59_som]. - -*' This realisation also includes the option to reserve a minimum semi-natural -*' vegetation share within the total available cropland for other land cover -*' classes, including grassland, forest, and other land (by a given target year), -*' in order to provide species habitats and to benefit from ecosystem ervices in -*' agricultural landscapes. - -*' @limitations There are currently no known limitations of this realization. - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/30_crop/endo_apr21/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/30_crop/endo_apr21/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/30_crop/endo_apr21/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/30_crop/endo_apr21/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/30_crop/endo_apr21/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/30_crop/endo_apr21/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/30_crop/endo_apr21/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/30_crop/penalty_apr22/equations.gms b/modules/30_crop/penalty_apr22/equations.gms deleted file mode 100644 index a44fe1e809..0000000000 --- a/modules/30_crop/penalty_apr22/equations.gms +++ /dev/null @@ -1,79 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @equations - -*' Agricultural production is calculated by multiplying the area under -*' production with corresponding yields. Production from rainfed and irrigated -*' areas is summed up: - - q30_prod(j2,kcr) .. - vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); - - -*' Rotational constraints prevent over-specialization. In this module realization, -*' they are implemented via a penalty payment if the constraints are violated. - -q30_rotation_penalty(i2) .. - vm_rotation_penalty(i2) - =g= - sum(cell(i2,j2), - sum(rota30, v30_penalty(j2,rota30) * sum(ct, i30_rotation_incentives(ct,rota30))) - + sum(rotamax_red30, v30_penalty_max_irrig(j2,rotamax_red30) * sum(ct, i30_rotation_incentives(ct,rotamax_red30))) - ); - - -*' The penalty applies to the areas which exceed a certain maximum -*' share of the land. Below this share, negative benefits are -*' avoided by defining the penalty to be positive. - - q30_rotation_max(j2,rotamax_red30) .. - v30_penalty(j2,rotamax_red30) - =g= - sum((rota_kcr30(rotamax_red30,kcr),w),vm_area(j2,kcr,w)) - - vm_land(j2,"crop") * f30_rotation_rules(rotamax_red30); - - -*' Minimum constraints apply penalties when a certain mimimum -*' share of a group is not achieved. This is used to guarantee a minimum -*' crop group diversity withing cells. - - q30_rotation_min(j2,rotamin_red30) .. - v30_penalty(j2,rotamin_red30) - =g= - vm_land(j2,"crop") * f30_rotation_rules(rotamin_red30) - - sum((rota_kcr30(rotamin_red30,kcr),w), vm_area(j2,kcr,w)); - - -*' The following maximum constraint avoids over-specialization in irrigated systems. -*' No minimum constraint is included for irrigated areas for computational -*' reasons. Minimum constraints just need to be met on total areas. - - q30_rotation_max_irrig(j2,rotamax_red30) .. - v30_penalty_max_irrig(j2,rotamax_red30) - =g= - sum((rota_kcr30(rotamax_red30,kcr)), vm_area(j2,kcr,"irrigated")) - - vm_AEI(j2) * f30_rotation_rules(rotamax_red30); - - -*' The carbon stocks of the above ground carbon pools are calculated based on croparea and related carbon density. - - q30_carbon(j2,ag_pools) .. - vm_carbon_stock_croparea(j2,ag_pools) =e= - sum((kcr,w), vm_area(j2,kcr,w)) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)); - - -*' The biodiversity value for cropland is calculated separately for annual and perennial crops: - - q30_bv_ann(j2,potnatveg) .. - vm_bv(j2,"crop_ann",potnatveg) - =e= - sum((crop_ann30,w), vm_area(j2,crop_ann30,w)) * fm_bii_coeff("crop_ann",potnatveg) * fm_luh2_side_layers(j2,potnatveg); - - q30_bv_per(j2,potnatveg) .. vm_bv(j2,"crop_per",potnatveg) - =e= - sum((crop_per30,w), vm_area(j2,crop_per30,w)) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/30_crop/penalty_apr22/realization.gms b/modules/30_crop/penalty_apr22/realization.gms deleted file mode 100644 index 993a8d461a..0000000000 --- a/modules/30_crop/penalty_apr22/realization.gms +++ /dev/null @@ -1,40 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description The endo_apr21 realization calculates the crop specific -*' agricultural land use endogenously based on yield data coming from the -*' module [14_yields] and the rotational incentives as well as suitability -*' constraints stated in the input data of the module. -*' -*' Cropland areas are linked to the crop specific production and the carbon -*' content of the different land carbon pools. The crop specific land use areas -*' are also used in [18_residues], [38_factor_costs], -*' [41_area_equipped_for_irrigation], [42_water_demand], [50_nr_soil_budget], -*' [53_methane] and [59_som]. - -*' This module realization allows for different scenarios of rotational -*' constraints which are implemented via penalty payments if constraints are -*' exceeded. Rotational constraints are defined for total land as well as -*' for irrigated areas only to avoid overspecialization on irrigated land. - -*' This realisation also includes the option to reserve a minimum semi-natural -*' vegetation share within the total available cropland for other land cover -*' classes, including grassland, forest, and other land (by a given target year), -*' in order to provide species habitats and to benefit from ecosystem ervices in -*' agricultural landscapes. - -*' @limitations There are currently no known limitations of this realization. - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/30_crop/penalty_apr22/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/30_crop/penalty_apr22/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/30_crop/penalty_apr22/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/30_crop/penalty_apr22/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/30_crop/penalty_apr22/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/30_crop/penalty_apr22/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/30_crop/penalty_apr22/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/30_crop/penalty_apr22/sets.gms b/modules/30_crop/penalty_apr22/sets.gms deleted file mode 100644 index 768e906278..0000000000 --- a/modules/30_crop/penalty_apr22/sets.gms +++ /dev/null @@ -1,79 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -sets - rotascen30 rotation constraint scenarios - /none,default,legumes,betr500,betr1000,agroecology/ - - rota30 rotational rules - /cereals1_max, cereals2_max, - resistant_max, oilcrops_max, - legumes_max, rootsrape_max, - rice_pro_max, tece_max - trce_max, maiz_max, - biomass_min, legumes_min, - minor_min, cereals_min, betr_min/ - - - rotamax30(rota30) rotational maximum rules - /cereals1_max, cereals2_max, - resistant_max, oilcrops_max, - legumes_max, rootsrape_max, - rice_pro_max, tece_max - trce_max, maiz_max - / - - rotamin30(rota30) rotational minimum rules - /biomass_min, legumes_min, minor_min, cereals_min, betr_min/ - - rotamax_red30(rotamax30) Maximum crop rotation reduced set - rotamin_red30(rotamin30) Minimum crop rotation reduced set - -* crop rotation groups: -* cereals or grasses are very favourable to loosen soils, therefore minimum constraint -* legumes need longer rotations, only soybean can and is cultivated every 2 years -* rapeseed and beets have same nematodes -* root crops have similar diseases - -* Sustainable practices: -* >=5% set-aside, >=5% biomass crops that approximate agroforestry systems -* six fold crop rotation of the remaining 90% -* at least one legume slot in crop rotation -* crop groups with multiple members like tece or foddr are allowed multiple slots -* one percent fruits and vegs in each cell for regional demand - - rota_kcr30(rota30, kcr) Mapping of crop types into crop rotation types - / cereals1_max . (tece, maiz, trce, rice_pro) - cereals2_max . (tece, maiz, trce, rice_pro) - resistant_max . (begr,betr,foddr,sugr_cane,cottn_pro,oilpalm,others) - oilcrops_max . (sunflower, rapeseed) - legumes_max . (foddr,puls_pro, soybean, groundnut) - rootsrape_max . (sugr_beet, cassav_sp, potato, rapeseed) - rice_pro_max . (rice_pro) - tece_max . (tece) - trce_max . (trce) - maiz_max . (maiz) - biomass_min . (sugr_cane, oilpalm, begr, betr) - legumes_min . (soybean, groundnut, puls_pro, foddr) - minor_min . (sunflower, rapeseed, sugr_beet, cassav_sp, potato, others) - cereals_min . (tece, maiz, trce, rice_pro) - betr_min . (betr) - / - - kbe30(kcr) bio energy activities - / betr, begr / - - bioen_type_30(kbe30) dynamic set bioen type - bioen_water_30(w) dynamic set bioen water - - crop_ann30(kcr) annual crops - / tece, maiz, trce, rice_pro, rapeseed, sunflower, potato, cassav_sp, sugr_beet, others, cottn_pro, foddr, soybean, groundnut, puls_pro / - - crop_per30(kcr) perennial crops - / oilpalm, begr, sugr_cane, betr / - -; diff --git a/modules/30_crop/rotation_apr22/declarations.gms b/modules/30_crop/rotation_apr22/declarations.gms deleted file mode 100644 index dc41cb568f..0000000000 --- a/modules/30_crop/rotation_apr22/declarations.gms +++ /dev/null @@ -1,45 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -parameters - i30_rotation_max_shr(t_all,rotamax30) Maximum share of a certain crop group on cropland (ha per ha) - i30_rotation_min_shr(t_all,rotamin30) Minimum share of a certain crop group on cropland (ha per ha) - p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) -; - -positive variables - vm_area(j,kcr,w) Agricultural production area (mio. ha) - vm_rotation_penalty(i) Penalty for violating rotational constraints (USD05MER) - vm_carbon_stock_croparea(j,ag_pools) Carbon stock in croparea (tC) -; - -equations - q30_prod(j,kcr) Production of cropped products (mio. tDM) - q30_rotation_max(j,rotamax30) Local maximum rotational constraints (mio. ha) - q30_rotation_min(j,rotamin30) Local minimum rotational constraints (mio. ha) - q30_rotation_max_irrig(j,rotamax30) Local maximum rotational constraints (mio. ha) - q30_carbon(j,ag_pools) Croplarea above ground carbon content calculation (mio. tC) - q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) - q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha) -; - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov_area(t,j,kcr,w,type) Agricultural production area (mio. ha) - ov_rotation_penalty(t,i,type) Penalty for violating rotational constraints (USD05MER) - ov_carbon_stock_croparea(t,j,ag_pools,type) Carbon stock in croparea (tC) - oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) - oq30_rotation_max(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) - oq30_rotation_min(t,j,rotamin30,type) Local minimum rotational constraints (mio. ha) - oq30_rotation_max_irrig(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) - oq30_carbon(t,j,ag_pools,type) Croplarea above ground carbon content calculation (mio. tC) - oq30_bv_ann(t,j,potnatveg,type) Biodiversity value of annual cropland (mio. ha) - oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (mio. ha) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### - -*** EOF declarations.gms *** diff --git a/modules/30_crop/rotation_apr22/equations.gms b/modules/30_crop/rotation_apr22/equations.gms deleted file mode 100644 index 3cd5ee574c..0000000000 --- a/modules/30_crop/rotation_apr22/equations.gms +++ /dev/null @@ -1,57 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @equations - -*' Agricultural production is calculated by multiplying the area under -*' production with corresponding yields. Production from rainfed and irrigated -*' areas is summed up: - - q30_prod(j2,kcr) .. - vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); - - -*' As additional constraints minimum and maximum rotational constraints limit -*' the placing of crops. On the one hand, these rotational constraints reflect -*' crop rotations limiting the share a specific crop can cover of the total area -*' of a cluster: - - q30_rotation_max(j2,rotamax_red30) .. - sum((rotamax_kcr30(rotamax_red30,kcr),w), vm_area(j2,kcr,w)) =l= - vm_land(j2,"crop") * sum(ct,i30_rotation_max_shr(ct,rotamax_red30)); - - q30_rotation_min(j2,rotamin_red30) .. - sum((rotamin_kcr30(rotamin_red30,kcr),w), vm_area(j2,kcr,w)) =g= - vm_land(j2,"crop") * sum(ct,i30_rotation_min_shr(ct,rotamin_red30)); - - -* The following maximum constraint avoids over-specialization in irrigated systems. -* No minimum constraint is included for irrigated areas for computational -* reasons. Minimum constraints just need to be met on total areas. - - q30_rotation_max_irrig(j2,rotamax_red30) .. - sum((rotamax_kcr30(rotamax_red30,kcr)), vm_area(j2,kcr,"irrigated")) =l= - vm_AEI(j2) * sum(ct,i30_rotation_max_shr(ct,rotamax_red30)); - - -*' The carbon stocks of the above ground carbon pools are calculated based on croparea and related carbon density. - - q30_carbon(j2,ag_pools) .. - vm_carbon_stock_croparea(j2,ag_pools) =e= - sum((kcr,w), vm_area(j2,kcr,w)) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)); - - -*' The biodiversity value for cropland is calculated separately for annual and perennial crops: - - q30_bv_ann(j2,potnatveg) .. - vm_bv(j2,"crop_ann",potnatveg) - =e= - sum((crop_ann30,w), vm_area(j2,crop_ann30,w)) * fm_bii_coeff("crop_ann",potnatveg) * fm_luh2_side_layers(j2,potnatveg); - - q30_bv_per(j2,potnatveg) .. vm_bv(j2,"crop_per",potnatveg) - =e= - sum((crop_per30,w), vm_area(j2,crop_per30,w)) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/30_crop/rotation_apr22/input.gms b/modules/30_crop/rotation_apr22/input.gms deleted file mode 100644 index 97dfc19ca4..0000000000 --- a/modules/30_crop/rotation_apr22/input.gms +++ /dev/null @@ -1,63 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -$setglobal c30_bioen_type all -* options: begr, betr, all - -$setglobal c30_bioen_water rainfed -* options: rainfed, irrigated, all - -$setglobal c30_rotation_constraints on -*options: on, off - -$setglobal c30_rotation_scenario default -*options: min,default,good,good_20div,setaside,legumes,betr0,betr10,betr20,betr25,betr30, -* betr40,betr50,sixfoldrotation,agroecology - -$setglobal c30_rotation_scenario_speed by2050 -* options: none, by2030, by2020 - -scalars - s30_rotation_scenario_start Rotation scenario start year / 2020 / - s30_rotation_scenario_target Rotation scenario target year / 2050 / -; - - -$ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes; -$else bioen_type_30("%c30_bioen_type%") = yes; -$endif - -$ifthen "%c30_bioen_water%" == "all" bioen_water_30(w) = yes; -$else bioen_water_30("%c30_bioen_water%") = yes; -$endif - -********* CROPAREA INITIALISATION ********************************************** - -table fm_croparea(t_all,j,w,kcr) Different croparea type areas (mio. ha) -$ondelim -$include "./modules/30_crop/rotation_apr22/input/f30_croparea_w_initialisation.cs3" -$offdelim -; -m_fillmissingyears(fm_croparea,"j,w,kcr"); - -********* CROP-ROTATIONAL CONSTRAINT ******************************************* - -table f30_rotation_max_shr(rotamax30,rotascen30) Maximum allowed area shares for each crop type (1) -$ondelim -$include "./modules/30_crop/rotation_apr22/input/f30_rotation_max_scen.csv" -$offdelim -; -$if "%c30_rotation_constraints%" == "off" f30_rotation_max_shr(crp30) = 1; - - -table f30_rotation_min_shr(rotamin30,rotascen30) Minimum allowed area shares for each crop type (1) -$ondelim -$include "./modules/30_crop/rotation_apr22/input/f30_rotation_min_scen.csv" -$offdelim -; -$if "%c30_rotation_constraints%" == "off" f30_rotation_min_shr(crp30) = 0; - diff --git a/modules/30_crop/rotation_apr22/input/files b/modules/30_crop/rotation_apr22/input/files deleted file mode 100644 index c20b7be222..0000000000 --- a/modules/30_crop/rotation_apr22/input/files +++ /dev/null @@ -1,4 +0,0 @@ -* list of files that are required here -f30_rotation_max_scen.csv -f30_rotation_min_scen.csv -f30_croparea_w_initialisation.cs3 diff --git a/modules/30_crop/rotation_apr22/postsolve.gms b/modules/30_crop/rotation_apr22/postsolve.gms deleted file mode 100644 index 18031392c2..0000000000 --- a/modules/30_crop/rotation_apr22/postsolve.gms +++ /dev/null @@ -1,50 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w); - ov_rotation_penalty(t,i,"marginal") = vm_rotation_penalty.m(i); - ov_carbon_stock_croparea(t,j,ag_pools,"marginal") = vm_carbon_stock_croparea.m(j,ag_pools); - oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); - oq30_rotation_max(t,j,rotamax30,"marginal") = q30_rotation_max.m(j,rotamax30); - oq30_rotation_min(t,j,rotamin30,"marginal") = q30_rotation_min.m(j,rotamin30); - oq30_rotation_max_irrig(t,j,rotamax30,"marginal") = q30_rotation_max_irrig.m(j,rotamax30); - oq30_carbon(t,j,ag_pools,"marginal") = q30_carbon.m(j,ag_pools); - oq30_bv_ann(t,j,potnatveg,"marginal") = q30_bv_ann.m(j,potnatveg); - oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg); - ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); - ov_rotation_penalty(t,i,"level") = vm_rotation_penalty.l(i); - ov_carbon_stock_croparea(t,j,ag_pools,"level") = vm_carbon_stock_croparea.l(j,ag_pools); - oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); - oq30_rotation_max(t,j,rotamax30,"level") = q30_rotation_max.l(j,rotamax30); - oq30_rotation_min(t,j,rotamin30,"level") = q30_rotation_min.l(j,rotamin30); - oq30_rotation_max_irrig(t,j,rotamax30,"level") = q30_rotation_max_irrig.l(j,rotamax30); - oq30_carbon(t,j,ag_pools,"level") = q30_carbon.l(j,ag_pools); - oq30_bv_ann(t,j,potnatveg,"level") = q30_bv_ann.l(j,potnatveg); - oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg); - ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); - ov_rotation_penalty(t,i,"upper") = vm_rotation_penalty.up(i); - ov_carbon_stock_croparea(t,j,ag_pools,"upper") = vm_carbon_stock_croparea.up(j,ag_pools); - oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); - oq30_rotation_max(t,j,rotamax30,"upper") = q30_rotation_max.up(j,rotamax30); - oq30_rotation_min(t,j,rotamin30,"upper") = q30_rotation_min.up(j,rotamin30); - oq30_rotation_max_irrig(t,j,rotamax30,"upper") = q30_rotation_max_irrig.up(j,rotamax30); - oq30_carbon(t,j,ag_pools,"upper") = q30_carbon.up(j,ag_pools); - oq30_bv_ann(t,j,potnatveg,"upper") = q30_bv_ann.up(j,potnatveg); - oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg); - ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); - ov_rotation_penalty(t,i,"lower") = vm_rotation_penalty.lo(i); - ov_carbon_stock_croparea(t,j,ag_pools,"lower") = vm_carbon_stock_croparea.lo(j,ag_pools); - oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); - oq30_rotation_max(t,j,rotamax30,"lower") = q30_rotation_max.lo(j,rotamax30); - oq30_rotation_min(t,j,rotamin30,"lower") = q30_rotation_min.lo(j,rotamin30); - oq30_rotation_max_irrig(t,j,rotamax30,"lower") = q30_rotation_max_irrig.lo(j,rotamax30); - oq30_carbon(t,j,ag_pools,"lower") = q30_carbon.lo(j,ag_pools); - oq30_bv_ann(t,j,potnatveg,"lower") = q30_bv_ann.lo(j,potnatveg); - oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/30_crop/rotation_apr22/preloop.gms b/modules/30_crop/rotation_apr22/preloop.gms deleted file mode 100644 index df6a30816f..0000000000 --- a/modules/30_crop/rotation_apr22/preloop.gms +++ /dev/null @@ -1,26 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - - -** Trajectory for cropland scenarios -* sigmoidal interpolation between start year and target year -m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); - -** create crop rotation scenario -i30_rotation_max_shr(t_all,rotamax30)= - f30_rotation_max_shr(rotamax30,"default") * (1-p30_rotation_scenario_fader(t_all))+ - f30_rotation_max_shr(rotamax30,"%c30_rotation_scenario%") * (p30_rotation_scenario_fader(t_all)); - -i30_rotation_min_shr(t_all,rotamin30)= - f30_rotation_min_shr(rotamin30,"default") * (1-p30_rotation_scenario_fader(t_all))+ - f30_rotation_min_shr(rotamin30,"%c30_rotation_scenario%") * (p30_rotation_scenario_fader(t_all)); - - -*due to some rounding errors the input data currently may contain in some cases -*very small, negative numbers. These numbers have to be set to 0 as area -*cannot be smaller than 0! -fm_croparea(t_past,j,w,kcr)$(fm_croparea(t_past,j,w,kcr)<0) = 0; diff --git a/modules/30_crop/rotation_apr22/presolve.gms b/modules/30_crop/rotation_apr22/presolve.gms deleted file mode 100644 index 1b847385d9..0000000000 --- a/modules/30_crop/rotation_apr22/presolve.gms +++ /dev/null @@ -1,26 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @code -*' First, all 2nd generation bioenergy area is fixed to zero, irrespective of type and -*' rainfed/irrigation. -vm_area.fx(j,kbe30,w)=0; -*' Second, the bounds for 2nd generation bioenergy area are released depending on -*' the dynamic sets bioen_type_30 and bioen_water_30. -*' SSP2 default settings are used for the historic period. -if(m_year(t) <= sm_fix_SSP2, - vm_area.up(j,kbe30,"rainfed") = Inf; -else - vm_area.up(j,bioen_type_30,bioen_water_30) = Inf; -); -*' @stop - -* only activate constraints which are binding -rotamax_red30(rotamax30) = yes$(i30_rotation_max_shr(t,rotamax30) < 1); -rotamin_red30(rotamin30) = yes$(i30_rotation_min_shr(t,rotamin30) > 0); - -vm_rotation_penalty.fx(i)=0; diff --git a/modules/30_crop/rotation_apr22/realization.gms b/modules/30_crop/rotation_apr22/realization.gms deleted file mode 100644 index 3e2f37077f..0000000000 --- a/modules/30_crop/rotation_apr22/realization.gms +++ /dev/null @@ -1,41 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description The rotation_apr21 realization calculates the crop specific -*' agricultural land use endogenously based on yield data coming from the -*' module [14_yields] and the rotational as well as suitability constraints -*' stated in the input data of the module. -*' -*' Cropland areas are linked to the crop specific production and the carbon -*' content of the different land carbon pools. The crop specific land use areas -*' are also used in [18_residues], [38_factor_costs], -*' [41_area_equipped_for_irrigation], [42_water_demand], [50_nr_soil_budget], -*' [53_methane] and [59_som]. - -*' This module realization allows for different scenarios of rotational -*' constraints. These are implemented as hard constraints. Maximum rotational -*' constraints are defined for total cropland as well as for irrigated areas -*' only to avoid overspecialization on irrigated land. Minimum constraints are -*' just valid for total cropland areas. - -*' This realisation also includes the option to reserve a minimum semi-natural -*' vegetation share within the total available cropland for other land cover -*' classes, including grassland, forest, and other land (by a given target year), -*' in order to provide species habitats and to benefit from ecosystem ervices in -*' agricultural landscapes. - -*' @limitations There are currently no known limitations of this realization. - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/30_crop/rotation_apr22/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/30_crop/rotation_apr22/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/30_crop/rotation_apr22/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/30_crop/rotation_apr22/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/30_crop/rotation_apr22/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/30_crop/rotation_apr22/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/30_crop/rotation_apr22/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/30_crop/rotation_apr22/sets.gms b/modules/30_crop/rotation_apr22/sets.gms deleted file mode 100644 index b8264aa0fd..0000000000 --- a/modules/30_crop/rotation_apr22/sets.gms +++ /dev/null @@ -1,101 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -sets - rotascen30 rotation constraint scenarios - /min,default,good,good_20div,setaside,legumes, - betr0,betr10,betr20,betr25,betr30,betr40,betr50, - sixfoldrotation,agroecology/ - - rotamax30 Maximum crop rotation categories - / all_max, cereals_excl_rice_max, stalk_max, - biomass_max, roots_max, legume_max, rape_sugr_max, - tece_max, maiz_max, trce_max, rice_max, - rapeseed_max, soybean_max, sunflower_max, groundnut_max, - oilpalm_max, puls_max, potato_max, cassava_max, - sugr_cane_max, sugr_beet_max, others_max, foddr_max, - fiber_max, begr_max, betr_max - / - - rotamin30 Minimum crop rotation categories - / - all_min, stalk_min, biomass_min, - legume_min, others_min, betr_min - / - - rotamax_red30(rotamax30) Maximum crop rotation reduced set - rotamin_red30(rotamin30) Minimum crop rotation reduced set - -* crop rotation groups: -* cereals or grasses are very favourable to loosen soils, therefore minimum constraint -* legumes need longer rotations, only soybean can and is cultivated every 2 years -* rapeseed and beets have same nematodes -* root crops have similar diseases - -* Sustainable practices: -* >=5% set-aside, >=5% biomass crops that approximate agroforestry systems -* six fold crop rotation of the remaining 90% -* at least one legume slot in crop rotation -* crop groups with multiple members like tece or foddr are allowed multiple slots -* one percent fruits and vegs in each cell for regional demand - - rotamax_kcr30(rotamax30, kcr) Mapping of crop types into crop rotation types - / all_max . (tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, - oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, - foddr, cottn_pro, begr, betr) - cereals_excl_rice_max . (tece, maiz, trce) - stalk_max . (tece, maiz, trce, rice_pro, sugr_cane, begr, foddr) - roots_max . (potato, cassav_sp, sugr_beet) - legume_max . (soybean, groundnut, puls_pro, foddr) - biomass_max . (sugr_cane, oilpalm, begr, betr) - rape_sugr_max . (rapeseed, sugr_beet) - - tece_max . (tece) - maiz_max . (maiz) - trce_max . (trce) - rice_max . (rice_pro) - rapeseed_max . (rapeseed) - soybean_max . (soybean) - sunflower_max . (sunflower) - groundnut_max . (groundnut) - oilpalm_max . (oilpalm) - puls_max . (puls_pro) - potato_max . (potato) - cassava_max . (cassav_sp) - sugr_cane_max . (sugr_cane) - sugr_beet_max . (sugr_beet) - others_max . (others) - foddr_max . (foddr) - fiber_max . (cottn_pro) - begr_max . (begr) - betr_max . (betr) / - - rotamin_kcr30(rotamin30,kcr) Mapping of crop types into crop rotation types - / all_min . (tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, - oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, - foddr, cottn_pro, begr, betr) - - stalk_min . (tece, maiz, trce, rice_pro, sugr_cane, foddr) - biomass_min . (sugr_cane, oilpalm, begr, betr) - legume_min . (soybean, groundnut, puls_pro, foddr) - others_min . (others) - betr_min . (betr) - / - - kbe30(kcr) bio energy activities - / betr, begr / - - bioen_type_30(kbe30) dynamic set bioen type - bioen_water_30(w) dynamic set bioen water - - crop_ann30(kcr) annual crops - / tece, maiz, trce, rice_pro, rapeseed, sunflower, potato, cassav_sp, sugr_beet, others, cottn_pro, foddr, soybean, groundnut, puls_pro / - - crop_per30(kcr) perennial crops - / oilpalm, begr, sugr_cane, betr / - -; diff --git a/modules/30_crop/penalty_apr22/declarations.gms b/modules/30_croparea/detail_apr24/declarations.gms similarity index 88% rename from modules/30_crop/penalty_apr22/declarations.gms rename to modules/30_croparea/detail_apr24/declarations.gms index 2d3d2eeebe..ff46199365 100644 --- a/modules/30_crop/penalty_apr22/declarations.gms +++ b/modules/30_croparea/detail_apr24/declarations.gms @@ -6,6 +6,7 @@ *** | Contact: magpie@pik-potsdam.de parameters + i30_rotation_rules(t_all,rota30) Rotational constraints (1) i30_rotation_incentives(t_all,rota30) Penalty for violating rotational constraints (USD05MER per ha) p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) ; @@ -23,6 +24,8 @@ equations q30_rotation_penalty(i) Total penalty for rotational constraint violations (mio. USD05MER) q30_rotation_max(j,rotamax30) Local maximum rotational constraints (mio. ha) q30_rotation_min(j,rotamin30) Local minimum rotational constraints (mio. ha) + q30_rotation_max2(j,rotamax30) Local maximum rotational constraints (mio. ha) + q30_rotation_min2(j,rotamin30) Local minimum rotational constraints (mio. ha) q30_rotation_max_irrig(j,rotamax30) Local maximum rotational constraints (mio. ha) q30_carbon(j,ag_pools) Croplarea above ground carbon content calculation (mio. tC) q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) @@ -40,6 +43,8 @@ parameters oq30_rotation_penalty(t,i,type) Total penalty for rotational constraint violations (mio. USD05MER) oq30_rotation_max(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) oq30_rotation_min(t,j,rotamin30,type) Local minimum rotational constraints (mio. ha) + oq30_rotation_max2(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) + oq30_rotation_min2(t,j,rotamin30,type) Local minimum rotational constraints (mio. ha) oq30_rotation_max_irrig(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) oq30_carbon(t,j,ag_pools,type) Croplarea above ground carbon content calculation (mio. tC) oq30_bv_ann(t,j,potnatveg,type) Biodiversity value of annual cropland (mio. ha) diff --git a/modules/30_croparea/detail_apr24/equations.gms b/modules/30_croparea/detail_apr24/equations.gms new file mode 100644 index 0000000000..034de74216 --- /dev/null +++ b/modules/30_croparea/detail_apr24/equations.gms @@ -0,0 +1,83 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @equations + +*' Agricultural production is calculated by multiplying the area under +*' production with corresponding yields. Production from rainfed and irrigated +*' areas is summed up: + + q30_prod(j2,kcr) .. + vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); + +*' Rotational constraints prevent over-specialization. In this realization, +*' they are either implemented via a rules (s30_implementation = 1) or +*' a penalty payment if the constraints are violated (s30_implementation = 0). + + q30_rotation_penalty(i2) .. + vm_rotation_penalty(i2) =g= + sum(cell(i2,j2), + sum(rota30, v30_penalty(j2,rota30) * sum(ct, i30_rotation_incentives(ct,rota30))) + + sum(rotamax_red30, v30_penalty_max_irrig(j2,rotamax_red30) + * sum(ct, i30_rotation_incentives(ct,rotamax_red30))) + ); + + q30_rotation_max(j2,rotamax_red30)$(s30_implementation = 1) .. + sum((rota_kcr30(rotamax_red30,kcr),w), vm_area(j2,kcr,w)) =l= + sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamax_red30)); + + q30_rotation_min(j2,rotamin_red30)$(s30_implementation = 1) .. + sum((rota_kcr30(rotamin_red30,kcr),w), vm_area(j2,kcr,w)) =g= + sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamin_red30)); + +*' The penalty applies to the areas which exceed a certain maximum +*' share of the land. Below this share, negative benefits are +*' avoided by defining the penalty to be positive. + + q30_rotation_max2(j2,rotamax_red30)$(s30_implementation = 0) .. + v30_penalty(j2,rotamax_red30) =g= + sum((rota_kcr30(rotamax_red30,kcr),w),vm_area(j2,kcr,w)) + - sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamax_red30)); + + +*' Minimum constraints apply penalties when a certain mimimum +*' share of a group is not achieved. This is used to guarantee a minimum +*' crop group diversity withing cells. + + q30_rotation_min2(j2,rotamin_red30)$(s30_implementation = 0) .. + v30_penalty(j2,rotamin_red30) =g= + sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamin_red30)) + - sum((rota_kcr30(rotamin_red30,kcr),w), vm_area(j2,kcr,w)); + + +*' The following maximum constraint avoids over-specialization in irrigated systems. +*' No minimum constraint is included for irrigated areas for computational +*' reasons. Minimum constraints just need to be met on total areas. + + q30_rotation_max_irrig(j2,rotamax_red30) .. + v30_penalty_max_irrig(j2,rotamax_red30) =g= + sum((rota_kcr30(rotamax_red30,kcr)), vm_area(j2,kcr,"irrigated")) + - vm_AEI(j2) * sum(ct,i30_rotation_rules(ct,rotamax_red30)); + + +*' The carbon stocks of the above ground carbon pools are calculated based on croparea and related carbon density. + + q30_carbon(j2,ag_pools) .. + vm_carbon_stock_croparea(j2,ag_pools) =e= + sum((kcr,w), vm_area(j2,kcr,w)) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)); + + +*' The biodiversity value for cropland is calculated separately for annual and perennial crops: + + q30_bv_ann(j2,potnatveg) .. + vm_bv(j2,"crop_ann",potnatveg) =e= + sum((crop_ann30,w), vm_area(j2,crop_ann30,w)) * fm_bii_coeff("crop_ann",potnatveg) + * fm_luh2_side_layers(j2,potnatveg); + + q30_bv_per(j2,potnatveg) .. vm_bv(j2,"crop_per",potnatveg) =e= + sum((crop_per30,w), vm_area(j2,crop_per30,w)) * fm_bii_coeff("crop_per",potnatveg) + * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/30_crop/penalty_apr22/input.gms b/modules/30_croparea/detail_apr24/input.gms similarity index 66% rename from modules/30_crop/penalty_apr22/input.gms rename to modules/30_croparea/detail_apr24/input.gms index 3cadd0b059..6db7c4dfeb 100644 --- a/modules/30_crop/penalty_apr22/input.gms +++ b/modules/30_croparea/detail_apr24/input.gms @@ -11,18 +11,17 @@ $setglobal c30_bioen_type all $setglobal c30_bioen_water rainfed * options: rainfed, irrigated, all -$setglobal c30_rotation_constraints on -*options: on, off +$setglobal c30_rotation_rules default +*options: none, default, legumes, betr500, betr1000, agroecology -$setglobal c30_rotation_scenario default +$setglobal c30_rotation_incentives default *options: none, default, legumes, betr500, betr1000, agroecology -$setglobal c30_rotation_scenario_speed by2050 -* options: none, by2030, by2020 scalars s30_rotation_scenario_start Rotation scenario start year / 2020 / s30_rotation_scenario_target Rotation scenario target year / 2050 / + s30_implementation Switch for rule-based (1) or penalty-based (0) implementation of rotation scenarios / 1 / ; @@ -38,24 +37,22 @@ $endif table fm_croparea(t_all,j,w,kcr) Different croparea type areas (mio. ha) $ondelim -$include "./modules/30_crop/penalty_apr22/input/f30_croparea_w_initialisation.cs3" +$include "./modules/30_croparea/detail_apr24/input/f30_croparea_w_initialisation.cs3" $offdelim ; m_fillmissingyears(fm_croparea,"j,w,kcr"); ********* CROP-ROTATIONAL CONSTRAINT ******************************************* -table f30_rotation_incentives(rota30,rotascen30) penalties for violating rotation rules (USD05MER) +table f30_rotation_incentives(rota30,incentscen30) penalties for violating rotation rules (USD05MER) $ondelim -$include "./modules/30_crop/penalty_apr22/input/f30_rotation_incentives.csv" +$include "./modules/30_croparea/detail_apr24/input/f30_rotation_incentives.csv" $offdelim ; -parameter f30_rotation_rules(rota30) Rotation min or max shares (1) -/ +table f30_rotation_rules(rota30,rotascen30) Rotation min or max shares (1) $ondelim -$include "./modules/30_crop/penalty_apr22/input/f30_rotation_rules.csv" +$include "./modules/30_croparea/detail_apr24/input/f30_rotation_rules.csv" $offdelim -/ ; diff --git a/modules/30_crop/penalty_apr22/input/files b/modules/30_croparea/detail_apr24/input/files similarity index 100% rename from modules/30_crop/penalty_apr22/input/files rename to modules/30_croparea/detail_apr24/input/files diff --git a/modules/30_crop/penalty_apr22/postsolve.gms b/modules/30_croparea/detail_apr24/postsolve.gms similarity index 87% rename from modules/30_crop/penalty_apr22/postsolve.gms rename to modules/30_croparea/detail_apr24/postsolve.gms index 84a11fd02a..481fb9e1c9 100644 --- a/modules/30_crop/penalty_apr22/postsolve.gms +++ b/modules/30_croparea/detail_apr24/postsolve.gms @@ -16,6 +16,8 @@ oq30_rotation_penalty(t,i,"marginal") = q30_rotation_penalty.m(i); oq30_rotation_max(t,j,rotamax30,"marginal") = q30_rotation_max.m(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"marginal") = q30_rotation_min.m(j,rotamin30); + oq30_rotation_max2(t,j,rotamax30,"marginal") = q30_rotation_max2.m(j,rotamax30); + oq30_rotation_min2(t,j,rotamin30,"marginal") = q30_rotation_min2.m(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"marginal") = q30_rotation_max_irrig.m(j,rotamax30); oq30_carbon(t,j,ag_pools,"marginal") = q30_carbon.m(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"marginal") = q30_bv_ann.m(j,potnatveg); @@ -29,6 +31,8 @@ oq30_rotation_penalty(t,i,"level") = q30_rotation_penalty.l(i); oq30_rotation_max(t,j,rotamax30,"level") = q30_rotation_max.l(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"level") = q30_rotation_min.l(j,rotamin30); + oq30_rotation_max2(t,j,rotamax30,"level") = q30_rotation_max2.l(j,rotamax30); + oq30_rotation_min2(t,j,rotamin30,"level") = q30_rotation_min2.l(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"level") = q30_rotation_max_irrig.l(j,rotamax30); oq30_carbon(t,j,ag_pools,"level") = q30_carbon.l(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"level") = q30_bv_ann.l(j,potnatveg); @@ -42,6 +46,8 @@ oq30_rotation_penalty(t,i,"upper") = q30_rotation_penalty.up(i); oq30_rotation_max(t,j,rotamax30,"upper") = q30_rotation_max.up(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"upper") = q30_rotation_min.up(j,rotamin30); + oq30_rotation_max2(t,j,rotamax30,"upper") = q30_rotation_max2.up(j,rotamax30); + oq30_rotation_min2(t,j,rotamin30,"upper") = q30_rotation_min2.up(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"upper") = q30_rotation_max_irrig.up(j,rotamax30); oq30_carbon(t,j,ag_pools,"upper") = q30_carbon.up(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"upper") = q30_bv_ann.up(j,potnatveg); @@ -55,6 +61,8 @@ oq30_rotation_penalty(t,i,"lower") = q30_rotation_penalty.lo(i); oq30_rotation_max(t,j,rotamax30,"lower") = q30_rotation_max.lo(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"lower") = q30_rotation_min.lo(j,rotamin30); + oq30_rotation_max2(t,j,rotamax30,"lower") = q30_rotation_max2.lo(j,rotamax30); + oq30_rotation_min2(t,j,rotamin30,"lower") = q30_rotation_min2.lo(j,rotamin30); oq30_rotation_max_irrig(t,j,rotamax30,"lower") = q30_rotation_max_irrig.lo(j,rotamax30); oq30_carbon(t,j,ag_pools,"lower") = q30_carbon.lo(j,ag_pools); oq30_bv_ann(t,j,potnatveg,"lower") = q30_bv_ann.lo(j,potnatveg); diff --git a/modules/30_crop/penalty_apr22/preloop.gms b/modules/30_croparea/detail_apr24/preloop.gms similarity index 68% rename from modules/30_crop/penalty_apr22/preloop.gms rename to modules/30_croparea/detail_apr24/preloop.gms index 075f0c5e82..51e2d0cfaa 100644 --- a/modules/30_crop/penalty_apr22/preloop.gms +++ b/modules/30_croparea/detail_apr24/preloop.gms @@ -10,12 +10,21 @@ m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); ** create crop rotation scenario -i30_rotation_incentives(t_all,rota30)= +i30_rotation_rules(t_all,rota30) = + f30_rotation_rules(rota30,"default") * (1-p30_rotation_scenario_fader(t_all)) + + f30_rotation_rules(rota30,"%c30_rotation_rules%") * (p30_rotation_scenario_fader(t_all)); + +** create crop rotation scenario +i30_rotation_incentives(t_all,rota30) = f30_rotation_incentives(rota30,"default") * (1-p30_rotation_scenario_fader(t_all)) + - f30_rotation_incentives(rota30,"%c30_rotation_scenario%") * (p30_rotation_scenario_fader(t_all)); + f30_rotation_incentives(rota30,"%c30_rotation_incentives%") * (p30_rotation_scenario_fader(t_all)); *due to some rounding errors the input data currently may contain in some cases *very small, negative numbers. These numbers have to be set to 0 as area *cannot be smaller than 0! fm_croparea(t_past,j,w,kcr)$(fm_croparea(t_past,j,w,kcr)<0) = 0; + +if(s30_implementation = 1, + v30_penalty.fx(j,rota30) = 0; +); diff --git a/modules/30_crop/penalty_apr22/presolve.gms b/modules/30_croparea/detail_apr24/presolve.gms similarity index 100% rename from modules/30_crop/penalty_apr22/presolve.gms rename to modules/30_croparea/detail_apr24/presolve.gms diff --git a/modules/30_croparea/detail_apr24/realization.gms b/modules/30_croparea/detail_apr24/realization.gms new file mode 100644 index 0000000000..42d40a5156 --- /dev/null +++ b/modules/30_croparea/detail_apr24/realization.gms @@ -0,0 +1,33 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @description This realization calculates the crop specific +*' agricultural crop area endogenously based on yield data provided by +*' module [14_yields] and detailed rotational constraints. +*' In addition, corresponding carbons stocks and BII values are calculated. +*' +*' The crop specific interface `vm_area` is used in many other modules, +*' including [18_residues], [38_factor_costs], +*' [41_area_equipped_for_irrigation], [42_water_demand], [50_nr_soil_budget], +*' [53_methane] and [59_som]. +*' +*' This realization allows for different scenarios of rotational +*' constraints which are either implemented via hard constraints or penalty payments +*' if constraints are exceeded. Rotational constraints are defined for total croparea +*' as well as for irrigated areas only to avoid overspecialization on irrigated land. + +*' @limitations There are currently no known limitations of this realization. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/30_croparea/detail_apr24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/30_croparea/detail_apr24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/30_croparea/detail_apr24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/30_croparea/detail_apr24/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/30_croparea/detail_apr24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/30_croparea/detail_apr24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/30_croparea/detail_apr24/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/30_croparea/detail_apr24/sets.gms b/modules/30_croparea/detail_apr24/sets.gms new file mode 100644 index 0000000000..e0fa90cefe --- /dev/null +++ b/modules/30_croparea/detail_apr24/sets.gms @@ -0,0 +1,114 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +sets + incentscen30 rotation inventive scenarios + /none,default,legumes,betr500,betr1000,agroecology/ + + rotascen30 rotation constraint scenarios + /min,default,good,good_20div,setaside,legumes, + betr0,betr10,betr20,betr25,betr30,betr40,betr50, + sixfoldrotation,agroecology,FSEC/ + + rota30 rotational rules + /cereals1_max, cereals2_max, cereals_excl_rice_max, stalk_max, + resistant_max, oilcrops_max, + legumes_max, rootsrape_max, roots_max, rape_sugr_max, biomass_max, + tece_max, maiz_max, trce_max, rice_max, + rapeseed_max, soybean_max, sunflower_max, groundnut_max, + oilpalm_max, puls_max, potato_max, cassava_max, + sugr_cane_max, sugr_beet_max, others_max, foddr_max, + fiber_max, begr_max, betr_max + biomass_min, legumes_min, stalk_min, others_min, + minor_min, cereals_min, betr_min/ + + + rotamax30(rota30) rotational maximum rules + /cereals1_max, cereals2_max, cereals_excl_rice_max, stalk_max, + resistant_max, oilcrops_max, + legumes_max, rootsrape_max, roots_max, rape_sugr_max, biomass_max, + tece_max, maiz_max, trce_max, rice_max, + rapeseed_max, soybean_max, sunflower_max, groundnut_max, + oilpalm_max, puls_max, potato_max, cassava_max, + sugr_cane_max, sugr_beet_max, others_max, foddr_max, + fiber_max, begr_max, betr_max/ + + rotamin30(rota30) rotational minimum rules + /biomass_min, legumes_min, stalk_min, others_min, + minor_min, cereals_min, betr_min/ + + rotamax_red30(rotamax30) Maximum crop rotation reduced set + rotamin_red30(rotamin30) Minimum crop rotation reduced set + +* crop rotation groups: +* cereals or grasses are very favourable to loosen soils, therefore minimum constraint +* legumes need longer rotations, only soybean can and is cultivated every 2 years +* rapeseed and beets have same nematodes +* root crops have similar diseases + +* Sustainable practices: +* >=5% set-aside, >=5% biomass crops that approximate agroforestry systems +* six fold crop rotation of the remaining 90% +* at least one legume slot in crop rotation +* crop groups with multiple members like tece or foddr are allowed multiple slots +* one percent fruits and vegs in each cell for regional demand + + rota_kcr30(rota30, kcr) Mapping of crop types into crop rotation types + / cereals1_max . (tece, maiz, trce, rice_pro) + cereals2_max . (tece, maiz, trce, rice_pro) + cereals_excl_rice_max . (tece, maiz, trce) + stalk_max . (tece, maiz, trce, rice_pro, sugr_cane, begr, foddr) + resistant_max . (begr,betr,foddr,sugr_cane,cottn_pro,oilpalm,others) + oilcrops_max . (sunflower, rapeseed) + legumes_max . (foddr, puls_pro, soybean, groundnut) + rootsrape_max . (sugr_beet, cassav_sp, potato, rapeseed) + roots_max . (sugr_beet, cassav_sp, potato) + rape_sugr_max . (rapeseed, sugr_beet) + biomass_max . (sugr_cane, oilpalm, begr, betr) + + tece_max . (tece) + maiz_max . (maiz) + trce_max . (trce) + rice_max . (rice_pro) + rapeseed_max . (rapeseed) + soybean_max . (soybean) + sunflower_max . (sunflower) + groundnut_max . (groundnut) + oilpalm_max . (oilpalm) + puls_max . (puls_pro) + potato_max . (potato) + cassava_max . (cassav_sp) + sugr_cane_max . (sugr_cane) + sugr_beet_max . (sugr_beet) + others_max . (others) + foddr_max . (foddr) + fiber_max . (cottn_pro) + begr_max . (begr) + betr_max . (betr) + + biomass_min . (sugr_cane, oilpalm, begr, betr) + legumes_min . (soybean, groundnut, puls_pro, foddr) + minor_min . (sunflower, rapeseed, sugr_beet, cassav_sp, potato, others) + cereals_min . (tece, maiz, trce, rice_pro) + stalk_min . (tece, maiz, trce, rice_pro, sugr_cane, foddr) + others_min . (others) + betr_min . (betr) + / + + kbe30(kcr) bio energy activities + / betr, begr / + + bioen_type_30(kbe30) dynamic set bioen type + bioen_water_30(w) dynamic set bioen water + + crop_ann30(kcr) annual crops + / tece, maiz, trce, rice_pro, rapeseed, sunflower, potato, cassav_sp, sugr_beet, others, cottn_pro, foddr, soybean, groundnut, puls_pro / + + crop_per30(kcr) perennial crops + / oilpalm, begr, sugr_cane, betr / + +; diff --git a/modules/30_crop/module.gms b/modules/30_croparea/module.gms similarity index 76% rename from modules/30_crop/module.gms rename to modules/30_croparea/module.gms index 2c80e2a8db..3b8eedc704 100644 --- a/modules/30_crop/module.gms +++ b/modules/30_croparea/module.gms @@ -15,7 +15,6 @@ *' @authors Jan Philipp Dietrich, Florian Humpenöder, Benjamin Bodirsky *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%crop%" == "endo_apr21" $include "./modules/30_crop/endo_apr21/realization.gms" -$Ifi "%crop%" == "penalty_apr22" $include "./modules/30_crop/penalty_apr22/realization.gms" -$Ifi "%crop%" == "rotation_apr22" $include "./modules/30_crop/rotation_apr22/realization.gms" +$Ifi "%croparea%" == "detail_apr24" $include "./modules/30_croparea/detail_apr24/realization.gms" +$Ifi "%croparea%" == "simple_apr24" $include "./modules/30_croparea/simple_apr24/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/30_crop/endo_apr21/declarations.gms b/modules/30_croparea/simple_apr24/declarations.gms similarity index 100% rename from modules/30_crop/endo_apr21/declarations.gms rename to modules/30_croparea/simple_apr24/declarations.gms diff --git a/modules/30_crop/endo_apr21/equations.gms b/modules/30_croparea/simple_apr24/equations.gms similarity index 73% rename from modules/30_crop/endo_apr21/equations.gms rename to modules/30_croparea/simple_apr24/equations.gms index 626f0ce4a6..40b4ff85d8 100644 --- a/modules/30_crop/endo_apr21/equations.gms +++ b/modules/30_croparea/simple_apr24/equations.gms @@ -35,17 +35,17 @@ *' The carbon stocks of the above ground carbon pools are calculated based on croparea and related carbon density. - q30_carbon(j2,ag_pools) .. - vm_carbon_stock_croparea(j2,ag_pools) =e= - sum((kcr,w), vm_area(j2,kcr,w)) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)); + q30_carbon(j2,ag_pools) .. + vm_carbon_stock_croparea(j2,ag_pools) =e= + sum((kcr,w), vm_area(j2,kcr,w)) * sum(ct, fm_carbon_density(ct,j2,"crop",ag_pools)); *' The biodiversity value for cropland is calculated separately for annual and perennial crops: - q30_bv_ann(j2,potnatveg) .. vm_bv(j2,"crop_ann",potnatveg) - =e= - sum((crop_ann30,w), vm_area(j2,crop_ann30,w)) * fm_bii_coeff("crop_ann",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + q30_bv_ann(j2,potnatveg) .. + vm_bv(j2,"crop_ann",potnatveg) =e= + sum((crop_ann30,w), vm_area(j2,crop_ann30,w)) * fm_bii_coeff("crop_ann",potnatveg) * fm_luh2_side_layers(j2,potnatveg); - q30_bv_per(j2,potnatveg) .. vm_bv(j2,"crop_per",potnatveg) - =e= - sum((crop_per30,w), vm_area(j2,crop_per30,w)) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + q30_bv_per(j2,potnatveg) .. + vm_bv(j2,"crop_per",potnatveg) =e= + sum((crop_per30,w), vm_area(j2,crop_per30,w)) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/30_crop/endo_apr21/input.gms b/modules/30_croparea/simple_apr24/input.gms similarity index 87% rename from modules/30_crop/endo_apr21/input.gms rename to modules/30_croparea/simple_apr24/input.gms index aeacce22d7..02c72d13d3 100644 --- a/modules/30_crop/endo_apr21/input.gms +++ b/modules/30_croparea/simple_apr24/input.gms @@ -31,7 +31,7 @@ $endif table fm_croparea(t_all,j,w,kcr) Different croparea type areas (mio. ha) $ondelim -$include "./modules/30_crop/endo_apr21/input/f30_croparea_w_initialisation.cs3" +$include "./modules/30_croparea/simple_apr24/input/f30_croparea_w_initialisation.cs3" $offdelim ; m_fillmissingyears(fm_croparea,"j,w,kcr"); @@ -41,7 +41,7 @@ m_fillmissingyears(fm_croparea,"j,w,kcr"); parameter f30_rotation_max_shr(crp30) Maximum allowed area shares for each crop type (1) / $ondelim -$include "./modules/30_crop/endo_apr21/input/f30_rotation_max.csv" +$include "./modules/30_croparea/simple_apr24/input/f30_rotation_max.csv" $offdelim /; $if "%c30_rotation_constraints%" == "off" f30_rotation_max_shr(crp30) = 1; @@ -50,7 +50,7 @@ $if "%c30_rotation_constraints%" == "off" f30_rotation_max_shr(crp30) = 1; parameter f30_rotation_min_shr(crp30) Minimum allowed area shares for each crop type (1) / $ondelim -$include "./modules/30_crop/endo_apr21/input/f30_rotation_min.csv" +$include "./modules/30_croparea/simple_apr24/input/f30_rotation_min.csv" $offdelim /; $if "%c30_rotation_constraints%" == "off" f30_rotation_min_shr(crp30) = 0; diff --git a/modules/30_crop/endo_apr21/input/files b/modules/30_croparea/simple_apr24/input/files similarity index 100% rename from modules/30_crop/endo_apr21/input/files rename to modules/30_croparea/simple_apr24/input/files diff --git a/modules/30_crop/endo_apr21/not_used.txt b/modules/30_croparea/simple_apr24/not_used.txt similarity index 100% rename from modules/30_crop/endo_apr21/not_used.txt rename to modules/30_croparea/simple_apr24/not_used.txt diff --git a/modules/30_crop/endo_apr21/postsolve.gms b/modules/30_croparea/simple_apr24/postsolve.gms similarity index 100% rename from modules/30_crop/endo_apr21/postsolve.gms rename to modules/30_croparea/simple_apr24/postsolve.gms diff --git a/modules/30_crop/endo_apr21/preloop.gms b/modules/30_croparea/simple_apr24/preloop.gms similarity index 100% rename from modules/30_crop/endo_apr21/preloop.gms rename to modules/30_croparea/simple_apr24/preloop.gms diff --git a/modules/30_crop/endo_apr21/presolve.gms b/modules/30_croparea/simple_apr24/presolve.gms similarity index 100% rename from modules/30_crop/endo_apr21/presolve.gms rename to modules/30_croparea/simple_apr24/presolve.gms diff --git a/modules/30_croparea/simple_apr24/realization.gms b/modules/30_croparea/simple_apr24/realization.gms new file mode 100644 index 0000000000..f4c9140600 --- /dev/null +++ b/modules/30_croparea/simple_apr24/realization.gms @@ -0,0 +1,28 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @description This realization calculates the crop specific +*' agricultural crop area endogenously based on yield data provided by +*' module [14_yields] and simplified rotational constraints. +*' In addition, corresponding carbons stocks and BII values are calculated. +*' +*' The crop specific interface `vm_area` is used in many other modules, +*' including [18_residues], [38_factor_costs], +*' [41_area_equipped_for_irrigation], [42_water_demand], [50_nr_soil_budget], +*' [53_methane] and [59_som]. + +*' @limitations There are currently no known limitations of this realization. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/30_croparea/simple_apr24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/30_croparea/simple_apr24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/30_croparea/simple_apr24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/30_croparea/simple_apr24/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/30_croparea/simple_apr24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/30_croparea/simple_apr24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/30_croparea/simple_apr24/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/30_crop/endo_apr21/sets.gms b/modules/30_croparea/simple_apr24/sets.gms similarity index 100% rename from modules/30_crop/endo_apr21/sets.gms rename to modules/30_croparea/simple_apr24/sets.gms diff --git a/modules/include.gms b/modules/include.gms index e46128a47c..d00709aaec 100644 --- a/modules/include.gms +++ b/modules/include.gms @@ -24,7 +24,7 @@ $include "./modules/21_trade/module.gms" $include "./modules/22_land_conservation/module.gms" $include "./modules/28_ageclass/module.gms" $include "./modules/29_cropland/module.gms" -$include "./modules/30_crop/module.gms" +$include "./modules/30_croparea/module.gms" $include "./modules/31_past/module.gms" $include "./modules/32_forestry/module.gms" $include "./modules/34_urban/module.gms" From 350667aeb418410e7a029cab529764aaee0baacb Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 21 Apr 2024 16:18:41 +0200 Subject: [PATCH 017/280] partial commit to save work --- config/default.cfg | 2 +- modules/30_croparea/detail_apr24/input.gms | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 22ec4d5252..b3cb85f97b 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -776,7 +776,7 @@ cfg$gms$c30_rotation_rules <- "default" # def = "default" # * none (no incentives), default (best guess), # * legumes (increased incentives for legumes), agroecology (mix), # * betr500 and betr1000 (incentives for short rotation agroforestry trees) -cfg$gms$c30_rotation_incentives <- "default" # def = "default" +cfg$gms$c30_rotation_incentives <- "none" # def = "none" # * Year by which rotation scenario is fully implemented: # * Start year: diff --git a/modules/30_croparea/detail_apr24/input.gms b/modules/30_croparea/detail_apr24/input.gms index 6db7c4dfeb..4a915b8a8f 100644 --- a/modules/30_croparea/detail_apr24/input.gms +++ b/modules/30_croparea/detail_apr24/input.gms @@ -12,9 +12,10 @@ $setglobal c30_bioen_water rainfed * options: rainfed, irrigated, all $setglobal c30_rotation_rules default -*options: none, default, legumes, betr500, betr1000, agroecology +*options: min, default, good, good_20div, setaside, legumes, sixfoldrotation, agroecology, +* betr0, betr10, betr20, betr25, betr30, betr40, betr50, FSEC -$setglobal c30_rotation_incentives default +$setglobal c30_rotation_incentives none *options: none, default, legumes, betr500, betr1000, agroecology From abdc8c86dabef84b60746edc154a5aa0abfe16b0 Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 21 Apr 2024 16:30:43 +0200 Subject: [PATCH 018/280] partial commit to save work --- config/scenario_fsec.csv | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/config/scenario_fsec.csv b/config/scenario_fsec.csv index 8f6ee53db2..705bbe9beb 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -26,8 +26,9 @@ gms$c15_food_scenario;;;SSP1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c21_trade_liberalization;;;;;;;;;;;;;;;;;;;;;;;l908080r807070;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s21_trade_bal_damper;0.65;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c22_protect_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BH_IFL;;;;;;;;;;;;;;;;;;;;;; -gms$crop;penalty_apr22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -gms$c30_rotation_scenario;default;;;;;;;;;;;;;;;;;;;;;;;;;;;agroecology;;;;;;;;;;;;;;;;;;;;;;; +gms$croparea;detail_apr24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c30_rotation_rules;FSEC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c30_rotation_incentives;default;;;;;;;;;;;;;;;;;;;;;;;;;;;agroecology;;;;;;;;;;;;;;;;;;;;;;; gms$s30_rotation_scenario_target;2050;;;;;;;;;;;;;;;;;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;;;; gms$c29_marginal_land;q33_marginal;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c30_bioen_water;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rainfed;;;;;;;;;;;;;;;;;;;;; From 67b57fc3c94c37b71bfe1205099dd3185ae03f80 Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 21 Apr 2024 18:27:41 +0200 Subject: [PATCH 019/280] partial commit to save work --- config/default.cfg | 2 ++ modules/29_cropland/detail_apr24/declarations.gms | 8 ++++---- modules/29_cropland/detail_apr24/equations.gms | 4 ++-- modules/29_cropland/detail_apr24/input.gms | 8 ++++---- modules/29_cropland/detail_apr24/presolve.gms | 10 ++++------ 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index b3cb85f97b..f639240e8f 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -729,6 +729,8 @@ cfg$gms$s29_treecover_scenario_start <- 2020 # def = 2020 cfg$gms$s29_treecover_scenario_target <- 2050 # def = 2050 # * Penalty for violation of treecover target cfg$gms$s29_treecover_penalty <- 0 #def = 0 +# * Cropland treecover can decrease (1) or not (0) +cfg$gms$s29_treecover_decrease <- 0 #def = 0 # * Minimum share of fallow land on total cropland area (including croparea, fallow land and tree cover). # * s29_fallow_target is faded in linearly between s29_fallow_scenario_start and s29_fallow_scenario_target. diff --git a/modules/29_cropland/detail_apr24/declarations.gms b/modules/29_cropland/detail_apr24/declarations.gms index 14405e207a..0d3aaf5d0e 100644 --- a/modules/29_cropland/detail_apr24/declarations.gms +++ b/modules/29_cropland/detail_apr24/declarations.gms @@ -21,16 +21,16 @@ parameters i29_snv_scenario_fader(t_all) SNV scenario fader (1) i29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) - i29_treecover_target(t,j) Target share for treecover on total cropland (1) - i29_treecover_penalty(t_all) Penalty for violation of treecover target (USD05MER per ha) + i29_treecover_target(t) Target share for treecover on total cropland (1) + i29_treecover_penalty(t) Penalty for violation of treecover target (USD05MER per ha) p29_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) p29_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) p29_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) pc29_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) i29_fallow_scenario_fader(t_all) Fallow land scenario fader (1) - i29_fallow_target(t_all) Target share for fallow land on total cropland (1) - i29_fallow_penalty(t_all) Penalty for violation of fallow target (USD05MER per ha) + i29_fallow_target(t) Target share for fallow land on total cropland (1) + i29_fallow_penalty(t) Penalty for violation of fallow target (USD05MER per ha) ; positive variables diff --git a/modules/29_cropland/detail_apr24/equations.gms b/modules/29_cropland/detail_apr24/equations.gms index 566441173f..9887e23df8 100644 --- a/modules/29_cropland/detail_apr24/equations.gms +++ b/modules/29_cropland/detail_apr24/equations.gms @@ -89,7 +89,7 @@ q29_treecover_shr(j2)$(s29_implementation = 1) .. sum(ac, v29_treecover(j2,ac)) =g= - sum(ct, i29_treecover_target(ct,j2)) * vm_land(j2,"crop"); + sum(ct, i29_treecover_target(ct)) * vm_land(j2,"crop"); *' Otherwise, a penalty is applied for the violation of treecover rules. *' The penalty applies to the missing treecover area, i.e. where treecover area @@ -97,7 +97,7 @@ q29_treecover_missing(j2)$(s29_implementation = 0) .. v29_treecover_missing(j2) =g= - vm_land(j2,"crop") * sum(ct, i29_treecover_target(ct,j2)) - sum(ac, v29_treecover(j2,ac)); + vm_land(j2,"crop") * sum(ct, i29_treecover_target(ct)) - sum(ac, v29_treecover(j2,ac)); q29_treecover_penalty(j2) .. v29_treecover_penalty(j2) =e= diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms index f2458f3ece..e050123544 100644 --- a/modules/29_cropland/detail_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -22,12 +22,12 @@ scalars s29_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / s29_treecover_scenario_start Cropland treecover scenario start year / 2020 / s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / - s29_treecover_target Target share of treecover on total cropland (1) / 0.3 / - s29_treecover_penalty Penalty for violation of treecover target (USD05MER per ha) / 500 / + s29_treecover_target Target share of treecover on total cropland (1) / 0 / + s29_treecover_penalty Penalty for violation of treecover target (USD05MER per ha) / 0 / s29_fallow_scenario_start Fallow land scenario start year / 2020 / s29_fallow_scenario_target Fallow land scenario target year / 2050 / - s29_fallow_target Target share of fallow land on total cropland (1) / 0.3 / - s29_fallow_penalty Penalty for violation of fallow target (USD05MER per ha) / 500 / + s29_fallow_target Target share of fallow land on total cropland (1) / 0 / + s29_fallow_penalty Penalty for violation of fallow target (USD05MER per ha) / 0 / s29_implementation Switch for rule-based (1) or penalty-based (0) implementation of fallow and treecover targets / 1 / ; diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index 4fb606c500..b865150ab0 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -56,11 +56,9 @@ else * create treecover target and penalty scenario -i29_treecover_target(t,j) = - ((1-i29_treecover_scenario_fader(t)) * sum(ac, pc29_treecover(j,ac))/pcm_land(j,"crop"))$(pcm_land(j,"crop") > 1e-10) + - (i29_treecover_scenario_fader(t) * s29_treecover_target); -i29_treecover_penalty(t_all) = s29_treecover_penalty * i29_treecover_scenario_fader(t_all); +i29_treecover_target(t) = s29_treecover_target * i29_treecover_scenario_fader(t); +i29_treecover_penalty(t) = s29_treecover_penalty * i29_treecover_scenario_fader(t); * create fallow land target and penalty scenario -i29_fallow_target(t_all) = s29_fallow_target * i29_fallow_scenario_fader(t_all); -i29_fallow_penalty(t_all) = s29_fallow_penalty * i29_fallow_scenario_fader(t_all); +i29_fallow_target(t) = s29_fallow_target * i29_fallow_scenario_fader(t); +i29_fallow_penalty(t) = s29_fallow_penalty * i29_fallow_scenario_fader(t); From a0b0e153b2756204260efdc4c34306564f59381d Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 21 Apr 2024 21:01:06 +0200 Subject: [PATCH 020/280] bugfix --- modules/29_cropland/simple_apr24/equations.gms | 4 +--- modules/32_forestry/dynamic_feb21/presolve.gms | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/29_cropland/simple_apr24/equations.gms b/modules/29_cropland/simple_apr24/equations.gms index 1088543e1c..a5cd2a0dd2 100644 --- a/modules/29_cropland/simple_apr24/equations.gms +++ b/modules/29_cropland/simple_apr24/equations.gms @@ -16,9 +16,7 @@ *' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas *' from cropland production that have a low suitability, e.g. due to steep slopes, *' to estimate the available cropland area. The cultivated area therefore has -*' to be smaller than the available cropland area. Moreover, the available cropland -*' can be reduced by constraining the cropland area in favour of other land types, -*' in order to increase compositional heterogeneity of land types at the cell level. +*' to be smaller than the available cropland area. q29_avl_cropland(j2) .. vm_land(j2,"crop") =l= sum(ct, p29_avl_cropland(ct,j2)); diff --git a/modules/32_forestry/dynamic_feb21/presolve.gms b/modules/32_forestry/dynamic_feb21/presolve.gms index 4ad3a9b119..3491620843 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_feb21/presolve.gms @@ -14,7 +14,7 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; p32_aff_pol_timestep("y1995",j) = 0; p32_aff_pol_timestep(t,j)$(ord(t)>1) = p32_aff_pol(t,j) - p32_aff_pol(t-1,j); * Suitable area (`p32_aff_pot`) for NPI/NDC afforestation - p32_aff_pot(t,j) = (vm_land.l(j,"crop") - vm_land.lo(j,"crop")) + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore"); + p32_aff_pot(t,j) = sum((kcr,w),vm_area.l(j,kcr,w) - vm_area.lo(j,kcr,w)) + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore"); * suitable area `p32_aff_pot` can be negative, if land restoration is switched on (level smaller than lower bound), therefore set negative values to 0 p32_aff_pot(t,j)$(p32_aff_pot(t,j) < 0) = 0; * Limit prescribed NPI/NDC afforestation in `p32_aff_pol_timestep` if not enough suitable area (`p32_aff_pot`) for afforestation is available From 43fd4fd215611a4c2389237f930531685ea1e541 Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 21 Apr 2024 21:23:57 +0200 Subject: [PATCH 021/280] bugfix --- config/scenario_fsec.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/config/scenario_fsec.csv b/config/scenario_fsec.csv index 705bbe9beb..cd0fc1a682 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -29,6 +29,7 @@ gms$c22_protect_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;BH_IFL;;;;;;;;;;;;;;;;;;;;; gms$croparea;detail_apr24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c30_rotation_rules;FSEC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c30_rotation_incentives;default;;;;;;;;;;;;;;;;;;;;;;;;;;;agroecology;;;;;;;;;;;;;;;;;;;;;;; +gms$s30_implementation;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s30_rotation_scenario_target;2050;;;;;;;;;;;;;;;;;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;;;; gms$c29_marginal_land;q33_marginal;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c30_bioen_water;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rainfed;;;;;;;;;;;;;;;;;;;;; From 8333584f2d89a2e8499a2e1bc0fa09f98d9548bd Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 22 Apr 2024 09:28:44 +0200 Subject: [PATCH 022/280] balance variable NPI NDC reforestation --- modules/32_forestry/dynamic_feb21/declarations.gms | 6 ++++-- modules/32_forestry/dynamic_feb21/equations.gms | 4 ++-- modules/32_forestry/dynamic_feb21/input.gms | 2 +- modules/32_forestry/dynamic_feb21/postsolve.gms | 4 ++++ 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/modules/32_forestry/dynamic_feb21/declarations.gms b/modules/32_forestry/dynamic_feb21/declarations.gms index 199e78df99..b5ee97415c 100644 --- a/modules/32_forestry/dynamic_feb21/declarations.gms +++ b/modules/32_forestry/dynamic_feb21/declarations.gms @@ -66,7 +66,8 @@ positive variables vm_cost_fore(i) Forestry costs (Mio USD) v32_cost_hvarea(i) Cost of harvesting timber from forests (mio. USD per yr) v32_land(j,type32,ac) Forestry land pools (mio. ha) - v32_land_missing(j) Forestry land which can be used at extrmemly high costs in case not enough area is available for new establishment (mio. ha) + v32_land_missing(j) Technical area balance term for timber plantation establishment (mio. ha) + v32_land_missing_ndc(j) Technical area balance term for NPI NDC reforestation (mio. ha) vm_landdiff_forestry Aggregated difference in forestry land compared to previous timestep (mio. ha) v32_cost_recur(i) Recurring forest management costs (USD per ha) v32_land_expansion(j,type32) Forestry land expansion (mio. ha) @@ -119,7 +120,8 @@ parameters ov_cost_fore(t,i,type) Forestry costs (Mio USD) ov32_cost_hvarea(t,i,type) Cost of harvesting timber from forests (mio. USD per yr) ov32_land(t,j,type32,ac,type) Forestry land pools (mio. ha) - ov32_land_missing(t,j,type) Forestry land which can be used at extrmemly high costs in case not enough area is available for new establishment (mio. ha) + ov32_land_missing(t,j,type) Technical area balance term for timber plantation establishment (mio. ha) + ov32_land_missing_ndc(t,j,type) Technical area balance term for NPI NDC reforestation (mio. ha) ov_landdiff_forestry(t,type) Aggregated difference in forestry land compared to previous timestep (mio. ha) ov32_cost_recur(t,i,type) Recurring forest management costs (USD per ha) ov32_land_expansion(t,j,type32,type) Forestry land expansion (mio. ha) diff --git a/modules/32_forestry/dynamic_feb21/equations.gms b/modules/32_forestry/dynamic_feb21/equations.gms index 259fdc7206..483ced9c3c 100644 --- a/modules/32_forestry/dynamic_feb21/equations.gms +++ b/modules/32_forestry/dynamic_feb21/equations.gms @@ -24,7 +24,7 @@ q32_cost_total(i2) .. vm_cost_fore(i2) =e= v32_cost_recur(i2) + v32_cost_establishment(i2) + v32_cost_hvarea(i2) - + sum(cell(i2,j2), v32_land_missing(j2)) * s32_free_land_cost + + sum(cell(i2,j2), v32_land_missing(j2) + v32_land_missing_ndc(j2)) * s32_free_land_cost ; *----------------------------------------------- @@ -68,7 +68,7 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( *' The constraint `q32_aff_pol` accounts for the exogenous afforestation prescribed by NPI/NDC policies. q32_aff_pol(j2) .. - sum(ac_est, v32_land(j2,"ndc",ac_est)) =e= sum(ct, p32_aff_pol_timestep(ct,j2)); + sum(ac_est, v32_land(j2,"ndc",ac_est)) =e= sum(ct, p32_aff_pol_timestep(ct,j2)) + v32_land_missing_ndc(j2); *' The constraint `q32_max_aff` accounts for the allowed maximum global endogenous *' afforestation defined in `i32_max_aff_area_glo`. diff --git a/modules/32_forestry/dynamic_feb21/input.gms b/modules/32_forestry/dynamic_feb21/input.gms index 961bb68cb5..7535dd5077 100644 --- a/modules/32_forestry/dynamic_feb21/input.gms +++ b/modules/32_forestry/dynamic_feb21/input.gms @@ -38,7 +38,7 @@ scalars s32_faustmann_rotation Switch to activate faustmann rotations (1=on 0=off) / 0 / s32_initial_distribution Switch to Activate ageclass distribution in plantations 0=off 1=equal distribution 2=FAO distribution 3=Poulter distribution 4=Manual distribution (1) / 0 / s32_price Price for timber (USD) / 45 / - s32_free_land_cost Very high cost for using non existing land for plantation establishment (USD per ha) /1000000/ + s32_free_land_cost Penalty for technial area balance term (USD per ha) /1000000/ s32_max_aff_area Maximum total global afforestation (mio. ha) / Inf / s32_aff_plantation Switch for using growth curves for afforestation 0=natveg 1=plantations (1) / 0 / s32_tcre_local Switch for local (1) or global (0) TRCE factors (1) / 1 / diff --git a/modules/32_forestry/dynamic_feb21/postsolve.gms b/modules/32_forestry/dynamic_feb21/postsolve.gms index 69a4b4e0de..6ac3f7ed22 100644 --- a/modules/32_forestry/dynamic_feb21/postsolve.gms +++ b/modules/32_forestry/dynamic_feb21/postsolve.gms @@ -14,6 +14,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_hvarea(t,i,"marginal") = v32_cost_hvarea.m(i); ov32_land(t,j,type32,ac,"marginal") = v32_land.m(j,type32,ac); ov32_land_missing(t,j,"marginal") = v32_land_missing.m(j); + ov32_land_missing_ndc(t,j,"marginal") = v32_land_missing_ndc.m(j); ov_landdiff_forestry(t,"marginal") = vm_landdiff_forestry.m; ov32_cost_recur(t,i,"marginal") = v32_cost_recur.m(i); ov32_land_expansion(t,j,type32,"marginal") = v32_land_expansion.m(j,type32); @@ -56,6 +57,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_hvarea(t,i,"level") = v32_cost_hvarea.l(i); ov32_land(t,j,type32,ac,"level") = v32_land.l(j,type32,ac); ov32_land_missing(t,j,"level") = v32_land_missing.l(j); + ov32_land_missing_ndc(t,j,"level") = v32_land_missing_ndc.l(j); ov_landdiff_forestry(t,"level") = vm_landdiff_forestry.l; ov32_cost_recur(t,i,"level") = v32_cost_recur.l(i); ov32_land_expansion(t,j,type32,"level") = v32_land_expansion.l(j,type32); @@ -98,6 +100,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_hvarea(t,i,"upper") = v32_cost_hvarea.up(i); ov32_land(t,j,type32,ac,"upper") = v32_land.up(j,type32,ac); ov32_land_missing(t,j,"upper") = v32_land_missing.up(j); + ov32_land_missing_ndc(t,j,"upper") = v32_land_missing_ndc.up(j); ov_landdiff_forestry(t,"upper") = vm_landdiff_forestry.up; ov32_cost_recur(t,i,"upper") = v32_cost_recur.up(i); ov32_land_expansion(t,j,type32,"upper") = v32_land_expansion.up(j,type32); @@ -140,6 +143,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_hvarea(t,i,"lower") = v32_cost_hvarea.lo(i); ov32_land(t,j,type32,ac,"lower") = v32_land.lo(j,type32,ac); ov32_land_missing(t,j,"lower") = v32_land_missing.lo(j); + ov32_land_missing_ndc(t,j,"lower") = v32_land_missing_ndc.lo(j); ov_landdiff_forestry(t,"lower") = vm_landdiff_forestry.lo; ov32_cost_recur(t,i,"lower") = v32_cost_recur.lo(i); ov32_land_expansion(t,j,type32,"lower") = v32_land_expansion.lo(j,type32); From 10142261c0cdeceeec30f1c3e79c86e3a5491ac1 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 22 Apr 2024 11:03:24 +0200 Subject: [PATCH 023/280] bugfixes --- config/default.cfg | 2 +- .../30_croparea/detail_apr24/declarations.gms | 1 + .../30_croparea/detail_apr24/equations.gms | 20 +++++++++---------- modules/30_croparea/detail_apr24/presolve.gms | 6 ++++-- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 5ab3f0bf1d..c1b4cde3a3 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -26,7 +26,7 @@ cfg$input <- c(regional = "rev4.104_h12_magpie.tgz", cellular = "rev4.104_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", validation = "rev4.104_h12_validation.tgz", additional = "additional_data_rev4.48.tgz", - calibration = "calibration_H12_26Mar24.tgz") + calibration = "calibration_H12_cropareaSimple_21Apr24.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, diff --git a/modules/30_croparea/detail_apr24/declarations.gms b/modules/30_croparea/detail_apr24/declarations.gms index ff46199365..b0ef264b21 100644 --- a/modules/30_croparea/detail_apr24/declarations.gms +++ b/modules/30_croparea/detail_apr24/declarations.gms @@ -9,6 +9,7 @@ parameters i30_rotation_rules(t_all,rota30) Rotational constraints (1) i30_rotation_incentives(t_all,rota30) Penalty for violating rotational constraints (USD05MER per ha) p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) + i30_implementation Switch for rule-based (1) or penalty-based (0) implementation of rotation scenarios ; positive variables diff --git a/modules/30_croparea/detail_apr24/equations.gms b/modules/30_croparea/detail_apr24/equations.gms index 034de74216..4b58d4e001 100644 --- a/modules/30_croparea/detail_apr24/equations.gms +++ b/modules/30_croparea/detail_apr24/equations.gms @@ -15,8 +15,8 @@ vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); *' Rotational constraints prevent over-specialization. In this realization, -*' they are either implemented via a rules (s30_implementation = 1) or -*' a penalty payment if the constraints are violated (s30_implementation = 0). +*' they are either implemented via a rules (i30_implementation = 1) or +*' a penalty payment if the constraints are violated (i30_implementation = 0). q30_rotation_penalty(i2) .. vm_rotation_penalty(i2) =g= @@ -26,31 +26,31 @@ * sum(ct, i30_rotation_incentives(ct,rotamax_red30))) ); - q30_rotation_max(j2,rotamax_red30)$(s30_implementation = 1) .. + q30_rotation_max(j2,rotamax_red30)$(i30_implementation = 1) .. sum((rota_kcr30(rotamax_red30,kcr),w), vm_area(j2,kcr,w)) =l= - sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamax_red30)); + vm_land(j2,"crop") * sum(ct,i30_rotation_rules(ct,rotamax_red30)); - q30_rotation_min(j2,rotamin_red30)$(s30_implementation = 1) .. + q30_rotation_min(j2,rotamin_red30)$(i30_implementation = 1) .. sum((rota_kcr30(rotamin_red30,kcr),w), vm_area(j2,kcr,w)) =g= - sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamin_red30)); + vm_land(j2,"crop") * sum(ct,i30_rotation_rules(ct,rotamin_red30)); *' The penalty applies to the areas which exceed a certain maximum *' share of the land. Below this share, negative benefits are *' avoided by defining the penalty to be positive. - q30_rotation_max2(j2,rotamax_red30)$(s30_implementation = 0) .. + q30_rotation_max2(j2,rotamax_red30)$(i30_implementation = 0) .. v30_penalty(j2,rotamax_red30) =g= sum((rota_kcr30(rotamax_red30,kcr),w),vm_area(j2,kcr,w)) - - sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamax_red30)); + - vm_land(j2,"crop") * sum(ct,i30_rotation_rules(ct,rotamax_red30)); *' Minimum constraints apply penalties when a certain mimimum *' share of a group is not achieved. This is used to guarantee a minimum *' crop group diversity withing cells. - q30_rotation_min2(j2,rotamin_red30)$(s30_implementation = 0) .. + q30_rotation_min2(j2,rotamin_red30)$(i30_implementation = 0) .. v30_penalty(j2,rotamin_red30) =g= - sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamin_red30)) + vm_land(j2,"crop") * sum(ct,i30_rotation_rules(ct,rotamin_red30)) - sum((rota_kcr30(rotamin_red30,kcr),w), vm_area(j2,kcr,w)); diff --git a/modules/30_croparea/detail_apr24/presolve.gms b/modules/30_croparea/detail_apr24/presolve.gms index 4c8d3a4fa8..d95c14a256 100644 --- a/modules/30_croparea/detail_apr24/presolve.gms +++ b/modules/30_croparea/detail_apr24/presolve.gms @@ -14,11 +14,13 @@ vm_area.fx(j,kbe30,w)=0; *' SSP2 default settings are used for the historic period. if(m_year(t) <= sm_fix_SSP2, vm_area.up(j,kbe30,"rainfed") = Inf; + i30_implementation = 1; else vm_area.up(j,bioen_type_30,bioen_water_30) = Inf; + i30_implementation = s30_implementation; ); *' @stop * only activate constraints which are binding -rotamax_red30(rotamax30) = yes$(i30_rotation_incentives(t,rotamax30) > 0); -rotamin_red30(rotamin30) = yes$(i30_rotation_incentives(t,rotamin30) > 0); +rotamax_red30(rotamax30) = yes$(i30_rotation_rules(t,rotamax30) < 1); +rotamin_red30(rotamin30) = yes$(i30_rotation_rules(t,rotamin30) > 0); From ec92cc655a7e99f1f3dfa36fa5ed64ff48459b3e Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 22 Apr 2024 12:39:50 +0200 Subject: [PATCH 024/280] bugfix --- modules/30_croparea/simple_apr24/not_used.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/30_croparea/simple_apr24/not_used.txt b/modules/30_croparea/simple_apr24/not_used.txt index 1fd7a8461c..50edb3866a 100644 --- a/modules/30_croparea/simple_apr24/not_used.txt +++ b/modules/30_croparea/simple_apr24/not_used.txt @@ -1,2 +1,3 @@ name,type,reason vm_AEI,input,questionnaire +vm_land,input,not needed From 876fc9d891e918cbf20b61ab91ac58123ba5053e Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 22 Apr 2024 12:58:33 +0200 Subject: [PATCH 025/280] bugfix --- modules/30_croparea/detail_apr24/equations.gms | 8 ++++---- modules/30_croparea/simple_apr24/not_used.txt | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/30_croparea/detail_apr24/equations.gms b/modules/30_croparea/detail_apr24/equations.gms index 4b58d4e001..95d5c18c24 100644 --- a/modules/30_croparea/detail_apr24/equations.gms +++ b/modules/30_croparea/detail_apr24/equations.gms @@ -28,11 +28,11 @@ q30_rotation_max(j2,rotamax_red30)$(i30_implementation = 1) .. sum((rota_kcr30(rotamax_red30,kcr),w), vm_area(j2,kcr,w)) =l= - vm_land(j2,"crop") * sum(ct,i30_rotation_rules(ct,rotamax_red30)); + sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamax_red30)); q30_rotation_min(j2,rotamin_red30)$(i30_implementation = 1) .. sum((rota_kcr30(rotamin_red30,kcr),w), vm_area(j2,kcr,w)) =g= - vm_land(j2,"crop") * sum(ct,i30_rotation_rules(ct,rotamin_red30)); + sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamin_red30)); *' The penalty applies to the areas which exceed a certain maximum *' share of the land. Below this share, negative benefits are @@ -41,7 +41,7 @@ q30_rotation_max2(j2,rotamax_red30)$(i30_implementation = 0) .. v30_penalty(j2,rotamax_red30) =g= sum((rota_kcr30(rotamax_red30,kcr),w),vm_area(j2,kcr,w)) - - vm_land(j2,"crop") * sum(ct,i30_rotation_rules(ct,rotamax_red30)); + - sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamax_red30)); *' Minimum constraints apply penalties when a certain mimimum @@ -50,7 +50,7 @@ q30_rotation_min2(j2,rotamin_red30)$(i30_implementation = 0) .. v30_penalty(j2,rotamin_red30) =g= - vm_land(j2,"crop") * sum(ct,i30_rotation_rules(ct,rotamin_red30)) + sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamin_red30)) - sum((rota_kcr30(rotamin_red30,kcr),w), vm_area(j2,kcr,w)); diff --git a/modules/30_croparea/simple_apr24/not_used.txt b/modules/30_croparea/simple_apr24/not_used.txt index 50edb3866a..1fd7a8461c 100644 --- a/modules/30_croparea/simple_apr24/not_used.txt +++ b/modules/30_croparea/simple_apr24/not_used.txt @@ -1,3 +1,2 @@ name,type,reason vm_AEI,input,questionnaire -vm_land,input,not needed From 8063487c11dd0a0c96ad09fef46d3f7457894e9a Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 22 Apr 2024 13:45:52 +0200 Subject: [PATCH 026/280] bugfix --- modules/32_forestry/dynamic_feb21/equations.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/32_forestry/dynamic_feb21/equations.gms b/modules/32_forestry/dynamic_feb21/equations.gms index 483ced9c3c..46945a28a1 100644 --- a/modules/32_forestry/dynamic_feb21/equations.gms +++ b/modules/32_forestry/dynamic_feb21/equations.gms @@ -68,7 +68,7 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( *' The constraint `q32_aff_pol` accounts for the exogenous afforestation prescribed by NPI/NDC policies. q32_aff_pol(j2) .. - sum(ac_est, v32_land(j2,"ndc",ac_est)) =e= sum(ct, p32_aff_pol_timestep(ct,j2)) + v32_land_missing_ndc(j2); + sum(ac_est, v32_land(j2,"ndc",ac_est)) + v32_land_missing_ndc(j2) =e= sum(ct, p32_aff_pol_timestep(ct,j2)); *' The constraint `q32_max_aff` accounts for the allowed maximum global endogenous *' afforestation defined in `i32_max_aff_area_glo`. From a26ece2382e190a51cf0aa2d300a0144232b32d8 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 22 Apr 2024 18:23:01 +0200 Subject: [PATCH 027/280] bugfixes --- config/default.cfg | 10 ++++---- .../29_cropland/detail_apr24/declarations.gms | 3 ++- .../29_cropland/detail_apr24/equations.gms | 4 ++-- modules/29_cropland/detail_apr24/input.gms | 6 ++--- modules/29_cropland/detail_apr24/presolve.gms | 24 ++++++++++--------- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index c1b4cde3a3..b2765a6057 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -718,7 +718,7 @@ cfg$gms$policy_countries29 <- all_iso_countries cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other" # * Switch for rule-based (1) or penalty-based (0) implementation of fallow and treecover targets -cfg$gms$s29_implementation <- 1 # def = 1 +cfg$gms$s29_implementation <- 0 # def = 0 # * Minimum share of treecover on total cropland area (including croparea, fallow land and tree cover). # * s29_treecover_target is faded in linearly between s29_treecover_scenario_start and s29_treecover_scenario_target. @@ -727,10 +727,10 @@ cfg$gms$s29_treecover_target <- 0 #def = 0 cfg$gms$s29_treecover_scenario_start <- 2020 # def = 2020 # * Target year (year when full implementation is reached): cfg$gms$s29_treecover_scenario_target <- 2050 # def = 2050 -# * Penalty for violation of treecover target -cfg$gms$s29_treecover_penalty <- 0 #def = 0 -# * Cropland treecover can decrease (1) or not (0) -cfg$gms$s29_treecover_decrease <- 0 #def = 0 +# * Penalty for violation of treecover target (USD per ha) +cfg$gms$s29_treecover_penalty <- 500 #def = 500 +# * Keep existing treecover on cropland (1) or allow decrease (0) +cfg$gms$s29_treecover_keep <- 1 #def = 1 # * Minimum share of fallow land on total cropland area (including croparea, fallow land and tree cover). # * s29_fallow_target is faded in linearly between s29_fallow_scenario_start and s29_fallow_scenario_target. diff --git a/modules/29_cropland/detail_apr24/declarations.gms b/modules/29_cropland/detail_apr24/declarations.gms index 0d3aaf5d0e..cb534f2b53 100644 --- a/modules/29_cropland/detail_apr24/declarations.gms +++ b/modules/29_cropland/detail_apr24/declarations.gms @@ -21,12 +21,13 @@ parameters i29_snv_scenario_fader(t_all) SNV scenario fader (1) i29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) - i29_treecover_target(t) Target share for treecover on total cropland (1) + i29_treecover_target(t,j) Target share for treecover on total cropland (1) i29_treecover_penalty(t) Penalty for violation of treecover target (USD05MER per ha) p29_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1) p29_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) p29_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) pc29_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) + p29_treecover_share(t,j) Share of treecover on total cropland (1) i29_fallow_scenario_fader(t_all) Fallow land scenario fader (1) i29_fallow_target(t) Target share for fallow land on total cropland (1) diff --git a/modules/29_cropland/detail_apr24/equations.gms b/modules/29_cropland/detail_apr24/equations.gms index 9887e23df8..566441173f 100644 --- a/modules/29_cropland/detail_apr24/equations.gms +++ b/modules/29_cropland/detail_apr24/equations.gms @@ -89,7 +89,7 @@ q29_treecover_shr(j2)$(s29_implementation = 1) .. sum(ac, v29_treecover(j2,ac)) =g= - sum(ct, i29_treecover_target(ct)) * vm_land(j2,"crop"); + sum(ct, i29_treecover_target(ct,j2)) * vm_land(j2,"crop"); *' Otherwise, a penalty is applied for the violation of treecover rules. *' The penalty applies to the missing treecover area, i.e. where treecover area @@ -97,7 +97,7 @@ q29_treecover_missing(j2)$(s29_implementation = 0) .. v29_treecover_missing(j2) =g= - vm_land(j2,"crop") * sum(ct, i29_treecover_target(ct)) - sum(ac, v29_treecover(j2,ac)); + vm_land(j2,"crop") * sum(ct, i29_treecover_target(ct,j2)) - sum(ac, v29_treecover(j2,ac)); q29_treecover_penalty(j2) .. v29_treecover_penalty(j2) =e= diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms index e050123544..198ea4001a 100644 --- a/modules/29_cropland/detail_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -19,16 +19,16 @@ scalars s29_cost_treecover_recur Tree cover recurring cost (USD05MER per ha) / 500 / s29_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / s29_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / - s29_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 / s29_treecover_scenario_start Cropland treecover scenario start year / 2020 / s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / s29_treecover_target Target share of treecover on total cropland (1) / 0 / - s29_treecover_penalty Penalty for violation of treecover target (USD05MER per ha) / 0 / + s29_treecover_keep Keep existing treecover on cropland (1) or allow decrease (0) / 1 / + s29_treecover_penalty Penalty for violation of treecover target (USD05MER per ha) / 500 / s29_fallow_scenario_start Fallow land scenario start year / 2020 / s29_fallow_scenario_target Fallow land scenario target year / 2050 / s29_fallow_target Target share of fallow land on total cropland (1) / 0 / s29_fallow_penalty Penalty for violation of fallow target (USD05MER per ha) / 0 / - s29_implementation Switch for rule-based (1) or penalty-based (0) implementation of fallow and treecover targets / 1 / + s29_implementation Switch for rule-based (1) or penalty-based (0) implementation of fallow and treecover targets / 0 / ; diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index b865150ab0..ef1eb80ee3 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -22,7 +22,8 @@ p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t- *' data (derived from satellite imagery from the Copernicus *' Global Land Service (@buchhorn_copernicus_2020)) and in *' cases of cropland reduction -p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * pcm_land(j,"crop"); +p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * pcm_land(j,"crop") + - sum(ac, pc29_treecover(j,ac)); p29_snv_relocation(t,j)$(p29_snv_relocation(t, j) > p29_max_snv_relocation(t,j)) = p29_max_snv_relocation(t,j); *' Area potentially available for cropping @@ -41,23 +42,24 @@ s29_shift = m_timestep_length_forestry/5; pc29_treecover(j,ac) = p29_treecover(t,j,ac); v29_treecover.l(j,ac) = p29_treecover(t,j,ac); +* create treecover target and penalty scenario +i29_treecover_target(t,j) = s29_treecover_target * i29_treecover_scenario_fader(t); +i29_treecover_penalty(t) = s29_treecover_penalty * i29_treecover_scenario_fader(t); + if(m_year(t) <= s29_treecover_scenario_start, v29_treecover.fx(j,ac) = pc29_treecover(j,ac); else v29_treecover.lo(j,ac_est) = 0; v29_treecover.up(j,ac_est) = Inf; - if(s29_treecover_decrease = 1, - v29_treecover.lo(j,ac_sub) = 0; - v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); - else - v29_treecover.fx(j,ac_sub) = pc29_treecover(j,ac_sub); - ); + v29_treecover.lo(j,ac_sub) = 0; + v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); ); - -* create treecover target and penalty scenario -i29_treecover_target(t) = s29_treecover_target * i29_treecover_scenario_fader(t); -i29_treecover_penalty(t) = s29_treecover_penalty * i29_treecover_scenario_fader(t); +p29_treecover_share(t,j) = 0; +p29_treecover_share(t,j)$(pcm_land(j,"crop") > 1e-10) = sum(ac, pc29_treecover(j,ac)) / pcm_land(j,"crop"); +if (s29_treecover_keep = 1, + i29_treecover_target(t,j)$(i29_treecover_target(t,j) < p29_treecover_share(t,j)) = p29_treecover_share(t,j); +); * create fallow land target and penalty scenario i29_fallow_target(t) = s29_fallow_target * i29_fallow_scenario_fader(t); From 3feb873ef1ea0773bb8d9a345e2b89a8601d0807 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 22 Apr 2024 21:49:08 +0200 Subject: [PATCH 028/280] partial commit to save work --- config/default.cfg | 52 ++++++++++++------- .../29_cropland/detail_apr24/declarations.gms | 12 ----- .../29_cropland/detail_apr24/equations.gms | 33 +++--------- modules/29_cropland/detail_apr24/input.gms | 7 ++- .../29_cropland/detail_apr24/postsolve.gms | 24 --------- modules/29_cropland/detail_apr24/preloop.gms | 5 -- .../30_croparea/detail_apr24/declarations.gms | 13 +++-- .../30_croparea/detail_apr24/equations.gms | 9 ++++ modules/30_croparea/detail_apr24/input.gms | 4 ++ .../30_croparea/detail_apr24/postsolve.gms | 8 +++ modules/30_croparea/detail_apr24/preloop.gms | 11 ++-- modules/30_croparea/detail_apr24/presolve.gms | 4 ++ modules/30_croparea/detail_apr24/sets.gms | 2 +- .../30_croparea/simple_apr24/declarations.gms | 15 ++++-- .../30_croparea/simple_apr24/equations.gms | 11 ++++ modules/30_croparea/simple_apr24/input.gms | 4 ++ .../30_croparea/simple_apr24/postsolve.gms | 12 +++++ modules/30_croparea/simple_apr24/preloop.gms | 3 +- modules/30_croparea/simple_apr24/presolve.gms | 4 ++ .../80_optimization/lp_nlp_apr17/input.gms | 1 + .../80_optimization/lp_nlp_apr17/solve.gms | 3 +- modules/80_optimization/nlp_apr17/input.gms | 1 + modules/80_optimization/nlp_apr17/solve.gms | 4 +- modules/80_optimization/nlp_par/input.gms | 1 + modules/80_optimization/nlp_par/solve.gms | 4 +- 25 files changed, 141 insertions(+), 106 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index b2765a6057..3142852022 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -717,30 +717,31 @@ cfg$gms$policy_countries29 <- all_iso_countries # * "secdforest, past, other" etc. cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other" -# * Switch for rule-based (1) or penalty-based (0) implementation of fallow and treecover targets -cfg$gms$s29_implementation <- 0 # def = 0 - -# * Minimum share of treecover on total cropland area (including croparea, fallow land and tree cover). +# * Minimum cluster share of treecover on total cropland area (including croparea, fallow land and tree cover). # * s29_treecover_target is faded in linearly between s29_treecover_scenario_start and s29_treecover_scenario_target. -cfg$gms$s29_treecover_target <- 0 #def = 0 +cfg$gms$s29_treecover_target <- 0 # def = 0 +# * Adjust s29_treecover_target to avoid loss of existing treecover (1=yes 0=no) +cfg$gms$s29_treecover_keep <- 1 # def = 1 # * Start year of tree cover share fade-in: -cfg$gms$s29_treecover_scenario_start <- 2020 # def = 2020 +cfg$gms$s29_treecover_scenario_start <- 2020 # def = 2020 # * Target year (year when full implementation is reached): -cfg$gms$s29_treecover_scenario_target <- 2050 # def = 2050 -# * Penalty for violation of treecover target (USD per ha) -cfg$gms$s29_treecover_penalty <- 500 #def = 500 -# * Keep existing treecover on cropland (1) or allow decrease (0) -cfg$gms$s29_treecover_keep <- 1 #def = 1 - -# * Minimum share of fallow land on total cropland area (including croparea, fallow land and tree cover). +cfg$gms$s29_treecover_scenario_target <- 2050 # def = 2050 +# * Tree cover establishment cost (USD05MER per ha) +cfg$gms$s29_cost_treecover_est <- 2000 # def = 2000 +# * Tree cover recurring cost (USD05MER per ha) +cfg$gms$s29_cost_treecover_recur <- 500 # def = 500 +# * Penalty for violation of treecover target (USD05MER per ha) +cfg$gms$s29_treecover_penalty <- 1000 # def = 1000 + +# * Minimum cluster share of fallow land on total cropland area (including croparea, fallow land and tree cover). # * s29_fallow_target is faded in linearly between s29_fallow_scenario_start and s29_fallow_scenario_target. -cfg$gms$s29_fallow_target <- 0 #def = 0 +cfg$gms$s29_fallow_target <- 0 # def = 0 # * Start year of tree cover share fade-in: -cfg$gms$s29_fallow_scenario_start <- 2020 # def = 2020 +cfg$gms$s29_fallow_scenario_start <- 2020 # def = 2020 # * Target year (year when full implementation is reached): -cfg$gms$s29_fallow_scenario_target <- 2050 # def = 2050 -# * Penalty for violation of fallow target -cfg$gms$s29_fallow_penalty <- 0 #def = 0 +cfg$gms$s29_fallow_scenario_target <- 2050 # def = 2050 +# * Penalty for violation of fallow target (USD05MER per ha) +cfg$gms$s29_fallow_penalty <- 500 # def = 500 # ***--------------------- 30_croparea --------------------------------------- # * 30_croparea defines the croparea, which is a subcomponent of total cropland defined in 29_cropland. @@ -756,6 +757,16 @@ cfg$gms$c30_bioen_type <- "all" # def = "all" # * (c30_bioen_water): switch for irrigation of bioenergy crops; options: rainfed, irrigated, all cfg$gms$c30_bioen_water <- "rainfed" # def = "rainfed" +# * Minimum cluster share of bioenergy trees (betr) on total cropland area +# * s30_betr_target is faded in linearly between s30_betr_scenario_start and s30_betr_scenario_target. +cfg$gms$s30_betr_target <- 0 # def = 0 +# * Start year of tree cover share fade-in: +cfg$gms$s30_betr_scenario_start <- 2020 # def = 2020 +# * Target year (year when full implementation is reached): +cfg$gms$s30_betr_scenario_target <- 2050 # def = 2050 +# * Penalty for violation of fallow target (USD05MER per ha) +cfg$gms$s30_betr_penalty <- 500 # def = 500 + # *** Options only available for `simple_apr24` realization *** # * (c30_rotation_constraints): switch for rotational constraints: on, off @@ -1950,6 +1961,11 @@ cfg$gms$c80_nlp_solver <- "conopt4" # def = conopt4 # * 0: default settings (optfile will be ignored) cfg$gms$s80_optfile <- 0 # def = 0 +# switch to use alternative solver settings if CONOPT4 fails +# * 0: not used +# * 1: additional solve statements for CONOPT4 without preprocessing and CONOPT3 +# * Note: Option 1 is very time-consuming and usually does not provide a feasible solution. +cfg$gms$s80_debug <- 0 # def = 0 #*******************************END MODULE SETUP******************************** diff --git a/modules/29_cropland/detail_apr24/declarations.gms b/modules/29_cropland/detail_apr24/declarations.gms index cb534f2b53..e9aa88f83d 100644 --- a/modules/29_cropland/detail_apr24/declarations.gms +++ b/modules/29_cropland/detail_apr24/declarations.gms @@ -37,12 +37,10 @@ parameters positive variables vm_cost_cropland(j) Cost for total cropland (mio. USD05MER per yr) v29_treecover(j,ac) Cropland tree cover per age class (mio. ha) - v29_treecover_penalty(j) Penalty for violation of treecover target (mio. USD05MER per yr) v29_treecover_missing(j) Missing treecover area towards target (mio. ha) v29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) v29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) vm_fallow(j) Fallow land is temporarily fallow cropland (mio. ha) - v29_fallow_penalty(j) Penalty for violation of fallow target (mio. USD05MER per yr) v29_fallow_missing(j) Missing fallow land towards target (mio. ha) ; @@ -53,12 +51,8 @@ equations q29_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) q29_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) q29_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) - q29_fallow_shr(j) Fallow land minimum share (mio. ha) - q29_fallow_penalty(j) Penalty for violation of fallow target (mio. USD05MER per yr) q29_fallow_missing(j) Missing fallow land towards target (mio. ha) q29_fallow_bv(j,potnatveg) Biodiversity value for fallow land (mio. ha) - q29_treecover_shr(j) Cropland treecover minimum share (mio. ha) - q29_treecover_penalty(j) Penalty for violation of treecover target (mio. USD05MER per yr) q29_treecover_missing(j) Missing treecover area towards target (mio. ha) q29_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (mio. ha) q29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) @@ -70,12 +64,10 @@ equations parameters ov_cost_cropland(t,j,type) Cost for total cropland (mio. USD05MER per yr) ov29_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) - ov29_treecover_penalty(t,j,type) Penalty for violation of treecover target (mio. USD05MER per yr) ov29_treecover_missing(t,j,type) Missing treecover area towards target (mio. ha) ov29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) ov29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) ov_fallow(t,j,type) Fallow land is temporarily fallow cropland (mio. ha) - ov29_fallow_penalty(t,j,type) Penalty for violation of fallow target (mio. USD05MER per yr) ov29_fallow_missing(t,j,type) Missing fallow land towards target (mio. ha) oq29_cropland(t,j,type) Total cropland calculation (mio. ha) oq29_avl_cropland(t,j,type) Available cropland constraint (mio. ha) @@ -83,12 +75,8 @@ parameters oq29_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) oq29_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) oq29_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) - oq29_fallow_shr(t,j,type) Fallow land minimum share (mio. ha) - oq29_fallow_penalty(t,j,type) Penalty for violation of fallow target (mio. USD05MER per yr) oq29_fallow_missing(t,j,type) Missing fallow land towards target (mio. ha) oq29_fallow_bv(t,j,potnatveg,type) Biodiversity value for fallow land (mio. ha) - oq29_treecover_shr(t,j,type) Cropland treecover minimum share (mio. ha) - oq29_treecover_penalty(t,j,type) Penalty for violation of treecover target (mio. USD05MER per yr) oq29_treecover_missing(t,j,type) Missing treecover area towards target (mio. ha) oq29_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (mio. ha) oq29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) diff --git a/modules/29_cropland/detail_apr24/equations.gms b/modules/29_cropland/detail_apr24/equations.gms index 566441173f..0faf477aca 100644 --- a/modules/29_cropland/detail_apr24/equations.gms +++ b/modules/29_cropland/detail_apr24/equations.gms @@ -28,7 +28,8 @@ q29_cost_cropland(j2) .. vm_cost_cropland(j2) =e= v29_cost_treecover_est(j2) + v29_cost_treecover_recur(j2) - + v29_fallow_penalty(j2) + v29_treecover_penalty(j2); + + v29_fallow_missing(j2) * sum(ct, i29_fallow_penalty(ct)) + + v29_treecover_missing(j2) * sum(ct, i29_treecover_penalty(ct)); *' The carbon stocks of total cropland are calculated as the sum of carbon stocks in @@ -59,25 +60,14 @@ sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p29_snv_relocation(ct,j2)); -*' In case of no penalty, fallow land is greater or equal a certain fraction of total cropland: - - q29_fallow_shr(j2)$(s29_implementation = 1) .. - vm_fallow(j2) =g= - sum(ct, i29_fallow_target(ct)) * vm_land(j2,"crop"); - -*' Otherwise, a penalty is applied for the violation of fallow land rules. +*' A penalty is applied for the violation of fallow land rules. *' The penalty applies to the missing fallow land, i.e. where fallow land *' is lower than a certain fraction of total cropland. - q29_fallow_missing(j2)$(s29_implementation = 0) .. + q29_fallow_missing(j2) .. v29_fallow_missing(j2) =g= vm_land(j2,"crop") * sum(ct, i29_fallow_target(ct)) - vm_fallow(j2); - q29_fallow_penalty(j2) .. - v29_fallow_penalty(j2) =e= - v29_fallow_missing(j2) * sum(ct, i29_fallow_penalty(ct)); - - *' Fallow land biodiversity value is based on perennial crops. q29_fallow_bv(j2,potnatveg) .. @@ -85,25 +75,14 @@ vm_fallow(j2) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); -*' In case of no penalty, tree cover is greater or equal a certain fraction of total cropland. - - q29_treecover_shr(j2)$(s29_implementation = 1) .. - sum(ac, v29_treecover(j2,ac)) =g= - sum(ct, i29_treecover_target(ct,j2)) * vm_land(j2,"crop"); - -*' Otherwise, a penalty is applied for the violation of treecover rules. +*' A penalty is applied for the violation of treecover rules. *' The penalty applies to the missing treecover area, i.e. where treecover area *' is lower than a certain fraction of total cropland. - q29_treecover_missing(j2)$(s29_implementation = 0) .. + q29_treecover_missing(j2) .. v29_treecover_missing(j2) =g= vm_land(j2,"crop") * sum(ct, i29_treecover_target(ct,j2)) - sum(ac, v29_treecover(j2,ac)); - q29_treecover_penalty(j2) .. - v29_treecover_penalty(j2) =e= - v29_treecover_missing(j2) * sum(ct, i29_treecover_penalty(ct)); - - *' Depending on `s29_treecover_bii_coeff`, tree cover biodiversity value *' is based on natural vegetation or plantation BII coefficients. diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms index 198ea4001a..ab00ed8a46 100644 --- a/modules/29_cropland/detail_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -22,13 +22,12 @@ scalars s29_treecover_scenario_start Cropland treecover scenario start year / 2020 / s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / s29_treecover_target Target share of treecover on total cropland (1) / 0 / - s29_treecover_keep Keep existing treecover on cropland (1) or allow decrease (0) / 1 / - s29_treecover_penalty Penalty for violation of treecover target (USD05MER per ha) / 500 / + s29_treecover_keep Adjust s29_treecover_target to avoid loss of existing treecover (1=yes 0=no) / 1 / + s29_treecover_penalty Penalty for violation of treecover target (USD05MER per ha) / 1000 / s29_fallow_scenario_start Fallow land scenario start year / 2020 / s29_fallow_scenario_target Fallow land scenario target year / 2050 / s29_fallow_target Target share of fallow land on total cropland (1) / 0 / - s29_fallow_penalty Penalty for violation of fallow target (USD05MER per ha) / 0 / - s29_implementation Switch for rule-based (1) or penalty-based (0) implementation of fallow and treecover targets / 0 / + s29_fallow_penalty Penalty for violation of fallow target (USD05MER per ha) / 500 / ; diff --git a/modules/29_cropland/detail_apr24/postsolve.gms b/modules/29_cropland/detail_apr24/postsolve.gms index 5070d341f2..0d05aea001 100644 --- a/modules/29_cropland/detail_apr24/postsolve.gms +++ b/modules/29_cropland/detail_apr24/postsolve.gms @@ -10,12 +10,10 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_cost_cropland(t,j,"marginal") = vm_cost_cropland.m(j); ov29_treecover(t,j,ac,"marginal") = v29_treecover.m(j,ac); - ov29_treecover_penalty(t,j,"marginal") = v29_treecover_penalty.m(j); ov29_treecover_missing(t,j,"marginal") = v29_treecover_missing.m(j); ov29_cost_treecover_est(t,j,"marginal") = v29_cost_treecover_est.m(j); ov29_cost_treecover_recur(t,j,"marginal") = v29_cost_treecover_recur.m(j); ov_fallow(t,j,"marginal") = vm_fallow.m(j); - ov29_fallow_penalty(t,j,"marginal") = v29_fallow_penalty.m(j); ov29_fallow_missing(t,j,"marginal") = v29_fallow_missing.m(j); oq29_cropland(t,j,"marginal") = q29_cropland.m(j); oq29_avl_cropland(t,j,"marginal") = q29_avl_cropland.m(j); @@ -23,12 +21,8 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_carbon(t,j,ag_pools,stockType,"marginal") = q29_carbon.m(j,ag_pools,stockType); oq29_land_snv(t,j,"marginal") = q29_land_snv.m(j); oq29_land_snv_trans(t,j,"marginal") = q29_land_snv_trans.m(j); - oq29_fallow_shr(t,j,"marginal") = q29_fallow_shr.m(j); - oq29_fallow_penalty(t,j,"marginal") = q29_fallow_penalty.m(j); oq29_fallow_missing(t,j,"marginal") = q29_fallow_missing.m(j); oq29_fallow_bv(t,j,potnatveg,"marginal") = q29_fallow_bv.m(j,potnatveg); - oq29_treecover_shr(t,j,"marginal") = q29_treecover_shr.m(j); - oq29_treecover_penalty(t,j,"marginal") = q29_treecover_penalty.m(j); oq29_treecover_missing(t,j,"marginal") = q29_treecover_missing.m(j); oq29_treecover_bv(t,j,potnatveg,"marginal") = q29_treecover_bv.m(j,potnatveg); oq29_cost_treecover_est(t,j,"marginal") = q29_cost_treecover_est.m(j); @@ -36,12 +30,10 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_treecover_est(t,j,ac,"marginal") = q29_treecover_est.m(j,ac); ov_cost_cropland(t,j,"level") = vm_cost_cropland.l(j); ov29_treecover(t,j,ac,"level") = v29_treecover.l(j,ac); - ov29_treecover_penalty(t,j,"level") = v29_treecover_penalty.l(j); ov29_treecover_missing(t,j,"level") = v29_treecover_missing.l(j); ov29_cost_treecover_est(t,j,"level") = v29_cost_treecover_est.l(j); ov29_cost_treecover_recur(t,j,"level") = v29_cost_treecover_recur.l(j); ov_fallow(t,j,"level") = vm_fallow.l(j); - ov29_fallow_penalty(t,j,"level") = v29_fallow_penalty.l(j); ov29_fallow_missing(t,j,"level") = v29_fallow_missing.l(j); oq29_cropland(t,j,"level") = q29_cropland.l(j); oq29_avl_cropland(t,j,"level") = q29_avl_cropland.l(j); @@ -49,12 +41,8 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_carbon(t,j,ag_pools,stockType,"level") = q29_carbon.l(j,ag_pools,stockType); oq29_land_snv(t,j,"level") = q29_land_snv.l(j); oq29_land_snv_trans(t,j,"level") = q29_land_snv_trans.l(j); - oq29_fallow_shr(t,j,"level") = q29_fallow_shr.l(j); - oq29_fallow_penalty(t,j,"level") = q29_fallow_penalty.l(j); oq29_fallow_missing(t,j,"level") = q29_fallow_missing.l(j); oq29_fallow_bv(t,j,potnatveg,"level") = q29_fallow_bv.l(j,potnatveg); - oq29_treecover_shr(t,j,"level") = q29_treecover_shr.l(j); - oq29_treecover_penalty(t,j,"level") = q29_treecover_penalty.l(j); oq29_treecover_missing(t,j,"level") = q29_treecover_missing.l(j); oq29_treecover_bv(t,j,potnatveg,"level") = q29_treecover_bv.l(j,potnatveg); oq29_cost_treecover_est(t,j,"level") = q29_cost_treecover_est.l(j); @@ -62,12 +50,10 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_treecover_est(t,j,ac,"level") = q29_treecover_est.l(j,ac); ov_cost_cropland(t,j,"upper") = vm_cost_cropland.up(j); ov29_treecover(t,j,ac,"upper") = v29_treecover.up(j,ac); - ov29_treecover_penalty(t,j,"upper") = v29_treecover_penalty.up(j); ov29_treecover_missing(t,j,"upper") = v29_treecover_missing.up(j); ov29_cost_treecover_est(t,j,"upper") = v29_cost_treecover_est.up(j); ov29_cost_treecover_recur(t,j,"upper") = v29_cost_treecover_recur.up(j); ov_fallow(t,j,"upper") = vm_fallow.up(j); - ov29_fallow_penalty(t,j,"upper") = v29_fallow_penalty.up(j); ov29_fallow_missing(t,j,"upper") = v29_fallow_missing.up(j); oq29_cropland(t,j,"upper") = q29_cropland.up(j); oq29_avl_cropland(t,j,"upper") = q29_avl_cropland.up(j); @@ -75,12 +61,8 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_carbon(t,j,ag_pools,stockType,"upper") = q29_carbon.up(j,ag_pools,stockType); oq29_land_snv(t,j,"upper") = q29_land_snv.up(j); oq29_land_snv_trans(t,j,"upper") = q29_land_snv_trans.up(j); - oq29_fallow_shr(t,j,"upper") = q29_fallow_shr.up(j); - oq29_fallow_penalty(t,j,"upper") = q29_fallow_penalty.up(j); oq29_fallow_missing(t,j,"upper") = q29_fallow_missing.up(j); oq29_fallow_bv(t,j,potnatveg,"upper") = q29_fallow_bv.up(j,potnatveg); - oq29_treecover_shr(t,j,"upper") = q29_treecover_shr.up(j); - oq29_treecover_penalty(t,j,"upper") = q29_treecover_penalty.up(j); oq29_treecover_missing(t,j,"upper") = q29_treecover_missing.up(j); oq29_treecover_bv(t,j,potnatveg,"upper") = q29_treecover_bv.up(j,potnatveg); oq29_cost_treecover_est(t,j,"upper") = q29_cost_treecover_est.up(j); @@ -88,12 +70,10 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_treecover_est(t,j,ac,"upper") = q29_treecover_est.up(j,ac); ov_cost_cropland(t,j,"lower") = vm_cost_cropland.lo(j); ov29_treecover(t,j,ac,"lower") = v29_treecover.lo(j,ac); - ov29_treecover_penalty(t,j,"lower") = v29_treecover_penalty.lo(j); ov29_treecover_missing(t,j,"lower") = v29_treecover_missing.lo(j); ov29_cost_treecover_est(t,j,"lower") = v29_cost_treecover_est.lo(j); ov29_cost_treecover_recur(t,j,"lower") = v29_cost_treecover_recur.lo(j); ov_fallow(t,j,"lower") = vm_fallow.lo(j); - ov29_fallow_penalty(t,j,"lower") = v29_fallow_penalty.lo(j); ov29_fallow_missing(t,j,"lower") = v29_fallow_missing.lo(j); oq29_cropland(t,j,"lower") = q29_cropland.lo(j); oq29_avl_cropland(t,j,"lower") = q29_avl_cropland.lo(j); @@ -101,12 +81,8 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_carbon(t,j,ag_pools,stockType,"lower") = q29_carbon.lo(j,ag_pools,stockType); oq29_land_snv(t,j,"lower") = q29_land_snv.lo(j); oq29_land_snv_trans(t,j,"lower") = q29_land_snv_trans.lo(j); - oq29_fallow_shr(t,j,"lower") = q29_fallow_shr.lo(j); - oq29_fallow_penalty(t,j,"lower") = q29_fallow_penalty.lo(j); oq29_fallow_missing(t,j,"lower") = q29_fallow_missing.lo(j); oq29_fallow_bv(t,j,potnatveg,"lower") = q29_fallow_bv.lo(j,potnatveg); - oq29_treecover_shr(t,j,"lower") = q29_treecover_shr.lo(j); - oq29_treecover_penalty(t,j,"lower") = q29_treecover_penalty.lo(j); oq29_treecover_missing(t,j,"lower") = q29_treecover_missing.lo(j); oq29_treecover_bv(t,j,potnatveg,"lower") = q29_treecover_bv.lo(j,potnatveg); oq29_cost_treecover_est(t,j,"lower") = q29_cost_treecover_est.lo(j); diff --git a/modules/29_cropland/detail_apr24/preloop.gms b/modules/29_cropland/detail_apr24/preloop.gms index e245094629..a7e39c8c8e 100644 --- a/modules/29_cropland/detail_apr24/preloop.gms +++ b/modules/29_cropland/detail_apr24/preloop.gms @@ -56,8 +56,3 @@ p29_country_dummy(policy_countries29) = 1; * Countries are weighted by available cropland area. i29_avl_cropland_iso(iso) = f29_avl_cropland_iso(iso,"%c29_marginal_land%"); p29_country_snv_weight(i) = sum(i_to_iso(i,iso), p29_country_dummy(iso) * i29_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i29_avl_cropland_iso(iso)); - -if(s29_implementation = 1, - v29_treecover_missing.fx(j) = 0; - v29_fallow_missing.fx(j) = 0; -); diff --git a/modules/30_croparea/detail_apr24/declarations.gms b/modules/30_croparea/detail_apr24/declarations.gms index b0ef264b21..844d35ab27 100644 --- a/modules/30_croparea/detail_apr24/declarations.gms +++ b/modules/30_croparea/detail_apr24/declarations.gms @@ -8,8 +8,11 @@ parameters i30_rotation_rules(t_all,rota30) Rotational constraints (1) i30_rotation_incentives(t_all,rota30) Penalty for violating rotational constraints (USD05MER per ha) - p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) + i30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) i30_implementation Switch for rule-based (1) or penalty-based (0) implementation of rotation scenarios + i30_betr_scenario_fader(t_all) Bioenergy land scenario fader (1) + i30_betr_target(t) Target share for bioenergy land on total cropland (1) + i30_betr_penalty(t) Penalty for violation of betr target (USD05MER per ha) ; positive variables @@ -18,15 +21,17 @@ positive variables vm_carbon_stock_croparea(j,ag_pools) Carbon stock in croparea (tC) v30_penalty_max_irrig(j,rotamax30) Penalty for violating max rotational constraints on irrigated land (mio. USD05MER) v30_penalty(j,rota30) Penalty for violating rotational constraints (mio. USD05MER) + v30_betr_missing(j) Missing bioenergy tree land towards target (mio. ha) ; equations q30_prod(j,kcr) Production of cropped products (mio. tDM) + q30_betr_missing(j) Missing bioenergy tree land towards target (mio. ha) q30_rotation_penalty(i) Total penalty for rotational constraint violations (mio. USD05MER) q30_rotation_max(j,rotamax30) Local maximum rotational constraints (mio. ha) q30_rotation_min(j,rotamin30) Local minimum rotational constraints (mio. ha) - q30_rotation_max2(j,rotamax30) Local maximum rotational constraints (mio. ha) - q30_rotation_min2(j,rotamin30) Local minimum rotational constraints (mio. ha) + q30_rotation_max2(j,rotamax30) Local maximum rotational constraints (mio. ha) + q30_rotation_min2(j,rotamin30) Local minimum rotational constraints (mio. ha) q30_rotation_max_irrig(j,rotamax30) Local maximum rotational constraints (mio. ha) q30_carbon(j,ag_pools) Croplarea above ground carbon content calculation (mio. tC) q30_bv_ann(j,potnatveg) Biodiversity value of annual cropland (mio. ha) @@ -40,7 +45,9 @@ parameters ov_carbon_stock_croparea(t,j,ag_pools,type) Carbon stock in croparea (tC) ov30_penalty_max_irrig(t,j,rotamax30,type) Penalty for violating max rotational constraints on irrigated land (mio. USD05MER) ov30_penalty(t,j,rota30,type) Penalty for violating rotational constraints (mio. USD05MER) + ov30_betr_missing(t,j,type) Missing bioenergy tree land towards target (mio. ha) oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) + oq30_betr_missing(t,j,type) Missing bioenergy tree land towards target (mio. ha) oq30_rotation_penalty(t,i,type) Total penalty for rotational constraint violations (mio. USD05MER) oq30_rotation_max(t,j,rotamax30,type) Local maximum rotational constraints (mio. ha) oq30_rotation_min(t,j,rotamin30,type) Local minimum rotational constraints (mio. ha) diff --git a/modules/30_croparea/detail_apr24/equations.gms b/modules/30_croparea/detail_apr24/equations.gms index 95d5c18c24..7629f075ca 100644 --- a/modules/30_croparea/detail_apr24/equations.gms +++ b/modules/30_croparea/detail_apr24/equations.gms @@ -14,6 +14,14 @@ q30_prod(j2,kcr) .. vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); +*' A penalty is applied for the violation of bioenergy tree (betr) rules. +*' The penalty applies to the missing bioenergy tree land, i.e. where bioenergy tree land +*' is lower than a certain fraction of total cropland. + + q30_betr_missing(j2) .. + v30_betr_missing(j2) =g= + vm_land(j2,"crop") * sum(ct, i30_betr_target(ct)) - vm_area(j2,"betr","rainfed"); + *' Rotational constraints prevent over-specialization. In this realization, *' they are either implemented via a rules (i30_implementation = 1) or *' a penalty payment if the constraints are violated (i30_implementation = 0). @@ -24,6 +32,7 @@ sum(rota30, v30_penalty(j2,rota30) * sum(ct, i30_rotation_incentives(ct,rota30))) + sum(rotamax_red30, v30_penalty_max_irrig(j2,rotamax_red30) * sum(ct, i30_rotation_incentives(ct,rotamax_red30))) + + v30_betr_missing(j2) * sum(ct, i30_betr_penalty(ct)) ); q30_rotation_max(j2,rotamax_red30)$(i30_implementation = 1) .. diff --git a/modules/30_croparea/detail_apr24/input.gms b/modules/30_croparea/detail_apr24/input.gms index 4a915b8a8f..72ca248086 100644 --- a/modules/30_croparea/detail_apr24/input.gms +++ b/modules/30_croparea/detail_apr24/input.gms @@ -23,6 +23,10 @@ scalars s30_rotation_scenario_start Rotation scenario start year / 2020 / s30_rotation_scenario_target Rotation scenario target year / 2050 / s30_implementation Switch for rule-based (1) or penalty-based (0) implementation of rotation scenarios / 1 / + s30_betr_scenario_start Bioenergy land scenario start year / 2020 / + s30_betr_scenario_target Bioenergy land scenario target year / 2050 / + s30_betr_target Target share of bioenergy land on total cropland (1) / 0 / + s30_betr_penalty Penalty for violation of betr target (USD05MER per ha) / 500 / ; diff --git a/modules/30_croparea/detail_apr24/postsolve.gms b/modules/30_croparea/detail_apr24/postsolve.gms index 481fb9e1c9..4f0dad15ae 100644 --- a/modules/30_croparea/detail_apr24/postsolve.gms +++ b/modules/30_croparea/detail_apr24/postsolve.gms @@ -12,7 +12,9 @@ ov_carbon_stock_croparea(t,j,ag_pools,"marginal") = vm_carbon_stock_croparea.m(j,ag_pools); ov30_penalty_max_irrig(t,j,rotamax30,"marginal") = v30_penalty_max_irrig.m(j,rotamax30); ov30_penalty(t,j,rota30,"marginal") = v30_penalty.m(j,rota30); + ov30_betr_missing(t,j,"marginal") = v30_betr_missing.m(j); oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); + oq30_betr_missing(t,j,"marginal") = q30_betr_missing.m(j); oq30_rotation_penalty(t,i,"marginal") = q30_rotation_penalty.m(i); oq30_rotation_max(t,j,rotamax30,"marginal") = q30_rotation_max.m(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"marginal") = q30_rotation_min.m(j,rotamin30); @@ -27,7 +29,9 @@ ov_carbon_stock_croparea(t,j,ag_pools,"level") = vm_carbon_stock_croparea.l(j,ag_pools); ov30_penalty_max_irrig(t,j,rotamax30,"level") = v30_penalty_max_irrig.l(j,rotamax30); ov30_penalty(t,j,rota30,"level") = v30_penalty.l(j,rota30); + ov30_betr_missing(t,j,"level") = v30_betr_missing.l(j); oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); + oq30_betr_missing(t,j,"level") = q30_betr_missing.l(j); oq30_rotation_penalty(t,i,"level") = q30_rotation_penalty.l(i); oq30_rotation_max(t,j,rotamax30,"level") = q30_rotation_max.l(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"level") = q30_rotation_min.l(j,rotamin30); @@ -42,7 +46,9 @@ ov_carbon_stock_croparea(t,j,ag_pools,"upper") = vm_carbon_stock_croparea.up(j,ag_pools); ov30_penalty_max_irrig(t,j,rotamax30,"upper") = v30_penalty_max_irrig.up(j,rotamax30); ov30_penalty(t,j,rota30,"upper") = v30_penalty.up(j,rota30); + ov30_betr_missing(t,j,"upper") = v30_betr_missing.up(j); oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); + oq30_betr_missing(t,j,"upper") = q30_betr_missing.up(j); oq30_rotation_penalty(t,i,"upper") = q30_rotation_penalty.up(i); oq30_rotation_max(t,j,rotamax30,"upper") = q30_rotation_max.up(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"upper") = q30_rotation_min.up(j,rotamin30); @@ -57,7 +63,9 @@ ov_carbon_stock_croparea(t,j,ag_pools,"lower") = vm_carbon_stock_croparea.lo(j,ag_pools); ov30_penalty_max_irrig(t,j,rotamax30,"lower") = v30_penalty_max_irrig.lo(j,rotamax30); ov30_penalty(t,j,rota30,"lower") = v30_penalty.lo(j,rota30); + ov30_betr_missing(t,j,"lower") = v30_betr_missing.lo(j); oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); + oq30_betr_missing(t,j,"lower") = q30_betr_missing.lo(j); oq30_rotation_penalty(t,i,"lower") = q30_rotation_penalty.lo(i); oq30_rotation_max(t,j,rotamax30,"lower") = q30_rotation_max.lo(j,rotamax30); oq30_rotation_min(t,j,rotamin30,"lower") = q30_rotation_min.lo(j,rotamin30); diff --git a/modules/30_croparea/detail_apr24/preloop.gms b/modules/30_croparea/detail_apr24/preloop.gms index 51e2d0cfaa..8d2ac45a5f 100644 --- a/modules/30_croparea/detail_apr24/preloop.gms +++ b/modules/30_croparea/detail_apr24/preloop.gms @@ -7,17 +7,18 @@ ** Trajectory for cropland scenarios * sigmoidal interpolation between start year and target year -m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); +m_sigmoid_time_interpol(i30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); +m_sigmoid_time_interpol(i30_betr_scenario_fader,s30_betr_scenario_start,s30_betr_scenario_target,0,1); ** create crop rotation scenario i30_rotation_rules(t_all,rota30) = - f30_rotation_rules(rota30,"default") * (1-p30_rotation_scenario_fader(t_all)) + - f30_rotation_rules(rota30,"%c30_rotation_rules%") * (p30_rotation_scenario_fader(t_all)); + f30_rotation_rules(rota30,"default") * (1-i30_rotation_scenario_fader(t_all)) + + f30_rotation_rules(rota30,"%c30_rotation_rules%") * (i30_rotation_scenario_fader(t_all)); ** create crop rotation scenario i30_rotation_incentives(t_all,rota30) = - f30_rotation_incentives(rota30,"default") * (1-p30_rotation_scenario_fader(t_all)) + - f30_rotation_incentives(rota30,"%c30_rotation_incentives%") * (p30_rotation_scenario_fader(t_all)); + f30_rotation_incentives(rota30,"default") * (1-i30_rotation_scenario_fader(t_all)) + + f30_rotation_incentives(rota30,"%c30_rotation_incentives%") * (i30_rotation_scenario_fader(t_all)); *due to some rounding errors the input data currently may contain in some cases diff --git a/modules/30_croparea/detail_apr24/presolve.gms b/modules/30_croparea/detail_apr24/presolve.gms index d95c14a256..0efea7ea26 100644 --- a/modules/30_croparea/detail_apr24/presolve.gms +++ b/modules/30_croparea/detail_apr24/presolve.gms @@ -24,3 +24,7 @@ else * only activate constraints which are binding rotamax_red30(rotamax30) = yes$(i30_rotation_rules(t,rotamax30) < 1); rotamin_red30(rotamin30) = yes$(i30_rotation_rules(t,rotamin30) > 0); + +* create betr target and penalty scenario +i30_betr_target(t) = s30_betr_target * i30_betr_scenario_fader(t); +i30_betr_penalty(t) = s30_betr_penalty * i30_betr_scenario_fader(t); diff --git a/modules/30_croparea/detail_apr24/sets.gms b/modules/30_croparea/detail_apr24/sets.gms index e0fa90cefe..addda5290f 100644 --- a/modules/30_croparea/detail_apr24/sets.gms +++ b/modules/30_croparea/detail_apr24/sets.gms @@ -94,7 +94,7 @@ sets legumes_min . (soybean, groundnut, puls_pro, foddr) minor_min . (sunflower, rapeseed, sugr_beet, cassav_sp, potato, others) cereals_min . (tece, maiz, trce, rice_pro) - stalk_min . (tece, maiz, trce, rice_pro, sugr_cane, foddr) + stalk_min . (tece, maiz, trce, rice_pro, sugr_cane, foddr) others_min . (others) betr_min . (betr) / diff --git a/modules/30_croparea/simple_apr24/declarations.gms b/modules/30_croparea/simple_apr24/declarations.gms index f3930b04c2..329674a599 100644 --- a/modules/30_croparea/simple_apr24/declarations.gms +++ b/modules/30_croparea/simple_apr24/declarations.gms @@ -6,17 +6,23 @@ *** | Contact: magpie@pik-potsdam.de parameters - p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) + i30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) + i30_betr_scenario_fader(t_all) Bioenergy land scenario fader (1) + i30_betr_target(t) Target share for bioenergy land on total cropland (1) + i30_betr_penalty(t) Penalty for violation of betr target (USD05MER per ha) ; positive variables vm_area(j,kcr,w) Agricultural production area (mio. ha) - vm_rotation_penalty(i) Penalty for violating rotational constraints (USD05MER) + vm_rotation_penalty(i) Penalty for violating rotational constraints (mio. USD05MER) vm_carbon_stock_croparea(j,ag_pools) Carbon stock in croparea (tC) + v30_betr_missing(j) Missing bioenergy tree land towards target (mio. ha) ; equations q30_prod(j,kcr) Production of cropped products (mio. tDM) + q30_betr_missing(j) Missing bioenergy tree land towards target (mio. ha) + q30_cost(i) Cost (mio. USD05MER) q30_rotation_max(j,crp30,w) Local maximum rotational constraints (mio. ha) q30_rotation_min(j,crp30,w) Local minimum rotational constraints (mio. ha) q30_carbon(j,ag_pools) Croplarea above ground carbon content calculation (mio. tC) @@ -27,9 +33,12 @@ equations *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov_area(t,j,kcr,w,type) Agricultural production area (mio. ha) - ov_rotation_penalty(t,i,type) Penalty for violating rotational constraints (USD05MER) + ov_rotation_penalty(t,i,type) Penalty for violating rotational constraints (mio. USD05MER) ov_carbon_stock_croparea(t,j,ag_pools,type) Carbon stock in croparea (tC) + ov30_betr_missing(t,j,type) Missing bioenergy tree land towards target (mio. ha) oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) + oq30_betr_missing(t,j,type) Missing bioenergy tree land towards target (mio. ha) + oq30_cost(t,i,type) Cost (mio. USD05MER) oq30_rotation_max(t,j,crp30,w,type) Local maximum rotational constraints (mio. ha) oq30_rotation_min(t,j,crp30,w,type) Local minimum rotational constraints (mio. ha) oq30_carbon(t,j,ag_pools,type) Croplarea above ground carbon content calculation (mio. tC) diff --git a/modules/30_croparea/simple_apr24/equations.gms b/modules/30_croparea/simple_apr24/equations.gms index 40b4ff85d8..1e872f1606 100644 --- a/modules/30_croparea/simple_apr24/equations.gms +++ b/modules/30_croparea/simple_apr24/equations.gms @@ -14,6 +14,17 @@ q30_prod(j2,kcr) .. vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); +*' A penalty is applied for the violation of bioenergy tree (betr) rules. +*' The penalty applies to the missing bioenergy tree land, i.e. where bioenergy tree land +*' is lower than a certain fraction of total cropland. + + q30_betr_missing(j2) .. + v30_betr_missing(j2) =g= + vm_land(j2,"crop") * sum(ct, i30_betr_target(ct)) - vm_area(j2,"betr","rainfed"); + + q30_cost(i2) .. + vm_rotation_penalty(i2) =g= + sum(cell(i2,j2), v30_betr_missing(j2) * sum(ct, i30_betr_penalty(ct))); *' As additional constraints minimum and maximum rotational constraints limit *' the placing of crops. On the one hand, these rotational constraints reflect diff --git a/modules/30_croparea/simple_apr24/input.gms b/modules/30_croparea/simple_apr24/input.gms index 02c72d13d3..e8f919c20f 100644 --- a/modules/30_croparea/simple_apr24/input.gms +++ b/modules/30_croparea/simple_apr24/input.gms @@ -17,6 +17,10 @@ $setglobal c30_rotation_constraints on scalars s30_rotation_scenario_start Rotation scenario start year / 2020 / s30_rotation_scenario_target Rotation scenario target year / 2050 / + s30_betr_scenario_start Bioenergy land scenario start year / 2020 / + s30_betr_scenario_target Bioenergy land scenario target year / 2050 / + s30_betr_target Target share of bioenergy land on total cropland (1) / 0 / + s30_betr_penalty Penalty for violation of betr target (USD05MER per ha) / 500 / ; $ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes; diff --git a/modules/30_croparea/simple_apr24/postsolve.gms b/modules/30_croparea/simple_apr24/postsolve.gms index a9ba060e13..500abbb32e 100644 --- a/modules/30_croparea/simple_apr24/postsolve.gms +++ b/modules/30_croparea/simple_apr24/postsolve.gms @@ -10,7 +10,10 @@ ov_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w); ov_rotation_penalty(t,i,"marginal") = vm_rotation_penalty.m(i); ov_carbon_stock_croparea(t,j,ag_pools,"marginal") = vm_carbon_stock_croparea.m(j,ag_pools); + ov30_betr_missing(t,j,"marginal") = v30_betr_missing.m(j); oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); + oq30_betr_missing(t,j,"marginal") = q30_betr_missing.m(j); + oq30_cost(t,i,"marginal") = q30_cost.m(i); oq30_rotation_max(t,j,crp30,w,"marginal") = q30_rotation_max.m(j,crp30,w); oq30_rotation_min(t,j,crp30,w,"marginal") = q30_rotation_min.m(j,crp30,w); oq30_carbon(t,j,ag_pools,"marginal") = q30_carbon.m(j,ag_pools); @@ -19,7 +22,10 @@ ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w); ov_rotation_penalty(t,i,"level") = vm_rotation_penalty.l(i); ov_carbon_stock_croparea(t,j,ag_pools,"level") = vm_carbon_stock_croparea.l(j,ag_pools); + ov30_betr_missing(t,j,"level") = v30_betr_missing.l(j); oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); + oq30_betr_missing(t,j,"level") = q30_betr_missing.l(j); + oq30_cost(t,i,"level") = q30_cost.l(i); oq30_rotation_max(t,j,crp30,w,"level") = q30_rotation_max.l(j,crp30,w); oq30_rotation_min(t,j,crp30,w,"level") = q30_rotation_min.l(j,crp30,w); oq30_carbon(t,j,ag_pools,"level") = q30_carbon.l(j,ag_pools); @@ -28,7 +34,10 @@ ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w); ov_rotation_penalty(t,i,"upper") = vm_rotation_penalty.up(i); ov_carbon_stock_croparea(t,j,ag_pools,"upper") = vm_carbon_stock_croparea.up(j,ag_pools); + ov30_betr_missing(t,j,"upper") = v30_betr_missing.up(j); oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); + oq30_betr_missing(t,j,"upper") = q30_betr_missing.up(j); + oq30_cost(t,i,"upper") = q30_cost.up(i); oq30_rotation_max(t,j,crp30,w,"upper") = q30_rotation_max.up(j,crp30,w); oq30_rotation_min(t,j,crp30,w,"upper") = q30_rotation_min.up(j,crp30,w); oq30_carbon(t,j,ag_pools,"upper") = q30_carbon.up(j,ag_pools); @@ -37,7 +46,10 @@ ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w); ov_rotation_penalty(t,i,"lower") = vm_rotation_penalty.lo(i); ov_carbon_stock_croparea(t,j,ag_pools,"lower") = vm_carbon_stock_croparea.lo(j,ag_pools); + ov30_betr_missing(t,j,"lower") = v30_betr_missing.lo(j); oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); + oq30_betr_missing(t,j,"lower") = q30_betr_missing.lo(j); + oq30_cost(t,i,"lower") = q30_cost.lo(i); oq30_rotation_max(t,j,crp30,w,"lower") = q30_rotation_max.lo(j,crp30,w); oq30_rotation_min(t,j,crp30,w,"lower") = q30_rotation_min.lo(j,crp30,w); oq30_carbon(t,j,ag_pools,"lower") = q30_carbon.lo(j,ag_pools); diff --git a/modules/30_croparea/simple_apr24/preloop.gms b/modules/30_croparea/simple_apr24/preloop.gms index 4cfa6b7f3b..899afc80c9 100644 --- a/modules/30_croparea/simple_apr24/preloop.gms +++ b/modules/30_croparea/simple_apr24/preloop.gms @@ -7,7 +7,8 @@ ** Trajectory for cropland scenarios * sigmoidal interpolation between start year and target year -m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); +m_sigmoid_time_interpol(i30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); +m_sigmoid_time_interpol(i30_betr_scenario_fader,s30_betr_scenario_start,s30_betr_scenario_target,0,1); *due to some rounding errors the input data currently may contain in some cases *very small, negative numbers. These numbers have to be set to 0 as area diff --git a/modules/30_croparea/simple_apr24/presolve.gms b/modules/30_croparea/simple_apr24/presolve.gms index 942042b0e9..5dee653207 100644 --- a/modules/30_croparea/simple_apr24/presolve.gms +++ b/modules/30_croparea/simple_apr24/presolve.gms @@ -25,3 +25,7 @@ vm_rotation_penalty.fx(i)=0; crpmax30(crp30) = yes$(f30_rotation_max_shr(crp30) < 1); crpmin30(crp30) = yes$(f30_rotation_min_shr(crp30) > 0); + +* create betr target and penalty scenario +i30_betr_target(t) = s30_betr_target * i30_betr_scenario_fader(t); +i30_betr_penalty(t) = s30_betr_penalty * i30_betr_scenario_fader(t); diff --git a/modules/80_optimization/lp_nlp_apr17/input.gms b/modules/80_optimization/lp_nlp_apr17/input.gms index 3dd0e0a426..ef30bc7517 100644 --- a/modules/80_optimization/lp_nlp_apr17/input.gms +++ b/modules/80_optimization/lp_nlp_apr17/input.gms @@ -10,6 +10,7 @@ scalars s80_optfile switch to use specfied solver settings (1) / 0 / s80_add_cplex add cplex optimization after conopt4 (1) / 0 / s80_add_conopt3 add conopt3 optimization after conopt4 (1) / 0 / + s80_debug switch to use alternative solver settings (1) / 0 / ; diff --git a/modules/80_optimization/lp_nlp_apr17/solve.gms b/modules/80_optimization/lp_nlp_apr17/solve.gms index 881dca8768..ef1e3112f0 100644 --- a/modules/80_optimization/lp_nlp_apr17/solve.gms +++ b/modules/80_optimization/lp_nlp_apr17/solve.gms @@ -143,6 +143,7 @@ $batinclude "./modules/include.gms" nl_relax option nlp = conopt4; ); +if (s80_debug = 1, * if solve stopped with an error, try it again without pre-processing if((magpie.modelstat = 13), display "WARNING: Modelstat 13 | retry without Conopt4 pre-processing"; @@ -160,7 +161,7 @@ $batinclude "./modules/include.gms" nl_relax solve magpie USING nlp MINIMIZING vm_cost_glo; option nlp = conopt4; ); - +); p80_modelstat(t) = magpie.modelstat; p80_num_nonopt(t) = magpie.numNOpt; diff --git a/modules/80_optimization/nlp_apr17/input.gms b/modules/80_optimization/nlp_apr17/input.gms index 8fbcc4271a..e88d3ff306 100644 --- a/modules/80_optimization/nlp_apr17/input.gms +++ b/modules/80_optimization/nlp_apr17/input.gms @@ -8,4 +8,5 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / s80_optfile switch to use specfied solver settings (1) / 0 / + s80_debug switch to use alternative solver settings (1) / 0 / ; diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index bae758fec1..969596f537 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -41,7 +41,8 @@ display vm_cost_glo.l; display magpie.modelstat; * in case of problems try different solvers and optfile settings -if (magpie.modelstat > 2, +if (s80_debug = 1, + if (magpie.modelstat > 2, repeat( s80_counter = s80_counter + 1 ; @@ -82,6 +83,7 @@ if (magpie.modelstat > 2, until (magpie.modelstat <= 2 or s80_counter >= s80_maxiter) ); + ); ); p80_modelstat(t) = magpie.modelstat; diff --git a/modules/80_optimization/nlp_par/input.gms b/modules/80_optimization/nlp_par/input.gms index 77e8e9f487..3b009a8781 100644 --- a/modules/80_optimization/nlp_par/input.gms +++ b/modules/80_optimization/nlp_par/input.gms @@ -8,4 +8,5 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / s80_optfile switch to use specfied solver settings (1) / 0 / + s80_debug switch to use alternative solver settings (1) / 0 / ; diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index d550c5e4ae..c3782fb632 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -85,7 +85,8 @@ repeat p80_handle(h) = 0; ); - if (s80_resolve = 1, + if (s80_debug = 1, + if (s80_resolve = 1, display "Resolve" if (p80_modelstat(t,h) ne s80_modelstat_previter, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; @@ -108,6 +109,7 @@ repeat magpie.handle = 1; ); p80_handle(h) = magpie.handle; + ); ); h2(h) = no; i2(i) = no; From 629a80924d018daae39cd4e2f7a70e9ed1f2ae26 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 22 Apr 2024 22:00:12 +0200 Subject: [PATCH 029/280] bugfix --- scripts/start/test_runs.R | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/start/test_runs.R b/scripts/start/test_runs.R index 93cfc01d17..64b65bdfc9 100644 --- a/scripts/start/test_runs.R +++ b/scripts/start/test_runs.R @@ -42,27 +42,27 @@ cfg$gms$c_timesteps <- timeSteps # Reference and Policy run for SSP1, SSP2 and SSP5 -for(ssp in c("SSP1","SSP2EU","SSP5")) { +for(ssp in c("SSP1","SSP2","SSP5")) { cfg$title <- .title(cfg, paste(ssp,"Ref",sep="-")) cfg <- setScenario(cfg,c(ssp,"NPI","rcp7p0")) cfg$gms$c56_mute_ghgprices_until <- "y2150" - cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ssp,"-NPi") - cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ssp,"-NPi") + cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-NPi") + cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-NPi") start_run(cfg, codeCheck = FALSE) cfg$title <- .title(cfg, paste(ssp,"NDC",sep="-")) cfg <- setScenario(cfg,c(ssp,"NDC","rcp4p5")) cfg$gms$c56_mute_ghgprices_until <- "y2150" - cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ssp,"-NDC") - cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ssp,"-NDC") + cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-NDC") + cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-NDC") start_run(cfg, codeCheck = FALSE) cfg$title <- .title(cfg, paste(ssp,"PkBudg650",sep="-")) cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9")) cfg$gms$c56_mute_ghgprices_until <- "y2030" - cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ssp,"-PkBudg650") - cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ssp,"-PkBudg650") + cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") + cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") start_run(cfg, codeCheck = FALSE) } From 670e8254b2a29465a150e0ed895b34d5951a99e9 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 23 Apr 2024 10:00:30 +0200 Subject: [PATCH 030/280] bugfixes --- config/default.cfg | 2 +- modules/29_cropland/detail_apr24/input.gms | 2 +- modules/29_cropland/detail_apr24/presolve.gms | 22 +++++---- modules/30_croparea/detail_apr24/presolve.gms | 7 ++- modules/30_croparea/detail_apr24/sets.gms | 47 +++++++++---------- 5 files changed, 43 insertions(+), 37 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 3142852022..8a9fc6e0c1 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -731,7 +731,7 @@ cfg$gms$s29_cost_treecover_est <- 2000 # def = 2000 # * Tree cover recurring cost (USD05MER per ha) cfg$gms$s29_cost_treecover_recur <- 500 # def = 500 # * Penalty for violation of treecover target (USD05MER per ha) -cfg$gms$s29_treecover_penalty <- 1000 # def = 1000 +cfg$gms$s29_treecover_penalty <- 2000 # def = 2000 # * Minimum cluster share of fallow land on total cropland area (including croparea, fallow land and tree cover). # * s29_fallow_target is faded in linearly between s29_fallow_scenario_start and s29_fallow_scenario_target. diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms index ab00ed8a46..773fc3c99e 100644 --- a/modules/29_cropland/detail_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -23,7 +23,7 @@ scalars s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / s29_treecover_target Target share of treecover on total cropland (1) / 0 / s29_treecover_keep Adjust s29_treecover_target to avoid loss of existing treecover (1=yes 0=no) / 1 / - s29_treecover_penalty Penalty for violation of treecover target (USD05MER per ha) / 1000 / + s29_treecover_penalty Penalty for violation of treecover target (USD05MER per ha) / 2000 / s29_fallow_scenario_start Fallow land scenario start year / 2020 / s29_fallow_scenario_target Fallow land scenario target year / 2050 / s29_fallow_target Target share of fallow land on total cropland (1) / 0 / diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index ef1eb80ee3..7cdac2bf19 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -44,23 +44,29 @@ v29_treecover.l(j,ac) = p29_treecover(t,j,ac); * create treecover target and penalty scenario i29_treecover_target(t,j) = s29_treecover_target * i29_treecover_scenario_fader(t); -i29_treecover_penalty(t) = s29_treecover_penalty * i29_treecover_scenario_fader(t); + +p29_treecover_share(t,j) = 0; +p29_treecover_share(t,j)$(pcm_land(j,"crop") > 1e-10) = sum(ac, pc29_treecover(j,ac)) / pcm_land(j,"crop"); +if (s29_treecover_keep = 1, + i29_treecover_target(t,j)$(i29_treecover_target(t,j) < p29_treecover_share(t,j)) = p29_treecover_share(t,j); +); if(m_year(t) <= s29_treecover_scenario_start, v29_treecover.fx(j,ac) = pc29_treecover(j,ac); + i29_treecover_penalty(t) = 0; else v29_treecover.lo(j,ac_est) = 0; v29_treecover.up(j,ac_est) = Inf; v29_treecover.lo(j,ac_sub) = 0; v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); -); - -p29_treecover_share(t,j) = 0; -p29_treecover_share(t,j)$(pcm_land(j,"crop") > 1e-10) = sum(ac, pc29_treecover(j,ac)) / pcm_land(j,"crop"); -if (s29_treecover_keep = 1, - i29_treecover_target(t,j)$(i29_treecover_target(t,j) < p29_treecover_share(t,j)) = p29_treecover_share(t,j); + i29_treecover_penalty(t) = s29_treecover_penalty; ); * create fallow land target and penalty scenario i29_fallow_target(t) = s29_fallow_target * i29_fallow_scenario_fader(t); -i29_fallow_penalty(t) = s29_fallow_penalty * i29_fallow_scenario_fader(t); + +if(m_year(t) <= s29_fallow_scenario_start, + i29_fallow_penalty(t) = 0; +else + i29_fallow_penalty(t) = s29_fallow_penalty; +); diff --git a/modules/30_croparea/detail_apr24/presolve.gms b/modules/30_croparea/detail_apr24/presolve.gms index 0efea7ea26..ff63a8c7e4 100644 --- a/modules/30_croparea/detail_apr24/presolve.gms +++ b/modules/30_croparea/detail_apr24/presolve.gms @@ -27,4 +27,9 @@ rotamin_red30(rotamin30) = yes$(i30_rotation_rules(t,rotamin30) > 0); * create betr target and penalty scenario i30_betr_target(t) = s30_betr_target * i30_betr_scenario_fader(t); -i30_betr_penalty(t) = s30_betr_penalty * i30_betr_scenario_fader(t); + +if(m_year(t) <= s30_betr_scenario_start, + i30_betr_penalty(t) = 0; +else + i30_betr_penalty(t) = s30_betr_penalty; +); diff --git a/modules/30_croparea/detail_apr24/sets.gms b/modules/30_croparea/detail_apr24/sets.gms index addda5290f..579e1f82b3 100644 --- a/modules/30_croparea/detail_apr24/sets.gms +++ b/modules/30_croparea/detail_apr24/sets.gms @@ -7,39 +7,35 @@ sets incentscen30 rotation inventive scenarios - /none,default,legumes,betr500,betr1000,agroecology/ + / none, default, legumes, agroecology / rotascen30 rotation constraint scenarios - /min,default,good,good_20div,setaside,legumes, - betr0,betr10,betr20,betr25,betr30,betr40,betr50, - sixfoldrotation,agroecology,FSEC/ + / min, default, good,good_20div, setaside, legumes, sixfoldrotation, agroecology, FSEC / rota30 rotational rules - /cereals1_max, cereals2_max, cereals_excl_rice_max, stalk_max, - resistant_max, oilcrops_max, - legumes_max, rootsrape_max, roots_max, rape_sugr_max, biomass_max, - tece_max, maiz_max, trce_max, rice_max, - rapeseed_max, soybean_max, sunflower_max, groundnut_max, - oilpalm_max, puls_max, potato_max, cassava_max, - sugr_cane_max, sugr_beet_max, others_max, foddr_max, - fiber_max, begr_max, betr_max - biomass_min, legumes_min, stalk_min, others_min, - minor_min, cereals_min, betr_min/ - + / cereals1_max, cereals2_max, cereals_excl_rice_max, stalk_max, + resistant_max, oilcrops_max, + legumes_max, rootsrape_max, roots_max, rape_sugr_max, biomass_max, + tece_max, maiz_max, trce_max, rice_max, + rapeseed_max, soybean_max, sunflower_max, groundnut_max, + oilpalm_max, puls_max, potato_max, cassava_max, + sugr_cane_max, sugr_beet_max, others_max, foddr_max, + fiber_max, begr_max, betr_max + biomass_min, legumes_min, stalk_min, others_min, + minor_min, cereals_min / rotamax30(rota30) rotational maximum rules - /cereals1_max, cereals2_max, cereals_excl_rice_max, stalk_max, - resistant_max, oilcrops_max, - legumes_max, rootsrape_max, roots_max, rape_sugr_max, biomass_max, - tece_max, maiz_max, trce_max, rice_max, - rapeseed_max, soybean_max, sunflower_max, groundnut_max, - oilpalm_max, puls_max, potato_max, cassava_max, - sugr_cane_max, sugr_beet_max, others_max, foddr_max, - fiber_max, begr_max, betr_max/ + / cereals1_max, cereals2_max, cereals_excl_rice_max, stalk_max, + resistant_max, oilcrops_max, + legumes_max, rootsrape_max, roots_max, rape_sugr_max, biomass_max, + tece_max, maiz_max, trce_max, rice_max, + rapeseed_max, soybean_max, sunflower_max, groundnut_max, + oilpalm_max, puls_max, potato_max, cassava_max, + sugr_cane_max, sugr_beet_max, others_max, foddr_max, + fiber_max, begr_max, betr_max / rotamin30(rota30) rotational minimum rules - /biomass_min, legumes_min, stalk_min, others_min, - minor_min, cereals_min, betr_min/ + / biomass_min, legumes_min, stalk_min, others_min, minor_min, cereals_min / rotamax_red30(rotamax30) Maximum crop rotation reduced set rotamin_red30(rotamin30) Minimum crop rotation reduced set @@ -96,7 +92,6 @@ sets cereals_min . (tece, maiz, trce, rice_pro) stalk_min . (tece, maiz, trce, rice_pro, sugr_cane, foddr) others_min . (others) - betr_min . (betr) / kbe30(kcr) bio energy activities From eea0d5fc0339af623b55025b52284a94cad55cba Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 23 Apr 2024 12:01:45 +0200 Subject: [PATCH 031/280] bugfix --- modules/29_cropland/detail_apr24/presolve.gms | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index 7cdac2bf19..2ae6680260 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -59,6 +59,7 @@ else v29_treecover.up(j,ac_est) = Inf; v29_treecover.lo(j,ac_sub) = 0; v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); + m_boundfix(v29_treecover,(j,ac_sub),l,10e-5); i29_treecover_penalty(t) = s29_treecover_penalty; ); From b44171cbdace3618842f28c97063d8d2acc4646b Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 23 Apr 2024 16:00:16 +0200 Subject: [PATCH 032/280] bugfixes --- CHANGELOG.md | 10 ++++++++-- config/default.cfg | 4 +++- modules/29_cropland/detail_apr24/declarations.gms | 2 ++ modules/29_cropland/detail_apr24/equations.gms | 4 ++-- modules/29_cropland/detail_apr24/input.gms | 1 + modules/29_cropland/detail_apr24/postsolve.gms | 4 ++++ modules/32_forestry/dynamic_feb21/equations.gms | 2 +- modules/80_optimization/lp_nlp_apr17/input.gms | 2 +- modules/80_optimization/lp_nlp_apr17/solve.gms | 2 +- modules/80_optimization/nlp_apr17/input.gms | 2 +- modules/80_optimization/nlp_apr17/solve.gms | 2 +- modules/80_optimization/nlp_par/input.gms | 2 +- modules/80_optimization/nlp_par/solve.gms | 2 +- 13 files changed, 27 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2072cddd55..4c91c7a38e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### changed -- +- **29_ageclass** module 29_ageclass has been renamed to 28_ageclass to make space for `29_cropland` just before `30_croparea` +- **30_crop** module `30_crop` renamed to `30_croparea`, which now only accounts for crop area. +- **30_crop** SNV implementation has been moved from `30_crop` to `29_cropland/detail_apr24` +- **30_crop** the two realizations `penalty_apr22` and `rotation_apr22` have been merged into a single `30_croparea/detail_apr24` realization +- **30_crop** the previous `30_crop/endo_apr21` realization has been moved to `30_croparea/simple_apr24` +- **80_optimization** added option `s80_extra_solve`, which is deactivated by default to shorten the run time of infeasible model runs ### added -- +- **29_cropland** new module `29_cropland` accounting for crop area, fallow cropland and tree cover on cropland with two realizations: `detail_apr24` (default) and `simple_apr24`. +- **10_land** added interface `pm_land_hist` with historic land use patterns ### removed - diff --git a/config/default.cfg b/config/default.cfg index 8a9fc6e0c1..824380ef5e 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -716,6 +716,8 @@ cfg$gms$policy_countries29 <- all_iso_countries # * "secdforest, other", # * "secdforest, past, other" etc. cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other" +# * Penalty for violation of cropland relocation target (USD05MER per ha) +cfg$gms$s29_relocation_penalty <- 1000000 # def = 1000000 # * Minimum cluster share of treecover on total cropland area (including croparea, fallow land and tree cover). # * s29_treecover_target is faded in linearly between s29_treecover_scenario_start and s29_treecover_scenario_target. @@ -1965,7 +1967,7 @@ cfg$gms$s80_optfile <- 0 # def = 0 # * 0: not used # * 1: additional solve statements for CONOPT4 without preprocessing and CONOPT3 # * Note: Option 1 is very time-consuming and usually does not provide a feasible solution. -cfg$gms$s80_debug <- 0 # def = 0 +cfg$gms$s80_extra_solve <- 0 # def = 0 #*******************************END MODULE SETUP******************************** diff --git a/modules/29_cropland/detail_apr24/declarations.gms b/modules/29_cropland/detail_apr24/declarations.gms index e9aa88f83d..a34fad1567 100644 --- a/modules/29_cropland/detail_apr24/declarations.gms +++ b/modules/29_cropland/detail_apr24/declarations.gms @@ -42,6 +42,7 @@ positive variables v29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) vm_fallow(j) Fallow land is temporarily fallow cropland (mio. ha) v29_fallow_missing(j) Missing fallow land towards target (mio. ha) + v29_relocation_missing(j) Missing fallow land towards target (mio. ha) ; equations @@ -69,6 +70,7 @@ parameters ov29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) ov_fallow(t,j,type) Fallow land is temporarily fallow cropland (mio. ha) ov29_fallow_missing(t,j,type) Missing fallow land towards target (mio. ha) + ov29_relocation_missing(t,j,type) Missing fallow land towards target (mio. ha) oq29_cropland(t,j,type) Total cropland calculation (mio. ha) oq29_avl_cropland(t,j,type) Available cropland constraint (mio. ha) oq29_cost_cropland(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr) diff --git a/modules/29_cropland/detail_apr24/equations.gms b/modules/29_cropland/detail_apr24/equations.gms index 0faf477aca..352f5210df 100644 --- a/modules/29_cropland/detail_apr24/equations.gms +++ b/modules/29_cropland/detail_apr24/equations.gms @@ -28,6 +28,7 @@ q29_cost_cropland(j2) .. vm_cost_cropland(j2) =e= v29_cost_treecover_est(j2) + v29_cost_treecover_recur(j2) + + v29_relocation_missing(j2) * s29_relocation_penalty + v29_fallow_missing(j2) * sum(ct, i29_fallow_penalty(ct)) + v29_treecover_missing(j2) * sum(ct, i29_treecover_penalty(ct)); @@ -57,8 +58,7 @@ *' (@buchhorn_copernicus_2020). q29_land_snv_trans(j2) .. - sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p29_snv_relocation(ct,j2)); - + v29_relocation_missing(j2) =g= sum(ct, p29_snv_relocation(ct,j2)) - sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)); *' A penalty is applied for the violation of fallow land rules. *' The penalty applies to the missing fallow land, i.e. where fallow land diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms index 773fc3c99e..396f1b3e03 100644 --- a/modules/29_cropland/detail_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -28,6 +28,7 @@ scalars s29_fallow_scenario_target Fallow land scenario target year / 2050 / s29_fallow_target Target share of fallow land on total cropland (1) / 0 / s29_fallow_penalty Penalty for violation of fallow target (USD05MER per ha) / 500 / + s29_relocation_penalty Penalty for violation of cropland relocation target (USD05MER per ha) / 1000000 / ; diff --git a/modules/29_cropland/detail_apr24/postsolve.gms b/modules/29_cropland/detail_apr24/postsolve.gms index 0d05aea001..27f29b6d99 100644 --- a/modules/29_cropland/detail_apr24/postsolve.gms +++ b/modules/29_cropland/detail_apr24/postsolve.gms @@ -15,6 +15,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); ov29_cost_treecover_recur(t,j,"marginal") = v29_cost_treecover_recur.m(j); ov_fallow(t,j,"marginal") = vm_fallow.m(j); ov29_fallow_missing(t,j,"marginal") = v29_fallow_missing.m(j); + ov29_relocation_missing(t,j,"marginal") = v29_relocation_missing.m(j); oq29_cropland(t,j,"marginal") = q29_cropland.m(j); oq29_avl_cropland(t,j,"marginal") = q29_avl_cropland.m(j); oq29_cost_cropland(t,j,"marginal") = q29_cost_cropland.m(j); @@ -35,6 +36,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); ov29_cost_treecover_recur(t,j,"level") = v29_cost_treecover_recur.l(j); ov_fallow(t,j,"level") = vm_fallow.l(j); ov29_fallow_missing(t,j,"level") = v29_fallow_missing.l(j); + ov29_relocation_missing(t,j,"level") = v29_relocation_missing.l(j); oq29_cropland(t,j,"level") = q29_cropland.l(j); oq29_avl_cropland(t,j,"level") = q29_avl_cropland.l(j); oq29_cost_cropland(t,j,"level") = q29_cost_cropland.l(j); @@ -55,6 +57,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); ov29_cost_treecover_recur(t,j,"upper") = v29_cost_treecover_recur.up(j); ov_fallow(t,j,"upper") = vm_fallow.up(j); ov29_fallow_missing(t,j,"upper") = v29_fallow_missing.up(j); + ov29_relocation_missing(t,j,"upper") = v29_relocation_missing.up(j); oq29_cropland(t,j,"upper") = q29_cropland.up(j); oq29_avl_cropland(t,j,"upper") = q29_avl_cropland.up(j); oq29_cost_cropland(t,j,"upper") = q29_cost_cropland.up(j); @@ -75,6 +78,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); ov29_cost_treecover_recur(t,j,"lower") = v29_cost_treecover_recur.lo(j); ov_fallow(t,j,"lower") = vm_fallow.lo(j); ov29_fallow_missing(t,j,"lower") = v29_fallow_missing.lo(j); + ov29_relocation_missing(t,j,"lower") = v29_relocation_missing.lo(j); oq29_cropland(t,j,"lower") = q29_cropland.lo(j); oq29_avl_cropland(t,j,"lower") = q29_avl_cropland.lo(j); oq29_cost_cropland(t,j,"lower") = q29_cost_cropland.lo(j); diff --git a/modules/32_forestry/dynamic_feb21/equations.gms b/modules/32_forestry/dynamic_feb21/equations.gms index 46945a28a1..5094f4ba18 100644 --- a/modules/32_forestry/dynamic_feb21/equations.gms +++ b/modules/32_forestry/dynamic_feb21/equations.gms @@ -68,7 +68,7 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( *' The constraint `q32_aff_pol` accounts for the exogenous afforestation prescribed by NPI/NDC policies. q32_aff_pol(j2) .. - sum(ac_est, v32_land(j2,"ndc",ac_est)) + v32_land_missing_ndc(j2) =e= sum(ct, p32_aff_pol_timestep(ct,j2)); + v32_land_missing_ndc(j2) =g= sum(ct, p32_aff_pol_timestep(ct,j2)) - sum(ac_est, v32_land(j2,"ndc",ac_est)); *' The constraint `q32_max_aff` accounts for the allowed maximum global endogenous *' afforestation defined in `i32_max_aff_area_glo`. diff --git a/modules/80_optimization/lp_nlp_apr17/input.gms b/modules/80_optimization/lp_nlp_apr17/input.gms index ef30bc7517..a157e8bf5a 100644 --- a/modules/80_optimization/lp_nlp_apr17/input.gms +++ b/modules/80_optimization/lp_nlp_apr17/input.gms @@ -10,7 +10,7 @@ scalars s80_optfile switch to use specfied solver settings (1) / 0 / s80_add_cplex add cplex optimization after conopt4 (1) / 0 / s80_add_conopt3 add conopt3 optimization after conopt4 (1) / 0 / - s80_debug switch to use alternative solver settings (1) / 0 / + s80_extra_solve switch to use alternative solver settings (1) / 0 / ; diff --git a/modules/80_optimization/lp_nlp_apr17/solve.gms b/modules/80_optimization/lp_nlp_apr17/solve.gms index ef1e3112f0..62650b1c1e 100644 --- a/modules/80_optimization/lp_nlp_apr17/solve.gms +++ b/modules/80_optimization/lp_nlp_apr17/solve.gms @@ -143,7 +143,7 @@ $batinclude "./modules/include.gms" nl_relax option nlp = conopt4; ); -if (s80_debug = 1, +if (s80_extra_solve = 1, * if solve stopped with an error, try it again without pre-processing if((magpie.modelstat = 13), display "WARNING: Modelstat 13 | retry without Conopt4 pre-processing"; diff --git a/modules/80_optimization/nlp_apr17/input.gms b/modules/80_optimization/nlp_apr17/input.gms index e88d3ff306..16536ff584 100644 --- a/modules/80_optimization/nlp_apr17/input.gms +++ b/modules/80_optimization/nlp_apr17/input.gms @@ -8,5 +8,5 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / s80_optfile switch to use specfied solver settings (1) / 0 / - s80_debug switch to use alternative solver settings (1) / 0 / + s80_extra_solve switch to use alternative solver settings (1) / 0 / ; diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index 969596f537..bb4edc2c31 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -41,7 +41,7 @@ display vm_cost_glo.l; display magpie.modelstat; * in case of problems try different solvers and optfile settings -if (s80_debug = 1, +if (s80_extra_solve = 1, if (magpie.modelstat > 2, repeat( s80_counter = s80_counter + 1 ; diff --git a/modules/80_optimization/nlp_par/input.gms b/modules/80_optimization/nlp_par/input.gms index 3b009a8781..c0a8d3303f 100644 --- a/modules/80_optimization/nlp_par/input.gms +++ b/modules/80_optimization/nlp_par/input.gms @@ -8,5 +8,5 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / s80_optfile switch to use specfied solver settings (1) / 0 / - s80_debug switch to use alternative solver settings (1) / 0 / + s80_extra_solve switch to use alternative solver settings (1) / 0 / ; diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index c3782fb632..4db21bc22d 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -85,7 +85,7 @@ repeat p80_handle(h) = 0; ); - if (s80_debug = 1, + if (s80_extra_solve = 1, if (s80_resolve = 1, display "Resolve" if (p80_modelstat(t,h) ne s80_modelstat_previter, From abd5d8a8a30ca6ccd64c867c38b98252434ee648 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 23 Apr 2024 17:30:57 +0200 Subject: [PATCH 033/280] bugfixes --- config/default.cfg | 4 ++-- modules/29_cropland/detail_apr24/input.gms | 2 +- modules/29_cropland/detail_apr24/realization.gms | 1 + modules/29_cropland/detail_apr24/scaling.gms | 9 +++++++++ modules/32_forestry/dynamic_feb21/input.gms | 2 +- modules/80_optimization/nlp_par/input.gms | 2 +- 6 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 modules/29_cropland/detail_apr24/scaling.gms diff --git a/config/default.cfg b/config/default.cfg index 824380ef5e..3b00828097 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -205,7 +205,7 @@ cfg$gms$land <- "landmatrix_dec18" # def = landmatrix_dec18 # * The balance variables in the land module avoid infeasibilities due to # * differences in accuracy between parameters and variables in GAMS. # * High costs make sure that the balance variables are only used as a last resort. -cfg$gms$s10_cost_balance <- 1000000 # def = 1000000 +cfg$gms$s10_cost_balance <- 1e+06 # def = 1e+06 # ***--------------------- 11_costs ------ -------------------------------- @@ -717,7 +717,7 @@ cfg$gms$policy_countries29 <- all_iso_countries # * "secdforest, past, other" etc. cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other" # * Penalty for violation of cropland relocation target (USD05MER per ha) -cfg$gms$s29_relocation_penalty <- 1000000 # def = 1000000 +cfg$gms$s29_relocation_penalty <- 1e+06 # def = 1e+06 # * Minimum cluster share of treecover on total cropland area (including croparea, fallow land and tree cover). # * s29_treecover_target is faded in linearly between s29_treecover_scenario_start and s29_treecover_scenario_target. diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms index 396f1b3e03..8b477c3d4a 100644 --- a/modules/29_cropland/detail_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -28,7 +28,7 @@ scalars s29_fallow_scenario_target Fallow land scenario target year / 2050 / s29_fallow_target Target share of fallow land on total cropland (1) / 0 / s29_fallow_penalty Penalty for violation of fallow target (USD05MER per ha) / 500 / - s29_relocation_penalty Penalty for violation of cropland relocation target (USD05MER per ha) / 1000000 / + s29_relocation_penalty Penalty for violation of cropland relocation target (USD05MER per ha) / 1e+06 / ; diff --git a/modules/29_cropland/detail_apr24/realization.gms b/modules/29_cropland/detail_apr24/realization.gms index 071000bd1e..c9b62fec84 100644 --- a/modules/29_cropland/detail_apr24/realization.gms +++ b/modules/29_cropland/detail_apr24/realization.gms @@ -25,6 +25,7 @@ $Ifi "%phase%" == "sets" $include "./modules/29_cropland/detail_apr24/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/29_cropland/detail_apr24/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/29_cropland/detail_apr24/input.gms" $Ifi "%phase%" == "equations" $include "./modules/29_cropland/detail_apr24/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/29_cropland/detail_apr24/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/29_cropland/detail_apr24/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/29_cropland/detail_apr24/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/29_cropland/detail_apr24/postsolve.gms" diff --git a/modules/29_cropland/detail_apr24/scaling.gms b/modules/29_cropland/detail_apr24/scaling.gms new file mode 100644 index 0000000000..2802c2cd18 --- /dev/null +++ b/modules/29_cropland/detail_apr24/scaling.gms @@ -0,0 +1,9 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +v29_fallow_missing.scale(j) = 10e-6; +v29_relocation_missing.scale(j) = 10e-6; diff --git a/modules/32_forestry/dynamic_feb21/input.gms b/modules/32_forestry/dynamic_feb21/input.gms index 7535dd5077..f9765e58d5 100644 --- a/modules/32_forestry/dynamic_feb21/input.gms +++ b/modules/32_forestry/dynamic_feb21/input.gms @@ -38,7 +38,7 @@ scalars s32_faustmann_rotation Switch to activate faustmann rotations (1=on 0=off) / 0 / s32_initial_distribution Switch to Activate ageclass distribution in plantations 0=off 1=equal distribution 2=FAO distribution 3=Poulter distribution 4=Manual distribution (1) / 0 / s32_price Price for timber (USD) / 45 / - s32_free_land_cost Penalty for technial area balance term (USD per ha) /1000000/ + s32_free_land_cost Penalty for technial area balance term (USD per ha) / 1e+06 / s32_max_aff_area Maximum total global afforestation (mio. ha) / Inf / s32_aff_plantation Switch for using growth curves for afforestation 0=natveg 1=plantations (1) / 0 / s32_tcre_local Switch for local (1) or global (0) TRCE factors (1) / 1 / diff --git a/modules/80_optimization/nlp_par/input.gms b/modules/80_optimization/nlp_par/input.gms index c0a8d3303f..bc0dc6e7ce 100644 --- a/modules/80_optimization/nlp_par/input.gms +++ b/modules/80_optimization/nlp_par/input.gms @@ -8,5 +8,5 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / s80_optfile switch to use specfied solver settings (1) / 0 / - s80_extra_solve switch to use alternative solver settings (1) / 0 / + s80_extra_solve switch to use alternative solver settings (1) / 0 / ; From 500c08fdb9e19dbaeaaf6e2815808ecc9ead88f6 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 23 Apr 2024 20:11:45 +0200 Subject: [PATCH 034/280] bugfix --- modules/29_cropland/detail_apr24/presolve.gms | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index 2ae6680260..b83722616d 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -24,6 +24,7 @@ p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t- *' cases of cropland reduction p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * pcm_land(j,"crop") - sum(ac, pc29_treecover(j,ac)); +p29_max_snv_relocation(t,j)$(p29_max_snv_relocation(t,j) < 0) = 0; p29_snv_relocation(t,j)$(p29_snv_relocation(t, j) > p29_max_snv_relocation(t,j)) = p29_max_snv_relocation(t,j); *' Area potentially available for cropping From 4f4fbf46b555e2d5cd595e2c9c76a66859d3a56d Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 23 Apr 2024 22:11:24 +0200 Subject: [PATCH 035/280] bugfixes --- config/default.cfg | 6 +++--- modules/29_cropland/detail_apr24/declarations.gms | 2 -- modules/29_cropland/detail_apr24/equations.gms | 3 +-- modules/29_cropland/detail_apr24/input.gms | 4 ++-- modules/29_cropland/detail_apr24/postsolve.gms | 4 ---- modules/29_cropland/detail_apr24/presolve.gms | 1 + modules/29_cropland/detail_apr24/realization.gms | 1 - modules/29_cropland/detail_apr24/scaling.gms | 9 --------- modules/32_forestry/dynamic_feb21/equations.gms | 2 +- 9 files changed, 8 insertions(+), 24 deletions(-) delete mode 100644 modules/29_cropland/detail_apr24/scaling.gms diff --git a/config/default.cfg b/config/default.cfg index 3b00828097..b9dc6b1bc3 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -716,14 +716,14 @@ cfg$gms$policy_countries29 <- all_iso_countries # * "secdforest, other", # * "secdforest, past, other" etc. cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other" -# * Penalty for violation of cropland relocation target (USD05MER per ha) -cfg$gms$s29_relocation_penalty <- 1e+06 # def = 1e+06 # * Minimum cluster share of treecover on total cropland area (including croparea, fallow land and tree cover). # * s29_treecover_target is faded in linearly between s29_treecover_scenario_start and s29_treecover_scenario_target. cfg$gms$s29_treecover_target <- 0 # def = 0 -# * Adjust s29_treecover_target to avoid loss of existing treecover (1=yes 0=no) +# * Avoid loss of existing treecover (1=yes 0=no) cfg$gms$s29_treecover_keep <- 1 # def = 1 +# * Maximum share of existing treecover on total cropland (1) +cfg$gms$s29_treecover_max <- 0.4 # def = 0.4 # * Start year of tree cover share fade-in: cfg$gms$s29_treecover_scenario_start <- 2020 # def = 2020 # * Target year (year when full implementation is reached): diff --git a/modules/29_cropland/detail_apr24/declarations.gms b/modules/29_cropland/detail_apr24/declarations.gms index a34fad1567..e9aa88f83d 100644 --- a/modules/29_cropland/detail_apr24/declarations.gms +++ b/modules/29_cropland/detail_apr24/declarations.gms @@ -42,7 +42,6 @@ positive variables v29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) vm_fallow(j) Fallow land is temporarily fallow cropland (mio. ha) v29_fallow_missing(j) Missing fallow land towards target (mio. ha) - v29_relocation_missing(j) Missing fallow land towards target (mio. ha) ; equations @@ -70,7 +69,6 @@ parameters ov29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) ov_fallow(t,j,type) Fallow land is temporarily fallow cropland (mio. ha) ov29_fallow_missing(t,j,type) Missing fallow land towards target (mio. ha) - ov29_relocation_missing(t,j,type) Missing fallow land towards target (mio. ha) oq29_cropland(t,j,type) Total cropland calculation (mio. ha) oq29_avl_cropland(t,j,type) Available cropland constraint (mio. ha) oq29_cost_cropland(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr) diff --git a/modules/29_cropland/detail_apr24/equations.gms b/modules/29_cropland/detail_apr24/equations.gms index 352f5210df..ebee259325 100644 --- a/modules/29_cropland/detail_apr24/equations.gms +++ b/modules/29_cropland/detail_apr24/equations.gms @@ -28,7 +28,6 @@ q29_cost_cropland(j2) .. vm_cost_cropland(j2) =e= v29_cost_treecover_est(j2) + v29_cost_treecover_recur(j2) - + v29_relocation_missing(j2) * s29_relocation_penalty + v29_fallow_missing(j2) * sum(ct, i29_fallow_penalty(ct)) + v29_treecover_missing(j2) * sum(ct, i29_treecover_penalty(ct)); @@ -58,7 +57,7 @@ *' (@buchhorn_copernicus_2020). q29_land_snv_trans(j2) .. - v29_relocation_missing(j2) =g= sum(ct, p29_snv_relocation(ct,j2)) - sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)); + sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p29_snv_relocation(ct,j2)); *' A penalty is applied for the violation of fallow land rules. *' The penalty applies to the missing fallow land, i.e. where fallow land diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms index 8b477c3d4a..b7022a5323 100644 --- a/modules/29_cropland/detail_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -22,13 +22,13 @@ scalars s29_treecover_scenario_start Cropland treecover scenario start year / 2020 / s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / s29_treecover_target Target share of treecover on total cropland (1) / 0 / - s29_treecover_keep Adjust s29_treecover_target to avoid loss of existing treecover (1=yes 0=no) / 1 / + s29_treecover_keep Avoid loss of existing treecover (1=yes 0=no) / 1 / + s29_treecover_max Maximum share of existing treecover on total cropland (1) / 0.4 / s29_treecover_penalty Penalty for violation of treecover target (USD05MER per ha) / 2000 / s29_fallow_scenario_start Fallow land scenario start year / 2020 / s29_fallow_scenario_target Fallow land scenario target year / 2050 / s29_fallow_target Target share of fallow land on total cropland (1) / 0 / s29_fallow_penalty Penalty for violation of fallow target (USD05MER per ha) / 500 / - s29_relocation_penalty Penalty for violation of cropland relocation target (USD05MER per ha) / 1e+06 / ; diff --git a/modules/29_cropland/detail_apr24/postsolve.gms b/modules/29_cropland/detail_apr24/postsolve.gms index 27f29b6d99..0d05aea001 100644 --- a/modules/29_cropland/detail_apr24/postsolve.gms +++ b/modules/29_cropland/detail_apr24/postsolve.gms @@ -15,7 +15,6 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); ov29_cost_treecover_recur(t,j,"marginal") = v29_cost_treecover_recur.m(j); ov_fallow(t,j,"marginal") = vm_fallow.m(j); ov29_fallow_missing(t,j,"marginal") = v29_fallow_missing.m(j); - ov29_relocation_missing(t,j,"marginal") = v29_relocation_missing.m(j); oq29_cropland(t,j,"marginal") = q29_cropland.m(j); oq29_avl_cropland(t,j,"marginal") = q29_avl_cropland.m(j); oq29_cost_cropland(t,j,"marginal") = q29_cost_cropland.m(j); @@ -36,7 +35,6 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); ov29_cost_treecover_recur(t,j,"level") = v29_cost_treecover_recur.l(j); ov_fallow(t,j,"level") = vm_fallow.l(j); ov29_fallow_missing(t,j,"level") = v29_fallow_missing.l(j); - ov29_relocation_missing(t,j,"level") = v29_relocation_missing.l(j); oq29_cropland(t,j,"level") = q29_cropland.l(j); oq29_avl_cropland(t,j,"level") = q29_avl_cropland.l(j); oq29_cost_cropland(t,j,"level") = q29_cost_cropland.l(j); @@ -57,7 +55,6 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); ov29_cost_treecover_recur(t,j,"upper") = v29_cost_treecover_recur.up(j); ov_fallow(t,j,"upper") = vm_fallow.up(j); ov29_fallow_missing(t,j,"upper") = v29_fallow_missing.up(j); - ov29_relocation_missing(t,j,"upper") = v29_relocation_missing.up(j); oq29_cropland(t,j,"upper") = q29_cropland.up(j); oq29_avl_cropland(t,j,"upper") = q29_avl_cropland.up(j); oq29_cost_cropland(t,j,"upper") = q29_cost_cropland.up(j); @@ -78,7 +75,6 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); ov29_cost_treecover_recur(t,j,"lower") = v29_cost_treecover_recur.lo(j); ov_fallow(t,j,"lower") = vm_fallow.lo(j); ov29_fallow_missing(t,j,"lower") = v29_fallow_missing.lo(j); - ov29_relocation_missing(t,j,"lower") = v29_relocation_missing.lo(j); oq29_cropland(t,j,"lower") = q29_cropland.lo(j); oq29_avl_cropland(t,j,"lower") = q29_avl_cropland.lo(j); oq29_cost_cropland(t,j,"lower") = q29_cost_cropland.lo(j); diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index b83722616d..d6177b87e7 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -48,6 +48,7 @@ i29_treecover_target(t,j) = s29_treecover_target * i29_treecover_scenario_fader( p29_treecover_share(t,j) = 0; p29_treecover_share(t,j)$(pcm_land(j,"crop") > 1e-10) = sum(ac, pc29_treecover(j,ac)) / pcm_land(j,"crop"); +p29_treecover_share(t,j)$(p29_treecover_share(t,j) > s29_treecover_max) = s29_treecover_max; if (s29_treecover_keep = 1, i29_treecover_target(t,j)$(i29_treecover_target(t,j) < p29_treecover_share(t,j)) = p29_treecover_share(t,j); ); diff --git a/modules/29_cropland/detail_apr24/realization.gms b/modules/29_cropland/detail_apr24/realization.gms index c9b62fec84..071000bd1e 100644 --- a/modules/29_cropland/detail_apr24/realization.gms +++ b/modules/29_cropland/detail_apr24/realization.gms @@ -25,7 +25,6 @@ $Ifi "%phase%" == "sets" $include "./modules/29_cropland/detail_apr24/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/29_cropland/detail_apr24/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/29_cropland/detail_apr24/input.gms" $Ifi "%phase%" == "equations" $include "./modules/29_cropland/detail_apr24/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/29_cropland/detail_apr24/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/29_cropland/detail_apr24/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/29_cropland/detail_apr24/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/29_cropland/detail_apr24/postsolve.gms" diff --git a/modules/29_cropland/detail_apr24/scaling.gms b/modules/29_cropland/detail_apr24/scaling.gms deleted file mode 100644 index 2802c2cd18..0000000000 --- a/modules/29_cropland/detail_apr24/scaling.gms +++ /dev/null @@ -1,9 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -v29_fallow_missing.scale(j) = 10e-6; -v29_relocation_missing.scale(j) = 10e-6; diff --git a/modules/32_forestry/dynamic_feb21/equations.gms b/modules/32_forestry/dynamic_feb21/equations.gms index 5094f4ba18..46945a28a1 100644 --- a/modules/32_forestry/dynamic_feb21/equations.gms +++ b/modules/32_forestry/dynamic_feb21/equations.gms @@ -68,7 +68,7 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( *' The constraint `q32_aff_pol` accounts for the exogenous afforestation prescribed by NPI/NDC policies. q32_aff_pol(j2) .. - v32_land_missing_ndc(j2) =g= sum(ct, p32_aff_pol_timestep(ct,j2)) - sum(ac_est, v32_land(j2,"ndc",ac_est)); + sum(ac_est, v32_land(j2,"ndc",ac_est)) + v32_land_missing_ndc(j2) =e= sum(ct, p32_aff_pol_timestep(ct,j2)); *' The constraint `q32_max_aff` accounts for the allowed maximum global endogenous *' afforestation defined in `i32_max_aff_area_glo`. From c082921809d8bf46edd7bcbc3ce05eacbce092f9 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 23 Apr 2024 23:29:14 +0200 Subject: [PATCH 036/280] bugfixes --- CHANGELOG.md | 1 + .../29_cropland/detail_apr24/declarations.gms | 4 ++- .../29_cropland/detail_apr24/equations.gms | 4 +++ .../29_cropland/detail_apr24/postsolve.gms | 4 +++ modules/29_cropland/detail_apr24/preloop.gms | 8 +++--- modules/29_cropland/detail_apr24/presolve.gms | 25 ++++++++----------- 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c91c7a38e..30703591ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### added - **29_cropland** new module `29_cropland` accounting for crop area, fallow cropland and tree cover on cropland with two realizations: `detail_apr24` (default) and `simple_apr24`. - **10_land** added interface `pm_land_hist` with historic land use patterns +- **32_forestry** added technical balance term `v32_land_missing_ndc` ### removed - diff --git a/modules/29_cropland/detail_apr24/declarations.gms b/modules/29_cropland/detail_apr24/declarations.gms index e9aa88f83d..9a1d38e2cb 100644 --- a/modules/29_cropland/detail_apr24/declarations.gms +++ b/modules/29_cropland/detail_apr24/declarations.gms @@ -27,7 +27,7 @@ parameters p29_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) p29_treecover(t,j,ac) Cropland tree cover per age class (mio. ha) pc29_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha) - p29_treecover_share(t,j) Share of treecover on total cropland (1) + pc29_treecover_share(j) Share of treecover on total cropland (1) i29_fallow_scenario_fader(t_all) Fallow land scenario fader (1) i29_fallow_target(t) Target share for fallow land on total cropland (1) @@ -54,6 +54,7 @@ equations q29_fallow_missing(j) Missing fallow land towards target (mio. ha) q29_fallow_bv(j,potnatveg) Biodiversity value for fallow land (mio. ha) q29_treecover_missing(j) Missing treecover area towards target (mio. ha) + q29_treecover_max(j) Maximum treecover area (mio. ha) q29_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (mio. ha) q29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) q29_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr) @@ -78,6 +79,7 @@ parameters oq29_fallow_missing(t,j,type) Missing fallow land towards target (mio. ha) oq29_fallow_bv(t,j,potnatveg,type) Biodiversity value for fallow land (mio. ha) oq29_treecover_missing(t,j,type) Missing treecover area towards target (mio. ha) + oq29_treecover_max(t,j,type) Maximum treecover area (mio. ha) oq29_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (mio. ha) oq29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) oq29_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr) diff --git a/modules/29_cropland/detail_apr24/equations.gms b/modules/29_cropland/detail_apr24/equations.gms index ebee259325..5b23f1272d 100644 --- a/modules/29_cropland/detail_apr24/equations.gms +++ b/modules/29_cropland/detail_apr24/equations.gms @@ -82,6 +82,10 @@ v29_treecover_missing(j2) =g= vm_land(j2,"crop") * sum(ct, i29_treecover_target(ct,j2)) - sum(ac, v29_treecover(j2,ac)); + q29_treecover_max(j2) .. + sum(ac, v29_treecover(j2,ac)) =l= + vm_land(j2,"crop") * s29_treecover_max; + *' Depending on `s29_treecover_bii_coeff`, tree cover biodiversity value *' is based on natural vegetation or plantation BII coefficients. diff --git a/modules/29_cropland/detail_apr24/postsolve.gms b/modules/29_cropland/detail_apr24/postsolve.gms index 0d05aea001..9bf9acb70f 100644 --- a/modules/29_cropland/detail_apr24/postsolve.gms +++ b/modules/29_cropland/detail_apr24/postsolve.gms @@ -24,6 +24,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_fallow_missing(t,j,"marginal") = q29_fallow_missing.m(j); oq29_fallow_bv(t,j,potnatveg,"marginal") = q29_fallow_bv.m(j,potnatveg); oq29_treecover_missing(t,j,"marginal") = q29_treecover_missing.m(j); + oq29_treecover_max(t,j,"marginal") = q29_treecover_max.m(j); oq29_treecover_bv(t,j,potnatveg,"marginal") = q29_treecover_bv.m(j,potnatveg); oq29_cost_treecover_est(t,j,"marginal") = q29_cost_treecover_est.m(j); oq29_cost_treecover_recur(t,j,"marginal") = q29_cost_treecover_recur.m(j); @@ -44,6 +45,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_fallow_missing(t,j,"level") = q29_fallow_missing.l(j); oq29_fallow_bv(t,j,potnatveg,"level") = q29_fallow_bv.l(j,potnatveg); oq29_treecover_missing(t,j,"level") = q29_treecover_missing.l(j); + oq29_treecover_max(t,j,"level") = q29_treecover_max.l(j); oq29_treecover_bv(t,j,potnatveg,"level") = q29_treecover_bv.l(j,potnatveg); oq29_cost_treecover_est(t,j,"level") = q29_cost_treecover_est.l(j); oq29_cost_treecover_recur(t,j,"level") = q29_cost_treecover_recur.l(j); @@ -64,6 +66,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_fallow_missing(t,j,"upper") = q29_fallow_missing.up(j); oq29_fallow_bv(t,j,potnatveg,"upper") = q29_fallow_bv.up(j,potnatveg); oq29_treecover_missing(t,j,"upper") = q29_treecover_missing.up(j); + oq29_treecover_max(t,j,"upper") = q29_treecover_max.up(j); oq29_treecover_bv(t,j,potnatveg,"upper") = q29_treecover_bv.up(j,potnatveg); oq29_cost_treecover_est(t,j,"upper") = q29_cost_treecover_est.up(j); oq29_cost_treecover_recur(t,j,"upper") = q29_cost_treecover_recur.up(j); @@ -84,6 +87,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_fallow_missing(t,j,"lower") = q29_fallow_missing.lo(j); oq29_fallow_bv(t,j,potnatveg,"lower") = q29_fallow_bv.lo(j,potnatveg); oq29_treecover_missing(t,j,"lower") = q29_treecover_missing.lo(j); + oq29_treecover_max(t,j,"lower") = q29_treecover_max.lo(j); oq29_treecover_bv(t,j,potnatveg,"lower") = q29_treecover_bv.lo(j,potnatveg); oq29_cost_treecover_est(t,j,"lower") = q29_cost_treecover_est.lo(j); oq29_cost_treecover_recur(t,j,"lower") = q29_cost_treecover_recur.lo(j); diff --git a/modules/29_cropland/detail_apr24/preloop.gms b/modules/29_cropland/detail_apr24/preloop.gms index a7e39c8c8e..b65a0c2b43 100644 --- a/modules/29_cropland/detail_apr24/preloop.gms +++ b/modules/29_cropland/detail_apr24/preloop.gms @@ -23,10 +23,10 @@ elseif s29_snv_shr > s29_snv_relocation_data_x1, * Initial tree cover on cropland is assumed to be equally distributed among all age-classes -pc29_treecover(j,ac) = 0; -pc29_treecover(j,ac)$(pm_land_hist("y2015",j,"crop") > 1e-10) = - (f29_treecover(j) / pm_land_hist("y2015",j,"crop") * pm_land_hist("y1995",j,"crop")) / card(ac); - +pc29_treecover_share(j) = 0; +pc29_treecover_share(j)$(pm_land_hist("y2015",j,"crop") > 1e-10) = f29_treecover(j) / pm_land_hist("y2015",j,"crop"); +pc29_treecover_share(j)$(pc29_treecover_share(j) > s29_treecover_max) = s29_treecover_max; +pc29_treecover(j,ac) = (pc29_treecover_share(j) * pm_land_hist("y1995",j,"crop")) / card(ac); *' Switch for tree cover on cropland: *' 0 = Use natveg growth curve towards LPJmL natural vegetation diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index d6177b87e7..852e0e93db 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -46,24 +46,19 @@ v29_treecover.l(j,ac) = p29_treecover(t,j,ac); * create treecover target and penalty scenario i29_treecover_target(t,j) = s29_treecover_target * i29_treecover_scenario_fader(t); -p29_treecover_share(t,j) = 0; -p29_treecover_share(t,j)$(pcm_land(j,"crop") > 1e-10) = sum(ac, pc29_treecover(j,ac)) / pcm_land(j,"crop"); -p29_treecover_share(t,j)$(p29_treecover_share(t,j) > s29_treecover_max) = s29_treecover_max; +pc29_treecover_share(j) = 0; +pc29_treecover_share(j)$(pcm_land(j,"crop") > 1e-10) = sum(ac, pc29_treecover(j,ac)) / pcm_land(j,"crop"); +pc29_treecover_share(j)$(pc29_treecover_share(j) > s29_treecover_max) = s29_treecover_max; if (s29_treecover_keep = 1, - i29_treecover_target(t,j)$(i29_treecover_target(t,j) < p29_treecover_share(t,j)) = p29_treecover_share(t,j); + i29_treecover_target(t,j)$(i29_treecover_target(t,j) < pc29_treecover_share(j)) = pc29_treecover_share(j); ); -if(m_year(t) <= s29_treecover_scenario_start, - v29_treecover.fx(j,ac) = pc29_treecover(j,ac); - i29_treecover_penalty(t) = 0; -else - v29_treecover.lo(j,ac_est) = 0; - v29_treecover.up(j,ac_est) = Inf; - v29_treecover.lo(j,ac_sub) = 0; - v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); - m_boundfix(v29_treecover,(j,ac_sub),l,10e-5); - i29_treecover_penalty(t) = s29_treecover_penalty; -); +v29_treecover.lo(j,ac_est) = 0; +v29_treecover.up(j,ac_est) = Inf; +v29_treecover.lo(j,ac_sub) = 0; +v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); +m_boundfix(v29_treecover,(j,ac_sub),l,10e-5); +i29_treecover_penalty(t) = s29_treecover_penalty; * create fallow land target and penalty scenario i29_fallow_target(t) = s29_fallow_target * i29_fallow_scenario_fader(t); From 5c455ed52acf01f85e27d3f6df1f8cdccb064fc9 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 24 Apr 2024 06:31:59 +0200 Subject: [PATCH 037/280] bugfixes --- config/default.cfg | 7 +++++- .../29_cropland/detail_apr24/declarations.gms | 12 ++++++---- .../29_cropland/detail_apr24/equations.gms | 11 ++++++--- modules/29_cropland/detail_apr24/input.gms | 4 +++- .../29_cropland/detail_apr24/postsolve.gms | 24 ++++++++++++------- modules/29_cropland/detail_apr24/presolve.gms | 17 ++++++++++++- modules/30_croparea/detail_apr24/presolve.gms | 3 +++ 7 files changed, 60 insertions(+), 18 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index b9dc6b1bc3..c4c5d26b83 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -717,12 +717,15 @@ cfg$gms$policy_countries29 <- all_iso_countries # * "secdforest, past, other" etc. cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other" +# * Penalty for transgression of available cropland (USD05MER per ha) +cfg$gms$s29_avl_crop_exceed_penalty <- 1e+06 + # * Minimum cluster share of treecover on total cropland area (including croparea, fallow land and tree cover). # * s29_treecover_target is faded in linearly between s29_treecover_scenario_start and s29_treecover_scenario_target. cfg$gms$s29_treecover_target <- 0 # def = 0 # * Avoid loss of existing treecover (1=yes 0=no) cfg$gms$s29_treecover_keep <- 1 # def = 1 -# * Maximum share of existing treecover on total cropland (1) +# * Maximum share of treecover on total cropland (1) cfg$gms$s29_treecover_max <- 0.4 # def = 0.4 # * Start year of tree cover share fade-in: cfg$gms$s29_treecover_scenario_start <- 2020 # def = 2020 @@ -738,6 +741,8 @@ cfg$gms$s29_treecover_penalty <- 2000 # def = 2000 # * Minimum cluster share of fallow land on total cropland area (including croparea, fallow land and tree cover). # * s29_fallow_target is faded in linearly between s29_fallow_scenario_start and s29_fallow_scenario_target. cfg$gms$s29_fallow_target <- 0 # def = 0 +# * Maximum share of fallow land on total cropland (1) +cfg$gms$s29_fallow_max <- 0.4 # def = 0.4 # * Start year of tree cover share fade-in: cfg$gms$s29_fallow_scenario_start <- 2020 # def = 2020 # * Target year (year when full implementation is reached): diff --git a/modules/29_cropland/detail_apr24/declarations.gms b/modules/29_cropland/detail_apr24/declarations.gms index 9a1d38e2cb..bd0b1fd36d 100644 --- a/modules/29_cropland/detail_apr24/declarations.gms +++ b/modules/29_cropland/detail_apr24/declarations.gms @@ -36,6 +36,7 @@ parameters positive variables vm_cost_cropland(j) Cost for total cropland (mio. USD05MER per yr) + v29_avl_crop_exceed(j) Transgression of availabe cropland land (mio. ha) v29_treecover(j,ac) Cropland tree cover per age class (mio. ha) v29_treecover_missing(j) Missing treecover area towards target (mio. ha) v29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) @@ -51,9 +52,10 @@ equations q29_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) q29_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) q29_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) - q29_fallow_missing(j) Missing fallow land towards target (mio. ha) + q29_fallow_min(j) Missing fallow land towards target (mio. ha) + q29_fallow_max(j) Maximum fallow land towards target (mio. ha) q29_fallow_bv(j,potnatveg) Biodiversity value for fallow land (mio. ha) - q29_treecover_missing(j) Missing treecover area towards target (mio. ha) + q29_treecover_min(j) Missing treecover area towards target (mio. ha) q29_treecover_max(j) Maximum treecover area (mio. ha) q29_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (mio. ha) q29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) @@ -64,6 +66,7 @@ equations *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov_cost_cropland(t,j,type) Cost for total cropland (mio. USD05MER per yr) + ov29_avl_crop_exceed(t,j,type) Transgression of availabe cropland land (mio. ha) ov29_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) ov29_treecover_missing(t,j,type) Missing treecover area towards target (mio. ha) ov29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) @@ -76,9 +79,10 @@ parameters oq29_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) oq29_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) oq29_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) - oq29_fallow_missing(t,j,type) Missing fallow land towards target (mio. ha) + oq29_fallow_min(t,j,type) Missing fallow land towards target (mio. ha) + oq29_fallow_max(t,j,type) Maximum fallow land towards target (mio. ha) oq29_fallow_bv(t,j,potnatveg,type) Biodiversity value for fallow land (mio. ha) - oq29_treecover_missing(t,j,type) Missing treecover area towards target (mio. ha) + oq29_treecover_min(t,j,type) Missing treecover area towards target (mio. ha) oq29_treecover_max(t,j,type) Maximum treecover area (mio. ha) oq29_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (mio. ha) oq29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) diff --git a/modules/29_cropland/detail_apr24/equations.gms b/modules/29_cropland/detail_apr24/equations.gms index 5b23f1272d..88000e5bc8 100644 --- a/modules/29_cropland/detail_apr24/equations.gms +++ b/modules/29_cropland/detail_apr24/equations.gms @@ -20,7 +20,7 @@ *' in order to increase compositional heterogeneity of land types at the cell level. q29_avl_cropland(j2) .. - vm_land(j2,"crop") =l= sum(ct, p29_avl_cropland(ct,j2)); + v29_avl_crop_exceed(j2) =g= vm_land(j2,"crop") - sum(ct, p29_avl_cropland(ct,j2)); *' Total cost for the cropland module. @@ -28,6 +28,7 @@ q29_cost_cropland(j2) .. vm_cost_cropland(j2) =e= v29_cost_treecover_est(j2) + v29_cost_treecover_recur(j2) + + v29_avl_crop_exceed(j2) * s29_avl_crop_exceed_penalty + v29_fallow_missing(j2) * sum(ct, i29_fallow_penalty(ct)) + v29_treecover_missing(j2) * sum(ct, i29_treecover_penalty(ct)); @@ -63,10 +64,14 @@ *' The penalty applies to the missing fallow land, i.e. where fallow land *' is lower than a certain fraction of total cropland. - q29_fallow_missing(j2) .. + q29_fallow_min(j2) .. v29_fallow_missing(j2) =g= vm_land(j2,"crop") * sum(ct, i29_fallow_target(ct)) - vm_fallow(j2); + q29_fallow_max(j2) .. + vm_fallow(j2) =l= + vm_land(j2,"crop") * s29_fallow_max; + *' Fallow land biodiversity value is based on perennial crops. q29_fallow_bv(j2,potnatveg) .. @@ -78,7 +83,7 @@ *' The penalty applies to the missing treecover area, i.e. where treecover area *' is lower than a certain fraction of total cropland. - q29_treecover_missing(j2) .. + q29_treecover_min(j2) .. v29_treecover_missing(j2) =g= vm_land(j2,"crop") * sum(ct, i29_treecover_target(ct,j2)) - sum(ac, v29_treecover(j2,ac)); diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms index b7022a5323..52f04d2061 100644 --- a/modules/29_cropland/detail_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -17,17 +17,19 @@ scalars s29_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / s29_cost_treecover_est Tree cover establishment cost (USD05MER per ha) / 2000 / s29_cost_treecover_recur Tree cover recurring cost (USD05MER per ha) / 500 / + s29_avl_crop_exceed_penalty Penalty for transgression of available cropland (USD05MER per ha) / 1e+06 / s29_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / s29_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / s29_treecover_scenario_start Cropland treecover scenario start year / 2020 / s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / s29_treecover_target Target share of treecover on total cropland (1) / 0 / s29_treecover_keep Avoid loss of existing treecover (1=yes 0=no) / 1 / - s29_treecover_max Maximum share of existing treecover on total cropland (1) / 0.4 / + s29_treecover_max Maximum share of treecover on total cropland (1) / 0.4 / s29_treecover_penalty Penalty for violation of treecover target (USD05MER per ha) / 2000 / s29_fallow_scenario_start Fallow land scenario start year / 2020 / s29_fallow_scenario_target Fallow land scenario target year / 2050 / s29_fallow_target Target share of fallow land on total cropland (1) / 0 / + s29_fallow_max Maximum share of fallow land on total cropland (1) / 0.4 / s29_fallow_penalty Penalty for violation of fallow target (USD05MER per ha) / 500 / ; diff --git a/modules/29_cropland/detail_apr24/postsolve.gms b/modules/29_cropland/detail_apr24/postsolve.gms index 9bf9acb70f..79aab84004 100644 --- a/modules/29_cropland/detail_apr24/postsolve.gms +++ b/modules/29_cropland/detail_apr24/postsolve.gms @@ -9,6 +9,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_cost_cropland(t,j,"marginal") = vm_cost_cropland.m(j); + ov29_avl_crop_exceed(t,j,"marginal") = v29_avl_crop_exceed.m(j); ov29_treecover(t,j,ac,"marginal") = v29_treecover.m(j,ac); ov29_treecover_missing(t,j,"marginal") = v29_treecover_missing.m(j); ov29_cost_treecover_est(t,j,"marginal") = v29_cost_treecover_est.m(j); @@ -21,15 +22,17 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_carbon(t,j,ag_pools,stockType,"marginal") = q29_carbon.m(j,ag_pools,stockType); oq29_land_snv(t,j,"marginal") = q29_land_snv.m(j); oq29_land_snv_trans(t,j,"marginal") = q29_land_snv_trans.m(j); - oq29_fallow_missing(t,j,"marginal") = q29_fallow_missing.m(j); + oq29_fallow_min(t,j,"marginal") = q29_fallow_min.m(j); + oq29_fallow_max(t,j,"marginal") = q29_fallow_max.m(j); oq29_fallow_bv(t,j,potnatveg,"marginal") = q29_fallow_bv.m(j,potnatveg); - oq29_treecover_missing(t,j,"marginal") = q29_treecover_missing.m(j); + oq29_treecover_min(t,j,"marginal") = q29_treecover_min.m(j); oq29_treecover_max(t,j,"marginal") = q29_treecover_max.m(j); oq29_treecover_bv(t,j,potnatveg,"marginal") = q29_treecover_bv.m(j,potnatveg); oq29_cost_treecover_est(t,j,"marginal") = q29_cost_treecover_est.m(j); oq29_cost_treecover_recur(t,j,"marginal") = q29_cost_treecover_recur.m(j); oq29_treecover_est(t,j,ac,"marginal") = q29_treecover_est.m(j,ac); ov_cost_cropland(t,j,"level") = vm_cost_cropland.l(j); + ov29_avl_crop_exceed(t,j,"level") = v29_avl_crop_exceed.l(j); ov29_treecover(t,j,ac,"level") = v29_treecover.l(j,ac); ov29_treecover_missing(t,j,"level") = v29_treecover_missing.l(j); ov29_cost_treecover_est(t,j,"level") = v29_cost_treecover_est.l(j); @@ -42,15 +45,17 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_carbon(t,j,ag_pools,stockType,"level") = q29_carbon.l(j,ag_pools,stockType); oq29_land_snv(t,j,"level") = q29_land_snv.l(j); oq29_land_snv_trans(t,j,"level") = q29_land_snv_trans.l(j); - oq29_fallow_missing(t,j,"level") = q29_fallow_missing.l(j); + oq29_fallow_min(t,j,"level") = q29_fallow_min.l(j); + oq29_fallow_max(t,j,"level") = q29_fallow_max.l(j); oq29_fallow_bv(t,j,potnatveg,"level") = q29_fallow_bv.l(j,potnatveg); - oq29_treecover_missing(t,j,"level") = q29_treecover_missing.l(j); + oq29_treecover_min(t,j,"level") = q29_treecover_min.l(j); oq29_treecover_max(t,j,"level") = q29_treecover_max.l(j); oq29_treecover_bv(t,j,potnatveg,"level") = q29_treecover_bv.l(j,potnatveg); oq29_cost_treecover_est(t,j,"level") = q29_cost_treecover_est.l(j); oq29_cost_treecover_recur(t,j,"level") = q29_cost_treecover_recur.l(j); oq29_treecover_est(t,j,ac,"level") = q29_treecover_est.l(j,ac); ov_cost_cropland(t,j,"upper") = vm_cost_cropland.up(j); + ov29_avl_crop_exceed(t,j,"upper") = v29_avl_crop_exceed.up(j); ov29_treecover(t,j,ac,"upper") = v29_treecover.up(j,ac); ov29_treecover_missing(t,j,"upper") = v29_treecover_missing.up(j); ov29_cost_treecover_est(t,j,"upper") = v29_cost_treecover_est.up(j); @@ -63,15 +68,17 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_carbon(t,j,ag_pools,stockType,"upper") = q29_carbon.up(j,ag_pools,stockType); oq29_land_snv(t,j,"upper") = q29_land_snv.up(j); oq29_land_snv_trans(t,j,"upper") = q29_land_snv_trans.up(j); - oq29_fallow_missing(t,j,"upper") = q29_fallow_missing.up(j); + oq29_fallow_min(t,j,"upper") = q29_fallow_min.up(j); + oq29_fallow_max(t,j,"upper") = q29_fallow_max.up(j); oq29_fallow_bv(t,j,potnatveg,"upper") = q29_fallow_bv.up(j,potnatveg); - oq29_treecover_missing(t,j,"upper") = q29_treecover_missing.up(j); + oq29_treecover_min(t,j,"upper") = q29_treecover_min.up(j); oq29_treecover_max(t,j,"upper") = q29_treecover_max.up(j); oq29_treecover_bv(t,j,potnatveg,"upper") = q29_treecover_bv.up(j,potnatveg); oq29_cost_treecover_est(t,j,"upper") = q29_cost_treecover_est.up(j); oq29_cost_treecover_recur(t,j,"upper") = q29_cost_treecover_recur.up(j); oq29_treecover_est(t,j,ac,"upper") = q29_treecover_est.up(j,ac); ov_cost_cropland(t,j,"lower") = vm_cost_cropland.lo(j); + ov29_avl_crop_exceed(t,j,"lower") = v29_avl_crop_exceed.lo(j); ov29_treecover(t,j,ac,"lower") = v29_treecover.lo(j,ac); ov29_treecover_missing(t,j,"lower") = v29_treecover_missing.lo(j); ov29_cost_treecover_est(t,j,"lower") = v29_cost_treecover_est.lo(j); @@ -84,9 +91,10 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_carbon(t,j,ag_pools,stockType,"lower") = q29_carbon.lo(j,ag_pools,stockType); oq29_land_snv(t,j,"lower") = q29_land_snv.lo(j); oq29_land_snv_trans(t,j,"lower") = q29_land_snv_trans.lo(j); - oq29_fallow_missing(t,j,"lower") = q29_fallow_missing.lo(j); + oq29_fallow_min(t,j,"lower") = q29_fallow_min.lo(j); + oq29_fallow_max(t,j,"lower") = q29_fallow_max.lo(j); oq29_fallow_bv(t,j,potnatveg,"lower") = q29_fallow_bv.lo(j,potnatveg); - oq29_treecover_missing(t,j,"lower") = q29_treecover_missing.lo(j); + oq29_treecover_min(t,j,"lower") = q29_treecover_min.lo(j); oq29_treecover_max(t,j,"lower") = q29_treecover_max.lo(j); oq29_treecover_bv(t,j,potnatveg,"lower") = q29_treecover_bv.lo(j,potnatveg); oq29_cost_treecover_est(t,j,"lower") = q29_cost_treecover_est.lo(j); diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index 852e0e93db..c0810c3ec2 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -58,13 +58,28 @@ v29_treecover.up(j,ac_est) = Inf; v29_treecover.lo(j,ac_sub) = 0; v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); m_boundfix(v29_treecover,(j,ac_sub),l,10e-5); -i29_treecover_penalty(t) = s29_treecover_penalty; + +if(m_year(t) <= s29_treecover_scenario_start, + i29_treecover_penalty(t) = 0; + v29_treecover_missing.fx(j) = 0; +else + i29_treecover_penalty(t) = s29_treecover_penalty; + v29_treecover_missing.lo(j) = 0; + v29_treecover_missing.up(j) = Inf; +); * create fallow land target and penalty scenario i29_fallow_target(t) = s29_fallow_target * i29_fallow_scenario_fader(t); if(m_year(t) <= s29_fallow_scenario_start, i29_fallow_penalty(t) = 0; + v29_fallow_missing.fx(j) = 0; else i29_fallow_penalty(t) = s29_fallow_penalty; + v29_fallow_missing.lo(j) = 0; + v29_fallow_missing.up(j) = Inf; ); + +vm_fallow.lo(j) = 0; +vm_fallow.up(j) = p29_avl_cropland(t,j); +m_boundfix(vm_fallow,(j),l,10e-5); diff --git a/modules/30_croparea/detail_apr24/presolve.gms b/modules/30_croparea/detail_apr24/presolve.gms index ff63a8c7e4..ef851982a3 100644 --- a/modules/30_croparea/detail_apr24/presolve.gms +++ b/modules/30_croparea/detail_apr24/presolve.gms @@ -30,6 +30,9 @@ i30_betr_target(t) = s30_betr_target * i30_betr_scenario_fader(t); if(m_year(t) <= s30_betr_scenario_start, i30_betr_penalty(t) = 0; + v30_betr_missing.fx(j) = 0; else i30_betr_penalty(t) = s30_betr_penalty; + v30_betr_missing.lo(j) = 0; + v30_betr_missing.up(j) = Inf; ); From 34e0c6bc1fddc8d921b35b8bf4f787fb50531a95 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 24 Apr 2024 07:36:59 +0200 Subject: [PATCH 038/280] bugfixes --- modules/29_cropland/detail_apr24/presolve.gms | 28 ++++++++++++------- modules/30_croparea/detail_apr24/presolve.gms | 16 +++++++---- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index c0810c3ec2..553aad23b6 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -59,25 +59,33 @@ v29_treecover.lo(j,ac_sub) = 0; v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); m_boundfix(v29_treecover,(j,ac_sub),l,10e-5); -if(m_year(t) <= s29_treecover_scenario_start, - i29_treecover_penalty(t) = 0; - v29_treecover_missing.fx(j) = 0; +if (m_year(t) <= s29_treecover_scenario_start, + i29_treecover_penalty(t) = 0; + v29_treecover_missing.fx(j) = 0; else - i29_treecover_penalty(t) = s29_treecover_penalty; - v29_treecover_missing.lo(j) = 0; - v29_treecover_missing.up(j) = Inf; + i29_treecover_penalty(t) = s29_treecover_penalty; + if (i29_treecover_penalty(t) > 0, + v29_treecover_missing.lo(j) = 0; + v29_treecover_missing.up(j) = Inf; + else + v29_treecover_missing.fx(j) = 0; + ); ); * create fallow land target and penalty scenario i29_fallow_target(t) = s29_fallow_target * i29_fallow_scenario_fader(t); -if(m_year(t) <= s29_fallow_scenario_start, +if (m_year(t) <= s29_fallow_scenario_start, i29_fallow_penalty(t) = 0; v29_fallow_missing.fx(j) = 0; else - i29_fallow_penalty(t) = s29_fallow_penalty; - v29_fallow_missing.lo(j) = 0; - v29_fallow_missing.up(j) = Inf; + i29_fallow_penalty(t) = s29_fallow_penalty; + if (i29_fallow_penalty(t) > 0, + v29_fallow_missing.lo(j) = 0; + v29_fallow_missing.up(j) = Inf; + else + v29_fallow_missing.fx(j) = 0; + ); ); vm_fallow.lo(j) = 0; diff --git a/modules/30_croparea/detail_apr24/presolve.gms b/modules/30_croparea/detail_apr24/presolve.gms index ef851982a3..907dd57aaa 100644 --- a/modules/30_croparea/detail_apr24/presolve.gms +++ b/modules/30_croparea/detail_apr24/presolve.gms @@ -28,11 +28,15 @@ rotamin_red30(rotamin30) = yes$(i30_rotation_rules(t,rotamin30) > 0); * create betr target and penalty scenario i30_betr_target(t) = s30_betr_target * i30_betr_scenario_fader(t); -if(m_year(t) <= s30_betr_scenario_start, - i30_betr_penalty(t) = 0; - v30_betr_missing.fx(j) = 0; +if (m_year(t) <= s30_betr_scenario_start, + i30_betr_penalty(t) = 0; + v30_betr_missing.fx(j) = 0; else - i30_betr_penalty(t) = s30_betr_penalty; - v30_betr_missing.lo(j) = 0; - v30_betr_missing.up(j) = Inf; + i30_betr_penalty(t) = s30_betr_penalty; + if (i30_betr_penalty(t) > 0, + v30_betr_missing.lo(j) = 0; + v30_betr_missing.up(j) = Inf; + else + v30_betr_missing.fx(j) = 0; + ); ); From 6279d3445402962f2a08db47c88e9332a335b277 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 24 Apr 2024 07:39:43 +0200 Subject: [PATCH 039/280] test without boundfix --- core/macros.gms | 2 +- modules/35_natveg/dynamic_feb21/presolve.gms | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/macros.gms b/core/macros.gms index 2fb013af99..1607fc6bae 100644 --- a/core/macros.gms +++ b/core/macros.gms @@ -10,7 +10,7 @@ * Macro for fixing a variable in the case that lower and upper bound are too * close to each other (closer than argument "sens") * EXAMPLE: ma_boundfix(vm_land,(j,"ifft"),up,10e-5); -$macro m_boundfix(x,arg,sufx,sens) x.fx arg$(x.up arg-x.lo arg0) + 0$(sum(s,w)<=0); diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/dynamic_feb21/presolve.gms index 97a6f33b35..6ff22789af 100644 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ b/modules/35_natveg/dynamic_feb21/presolve.gms @@ -129,7 +129,7 @@ m_boundfix(v35_secdforest,(j,ac_sub),l,10e-5); * Secondary forest conservation * protection bound fix -pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_secdforest(j,ac_sub)); +*pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_secdforest(j,ac_sub)); * set restoration target p35_land_restoration(j,"secdforest") = pm_land_conservation(t,j,"secdforest","restore"); * Do not restore secdforest in areas where total natural @@ -149,7 +149,7 @@ m_boundfix(v35_other,(j,ac_sub),l,10e-5); * Other land conservation * protection bound fix -pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_other(j,ac_sub)); +*pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_other(j,ac_sub)); * set restoration target p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); * Do not restore other land in areas where total natural From 274542d8d87e2bb3555d03c261e1524abad11087 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 24 Apr 2024 08:04:49 +0200 Subject: [PATCH 040/280] bugfixes --- core/macros.gms | 4 ++-- modules/10_land/landmatrix_dec18/presolve.gms | 2 +- modules/29_cropland/detail_apr24/presolve.gms | 4 ++-- modules/32_forestry/dynamic_feb21/presolve.gms | 2 +- modules/35_natveg/dynamic_feb21/presolve.gms | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/macros.gms b/core/macros.gms index 1607fc6bae..b067d75936 100644 --- a/core/macros.gms +++ b/core/macros.gms @@ -9,8 +9,8 @@ * Macro for fixing a variable in the case that lower and upper bound are too * close to each other (closer than argument "sens") -* EXAMPLE: ma_boundfix(vm_land,(j,"ifft"),up,10e-5); -$macro m_boundfix(x,arg,sufx,sens) x.l arg$(x.up arg-x.lo arg0) + 0$(sum(s,w)<=0); diff --git a/modules/10_land/landmatrix_dec18/presolve.gms b/modules/10_land/landmatrix_dec18/presolve.gms index edee5163dc..d3628c565a 100644 --- a/modules/10_land/landmatrix_dec18/presolve.gms +++ b/modules/10_land/landmatrix_dec18/presolve.gms @@ -22,4 +22,4 @@ vm_lu_transitions.up(j,"primforest","primforest") = Inf; *' @stop -m_boundfix(vm_land,(j,land),up,10e-5); +m_boundfix(vm_land,(j,land),up,1e-10); diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index 553aad23b6..3d1b53e322 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -57,7 +57,7 @@ v29_treecover.lo(j,ac_est) = 0; v29_treecover.up(j,ac_est) = Inf; v29_treecover.lo(j,ac_sub) = 0; v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); -m_boundfix(v29_treecover,(j,ac_sub),l,10e-5); +m_boundfix(v29_treecover,(j,ac_sub),l,1e-10); if (m_year(t) <= s29_treecover_scenario_start, i29_treecover_penalty(t) = 0; @@ -90,4 +90,4 @@ else vm_fallow.lo(j) = 0; vm_fallow.up(j) = p29_avl_cropland(t,j); -m_boundfix(vm_fallow,(j),l,10e-5); +m_boundfix(vm_fallow,(j),l,1e-10); diff --git a/modules/32_forestry/dynamic_feb21/presolve.gms b/modules/32_forestry/dynamic_feb21/presolve.gms index 3491620843..7f2659735f 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_feb21/presolve.gms @@ -153,7 +153,7 @@ else *' No afforestation is allowed if carbon density <= 20 tc/ha v32_land.fx(j,"aff",ac_est)$(fm_carbon_density(t,j,"forestry","vegc") <= 20) = 0; -m_boundfix(v32_land,(j,type32,ac_sub),up,10e-5); +m_boundfix(v32_land,(j,type32,ac_sub),up,1e-10); ** Calculate future yield based on rotation length if((ord(t)=1), diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/dynamic_feb21/presolve.gms index 6ff22789af..6bff1937f4 100644 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ b/modules/35_natveg/dynamic_feb21/presolve.gms @@ -125,11 +125,11 @@ v35_secdforest.lo(j,ac_sub) = max((1-s35_natveg_harvest_shr) * pc35_secdforest(j ); * upper bound v35_secdforest.up(j,ac_sub) = pc35_secdforest(j,ac_sub); -m_boundfix(v35_secdforest,(j,ac_sub),l,10e-5); +m_boundfix(v35_secdforest,(j,ac_sub),l,1e-10); * Secondary forest conservation * protection bound fix -*pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_secdforest(j,ac_sub)); +pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 1e-10) = sum(ac_sub, pc35_secdforest(j,ac_sub)); * set restoration target p35_land_restoration(j,"secdforest") = pm_land_conservation(t,j,"secdforest","restore"); * Do not restore secdforest in areas where total natural @@ -145,11 +145,11 @@ v35_other.lo(j,ac) = 0; v35_other.up(j,ac) = Inf; *set upper bound v35_other.up(j,ac_sub) = pc35_other(j,ac_sub); -m_boundfix(v35_other,(j,ac_sub),l,10e-5); +m_boundfix(v35_other,(j,ac_sub),l,1e-10); * Other land conservation * protection bound fix -*pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_other(j,ac_sub)); +pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 1e-10) = sum(ac_sub, pc35_other(j,ac_sub)); * set restoration target p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); * Do not restore other land in areas where total natural From a3eb57696a119426e055c9d09a7c9e1b2fc99639 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 24 Apr 2024 08:36:12 +0200 Subject: [PATCH 041/280] reverting back --- core/macros.gms | 2 +- modules/10_land/landmatrix_dec18/presolve.gms | 2 +- modules/29_cropland/detail_apr24/presolve.gms | 6 +++--- modules/32_forestry/dynamic_feb21/presolve.gms | 2 +- modules/35_natveg/dynamic_feb21/presolve.gms | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/macros.gms b/core/macros.gms index b067d75936..2fb013af99 100644 --- a/core/macros.gms +++ b/core/macros.gms @@ -9,7 +9,7 @@ * Macro for fixing a variable in the case that lower and upper bound are too * close to each other (closer than argument "sens") -* EXAMPLE: ma_boundfix(vm_land,(j,"ifft"),up,1e-10); +* EXAMPLE: ma_boundfix(vm_land,(j,"ifft"),up,10e-5); $macro m_boundfix(x,arg,sufx,sens) x.fx arg$(x.up arg-x.lo arg0) + 0$(sum(s,w)<=0); diff --git a/modules/10_land/landmatrix_dec18/presolve.gms b/modules/10_land/landmatrix_dec18/presolve.gms index d3628c565a..edee5163dc 100644 --- a/modules/10_land/landmatrix_dec18/presolve.gms +++ b/modules/10_land/landmatrix_dec18/presolve.gms @@ -22,4 +22,4 @@ vm_lu_transitions.up(j,"primforest","primforest") = Inf; *' @stop -m_boundfix(vm_land,(j,land),up,1e-10); +m_boundfix(vm_land,(j,land),up,10e-5); diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index 3d1b53e322..698fe7b3a1 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -47,7 +47,7 @@ v29_treecover.l(j,ac) = p29_treecover(t,j,ac); i29_treecover_target(t,j) = s29_treecover_target * i29_treecover_scenario_fader(t); pc29_treecover_share(j) = 0; -pc29_treecover_share(j)$(pcm_land(j,"crop") > 1e-10) = sum(ac, pc29_treecover(j,ac)) / pcm_land(j,"crop"); +pc29_treecover_share(j)$(pcm_land(j,"crop") > 10e-5) = sum(ac, pc29_treecover(j,ac)) / pcm_land(j,"crop"); pc29_treecover_share(j)$(pc29_treecover_share(j) > s29_treecover_max) = s29_treecover_max; if (s29_treecover_keep = 1, i29_treecover_target(t,j)$(i29_treecover_target(t,j) < pc29_treecover_share(j)) = pc29_treecover_share(j); @@ -57,7 +57,7 @@ v29_treecover.lo(j,ac_est) = 0; v29_treecover.up(j,ac_est) = Inf; v29_treecover.lo(j,ac_sub) = 0; v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); -m_boundfix(v29_treecover,(j,ac_sub),l,1e-10); +m_boundfix(v29_treecover,(j,ac_sub),l,10e-5); if (m_year(t) <= s29_treecover_scenario_start, i29_treecover_penalty(t) = 0; @@ -90,4 +90,4 @@ else vm_fallow.lo(j) = 0; vm_fallow.up(j) = p29_avl_cropland(t,j); -m_boundfix(vm_fallow,(j),l,1e-10); +m_boundfix(vm_fallow,(j),l,10e-5); diff --git a/modules/32_forestry/dynamic_feb21/presolve.gms b/modules/32_forestry/dynamic_feb21/presolve.gms index 7f2659735f..3491620843 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_feb21/presolve.gms @@ -153,7 +153,7 @@ else *' No afforestation is allowed if carbon density <= 20 tc/ha v32_land.fx(j,"aff",ac_est)$(fm_carbon_density(t,j,"forestry","vegc") <= 20) = 0; -m_boundfix(v32_land,(j,type32,ac_sub),up,1e-10); +m_boundfix(v32_land,(j,type32,ac_sub),up,10e-5); ** Calculate future yield based on rotation length if((ord(t)=1), diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/dynamic_feb21/presolve.gms index 6bff1937f4..97a6f33b35 100644 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ b/modules/35_natveg/dynamic_feb21/presolve.gms @@ -125,11 +125,11 @@ v35_secdforest.lo(j,ac_sub) = max((1-s35_natveg_harvest_shr) * pc35_secdforest(j ); * upper bound v35_secdforest.up(j,ac_sub) = pc35_secdforest(j,ac_sub); -m_boundfix(v35_secdforest,(j,ac_sub),l,1e-10); +m_boundfix(v35_secdforest,(j,ac_sub),l,10e-5); * Secondary forest conservation * protection bound fix -pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 1e-10) = sum(ac_sub, pc35_secdforest(j,ac_sub)); +pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_secdforest(j,ac_sub)); * set restoration target p35_land_restoration(j,"secdforest") = pm_land_conservation(t,j,"secdforest","restore"); * Do not restore secdforest in areas where total natural @@ -145,11 +145,11 @@ v35_other.lo(j,ac) = 0; v35_other.up(j,ac) = Inf; *set upper bound v35_other.up(j,ac_sub) = pc35_other(j,ac_sub); -m_boundfix(v35_other,(j,ac_sub),l,1e-10); +m_boundfix(v35_other,(j,ac_sub),l,10e-5); * Other land conservation * protection bound fix -pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 1e-10) = sum(ac_sub, pc35_other(j,ac_sub)); +pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_other(j,ac_sub)); * set restoration target p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); * Do not restore other land in areas where total natural From 34b830b1846e7222707174ea4cb047ea1c2eaff5 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 24 Apr 2024 08:57:37 +0200 Subject: [PATCH 042/280] check again with other bounds --- modules/10_land/landmatrix_dec18/presolve.gms | 2 +- modules/29_cropland/detail_apr24/presolve.gms | 6 +++--- modules/32_forestry/dynamic_feb21/presolve.gms | 2 +- modules/35_natveg/dynamic_feb21/presolve.gms | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/10_land/landmatrix_dec18/presolve.gms b/modules/10_land/landmatrix_dec18/presolve.gms index edee5163dc..d3628c565a 100644 --- a/modules/10_land/landmatrix_dec18/presolve.gms +++ b/modules/10_land/landmatrix_dec18/presolve.gms @@ -22,4 +22,4 @@ vm_lu_transitions.up(j,"primforest","primforest") = Inf; *' @stop -m_boundfix(vm_land,(j,land),up,10e-5); +m_boundfix(vm_land,(j,land),up,1e-10); diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index 698fe7b3a1..3d1b53e322 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -47,7 +47,7 @@ v29_treecover.l(j,ac) = p29_treecover(t,j,ac); i29_treecover_target(t,j) = s29_treecover_target * i29_treecover_scenario_fader(t); pc29_treecover_share(j) = 0; -pc29_treecover_share(j)$(pcm_land(j,"crop") > 10e-5) = sum(ac, pc29_treecover(j,ac)) / pcm_land(j,"crop"); +pc29_treecover_share(j)$(pcm_land(j,"crop") > 1e-10) = sum(ac, pc29_treecover(j,ac)) / pcm_land(j,"crop"); pc29_treecover_share(j)$(pc29_treecover_share(j) > s29_treecover_max) = s29_treecover_max; if (s29_treecover_keep = 1, i29_treecover_target(t,j)$(i29_treecover_target(t,j) < pc29_treecover_share(j)) = pc29_treecover_share(j); @@ -57,7 +57,7 @@ v29_treecover.lo(j,ac_est) = 0; v29_treecover.up(j,ac_est) = Inf; v29_treecover.lo(j,ac_sub) = 0; v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); -m_boundfix(v29_treecover,(j,ac_sub),l,10e-5); +m_boundfix(v29_treecover,(j,ac_sub),l,1e-10); if (m_year(t) <= s29_treecover_scenario_start, i29_treecover_penalty(t) = 0; @@ -90,4 +90,4 @@ else vm_fallow.lo(j) = 0; vm_fallow.up(j) = p29_avl_cropland(t,j); -m_boundfix(vm_fallow,(j),l,10e-5); +m_boundfix(vm_fallow,(j),l,1e-10); diff --git a/modules/32_forestry/dynamic_feb21/presolve.gms b/modules/32_forestry/dynamic_feb21/presolve.gms index 3491620843..7f2659735f 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_feb21/presolve.gms @@ -153,7 +153,7 @@ else *' No afforestation is allowed if carbon density <= 20 tc/ha v32_land.fx(j,"aff",ac_est)$(fm_carbon_density(t,j,"forestry","vegc") <= 20) = 0; -m_boundfix(v32_land,(j,type32,ac_sub),up,10e-5); +m_boundfix(v32_land,(j,type32,ac_sub),up,1e-10); ** Calculate future yield based on rotation length if((ord(t)=1), diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/dynamic_feb21/presolve.gms index 97a6f33b35..6bff1937f4 100644 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ b/modules/35_natveg/dynamic_feb21/presolve.gms @@ -125,11 +125,11 @@ v35_secdforest.lo(j,ac_sub) = max((1-s35_natveg_harvest_shr) * pc35_secdforest(j ); * upper bound v35_secdforest.up(j,ac_sub) = pc35_secdforest(j,ac_sub); -m_boundfix(v35_secdforest,(j,ac_sub),l,10e-5); +m_boundfix(v35_secdforest,(j,ac_sub),l,1e-10); * Secondary forest conservation * protection bound fix -pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_secdforest(j,ac_sub)); +pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 1e-10) = sum(ac_sub, pc35_secdforest(j,ac_sub)); * set restoration target p35_land_restoration(j,"secdforest") = pm_land_conservation(t,j,"secdforest","restore"); * Do not restore secdforest in areas where total natural @@ -145,11 +145,11 @@ v35_other.lo(j,ac) = 0; v35_other.up(j,ac) = Inf; *set upper bound v35_other.up(j,ac_sub) = pc35_other(j,ac_sub); -m_boundfix(v35_other,(j,ac_sub),l,10e-5); +m_boundfix(v35_other,(j,ac_sub),l,1e-10); * Other land conservation * protection bound fix -pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_other(j,ac_sub)); +pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 1e-10) = sum(ac_sub, pc35_other(j,ac_sub)); * set restoration target p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); * Do not restore other land in areas where total natural From 41d1debc165b39a80f732ce258e210df28fbc9b0 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 24 Apr 2024 10:05:23 +0200 Subject: [PATCH 043/280] test different boundfix values --- core/macros.gms | 2 +- modules/10_land/landmatrix_dec18/presolve.gms | 2 +- modules/29_cropland/detail_apr24/presolve.gms | 4 ++-- modules/32_forestry/dynamic_feb21/presolve.gms | 2 +- modules/35_natveg/dynamic_feb21/presolve.gms | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/macros.gms b/core/macros.gms index 2fb013af99..70830f9d68 100644 --- a/core/macros.gms +++ b/core/macros.gms @@ -9,7 +9,7 @@ * Macro for fixing a variable in the case that lower and upper bound are too * close to each other (closer than argument "sens") -* EXAMPLE: ma_boundfix(vm_land,(j,"ifft"),up,10e-5); +* EXAMPLE: ma_boundfix(vm_land,(j,"ifft"),up,1e-6); $macro m_boundfix(x,arg,sufx,sens) x.fx arg$(x.up arg-x.lo arg0) + 0$(sum(s,w)<=0); diff --git a/modules/10_land/landmatrix_dec18/presolve.gms b/modules/10_land/landmatrix_dec18/presolve.gms index d3628c565a..5a79286fe5 100644 --- a/modules/10_land/landmatrix_dec18/presolve.gms +++ b/modules/10_land/landmatrix_dec18/presolve.gms @@ -22,4 +22,4 @@ vm_lu_transitions.up(j,"primforest","primforest") = Inf; *' @stop -m_boundfix(vm_land,(j,land),up,1e-10); +m_boundfix(vm_land,(j,land),up,1e-6); diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index 3d1b53e322..54fe3c9120 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -57,7 +57,7 @@ v29_treecover.lo(j,ac_est) = 0; v29_treecover.up(j,ac_est) = Inf; v29_treecover.lo(j,ac_sub) = 0; v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); -m_boundfix(v29_treecover,(j,ac_sub),l,1e-10); +m_boundfix(v29_treecover,(j,ac_sub),l,1e-6); if (m_year(t) <= s29_treecover_scenario_start, i29_treecover_penalty(t) = 0; @@ -90,4 +90,4 @@ else vm_fallow.lo(j) = 0; vm_fallow.up(j) = p29_avl_cropland(t,j); -m_boundfix(vm_fallow,(j),l,1e-10); +m_boundfix(vm_fallow,(j),l,1e-6); diff --git a/modules/32_forestry/dynamic_feb21/presolve.gms b/modules/32_forestry/dynamic_feb21/presolve.gms index 7f2659735f..b36dda9d4e 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_feb21/presolve.gms @@ -153,7 +153,7 @@ else *' No afforestation is allowed if carbon density <= 20 tc/ha v32_land.fx(j,"aff",ac_est)$(fm_carbon_density(t,j,"forestry","vegc") <= 20) = 0; -m_boundfix(v32_land,(j,type32,ac_sub),up,1e-10); +m_boundfix(v32_land,(j,type32,ac_sub),up,1e-6); ** Calculate future yield based on rotation length if((ord(t)=1), diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/dynamic_feb21/presolve.gms index 6bff1937f4..9e757cbe3b 100644 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ b/modules/35_natveg/dynamic_feb21/presolve.gms @@ -125,7 +125,7 @@ v35_secdforest.lo(j,ac_sub) = max((1-s35_natveg_harvest_shr) * pc35_secdforest(j ); * upper bound v35_secdforest.up(j,ac_sub) = pc35_secdforest(j,ac_sub); -m_boundfix(v35_secdforest,(j,ac_sub),l,1e-10); +m_boundfix(v35_secdforest,(j,ac_sub),l,1e-6); * Secondary forest conservation * protection bound fix @@ -145,7 +145,7 @@ v35_other.lo(j,ac) = 0; v35_other.up(j,ac) = Inf; *set upper bound v35_other.up(j,ac_sub) = pc35_other(j,ac_sub); -m_boundfix(v35_other,(j,ac_sub),l,1e-10); +m_boundfix(v35_other,(j,ac_sub),l,1e-6); * Other land conservation * protection bound fix From a1791296fdb1764e0d47790bac4a5990211e3723 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 24 Apr 2024 12:28:54 +0200 Subject: [PATCH 044/280] revert q29_avl_cropland --- config/default.cfg | 3 --- modules/29_cropland/detail_apr24/declarations.gms | 2 -- modules/29_cropland/detail_apr24/equations.gms | 3 +-- modules/29_cropland/detail_apr24/input.gms | 1 - modules/29_cropland/detail_apr24/postsolve.gms | 4 ---- 5 files changed, 1 insertion(+), 12 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index c4c5d26b83..80c48514fb 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -717,9 +717,6 @@ cfg$gms$policy_countries29 <- all_iso_countries # * "secdforest, past, other" etc. cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other" -# * Penalty for transgression of available cropland (USD05MER per ha) -cfg$gms$s29_avl_crop_exceed_penalty <- 1e+06 - # * Minimum cluster share of treecover on total cropland area (including croparea, fallow land and tree cover). # * s29_treecover_target is faded in linearly between s29_treecover_scenario_start and s29_treecover_scenario_target. cfg$gms$s29_treecover_target <- 0 # def = 0 diff --git a/modules/29_cropland/detail_apr24/declarations.gms b/modules/29_cropland/detail_apr24/declarations.gms index bd0b1fd36d..386fb8b999 100644 --- a/modules/29_cropland/detail_apr24/declarations.gms +++ b/modules/29_cropland/detail_apr24/declarations.gms @@ -36,7 +36,6 @@ parameters positive variables vm_cost_cropland(j) Cost for total cropland (mio. USD05MER per yr) - v29_avl_crop_exceed(j) Transgression of availabe cropland land (mio. ha) v29_treecover(j,ac) Cropland tree cover per age class (mio. ha) v29_treecover_missing(j) Missing treecover area towards target (mio. ha) v29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) @@ -66,7 +65,6 @@ equations *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov_cost_cropland(t,j,type) Cost for total cropland (mio. USD05MER per yr) - ov29_avl_crop_exceed(t,j,type) Transgression of availabe cropland land (mio. ha) ov29_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) ov29_treecover_missing(t,j,type) Missing treecover area towards target (mio. ha) ov29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) diff --git a/modules/29_cropland/detail_apr24/equations.gms b/modules/29_cropland/detail_apr24/equations.gms index 88000e5bc8..e95aa9a0b4 100644 --- a/modules/29_cropland/detail_apr24/equations.gms +++ b/modules/29_cropland/detail_apr24/equations.gms @@ -20,7 +20,7 @@ *' in order to increase compositional heterogeneity of land types at the cell level. q29_avl_cropland(j2) .. - v29_avl_crop_exceed(j2) =g= vm_land(j2,"crop") - sum(ct, p29_avl_cropland(ct,j2)); + vm_land(j2,"crop") =l= sum(ct, p29_avl_cropland(ct,j2)); *' Total cost for the cropland module. @@ -28,7 +28,6 @@ q29_cost_cropland(j2) .. vm_cost_cropland(j2) =e= v29_cost_treecover_est(j2) + v29_cost_treecover_recur(j2) - + v29_avl_crop_exceed(j2) * s29_avl_crop_exceed_penalty + v29_fallow_missing(j2) * sum(ct, i29_fallow_penalty(ct)) + v29_treecover_missing(j2) * sum(ct, i29_treecover_penalty(ct)); diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms index 52f04d2061..af51a029e4 100644 --- a/modules/29_cropland/detail_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -17,7 +17,6 @@ scalars s29_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / s29_cost_treecover_est Tree cover establishment cost (USD05MER per ha) / 2000 / s29_cost_treecover_recur Tree cover recurring cost (USD05MER per ha) / 500 / - s29_avl_crop_exceed_penalty Penalty for transgression of available cropland (USD05MER per ha) / 1e+06 / s29_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 / s29_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / s29_treecover_scenario_start Cropland treecover scenario start year / 2020 / diff --git a/modules/29_cropland/detail_apr24/postsolve.gms b/modules/29_cropland/detail_apr24/postsolve.gms index 79aab84004..1f6b4d64e6 100644 --- a/modules/29_cropland/detail_apr24/postsolve.gms +++ b/modules/29_cropland/detail_apr24/postsolve.gms @@ -9,7 +9,6 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_cost_cropland(t,j,"marginal") = vm_cost_cropland.m(j); - ov29_avl_crop_exceed(t,j,"marginal") = v29_avl_crop_exceed.m(j); ov29_treecover(t,j,ac,"marginal") = v29_treecover.m(j,ac); ov29_treecover_missing(t,j,"marginal") = v29_treecover_missing.m(j); ov29_cost_treecover_est(t,j,"marginal") = v29_cost_treecover_est.m(j); @@ -32,7 +31,6 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_cost_treecover_recur(t,j,"marginal") = q29_cost_treecover_recur.m(j); oq29_treecover_est(t,j,ac,"marginal") = q29_treecover_est.m(j,ac); ov_cost_cropland(t,j,"level") = vm_cost_cropland.l(j); - ov29_avl_crop_exceed(t,j,"level") = v29_avl_crop_exceed.l(j); ov29_treecover(t,j,ac,"level") = v29_treecover.l(j,ac); ov29_treecover_missing(t,j,"level") = v29_treecover_missing.l(j); ov29_cost_treecover_est(t,j,"level") = v29_cost_treecover_est.l(j); @@ -55,7 +53,6 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_cost_treecover_recur(t,j,"level") = q29_cost_treecover_recur.l(j); oq29_treecover_est(t,j,ac,"level") = q29_treecover_est.l(j,ac); ov_cost_cropland(t,j,"upper") = vm_cost_cropland.up(j); - ov29_avl_crop_exceed(t,j,"upper") = v29_avl_crop_exceed.up(j); ov29_treecover(t,j,ac,"upper") = v29_treecover.up(j,ac); ov29_treecover_missing(t,j,"upper") = v29_treecover_missing.up(j); ov29_cost_treecover_est(t,j,"upper") = v29_cost_treecover_est.up(j); @@ -78,7 +75,6 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_cost_treecover_recur(t,j,"upper") = q29_cost_treecover_recur.up(j); oq29_treecover_est(t,j,ac,"upper") = q29_treecover_est.up(j,ac); ov_cost_cropland(t,j,"lower") = vm_cost_cropland.lo(j); - ov29_avl_crop_exceed(t,j,"lower") = v29_avl_crop_exceed.lo(j); ov29_treecover(t,j,ac,"lower") = v29_treecover.lo(j,ac); ov29_treecover_missing(t,j,"lower") = v29_treecover_missing.lo(j); ov29_cost_treecover_est(t,j,"lower") = v29_cost_treecover_est.lo(j); From 9d3b74a470f4e422cc82434dd7b53b0c1f8fda52 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 24 Apr 2024 12:40:43 +0200 Subject: [PATCH 045/280] additional test runs --- scripts/start/test_runs.R | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/start/test_runs.R b/scripts/start/test_runs.R index 64b65bdfc9..8118f9b927 100644 --- a/scripts/start/test_runs.R +++ b/scripts/start/test_runs.R @@ -79,6 +79,16 @@ cfg <- fsecScenario(scenario = "c_BAU") cfg$results_folder_highres <- "output" start_run(cfg = cfg, codeCheck = codeCheck) +### NatureSparing +cfg <- fsecScenario(scenario = "b_NatureSparing") +cfg$results_folder_highres <- "output" +start_run(cfg = cfg, codeCheck = codeCheck) + +### LandscapeElements +cfg <- fsecScenario(scenario = "a_LandscapeElements") +cfg$results_folder_highres <- "output" +start_run(cfg = cfg, codeCheck = codeCheck) + ### FSDP Scenario cfg <- fsecScenario(scenario = "e_FSDP") cfg$results_folder_highres <- "output" From 960767e3b57703d1f3888e31d718c5c745a4d480 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 24 Apr 2024 17:32:49 +0200 Subject: [PATCH 046/280] scaling for age-class variables --- modules/29_cropland/detail_apr24/realization.gms | 1 + modules/29_cropland/detail_apr24/scaling.gms | 8 ++++++++ modules/32_forestry/dynamic_feb21/scaling.gms | 1 + modules/35_natveg/dynamic_feb21/scaling.gms | 2 ++ 4 files changed, 12 insertions(+) create mode 100644 modules/29_cropland/detail_apr24/scaling.gms diff --git a/modules/29_cropland/detail_apr24/realization.gms b/modules/29_cropland/detail_apr24/realization.gms index 071000bd1e..c9b62fec84 100644 --- a/modules/29_cropland/detail_apr24/realization.gms +++ b/modules/29_cropland/detail_apr24/realization.gms @@ -25,6 +25,7 @@ $Ifi "%phase%" == "sets" $include "./modules/29_cropland/detail_apr24/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/29_cropland/detail_apr24/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/29_cropland/detail_apr24/input.gms" $Ifi "%phase%" == "equations" $include "./modules/29_cropland/detail_apr24/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/29_cropland/detail_apr24/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/29_cropland/detail_apr24/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/29_cropland/detail_apr24/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/29_cropland/detail_apr24/postsolve.gms" diff --git a/modules/29_cropland/detail_apr24/scaling.gms b/modules/29_cropland/detail_apr24/scaling.gms new file mode 100644 index 0000000000..d92955e666 --- /dev/null +++ b/modules/29_cropland/detail_apr24/scaling.gms @@ -0,0 +1,8 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +v29_treecover.scale(j,ac) = 1e6; diff --git a/modules/32_forestry/dynamic_feb21/scaling.gms b/modules/32_forestry/dynamic_feb21/scaling.gms index 284349ec52..4cc23a7c4d 100644 --- a/modules/32_forestry/dynamic_feb21/scaling.gms +++ b/modules/32_forestry/dynamic_feb21/scaling.gms @@ -10,3 +10,4 @@ v32_cost_recur.scale(i) = 10e4; vm_cost_fore.scale(i) = 10e4; v32_cost_hvarea.scale(i)$(s32_hvarea = 1 OR s32_hvarea = 2) = 10e3; vm_cdr_aff.scale(j,ac,aff_effect) = 10e-4; +v32_land.scale(j,type32,ac) = 1e6; diff --git a/modules/35_natveg/dynamic_feb21/scaling.gms b/modules/35_natveg/dynamic_feb21/scaling.gms index c4a52d9d82..1971d125a5 100644 --- a/modules/35_natveg/dynamic_feb21/scaling.gms +++ b/modules/35_natveg/dynamic_feb21/scaling.gms @@ -6,3 +6,5 @@ *** | Contact: magpie@pik-potsdam.de vm_cost_hvarea_natveg.scale(i)$(s35_hvarea = 1 OR s35_hvarea = 2) = 10e4; +v35_other.scale(j,ac) = 1e6; +v35_secdforest.scale(j,ac) = 1e6; From 5b89eeea829069d9645f025e6675be57a75f7f73 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 24 Apr 2024 21:51:36 +0200 Subject: [PATCH 047/280] scaling for age-class variables --- modules/29_cropland/detail_apr24/scaling.gms | 2 +- modules/32_forestry/dynamic_feb21/scaling.gms | 2 +- modules/35_natveg/dynamic_feb21/scaling.gms | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/29_cropland/detail_apr24/scaling.gms b/modules/29_cropland/detail_apr24/scaling.gms index d92955e666..ce898e661a 100644 --- a/modules/29_cropland/detail_apr24/scaling.gms +++ b/modules/29_cropland/detail_apr24/scaling.gms @@ -5,4 +5,4 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -v29_treecover.scale(j,ac) = 1e6; +v29_treecover.scale(j,ac) = 1e-6; diff --git a/modules/32_forestry/dynamic_feb21/scaling.gms b/modules/32_forestry/dynamic_feb21/scaling.gms index 4cc23a7c4d..ba76c8104b 100644 --- a/modules/32_forestry/dynamic_feb21/scaling.gms +++ b/modules/32_forestry/dynamic_feb21/scaling.gms @@ -10,4 +10,4 @@ v32_cost_recur.scale(i) = 10e4; vm_cost_fore.scale(i) = 10e4; v32_cost_hvarea.scale(i)$(s32_hvarea = 1 OR s32_hvarea = 2) = 10e3; vm_cdr_aff.scale(j,ac,aff_effect) = 10e-4; -v32_land.scale(j,type32,ac) = 1e6; +v32_land.scale(j,type32,ac) = 1e-6; diff --git a/modules/35_natveg/dynamic_feb21/scaling.gms b/modules/35_natveg/dynamic_feb21/scaling.gms index 1971d125a5..a79952fc6f 100644 --- a/modules/35_natveg/dynamic_feb21/scaling.gms +++ b/modules/35_natveg/dynamic_feb21/scaling.gms @@ -6,5 +6,5 @@ *** | Contact: magpie@pik-potsdam.de vm_cost_hvarea_natveg.scale(i)$(s35_hvarea = 1 OR s35_hvarea = 2) = 10e4; -v35_other.scale(j,ac) = 1e6; -v35_secdforest.scale(j,ac) = 1e6; +v35_other.scale(j,ac) = 1e-6; +v35_secdforest.scale(j,ac) = 1e-6; From 0bdde4ded9900889936bc2a7d816932497aaa2bc Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 25 Apr 2024 06:26:20 +0200 Subject: [PATCH 048/280] bugfixes --- modules/29_cropland/detail_apr24/equations.gms | 4 ++-- modules/30_croparea/detail_apr24/equations.gms | 2 +- modules/30_croparea/simple_apr24/equations.gms | 2 +- modules/30_croparea/simple_apr24/presolve.gms | 14 +++++++++++++- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/modules/29_cropland/detail_apr24/equations.gms b/modules/29_cropland/detail_apr24/equations.gms index e95aa9a0b4..6767a341d5 100644 --- a/modules/29_cropland/detail_apr24/equations.gms +++ b/modules/29_cropland/detail_apr24/equations.gms @@ -63,7 +63,7 @@ *' The penalty applies to the missing fallow land, i.e. where fallow land *' is lower than a certain fraction of total cropland. - q29_fallow_min(j2) .. + q29_fallow_min(j2)$(sum(ct, i29_fallow_penalty(ct)) > 0) .. v29_fallow_missing(j2) =g= vm_land(j2,"crop") * sum(ct, i29_fallow_target(ct)) - vm_fallow(j2); @@ -82,7 +82,7 @@ *' The penalty applies to the missing treecover area, i.e. where treecover area *' is lower than a certain fraction of total cropland. - q29_treecover_min(j2) .. + q29_treecover_min(j2)$(sum(ct, i29_treecover_penalty(ct)) > 0) .. v29_treecover_missing(j2) =g= vm_land(j2,"crop") * sum(ct, i29_treecover_target(ct,j2)) - sum(ac, v29_treecover(j2,ac)); diff --git a/modules/30_croparea/detail_apr24/equations.gms b/modules/30_croparea/detail_apr24/equations.gms index 7629f075ca..2ddbbc8409 100644 --- a/modules/30_croparea/detail_apr24/equations.gms +++ b/modules/30_croparea/detail_apr24/equations.gms @@ -18,7 +18,7 @@ *' The penalty applies to the missing bioenergy tree land, i.e. where bioenergy tree land *' is lower than a certain fraction of total cropland. - q30_betr_missing(j2) .. + q30_betr_missing(j2)$(sum(ct, i30_betr_penalty(ct)) > 0) .. v30_betr_missing(j2) =g= vm_land(j2,"crop") * sum(ct, i30_betr_target(ct)) - vm_area(j2,"betr","rainfed"); diff --git a/modules/30_croparea/simple_apr24/equations.gms b/modules/30_croparea/simple_apr24/equations.gms index 1e872f1606..dca6bc7c08 100644 --- a/modules/30_croparea/simple_apr24/equations.gms +++ b/modules/30_croparea/simple_apr24/equations.gms @@ -18,7 +18,7 @@ *' The penalty applies to the missing bioenergy tree land, i.e. where bioenergy tree land *' is lower than a certain fraction of total cropland. - q30_betr_missing(j2) .. + q30_betr_missing(j2)$(sum(ct, i30_betr_penalty(ct)) > 0) .. v30_betr_missing(j2) =g= vm_land(j2,"crop") * sum(ct, i30_betr_target(ct)) - vm_area(j2,"betr","rainfed"); diff --git a/modules/30_croparea/simple_apr24/presolve.gms b/modules/30_croparea/simple_apr24/presolve.gms index 5dee653207..f91d1a0cf1 100644 --- a/modules/30_croparea/simple_apr24/presolve.gms +++ b/modules/30_croparea/simple_apr24/presolve.gms @@ -28,4 +28,16 @@ crpmin30(crp30) = yes$(f30_rotation_min_shr(crp30) > 0); * create betr target and penalty scenario i30_betr_target(t) = s30_betr_target * i30_betr_scenario_fader(t); -i30_betr_penalty(t) = s30_betr_penalty * i30_betr_scenario_fader(t); + +if (m_year(t) <= s30_betr_scenario_start, + i30_betr_penalty(t) = 0; + v30_betr_missing.fx(j) = 0; +else + i30_betr_penalty(t) = s30_betr_penalty; + if (i30_betr_penalty(t) > 0, + v30_betr_missing.lo(j) = 0; + v30_betr_missing.up(j) = Inf; + else + v30_betr_missing.fx(j) = 0; + ); +); From 37a8b370b9e4c31cca11fdcf93f5aff914b4bae4 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 25 Apr 2024 11:34:05 +0200 Subject: [PATCH 049/280] bugfixes --- modules/30_croparea/detail_apr24/presolve.gms | 9 +++++++-- modules/30_croparea/simple_apr24/presolve.gms | 3 --- modules/58_peatland/v2/scaling.gms | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/30_croparea/detail_apr24/presolve.gms b/modules/30_croparea/detail_apr24/presolve.gms index 907dd57aaa..4a028ffad2 100644 --- a/modules/30_croparea/detail_apr24/presolve.gms +++ b/modules/30_croparea/detail_apr24/presolve.gms @@ -22,8 +22,13 @@ else *' @stop * only activate constraints which are binding -rotamax_red30(rotamax30) = yes$(i30_rotation_rules(t,rotamax30) < 1); -rotamin_red30(rotamin30) = yes$(i30_rotation_rules(t,rotamin30) > 0); +if (i30_implementation = 1, + rotamax_red30(rotamax30) = yes$(i30_rotation_rules(t,rotamax30) < 1); + rotamin_red30(rotamin30) = yes$(i30_rotation_rules(t,rotamin30) > 0); +else + rotamax_red30(rotamax30) = yes$(i30_rotation_incentives(t,rotamax30) > 0); + rotamin_red30(rotamin30) = yes$(i30_rotation_incentives(t,rotamin30) > 0); +); * create betr target and penalty scenario i30_betr_target(t) = s30_betr_target * i30_betr_scenario_fader(t); diff --git a/modules/30_croparea/simple_apr24/presolve.gms b/modules/30_croparea/simple_apr24/presolve.gms index f91d1a0cf1..fb57b1d9f4 100644 --- a/modules/30_croparea/simple_apr24/presolve.gms +++ b/modules/30_croparea/simple_apr24/presolve.gms @@ -20,9 +20,6 @@ else *' @stop -*' No penalties exist in this realization -vm_rotation_penalty.fx(i)=0; - crpmax30(crp30) = yes$(f30_rotation_max_shr(crp30) < 1); crpmin30(crp30) = yes$(f30_rotation_min_shr(crp30) > 0); diff --git a/modules/58_peatland/v2/scaling.gms b/modules/58_peatland/v2/scaling.gms index 3acae9e9b6..787936e8ca 100644 --- a/modules/58_peatland/v2/scaling.gms +++ b/modules/58_peatland/v2/scaling.gms @@ -6,3 +6,4 @@ *** | Contact: magpie@pik-potsdam.de v58_peatlandChange.scale(j,land58) = 10e-3; +v58_peatland.scale(j,land58) = 10e-3; From fe498810470bbd82ae2a87b71d7cdb3db69ac997 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Thu, 25 Apr 2024 12:04:54 +0200 Subject: [PATCH 050/280] updated (non-default) AEI data (from Mehta2022 to Mehta2024) --- CHANGELOG.md | 2 +- config/default.cfg | 9 ++--- literature.bib | 35 ++++++++++++++++++- .../endo_apr13/realization.gms | 5 +-- .../endo_apr13/sets.gms | 2 +- .../static/realization.gms | 2 +- .../static/sets.gms | 2 +- .../agr_sector_aug13/realization.gms | 1 + 8 files changed, 47 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e79c68937e..fec09f1e45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### changed -- +- **41_area_equipped_for_irrigation** updated (non-default) AEI data (from Mehta2022 to Mehta2024) ### added - diff --git a/config/default.cfg b/config/default.cfg index 8cb29833e9..da7c361c64 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -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.104_h12_magpie.tgz", - cellular = "rev4.104_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.104_h12_validation.tgz", +cfg$input <- c(regional = "rev4.107_h12_magpie.tgz", + cellular = "rev4.107_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.107_h12_validation.tgz", additional = "additional_data_rev4.48.tgz", calibration = "calibration_H12_26Mar24.tgz") @@ -1081,7 +1081,8 @@ cfg$gms$area_equipped_for_irrigation <- "endo_apr13" # def = endo_apr13 # * switch for initialization area # * (LUH2v2): area equipped for irrigation based on LUH2v2 irrigated areas -# * (Mehta2022): area equipped for irrigation from Mehta et al. (2022) +# * (Mehta2024_Siebert2013): area equipped for irrigation from Mehta et al. (2024) using GMIA (Siebert et al, 2013) base map +# * (Mehta2024_Meier2018): are equipped for irrigation from Mehta et al. (2024) using Meier et al. (2018) base map cfg$gms$c41_initial_irrigation_area <- "LUH2v2" # def = LUH2v2 # * Sets the rate of depreciation of irrigation infrastructure in every timestep. diff --git a/literature.bib b/literature.bib index d4ee7ea751..7f64577c5a 100644 --- a/literature.bib +++ b/literature.bib @@ -1023,6 +1023,39 @@ @article{siebert_FAO_2007 year = {2007}, } +@article{siebert_FAO_2007, + author = {Stefan Siebert and Petra Döll and Sebastian Feick and Jippe Hoogeveen and Karen Frenken}, + year = {2007}, + title = {Global Map of Irrigation Areas version 4.0.1.}, + journal = {Johann Wolfgang Goethe University, Frankfurt am Main, Germany / Food and Agriculture Organization of the United Nations, Rome, Italy.}, + url = {http://www.fao.org/nr/water/aquastat/irrigationmap/index10.stm}, +} + +@article{siebert_FAO_2013, + author = {Stefan Siebert, Verena Henrich, Karen Frenken and Jacob Burk}, + year = {2013}, + title = {Global Map of Irrigation Areas version 5}, + journal = {Rheinische Friedrich-Wilhelms-University, Bonn, Germany / Food and Agriculture Organization of the United Nations, Rome, Italy}, + url = {https://data.apps.fao.org/catalog/iso/f79213a0-88fd-11da-a88f-000d939bc5d8}, +} + +@article{meier_global_2018, + author = {Meier, Jonas; Zabel, Florian; Mauser, Wolfram}, + year = {2018}, + title = {Global Irrigated Areas dataset}, + journal = {PANGAEA}, + doi = {https://doi.org/10.1594/PANGAEA.884744}, + url = {https://doi.pangaea.de/10.1594/PANGAEA.884744}, +} + +@article{mehta_half_2024, + author = {Mehta, P., Siebert, S., Kummu, M. et al.}, + year = {2024}, + title = {Half of twenty-first century global irrigation expansion has been in water-stressed regions}, + journal = {Nature Water}, + doi = {https://doi.org/10.1038/s44221-024-00206-9}, +} + @book{fao_aquastat_2016, address = {Rome}, title = {{AQUASTAT} core database}, @@ -1030,7 +1063,7 @@ @book{fao_aquastat_2016 author = {{FAO}}, url = {{https://data.harvestportal.org/de/dataset/fao-aquastat/resource/c4668555-eb76-4882-83b1-230038e24f02?inner_span=True}}, year = {2016}, - note = {Database accessed on 2023/02/06} + note = {Database accessed on 2023/02/06}, } @techreport{worldbank_irrigation_1995, diff --git a/modules/41_area_equipped_for_irrigation/endo_apr13/realization.gms b/modules/41_area_equipped_for_irrigation/endo_apr13/realization.gms index 9208456cb5..07fb647508 100644 --- a/modules/41_area_equipped_for_irrigation/endo_apr13/realization.gms +++ b/modules/41_area_equipped_for_irrigation/endo_apr13/realization.gms @@ -7,8 +7,9 @@ *' @description This realization allows the model to endogenously decide on investments to deploy additional -*' irrigation infrastructure, i.e. to increase the area equipped for irrigation (AEI). Initial values for AEI -*' in 1995 are taken from @siebert_FAO_2007. Contraction of AEI is not possible. +*' irrigation infrastructure, i.e. to increase the area equipped for irrigation (AEI). +*' Initial values for AEI are areas that are irrigated in the initial time step in LUH2v2. +*' Contraction of AEI is not possible. *' Irrigated crop production can only take place where irrigation infrastructure is present. *' *' Unit costs per hectare for AEI expansion are derived from a World Bank study (@worldbank_irrigation_1995) diff --git a/modules/41_area_equipped_for_irrigation/endo_apr13/sets.gms b/modules/41_area_equipped_for_irrigation/endo_apr13/sets.gms index 6f0264ed1b..3ffe557c32 100644 --- a/modules/41_area_equipped_for_irrigation/endo_apr13/sets.gms +++ b/modules/41_area_equipped_for_irrigation/endo_apr13/sets.gms @@ -10,5 +10,5 @@ sets / y1995, y2000, y2005, y2010, y2015 / aei41 Data source for area equipped for irrigation - / LUH2v2, Mehta2022 / + / LUH2v2, Mehta2024_Siebert2013, Mehta2024_Meier2018 / ; diff --git a/modules/41_area_equipped_for_irrigation/static/realization.gms b/modules/41_area_equipped_for_irrigation/static/realization.gms index a838b9fc32..5a50115a9c 100644 --- a/modules/41_area_equipped_for_irrigation/static/realization.gms +++ b/modules/41_area_equipped_for_irrigation/static/realization.gms @@ -7,7 +7,7 @@ *' In this realization, area equipped for irrigation is fixed to input data (around the year 2000) -*' for all time steps. The source of the input data is @siebert_FAO_2007. +*' for all time steps. The sources of the input data are @siebert_FAO_2013 and @mehta_half_2024. *' *' @limitations No irrigation is possible on areas that have not been equipped for irrigation in the past. *' diff --git a/modules/41_area_equipped_for_irrigation/static/sets.gms b/modules/41_area_equipped_for_irrigation/static/sets.gms index 6f0264ed1b..3ffe557c32 100644 --- a/modules/41_area_equipped_for_irrigation/static/sets.gms +++ b/modules/41_area_equipped_for_irrigation/static/sets.gms @@ -10,5 +10,5 @@ sets / y1995, y2000, y2005, y2010, y2015 / aei41 Data source for area equipped for irrigation - / LUH2v2, Mehta2022 / + / LUH2v2, Mehta2024_Siebert2013, Mehta2024_Meier2018 / ; diff --git a/modules/42_water_demand/agr_sector_aug13/realization.gms b/modules/42_water_demand/agr_sector_aug13/realization.gms index 4682d1fc6b..06cafc3fbc 100644 --- a/modules/42_water_demand/agr_sector_aug13/realization.gms +++ b/modules/42_water_demand/agr_sector_aug13/realization.gms @@ -33,6 +33,7 @@ *' efficiency times management factor") from @PIK_report104_2007. *' Here, irrigated area from @siebert_FAO_2007 has been used as aggregation *' weight. +*' Contraction of AEI happens if a depreciation rate is set in the switch `s41_AEI_depreciation`. *' *' * A regression of country values of the "conveyance efficiency times *' management factor" from @PIK_report104_2007 on GDP. From dd0cc6836a5f860ff8c8de255f081d60805f63e3 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 25 Apr 2024 16:47:24 +0200 Subject: [PATCH 051/280] new forest recovery based on potential forest area --- core/sets.gms | 7 +- .../managementcalib_aug19/declarations.gms | 8 +- .../14_yields/managementcalib_aug19/input.gms | 2 +- .../area_based_apr22/presolve.gms | 4 +- .../35_natveg/dynamic_may24/declarations.gms | 129 +++++++++++ modules/35_natveg/dynamic_may24/equations.gms | 209 ++++++++++++++++++ modules/35_natveg/dynamic_may24/input.gms | 63 ++++++ modules/35_natveg/dynamic_may24/postsolve.gms | 179 +++++++++++++++ modules/35_natveg/dynamic_may24/preloop.gms | 65 ++++++ modules/35_natveg/dynamic_may24/presolve.gms | 185 ++++++++++++++++ .../35_natveg/dynamic_may24/realization.gms | 44 ++++ modules/35_natveg/dynamic_may24/scaling.gms | 8 + modules/35_natveg/dynamic_may24/sets.gms | 28 +++ modules/35_natveg/module.gms | 1 + 14 files changed, 923 insertions(+), 9 deletions(-) create mode 100644 modules/35_natveg/dynamic_may24/declarations.gms create mode 100644 modules/35_natveg/dynamic_may24/equations.gms create mode 100644 modules/35_natveg/dynamic_may24/input.gms create mode 100644 modules/35_natveg/dynamic_may24/postsolve.gms create mode 100644 modules/35_natveg/dynamic_may24/preloop.gms create mode 100644 modules/35_natveg/dynamic_may24/presolve.gms create mode 100644 modules/35_natveg/dynamic_may24/realization.gms create mode 100644 modules/35_natveg/dynamic_may24/scaling.gms create mode 100644 modules/35_natveg/dynamic_may24/sets.gms diff --git a/core/sets.gms b/core/sets.gms index f142e5c0eb..e506848e8b 100644 --- a/core/sets.gms +++ b/core/sets.gms @@ -247,10 +247,13 @@ sets land_ag(land) Agricultural land pools / crop, past / - forest_land(land) land from which timber can be taken away + land_timber(land) land from which timber can be taken away / forestry, primforest, secdforest,other / - land_natveg(forest_land) Natural vegetation land pools + land_forest(land) Forested land pools + / forestry, primforest, secdforest / + + land_natveg(land_timber) Natural vegetation land pools / primforest, secdforest, other / forest_type forest type diff --git a/modules/14_yields/managementcalib_aug19/declarations.gms b/modules/14_yields/managementcalib_aug19/declarations.gms index 68eaecbcaf..75fde4f8a9 100644 --- a/modules/14_yields/managementcalib_aug19/declarations.gms +++ b/modules/14_yields/managementcalib_aug19/declarations.gms @@ -14,10 +14,10 @@ parameters i14_fao_yields_hist(t,i,kcr) FAO yields per region at the historical referende year (tDM per ha per yr) i14_lambda_yields(t,i,kcr) Scaling factor for non-linear management calibration (1) i14_managementcalib(t,j,kcr,w) Regional management calibration factor accounting for FAO yield levels (1) - p14_growing_stock(t,j,ac,forest_land,forest_type) Forest growing stock (tDM per ha per yr) - pm_timber_yield(t,j,ac,forest_land) Forest growing stock (tDM per ha per yr) - p14_growing_stock_initial(j,ac,forest_land,forest_type) Initial Forest growing stock (tDM per ha per yr) - pm_timber_yield_initial(j,ac,forest_land) Initial Forest yield (tDM per ha per yr) + p14_growing_stock(t,j,ac,land_timber,forest_type) Forest growing stock (tDM per ha per yr) + pm_timber_yield(t,j,ac,land_timber) Forest growing stock (tDM per ha per yr) + p14_growing_stock_initial(j,ac,land_timber,forest_type) Initial Forest growing stock (tDM per ha per yr) + pm_timber_yield_initial(j,ac,land_timber) Initial Forest yield (tDM per ha per yr) pm_yields_semi_calib(j,kve,w) Potential yields calibrated to FAO regional levels (tDM per ha per yr) i14_calib_yields_hist(i,w) Calibrated yields average over region and crop type at the historical reference year (tDM per ha per yr) i14_calib_yields_ratio(i) Irrigated to rainfed yield ratio for calibrated yields (1) diff --git a/modules/14_yields/managementcalib_aug19/input.gms b/modules/14_yields/managementcalib_aug19/input.gms index 4677381139..4cf1313223 100644 --- a/modules/14_yields/managementcalib_aug19/input.gms +++ b/modules/14_yields/managementcalib_aug19/input.gms @@ -77,7 +77,7 @@ $include "./modules/14_yields/input/f14_ipcc_bce.cs3" $offdelim ; -parameter f14_aboveground_fraction(forest_land) Root to shoot ratio (1) +parameter f14_aboveground_fraction(land_timber) Root to shoot ratio (1) / $ondelim $include "./modules/14_yields/input/f14_aboveground_fraction.csv" diff --git a/modules/22_land_conservation/area_based_apr22/presolve.gms b/modules/22_land_conservation/area_based_apr22/presolve.gms index 1ff0c39820..9debb3b725 100644 --- a/modules/22_land_conservation/area_based_apr22/presolve.gms +++ b/modules/22_land_conservation/area_based_apr22/presolve.gms @@ -88,7 +88,7 @@ pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secd * Grassland restoration is limited by grassland restoration potential p22_past_restore_pot(t,j) = sum(land, pcm_land(j, land)) - pcm_land(j, "urban") - - sum(forest_land, pcm_land(j, forest_land)) + - sum(land_timber, pcm_land(j, land_timber)) - pm_land_conservation(t,j,"past","protect") - pm_land_conservation(t,j,"secdforest","restore"); p22_past_restore_pot(t,j)$(p22_past_restore_pot(t,j) < 0) = 0; @@ -97,7 +97,7 @@ pm_land_conservation(t,j,"past","restore")$(pm_land_conservation(t,j,"past","res * Other land restoration is limited by other land restoration potential p22_other_restore_pot(t,j) = sum(land, pcm_land(j, land)) - pcm_land(j, "urban") - - sum(forest_land, pcm_land(j, forest_land)) + - sum(land_timber, pcm_land(j, land_timber)) - sum(consv_type, pm_land_conservation(t,j,"past",consv_type)) - pm_land_conservation(t,j,"secdforest","restore"); p22_other_restore_pot(t,j)$(p22_other_restore_pot(t,j) < 0) = 0; diff --git a/modules/35_natveg/dynamic_may24/declarations.gms b/modules/35_natveg/dynamic_may24/declarations.gms new file mode 100644 index 0000000000..ec3dad2e85 --- /dev/null +++ b/modules/35_natveg/dynamic_may24/declarations.gms @@ -0,0 +1,129 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +scalars + s35_shift number of 5-year age-classes corresponding to current time step length (1) +; + +parameters + i35_secdforest(j,ac) Initial secdforest (mio. ha) + i35_other(j,ac) Initial other land (mio. ha) + p35_secdforest(t,j,ac) Secdforest per age class (mio. ha) + p35_other(t,j,ac) Other land per age class (mio. ha) + pc35_secdforest(j,ac) Secdforest per age class in current time step (mio. ha) + pc35_other(j,ac) Other land per age class in current time step (mio. ha) + p35_min_forest(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) + p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) + p35_damage_fader(t_all) Fader for forest damage (1) + p35_max_forest_recovery(j) Forest recovery potential (mio. ha) + p35_carbon_density_secdforest(t,j,ac,ag_pools) Carbon density secdforest (tC per ha) + p35_carbon_density_other(t,j,ac,ag_pools) Carbon density other land (tC per ha) + p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) + p35_disturbance_loss_primf(t,j) Loss due to disturbances in primary forest (mio. ha) + i35_plantedclass_ac(j,ac) Area of age-classes in secondary forest (1) + p35_poulter_dist(j,ac) Share of age-classes in secondary forest (1) + p35_land(t,j,land_natveg,ac) Natural vegetation area (mio. ha) + p35_updated_gs_natfor(t,i) Updated growing stock in natural forests after calibration (m3 per ha) + p35_land_start_ac(j,ac,land_natveg) Initial Natural vegetation area (mio. ha) + p35_protection_dist(j,ac) Distribution of secondary forest protection (1) + p35_land_restoration(j,land_natveg) Actual secondary forest and other land restoration area (mio. ha) +; + +equations + q35_land_secdforest(j) Secdforest land pool calculation (mio. ha) + q35_land_other(j) Other land pool calculation (mio. ha) + q35_carbon_primforest(j,ag_pools,stockType) Primforest carbon stock calculation (mio tC) + q35_carbon_secdforest(j,ag_pools,stockType) Secdforest carbon stock calculation (mio tC) + q35_carbon_other(j,ag_pools,stockType) Other land carbon stock calculation (mio tC) + q35_min_forest(j) Minimum forest land constraint (mio. ha) + q35_min_other(j) Minimum other land constraint (mio. ha) + q35_landdiff Difference in natveg land (mio. ha) + q35_other_expansion(j) Other land expansion (mio. ha) + q35_other_reduction(j,ac) Other land reduction (mio. ha) + q35_secdforest_expansion(j) Secdforest reduction (mio. ha) + q35_secdforest_reduction(j,ac) Secdforest reduction (mio. ha) + q35_primforest_reduction(j) Primforest reduction (mio. ha) + q35_secdforest_regeneration(j) Secondary forest remains secondary forest (mio. ha) + q35_max_secdforest_regeneration(j) Secondary (mio. ha) + q35_other_regeneration(j) Other land remains other land (mio. ha) + q35_other_est(j,ac) Distribution of other land additions over ac_est (mio. ha) + q35_secdforest_est(j,ac) Distribution of secdforest additions over ac_est (mio. ha) + q35_hvarea_other(j,ac) Harvested area other land (mio. ha) + q35_hvarea_secdforest(j,ac) Harvested area secdforest (mio. ha) + q35_hvarea_primforest(j) Harvested area primforest (mio. ha) + q35_prod_secdforest(j) Production of woody biomass from secondary forests (mio. tDM per yr) + q35_prod_primforest(j) Production of woody biomass from primary forests (mio. tDM per yr) + q35_prod_other(j) Production of woody biomass from other land (mio. tDM per yr) + q35_cost_hvarea(i) Cost of harvesting natural vegetation (mio. USD) + q35_bv_primforest(j,potnatveg) Biodiversity value of primary forest (mio. ha) + q35_bv_secdforest(j,potnatveg) Biodiversity value of secondary forest (mio. ha) + q35_bv_other(j,potnatveg) Biodiversity value of other land (mio. ha) + q35_natveg_conservation(j) Total natural vegetation conservation constraint (mio. ha) +; + +positive variables + v35_secdforest(j,ac) Detailed stock of secdforest (mio. ha) + v35_other(j,ac) Detailed stock of other land (mio. ha) + vm_landdiff_natveg Aggregated difference in natveg land compared to previous timestep (mio. ha) + v35_other_expansion(j) Other land expansion compared to previous timestep (mio. ha) + v35_other_reduction(j,ac) Other land reduction compared to previous timestep (mio. ha) + v35_secdforest_expansion(j) Secdforest reduction compared to previous timestep (mio. ha) + v35_secdforest_reduction(j,ac) Secdforest reduction compared to previous timestep (mio. ha) + v35_primforest_reduction(j) Primforest reduction compared to previous timestep (mio. ha) + v35_hvarea_secdforest(j,ac) Harvested area from secondary forest (mio. ha) + v35_hvarea_other(j,ac) Harvested area from other land (mio. ha) + v35_hvarea_primforest(j) Harvested area from primary forest (mio. ha) + vm_prod_natveg(j,land_natveg,kforestry) Production of woody biomass from natural vegetation (mio. tDM per yr) + vm_cost_hvarea_natveg(i) Cost of harvesting natural vegetation (mio. USD) +; + + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov35_secdforest(t,j,ac,type) Detailed stock of secdforest (mio. ha) + ov35_other(t,j,ac,type) Detailed stock of other land (mio. ha) + ov_landdiff_natveg(t,type) Aggregated difference in natveg land compared to previous timestep (mio. ha) + ov35_other_expansion(t,j,type) Other land expansion compared to previous timestep (mio. ha) + ov35_other_reduction(t,j,ac,type) Other land reduction compared to previous timestep (mio. ha) + ov35_secdforest_expansion(t,j,type) Secdforest reduction compared to previous timestep (mio. ha) + ov35_secdforest_reduction(t,j,ac,type) Secdforest reduction compared to previous timestep (mio. ha) + ov35_primforest_reduction(t,j,type) Primforest reduction compared to previous timestep (mio. ha) + ov35_hvarea_secdforest(t,j,ac,type) Harvested area from secondary forest (mio. ha) + ov35_hvarea_other(t,j,ac,type) Harvested area from other land (mio. ha) + ov35_hvarea_primforest(t,j,type) Harvested area from primary forest (mio. ha) + ov_prod_natveg(t,j,land_natveg,kforestry,type) Production of woody biomass from natural vegetation (mio. tDM per yr) + ov_cost_hvarea_natveg(t,i,type) Cost of harvesting natural vegetation (mio. USD) + oq35_land_secdforest(t,j,type) Secdforest land pool calculation (mio. ha) + oq35_land_other(t,j,type) Other land pool calculation (mio. ha) + oq35_carbon_primforest(t,j,ag_pools,stockType,type) Primforest carbon stock calculation (mio tC) + oq35_carbon_secdforest(t,j,ag_pools,stockType,type) Secdforest carbon stock calculation (mio tC) + oq35_carbon_other(t,j,ag_pools,stockType,type) Other land carbon stock calculation (mio tC) + oq35_min_forest(t,j,type) Minimum forest land constraint (mio. ha) + oq35_min_other(t,j,type) Minimum other land constraint (mio. ha) + oq35_landdiff(t,type) Difference in natveg land (mio. ha) + oq35_other_expansion(t,j,type) Other land expansion (mio. ha) + oq35_other_reduction(t,j,ac,type) Other land reduction (mio. ha) + oq35_secdforest_expansion(t,j,type) Secdforest reduction (mio. ha) + oq35_secdforest_reduction(t,j,ac,type) Secdforest reduction (mio. ha) + oq35_primforest_reduction(t,j,type) Primforest reduction (mio. ha) + oq35_secdforest_regeneration(t,j,type) Secondary forest remains secondary forest (mio. ha) + oq35_other_regeneration(t,j,type) Other land remains other land (mio. ha) + oq35_other_est(t,j,ac,type) Distribution of other land additions over ac_est (mio. ha) + oq35_secdforest_est(t,j,ac,type) Distribution of secdforest additions over ac_est (mio. ha) + oq35_hvarea_other(t,j,ac,type) Harvested area other land (mio. ha) + oq35_hvarea_secdforest(t,j,ac,type) Harvested area secdforest (mio. ha) + oq35_hvarea_primforest(t,j,type) Harvested area primforest (mio. ha) + oq35_prod_secdforest(t,j,type) Production of woody biomass from secondary forests (mio. tDM per yr) + oq35_prod_primforest(t,j,type) Production of woody biomass from primary forests (mio. tDM per yr) + oq35_prod_other(t,j,type) Production of woody biomass from other land (mio. tDM per yr) + oq35_cost_hvarea(t,i,type) Cost of harvesting natural vegetation (mio. USD) + oq35_bv_primforest(t,j,potnatveg,type) Biodiversity value of primary forest (mio. ha) + oq35_bv_secdforest(t,j,potnatveg,type) Biodiversity value of secondary forest (mio. ha) + oq35_bv_other(t,j,potnatveg,type) Biodiversity value of other land (mio. ha) + oq35_natveg_conservation(t,j,type) Total natural vegetation conservation constraint (mio. ha) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/35_natveg/dynamic_may24/equations.gms b/modules/35_natveg/dynamic_may24/equations.gms new file mode 100644 index 0000000000..72c3c71047 --- /dev/null +++ b/modules/35_natveg/dynamic_may24/equations.gms @@ -0,0 +1,209 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @equations +*' The interface `vm_land` provides aggregated natveg land pools (`ac`) to other modules. + + q35_land_secdforest(j2) .. vm_land(j2,"secdforest") =e= sum(ac, v35_secdforest(j2,ac)); + + q35_land_other(j2) .. vm_land(j2,"other") =e= sum(ac, v35_other(j2,ac)); + +*' The total natural land area cannot be smaller than the total natural land conservation target. +*' Area requirements for natural land conservation are derived from WDPA and formulated based on +*' conservation priority areas during future time steps. + + q35_natveg_conservation(j2) .. + sum(land_natveg, vm_land(j2,land_natveg)) + =g= + sum((ct,land_natveg,consv_type), pm_land_conservation(ct,j2,land_natveg,consv_type)); + +*' Carbon stocks for primary forest, secondary forest or other natural land are calculated +*' as the product of respective area and carbon density. +*' Carbon stocks decline if the area decreases +*' (e.g. due to cropland expansion into forests). +*' In case of abandoned agricultural land (increase of other natural land), +*' natural succession, represented by age-class growth, results in increasing carbon stocks. + + q35_carbon_primforest(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"primforest",ag_pools,stockType) =e= + m_carbon_stock(vm_land,fm_carbon_density,"primforest"); + + q35_carbon_secdforest(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"secdforest",ag_pools,stockType) =e= + m_carbon_stock_ac(v35_secdforest,pm_carbon_density_ac,"ac","ac_sub"); + + q35_carbon_other(j2,ag_pools,stockType) .. + vm_carbon_stock(j2,"other",ag_pools,stockType) =e= + m_carbon_stock_ac(v35_other,pm_carbon_density_ac,"ac","ac_sub"); + +*' The biodiversity value (BV) of primary forest, secondary forest and other land is computed by multiplying their respective land area with bii coefficients, which depend on the age class and whether the potential natural vegetation forest or non-forest (luh2 side layers). + + q35_bv_primforest(j2,potnatveg) .. vm_bv(j2,"primforest",potnatveg) + =e= + vm_land(j2,"primforest") * fm_bii_coeff("primary",potnatveg) * fm_luh2_side_layers(j2,potnatveg); + + q35_bv_secdforest(j2,potnatveg) .. vm_bv(j2,"secdforest",potnatveg) + =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v35_secdforest(j2,ac)) * + fm_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); + + q35_bv_other(j2,potnatveg) .. vm_bv(j2,"other",potnatveg) + =e= + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v35_other(j2,ac)) * + fm_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); + +*' NPI/NDC land protection policies based on country reports are implemented as +*' minium forest and other land stocks. They are not interchangeable (as compared to +*' the natural land conservation constraint) and specifically formulated for forest and +*' other land stocks. + + q35_min_forest(j2) .. vm_land(j2,"primforest") + vm_land(j2,"secdforest") + =g= + sum(ct, p35_min_forest(ct,j2)); + + q35_min_other(j2) .. vm_land(j2,"other") =g= sum(ct, p35_min_other(ct,j2)); + +*' The following technical calculations are needed for reducing differences in land-use patterns between time steps. +*' The gross change in natural vegetation is calculated based on land expansion and +*' land contraction of other land, and land reduction of primary and secondary forest. +*' This information is then passed to the land module ([10_land]): + + q35_landdiff .. vm_landdiff_natveg =e= + sum(j2, + v35_other_expansion(j2) + + sum(ac_sub, v35_other_reduction(j2,ac_sub)) + + v35_secdforest_expansion(j2) + + sum(ac_sub, v35_secdforest_reduction(j2,ac_sub)) + + v35_primforest_reduction(j2)); + + q35_other_expansion(j2) .. + v35_other_expansion(j2) =e= + sum(ac_est, v35_other(j2,ac_est) + v35_secdforest(j2,ac_est)); + + q35_other_reduction(j2,ac_sub) .. + v35_other_reduction(j2,ac_sub) =e= + pc35_other(j2,ac_sub) - v35_other(j2,ac_sub); + + q35_secdforest_expansion(j2) .. + v35_secdforest_expansion(j2) =e= + sum(ac_est, v35_secdforest(j2,ac_est)); + + q35_secdforest_reduction(j2,ac_sub) .. + v35_secdforest_reduction(j2,ac_sub) =e= + pc35_secdforest(j2,ac_sub) - v35_secdforest(j2,ac_sub); + + q35_primforest_reduction(j2) .. + v35_primforest_reduction(j2) =e= + pcm_land(j2,"primforest") - vm_land(j2,"primforest"); + +******************************************************************* +**** Timber production related equations in natural vegetation **** +******************************************************************* + +*' For natural forest, per-hectare harvesting costs are positive to make sure that older +*' forest with higher growing stock is preferred over younger forest. +*' To mimic the difficulties in accessing primary forest, per-hectare harvesting +*' costs for primary forest are higher than for secondary forest. Harvesting costs +*' are paid everytime natural vegetation is harvested. The "real" harvested area +*' are received from the timber module [73_timber]. + +q35_cost_hvarea(i2).. + vm_cost_hvarea_natveg(i2) + =e= + sum((ct,cell(i2,j2),ac_sub), v35_hvarea_secdforest(j2,ac_sub)) * s35_timber_harvest_cost_secdforest + + sum((ct,cell(i2,j2),ac_sub), v35_hvarea_other(j2, ac_sub)) * s35_timber_harvest_cost_other + + sum((ct,cell(i2,j2)), v35_hvarea_primforest(j2)) * s35_timber_harvest_cost_primforest + ; + +** Secondary forest +*' Woody biomass production from secondary forests is calculated by multiplying the +*' area under production with corresponding yields of secondary forests, divided by the timestep length. + +q35_prod_secdforest(j2).. + sum(kforestry, vm_prod_natveg(j2,"secdforest",kforestry)) + =e= + sum(ac_sub, v35_hvarea_secdforest(j2,ac_sub) * sum(ct,pm_timber_yield(ct,j2,ac_sub,"secdforest"))) / m_timestep_length_forestry; + +** Primary forest +*' Woody biomass production from primary forests is calculated by multiplying the +*' area under production with corresponding yields of primary forests, divided by the timestep length. + +q35_prod_primforest(j2).. + sum(kforestry, vm_prod_natveg(j2,"primforest",kforestry)) + =e= + v35_hvarea_primforest(j2) * sum(ct, pm_timber_yield(ct,j2,"acx","primforest")) / m_timestep_length_forestry; + +** Other land +*' Wood-fuel production from other land is calculated by multiplying the area under +*' production with corresponding yields of other land, divided by the timestep length. +*' Wood production from other landis not allowed. + +q35_prod_other(j2).. + vm_prod_natveg(j2,"other","woodfuel") + =e= + sum(ac_sub, v35_hvarea_other(j2,ac_sub) * sum(ct, pm_timber_yield(ct,j2,ac_sub,"other"))) / m_timestep_length_forestry + ; + +*' Following equations show the harvested area from natural vegetation i.e. primary +*' forests, secondary forests and other land. Important to note here that no wood +*' production should be realized from other land. Harvested area for production +*' purposes can be lower oe equal than land reduction in natural vegetation as +*' not all lost area is (or should be) used for production. + +q35_hvarea_secdforest(j2,ac_sub).. + v35_hvarea_secdforest(j2,ac_sub) + =l= + v35_secdforest_reduction(j2,ac_sub); + +q35_hvarea_primforest(j2).. + v35_hvarea_primforest(j2) + =l= + v35_primforest_reduction(j2); + +q35_hvarea_other(j2,ac_sub).. + v35_hvarea_other(j2,ac_sub) + =l= + v35_other_reduction(j2,ac_sub); + + +*' Harvested secondary forest is still considered secondary forests due to +*' restrictive NPI definitions. Also primary forest harvested will be considered +*' to be secondary forest i.e., harvested primary forest gets reclassified as +*' secondary forest and ends up in the youngest age-class (and follows regrowth) + +q35_secdforest_regeneration(j2).. + sum(ac_est, v35_secdforest(j2,ac_est)) + =g= + sum(ac_sub,v35_hvarea_secdforest(j2,ac_sub)) + + v35_hvarea_primforest(j2) + + p35_land_restoration(j2,"secdforest") + ; + +q35_max_secdforest_regeneration(j2).. + sum(ac_est, v35_secdforest(j2,ac_est)) + + sum(type32, vm_landexpansion_forestry(j2,type32)) + =l= + p35_max_forest_recovery(j2) + ; + +*' Harvested other land is still considered other land + +q35_other_regeneration(j2).. + sum(ac_est, v35_other(j2,ac_est)) + =g= + sum(ac_sub,v35_hvarea_other(j2,ac_sub)) + ; + +*' The following two constraints distribute additions to secdforest and other land +*' over ac_est, which depends on the time step length (e.g. ac0 and ac5 for a 10 year time step). + +q35_secdforest_est(j2,ac_est) .. +v35_secdforest(j2,ac_est) =e= sum(ac_est2, v35_secdforest(j2,ac_est2))/card(ac_est2); + +q35_other_est(j2,ac_est) .. +v35_other(j2,ac_est) =e= sum(ac_est2, v35_other(j2,ac_est2))/card(ac_est2); + diff --git a/modules/35_natveg/dynamic_may24/input.gms b/modules/35_natveg/dynamic_may24/input.gms new file mode 100644 index 0000000000..de5bef3564 --- /dev/null +++ b/modules/35_natveg/dynamic_may24/input.gms @@ -0,0 +1,63 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +$setglobal c35_ad_policy npi +$setglobal c35_aolc_policy npi +$setglobal c35_shock_scenario none + +scalars +s35_hvarea Flag for harvested area (0=zero 1=exognous 2=endogneous) / 0 / +s35_hvarea_secdforest annual secdforest harvest rate for s35_hvarea equals 1 (percent per year) / 0 / +s35_hvarea_primforest annual primforest harvest rate for s35_hvarea equals 1 (percent per year) / 0 / +s35_hvarea_other annual other land harvest rate for s35_hvarea equals 1 (percent per year) / 0 / +s35_timber_harvest_cost_secdforest Cost for harvesting from secondary forest (USD per ha) / 2000/ +s35_timber_harvest_cost_other Cost for harvesting from other land (USD per ha) / 1500 / +s35_timber_harvest_cost_primforest Cost for harvesting from primary forest (USD per ha) / 3000/ +s35_natveg_harvest_shr Constrains the allowed wood harvest from natural vegetation (1=unconstrained) (1) /1/ +s35_secdf_distribution Flag for secdf initialization (0=all secondary forest in highest age class 1=Equal distribution among all age classes 2=Poulter distribution from MODIS satellite data) (1) / 0 / +s35_forest_damage Damage simulation in forests (0=none 1=shifting agriculture 2= Damage from shifting agriculture is faded out by c35_forest_damage_end 4= f35_forest_shock scenario) / 2 / +s35_forest_damage_end Year of forest damage end (1) / 2050 / +; + +table f35_forest_lost_share(i,driver_source) Share of area damanged by forest fires (1) +$ondelim +$include "./modules/35_natveg/input/f35_forest_lost_share.cs3" +$offdelim +; + +table f35_min_land_stock(t_all,j,pol35,pol_stock35) Avoided deforestation and land protection policies [minimum land stock] (Mha) +$ondelim +$include "./modules/35_natveg/input/npi_ndc_ad_aolc_pol.cs3" +$offdelim +; + +table f35_forest_shock(t_all, shock_scen) Forest carbon shock scenarios (area share affected per year) +$ondelim +$include "./modules/35_natveg/input/f35_forest_shock.csv" +$offdelim +; + +parameter f35_forest_disturbance_share(i) Share of area damanged by forest disturbances (1) +/ +$ondelim +$include "./modules/35_natveg/input/f35_forest_disturbance_share.cs4" +$offdelim +/; + +parameter f35_gs_relativetarget(i) Relative growing stock target in each region (m3 per ha) +/ +$ondelim +$include "./modules/35_natveg/input/f35_gs_relativetarget.cs4" +$offdelim +/; + +parameter fm_pot_forest_area(j) Potential forest area (mio. ha) +/ +$ondelim +$include "./modules/35_natveg/input/pot_forest_area.cs3" +$offdelim +/; diff --git a/modules/35_natveg/dynamic_may24/postsolve.gms b/modules/35_natveg/dynamic_may24/postsolve.gms new file mode 100644 index 0000000000..41f427750b --- /dev/null +++ b/modules/35_natveg/dynamic_may24/postsolve.gms @@ -0,0 +1,179 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*secdforest age class calculation +p35_secdforest(t,j,ac) = v35_secdforest.l(j,ac); + +*other land age class calculation +p35_other(t,j,ac) = v35_other.l(j,ac); + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); + ov35_other(t,j,ac,"marginal") = v35_other.m(j,ac); + ov_landdiff_natveg(t,"marginal") = vm_landdiff_natveg.m; + ov35_other_expansion(t,j,"marginal") = v35_other_expansion.m(j); + ov35_other_reduction(t,j,ac,"marginal") = v35_other_reduction.m(j,ac); + ov35_secdforest_expansion(t,j,"marginal") = v35_secdforest_expansion.m(j); + ov35_secdforest_reduction(t,j,ac,"marginal") = v35_secdforest_reduction.m(j,ac); + ov35_primforest_reduction(t,j,"marginal") = v35_primforest_reduction.m(j); + ov35_hvarea_secdforest(t,j,ac,"marginal") = v35_hvarea_secdforest.m(j,ac); + ov35_hvarea_other(t,j,ac,"marginal") = v35_hvarea_other.m(j,ac); + ov35_hvarea_primforest(t,j,"marginal") = v35_hvarea_primforest.m(j); + ov_prod_natveg(t,j,land_natveg,kforestry,"marginal") = vm_prod_natveg.m(j,land_natveg,kforestry); + ov_cost_hvarea_natveg(t,i,"marginal") = vm_cost_hvarea_natveg.m(i); + oq35_land_secdforest(t,j,"marginal") = q35_land_secdforest.m(j); + oq35_land_other(t,j,"marginal") = q35_land_other.m(j); + oq35_carbon_primforest(t,j,ag_pools,stockType,"marginal") = q35_carbon_primforest.m(j,ag_pools,stockType); + oq35_carbon_secdforest(t,j,ag_pools,stockType,"marginal") = q35_carbon_secdforest.m(j,ag_pools,stockType); + oq35_carbon_other(t,j,ag_pools,stockType,"marginal") = q35_carbon_other.m(j,ag_pools,stockType); + oq35_min_forest(t,j,"marginal") = q35_min_forest.m(j); + oq35_min_other(t,j,"marginal") = q35_min_other.m(j); + oq35_landdiff(t,"marginal") = q35_landdiff.m; + oq35_other_expansion(t,j,"marginal") = q35_other_expansion.m(j); + oq35_other_reduction(t,j,ac,"marginal") = q35_other_reduction.m(j,ac); + oq35_secdforest_expansion(t,j,"marginal") = q35_secdforest_expansion.m(j); + oq35_secdforest_reduction(t,j,ac,"marginal") = q35_secdforest_reduction.m(j,ac); + oq35_primforest_reduction(t,j,"marginal") = q35_primforest_reduction.m(j); + oq35_secdforest_regeneration(t,j,"marginal") = q35_secdforest_regeneration.m(j); + oq35_other_regeneration(t,j,"marginal") = q35_other_regeneration.m(j); + oq35_other_est(t,j,ac,"marginal") = q35_other_est.m(j,ac); + oq35_secdforest_est(t,j,ac,"marginal") = q35_secdforest_est.m(j,ac); + oq35_hvarea_other(t,j,ac,"marginal") = q35_hvarea_other.m(j,ac); + oq35_hvarea_secdforest(t,j,ac,"marginal") = q35_hvarea_secdforest.m(j,ac); + oq35_hvarea_primforest(t,j,"marginal") = q35_hvarea_primforest.m(j); + oq35_prod_secdforest(t,j,"marginal") = q35_prod_secdforest.m(j); + oq35_prod_primforest(t,j,"marginal") = q35_prod_primforest.m(j); + oq35_prod_other(t,j,"marginal") = q35_prod_other.m(j); + oq35_cost_hvarea(t,i,"marginal") = q35_cost_hvarea.m(i); + oq35_bv_primforest(t,j,potnatveg,"marginal") = q35_bv_primforest.m(j,potnatveg); + oq35_bv_secdforest(t,j,potnatveg,"marginal") = q35_bv_secdforest.m(j,potnatveg); + oq35_bv_other(t,j,potnatveg,"marginal") = q35_bv_other.m(j,potnatveg); + oq35_natveg_conservation(t,j,"marginal") = q35_natveg_conservation.m(j); + ov35_secdforest(t,j,ac,"level") = v35_secdforest.l(j,ac); + ov35_other(t,j,ac,"level") = v35_other.l(j,ac); + ov_landdiff_natveg(t,"level") = vm_landdiff_natveg.l; + ov35_other_expansion(t,j,"level") = v35_other_expansion.l(j); + ov35_other_reduction(t,j,ac,"level") = v35_other_reduction.l(j,ac); + ov35_secdforest_expansion(t,j,"level") = v35_secdforest_expansion.l(j); + ov35_secdforest_reduction(t,j,ac,"level") = v35_secdforest_reduction.l(j,ac); + ov35_primforest_reduction(t,j,"level") = v35_primforest_reduction.l(j); + ov35_hvarea_secdforest(t,j,ac,"level") = v35_hvarea_secdforest.l(j,ac); + ov35_hvarea_other(t,j,ac,"level") = v35_hvarea_other.l(j,ac); + ov35_hvarea_primforest(t,j,"level") = v35_hvarea_primforest.l(j); + ov_prod_natveg(t,j,land_natveg,kforestry,"level") = vm_prod_natveg.l(j,land_natveg,kforestry); + ov_cost_hvarea_natveg(t,i,"level") = vm_cost_hvarea_natveg.l(i); + oq35_land_secdforest(t,j,"level") = q35_land_secdforest.l(j); + oq35_land_other(t,j,"level") = q35_land_other.l(j); + oq35_carbon_primforest(t,j,ag_pools,stockType,"level") = q35_carbon_primforest.l(j,ag_pools,stockType); + oq35_carbon_secdforest(t,j,ag_pools,stockType,"level") = q35_carbon_secdforest.l(j,ag_pools,stockType); + oq35_carbon_other(t,j,ag_pools,stockType,"level") = q35_carbon_other.l(j,ag_pools,stockType); + oq35_min_forest(t,j,"level") = q35_min_forest.l(j); + oq35_min_other(t,j,"level") = q35_min_other.l(j); + oq35_landdiff(t,"level") = q35_landdiff.l; + oq35_other_expansion(t,j,"level") = q35_other_expansion.l(j); + oq35_other_reduction(t,j,ac,"level") = q35_other_reduction.l(j,ac); + oq35_secdforest_expansion(t,j,"level") = q35_secdforest_expansion.l(j); + oq35_secdforest_reduction(t,j,ac,"level") = q35_secdforest_reduction.l(j,ac); + oq35_primforest_reduction(t,j,"level") = q35_primforest_reduction.l(j); + oq35_secdforest_regeneration(t,j,"level") = q35_secdforest_regeneration.l(j); + oq35_other_regeneration(t,j,"level") = q35_other_regeneration.l(j); + oq35_other_est(t,j,ac,"level") = q35_other_est.l(j,ac); + oq35_secdforest_est(t,j,ac,"level") = q35_secdforest_est.l(j,ac); + oq35_hvarea_other(t,j,ac,"level") = q35_hvarea_other.l(j,ac); + oq35_hvarea_secdforest(t,j,ac,"level") = q35_hvarea_secdforest.l(j,ac); + oq35_hvarea_primforest(t,j,"level") = q35_hvarea_primforest.l(j); + oq35_prod_secdforest(t,j,"level") = q35_prod_secdforest.l(j); + oq35_prod_primforest(t,j,"level") = q35_prod_primforest.l(j); + oq35_prod_other(t,j,"level") = q35_prod_other.l(j); + oq35_cost_hvarea(t,i,"level") = q35_cost_hvarea.l(i); + oq35_bv_primforest(t,j,potnatveg,"level") = q35_bv_primforest.l(j,potnatveg); + oq35_bv_secdforest(t,j,potnatveg,"level") = q35_bv_secdforest.l(j,potnatveg); + oq35_bv_other(t,j,potnatveg,"level") = q35_bv_other.l(j,potnatveg); + oq35_natveg_conservation(t,j,"level") = q35_natveg_conservation.l(j); + ov35_secdforest(t,j,ac,"upper") = v35_secdforest.up(j,ac); + ov35_other(t,j,ac,"upper") = v35_other.up(j,ac); + ov_landdiff_natveg(t,"upper") = vm_landdiff_natveg.up; + ov35_other_expansion(t,j,"upper") = v35_other_expansion.up(j); + ov35_other_reduction(t,j,ac,"upper") = v35_other_reduction.up(j,ac); + ov35_secdforest_expansion(t,j,"upper") = v35_secdforest_expansion.up(j); + ov35_secdforest_reduction(t,j,ac,"upper") = v35_secdforest_reduction.up(j,ac); + ov35_primforest_reduction(t,j,"upper") = v35_primforest_reduction.up(j); + ov35_hvarea_secdforest(t,j,ac,"upper") = v35_hvarea_secdforest.up(j,ac); + ov35_hvarea_other(t,j,ac,"upper") = v35_hvarea_other.up(j,ac); + ov35_hvarea_primforest(t,j,"upper") = v35_hvarea_primforest.up(j); + ov_prod_natveg(t,j,land_natveg,kforestry,"upper") = vm_prod_natveg.up(j,land_natveg,kforestry); + ov_cost_hvarea_natveg(t,i,"upper") = vm_cost_hvarea_natveg.up(i); + oq35_land_secdforest(t,j,"upper") = q35_land_secdforest.up(j); + oq35_land_other(t,j,"upper") = q35_land_other.up(j); + oq35_carbon_primforest(t,j,ag_pools,stockType,"upper") = q35_carbon_primforest.up(j,ag_pools,stockType); + oq35_carbon_secdforest(t,j,ag_pools,stockType,"upper") = q35_carbon_secdforest.up(j,ag_pools,stockType); + oq35_carbon_other(t,j,ag_pools,stockType,"upper") = q35_carbon_other.up(j,ag_pools,stockType); + oq35_min_forest(t,j,"upper") = q35_min_forest.up(j); + oq35_min_other(t,j,"upper") = q35_min_other.up(j); + oq35_landdiff(t,"upper") = q35_landdiff.up; + oq35_other_expansion(t,j,"upper") = q35_other_expansion.up(j); + oq35_other_reduction(t,j,ac,"upper") = q35_other_reduction.up(j,ac); + oq35_secdforest_expansion(t,j,"upper") = q35_secdforest_expansion.up(j); + oq35_secdforest_reduction(t,j,ac,"upper") = q35_secdforest_reduction.up(j,ac); + oq35_primforest_reduction(t,j,"upper") = q35_primforest_reduction.up(j); + oq35_secdforest_regeneration(t,j,"upper") = q35_secdforest_regeneration.up(j); + oq35_other_regeneration(t,j,"upper") = q35_other_regeneration.up(j); + oq35_other_est(t,j,ac,"upper") = q35_other_est.up(j,ac); + oq35_secdforest_est(t,j,ac,"upper") = q35_secdforest_est.up(j,ac); + oq35_hvarea_other(t,j,ac,"upper") = q35_hvarea_other.up(j,ac); + oq35_hvarea_secdforest(t,j,ac,"upper") = q35_hvarea_secdforest.up(j,ac); + oq35_hvarea_primforest(t,j,"upper") = q35_hvarea_primforest.up(j); + oq35_prod_secdforest(t,j,"upper") = q35_prod_secdforest.up(j); + oq35_prod_primforest(t,j,"upper") = q35_prod_primforest.up(j); + oq35_prod_other(t,j,"upper") = q35_prod_other.up(j); + oq35_cost_hvarea(t,i,"upper") = q35_cost_hvarea.up(i); + oq35_bv_primforest(t,j,potnatveg,"upper") = q35_bv_primforest.up(j,potnatveg); + oq35_bv_secdforest(t,j,potnatveg,"upper") = q35_bv_secdforest.up(j,potnatveg); + oq35_bv_other(t,j,potnatveg,"upper") = q35_bv_other.up(j,potnatveg); + oq35_natveg_conservation(t,j,"upper") = q35_natveg_conservation.up(j); + ov35_secdforest(t,j,ac,"lower") = v35_secdforest.lo(j,ac); + ov35_other(t,j,ac,"lower") = v35_other.lo(j,ac); + ov_landdiff_natveg(t,"lower") = vm_landdiff_natveg.lo; + ov35_other_expansion(t,j,"lower") = v35_other_expansion.lo(j); + ov35_other_reduction(t,j,ac,"lower") = v35_other_reduction.lo(j,ac); + ov35_secdforest_expansion(t,j,"lower") = v35_secdforest_expansion.lo(j); + ov35_secdforest_reduction(t,j,ac,"lower") = v35_secdforest_reduction.lo(j,ac); + ov35_primforest_reduction(t,j,"lower") = v35_primforest_reduction.lo(j); + ov35_hvarea_secdforest(t,j,ac,"lower") = v35_hvarea_secdforest.lo(j,ac); + ov35_hvarea_other(t,j,ac,"lower") = v35_hvarea_other.lo(j,ac); + ov35_hvarea_primforest(t,j,"lower") = v35_hvarea_primforest.lo(j); + ov_prod_natveg(t,j,land_natveg,kforestry,"lower") = vm_prod_natveg.lo(j,land_natveg,kforestry); + ov_cost_hvarea_natveg(t,i,"lower") = vm_cost_hvarea_natveg.lo(i); + oq35_land_secdforest(t,j,"lower") = q35_land_secdforest.lo(j); + oq35_land_other(t,j,"lower") = q35_land_other.lo(j); + oq35_carbon_primforest(t,j,ag_pools,stockType,"lower") = q35_carbon_primforest.lo(j,ag_pools,stockType); + oq35_carbon_secdforest(t,j,ag_pools,stockType,"lower") = q35_carbon_secdforest.lo(j,ag_pools,stockType); + oq35_carbon_other(t,j,ag_pools,stockType,"lower") = q35_carbon_other.lo(j,ag_pools,stockType); + oq35_min_forest(t,j,"lower") = q35_min_forest.lo(j); + oq35_min_other(t,j,"lower") = q35_min_other.lo(j); + oq35_landdiff(t,"lower") = q35_landdiff.lo; + oq35_other_expansion(t,j,"lower") = q35_other_expansion.lo(j); + oq35_other_reduction(t,j,ac,"lower") = q35_other_reduction.lo(j,ac); + oq35_secdforest_expansion(t,j,"lower") = q35_secdforest_expansion.lo(j); + oq35_secdforest_reduction(t,j,ac,"lower") = q35_secdforest_reduction.lo(j,ac); + oq35_primforest_reduction(t,j,"lower") = q35_primforest_reduction.lo(j); + oq35_secdforest_regeneration(t,j,"lower") = q35_secdforest_regeneration.lo(j); + oq35_other_regeneration(t,j,"lower") = q35_other_regeneration.lo(j); + oq35_other_est(t,j,ac,"lower") = q35_other_est.lo(j,ac); + oq35_secdforest_est(t,j,ac,"lower") = q35_secdforest_est.lo(j,ac); + oq35_hvarea_other(t,j,ac,"lower") = q35_hvarea_other.lo(j,ac); + oq35_hvarea_secdforest(t,j,ac,"lower") = q35_hvarea_secdforest.lo(j,ac); + oq35_hvarea_primforest(t,j,"lower") = q35_hvarea_primforest.lo(j); + oq35_prod_secdforest(t,j,"lower") = q35_prod_secdforest.lo(j); + oq35_prod_primforest(t,j,"lower") = q35_prod_primforest.lo(j); + oq35_prod_other(t,j,"lower") = q35_prod_other.lo(j); + oq35_cost_hvarea(t,i,"lower") = q35_cost_hvarea.lo(i); + oq35_bv_primforest(t,j,potnatveg,"lower") = q35_bv_primforest.lo(j,potnatveg); + oq35_bv_secdforest(t,j,potnatveg,"lower") = q35_bv_secdforest.lo(j,potnatveg); + oq35_bv_other(t,j,potnatveg,"lower") = q35_bv_other.lo(j,potnatveg); + oq35_natveg_conservation(t,j,"lower") = q35_natveg_conservation.lo(j); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/35_natveg/dynamic_may24/preloop.gms b/modules/35_natveg/dynamic_may24/preloop.gms new file mode 100644 index 0000000000..3d897377d7 --- /dev/null +++ b/modules/35_natveg/dynamic_may24/preloop.gms @@ -0,0 +1,65 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +** initialize other land +i35_other(j,ac) = 0; +i35_other(j,"acx") = pcm_land(j,"other"); + +** initialize secdforest area depending on switch. +if(s35_secdf_distribution = 0, + i35_secdforest(j,"acx") = pcm_land(j,"secdforest"); +elseif s35_secdf_distribution = 1, +* ac0 is excluded here. Therefore no initial shifting is needed. + i35_secdforest(j,ac)$(not sameas(ac,"ac0")) = pcm_land(j,"secdforest")/(card(ac)-1); +elseif s35_secdf_distribution = 2, +*classes 1, 2, 3 include plantation and are therefore excluded +*As disturbance history (fire) would affect the age structure +*We use the sahre from class 4 to be in class 1,2,3 +*class 15 is primary forest and is therefore excluded + i35_plantedclass_ac(j,ac) = im_plantedclass_ac(j,ac); + i35_plantedclass_ac(j,ac_planted)$(i35_plantedclass_ac(j,ac_planted) > im_plantedclass_ac(j,"ac35")) = im_plantedclass_ac(j,"ac35"); + +* Distribute this area correctly + p35_poulter_dist(j,ac) = 0; + p35_poulter_dist(j,ac) = (i35_plantedclass_ac(j,ac)/sum(ac2,i35_plantedclass_ac(j,ac2)))$(sum(ac2,i35_plantedclass_ac(j,ac2))>0); + i35_secdforest(j,ac)$(not sameas(ac,"ac0")) = pcm_land(j,"secdforest")*p35_poulter_dist(j,ac); +); + +*use residual approach to avoid rounding errors +i35_secdforest(j,"acx") = i35_secdforest(j,"acx") + (pcm_land(j,"secdforest") - sum(ac, i35_secdforest(j,ac))); + +*initialize parameter +p35_other(t,j,ac) = 0; +p35_secdforest(t,j,ac) = 0; + +* initialize forest disturbance losses +p35_disturbance_loss_secdf(t,j,ac) = 0; +p35_disturbance_loss_primf(t,j) = 0; + +* ----------------------------------------- +* Land conservation for climate mitigation +* ----------------------------------------- + +p35_min_forest(t,j) = f35_min_land_stock(t,j,"%c35_ad_policy%","forest"); +p35_min_other(t,j) = f35_min_land_stock(t,j,"%c35_ad_policy%","other"); + + +* ---------------------------------------- +* Calibrate Natural vegetation yields +* ---------------------------------------- + +** Initialize with 0 cvalues +p35_land_start_ac(j,ac,land_natveg) = 0; +** Capture natural forest values (primary forest + secondary forest) +p35_land_start_ac(j,"acx","primforest") = pcm_land(j,"primforest"); +p35_land_start_ac(j,ac,"secdforest") = i35_secdforest(j,ac); + + +* ----------------------------- +* Set forest damage trajectory +* ----------------------------- +m_sigmoid_time_interpol(p35_damage_fader,sm_fix_SSP2,s35_forest_damage_end,0,1); diff --git a/modules/35_natveg/dynamic_may24/presolve.gms b/modules/35_natveg/dynamic_may24/presolve.gms new file mode 100644 index 0000000000..b9146a9aea --- /dev/null +++ b/modules/35_natveg/dynamic_may24/presolve.gms @@ -0,0 +1,185 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +if((ord(t) = 1), + pc35_secdforest(j,ac) = i35_secdforest(j,ac); + pc35_other(j,ac) = i35_other(j,ac); +else + pc35_secdforest(j,ac) = p35_secdforest(t-1,j,ac); + pc35_other(j,ac) = p35_other(t-1,j,ac); +); + +* ---------------------------------------------------- +* Shift ageclasses due to shifting agriculture fires +* ---------------------------------------------------- + +* first calculate damages +if(s35_forest_damage=1, + p35_disturbance_loss_secdf(t,j,ac_sub) = pc35_secdforest(j,ac_sub) * sum(cell(i,j),f35_forest_lost_share(i,"shifting_agriculture"))*m_timestep_length_forestry; + p35_disturbance_loss_primf(t,j) = pcm_land(j,"primforest") * sum(cell(i,j),f35_forest_lost_share(i,"shifting_agriculture"))*m_timestep_length_forestry; + ); + +* shifting cultivation is faded out +if(s35_forest_damage=2, + p35_disturbance_loss_secdf(t,j,ac_sub) = pc35_secdforest(j,ac_sub) * sum(cell(i,j),f35_forest_lost_share(i,"shifting_agriculture"))*m_timestep_length_forestry*(1 - p35_damage_fader(t)); + p35_disturbance_loss_primf(t,j) = pcm_land(j,"primforest") * sum(cell(i,j),f35_forest_lost_share(i,"shifting_agriculture"))*m_timestep_length_forestry*(1 - p35_damage_fader(t)); + ); + +if(s35_forest_damage=3, + p35_disturbance_loss_secdf(t,j,ac_sub) = pc35_secdforest(j,ac_sub) * sum((cell(i,j),combined_loss),f35_forest_lost_share(i,combined_loss))*m_timestep_length_forestry; + p35_disturbance_loss_primf(t,j) = pcm_land(j,"primforest") * sum((cell(i,j),combined_loss),f35_forest_lost_share(i,combined_loss))*m_timestep_length_forestry; + ); + +* generic disturbance scenarios +if(s35_forest_damage=4, + p35_disturbance_loss_secdf(t,j,ac_sub) = pc35_secdforest(j,ac_sub) * f35_forest_shock(t,"%c35_shock_scenario%") * m_timestep_length; + p35_disturbance_loss_primf(t,j) = pcm_land(j,"primforest") * f35_forest_shock(t,"%c35_shock_scenario%") * m_timestep_length; + ); + +* Distribution of damages correctly +pc35_secdforest(j,ac_est) = pc35_secdforest(j,ac_est) + sum(ac_sub,p35_disturbance_loss_secdf(t,j,ac_sub))/card(ac_est2) + p35_disturbance_loss_primf(t,j)/card(ac_est2); + +pc35_secdforest(j,ac_sub) = pc35_secdforest(j,ac_sub) - p35_disturbance_loss_secdf(t,j,ac_sub); +pcm_land(j,"primforest") = pcm_land(j,"primforest") - p35_disturbance_loss_primf(t,j); +vm_land.l(j,"primforest") = pcm_land(j,"primforest"); + +* Regrowth of natural vegetation (natural succession) is modelled by shifting age-classes according to time step length. +s35_shift = m_timestep_length_forestry/5; +* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) + p35_other(t,j,ac)$(ord(ac) > s35_shift) = pc35_other(j,ac-s35_shift); +* account for cases at the end of the age class set (s35_shift > 1) which are not shifted by the above calculation + p35_other(t,j,"acx") = p35_other(t,j,"acx") + + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_other(j,ac)); + +* Usual shift +* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) + p35_secdforest(t,j,ac)$(ord(ac) > s35_shift) = pc35_secdforest(j,ac-s35_shift); +* account for cases at the end of the age class set (s35_shift > 1) which are not shifted by the above calculation + p35_secdforest(t,j,"acx") = p35_secdforest(t,j,"acx") + + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_secdforest(j,ac)); + +* -------------------------------------- +*Secondary forest recovery +* -------------------------------------- + +* Forest recovery is constrained by the potential forest area in each cluster +p35_max_forest_recovery(j) = fm_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); +p35_max_forest_recovery(j)$(p35_max_forest_recovery(j) < 0) = 0; + +* ------------------------------------- +* Set bounds based on land conservation +* ------------------------------------- + +* Within the optimization, primary forests can only decrease +* (e.g. due to cropland expansion). +* In contrast, other natural land and secdforest can decrease and increase within the optimization. +* For instance, other natural land increases if agricultural land is abandoned. + +* Correct land conservation for damage +pm_land_conservation(t,j,land_natveg,"protect")$(pm_land_conservation(t,j,land_natveg,"protect") > pcm_land(j,land_natveg)) = pcm_land(j,land_natveg); + +** Setting bounds for only allowing s35_natveg_harvest_shr percentage of available forest to be harvested (highest age class) + +* Primary forest + +** Allowing selective logging only after historical period +if (sum(sameas(t_past,t),1) = 1, +vm_land.lo(j,"primforest") = 0; +else +vm_land.lo(j,"primforest") = (1-s35_natveg_harvest_shr) * pcm_land(j,"primforest"); +); +* Primary forest conservation +vm_land.lo(j,"primforest")$(vm_land.lo(j,"primforest") < pm_land_conservation(t,j,"primforest","protect")) = pm_land_conservation(t,j,"primforest","protect"); +vm_land.up(j,"primforest") = pcm_land(j,"primforest"); + +* Secondary forest + +*reset bound +v35_secdforest.lo(j,ac) = 0; +v35_secdforest.up(j,ac) = Inf; + +p35_protection_dist(j,ac_sub) = (pc35_secdforest(j,ac_sub)/sum(ac_sub2,pc35_secdforest(j,ac_sub2)))$(sum(ac_sub2,pc35_secdforest(j,ac_sub2))>0); +if (sum(sameas(t_past,t),1) = 1, +v35_secdforest.lo(j,ac_sub) = pm_land_conservation(t,j,"secdforest","protect") * p35_protection_dist(j,ac_sub); +else +v35_secdforest.lo(j,ac_sub) = max((1-s35_natveg_harvest_shr) * pc35_secdforest(j,ac_sub), pm_land_conservation(t,j,"secdforest","protect") * p35_protection_dist(j,ac_sub)); +); +* upper bound +v35_secdforest.up(j,ac_sub) = pc35_secdforest(j,ac_sub); +m_boundfix(v35_secdforest,(j,ac_sub),l,10e-5); + +* Secondary forest conservation +* protection bound fix +pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_secdforest(j,ac_sub)); +* set restoration target +p35_land_restoration(j,"secdforest") = pm_land_conservation(t,j,"secdforest","restore"); +* Do not restore secdforest in areas where total natural +* land area meets the total natural land conservation target +p35_land_restoration(j,"secdforest")$(sum(land_natveg, pcm_land(j,land_natveg)) >= sum((land_natveg, consv_type), pm_land_conservation(t,j,land_natveg,consv_type))) = 0; +* set conservation bound +vm_land.lo(j,"secdforest") = pm_land_conservation(t,j,"secdforest","protect") + p35_land_restoration(j,"secdforest"); + +** Other land + +*reset bounds +v35_other.lo(j,ac) = 0; +v35_other.up(j,ac) = Inf; +*set upper bound +v35_other.up(j,ac_sub) = pc35_other(j,ac_sub); +m_boundfix(v35_other,(j,ac_sub),l,10e-5); + +* Other land conservation +* protection bound fix +pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_other(j,ac_sub)); +* set restoration target +p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); +* Do not restore other land in areas where total natural +* land area meets the total natural land conservation target +p35_land_restoration(j,"other")$(sum(land_natveg, pcm_land(j,land_natveg)) >= sum((land_natveg, consv_type), pm_land_conservation(t,j,land_natveg,consv_type))) = 0; +* set conservation bound +vm_land.lo(j,"other") = pm_land_conservation(t,j,"other","protect") + p35_land_restoration(j,"other"); + +* ------------------------------ +* Calculate carbon density +* ------------------------------ + +* highest carbon density 1st time step to account for reshuffling +p35_carbon_density_secdforest(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); +p35_carbon_density_other(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); + +* ------------------ +* NPI/NDC policy +* ------------------ + +p35_min_forest(t,j)$(p35_min_forest(t,j) > pcm_land(j,"primforest") + pcm_land(j,"secdforest")) = pcm_land(j,"primforest") + pcm_land(j,"secdforest"); +p35_min_other(t,j)$(p35_min_other(t,j) > pcm_land(j,"other")) = pcm_land(j,"other"); + +** Display +p35_land(t,j,land_natveg,ac) = 0; +p35_land(t,j,"primforest","acx") = pcm_land(j,"primforest"); +p35_land(t,j,"secdforest",ac) = p35_secdforest(t,j,ac); +*p35_land(t,j,"other",ac) = p35_other(t,j,ac): +p35_updated_gs_natfor(t,i) = 0; +p35_updated_gs_natfor(t,i)$(sum((cell(i,j),ac,land_natveg), p35_land(t,j,land_natveg,ac))>0) = (sum((cell(i,j),ac,land_natveg),(pm_timber_yield(t,j,ac,land_natveg) / sm_wood_density) * p35_land(t,j,land_natveg,ac))/ sum((cell(i,j),ac,land_natveg), p35_land(t,j,land_natveg,ac))); + +** Youngest age classes are not allowed to be harvested +v35_hvarea_secdforest.fx(j,ac_est) = 0; +v35_hvarea_other.fx(j,ac_est) = 0; +v35_secdforest_reduction.fx(j,ac_est) = 0; +v35_other_reduction.fx(j,ac_est) = 0; + +vm_prod_natveg.fx(j,"other","wood") = 0; + +if(s35_hvarea = 0, + v35_hvarea_secdforest.fx(j,ac_sub) = 0; + v35_hvarea_primforest.fx(j) = 0; + v35_hvarea_other.fx(j,ac_sub) = 0; +elseif s35_hvarea = 1, + v35_hvarea_secdforest.fx(j,ac_sub) = (v35_secdforest.l(j,ac_sub) - v35_secdforest.lo(j,ac_sub))*s35_hvarea_secdforest*m_timestep_length_forestry; + v35_hvarea_primforest.fx(j) = (vm_land.l(j,"primforest") - vm_land.lo(j,"primforest"))*s35_hvarea_primforest*m_timestep_length_forestry; + v35_hvarea_other.fx(j,ac_sub) = (v35_other.l(j,ac_sub) - v35_other.lo(j,ac_sub))*s35_hvarea_other*m_timestep_length_forestry; +); diff --git a/modules/35_natveg/dynamic_may24/realization.gms b/modules/35_natveg/dynamic_may24/realization.gms new file mode 100644 index 0000000000..af25d81fa5 --- /dev/null +++ b/modules/35_natveg/dynamic_may24/realization.gms @@ -0,0 +1,44 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +*' @description In the dynamic_may24 realization, land and carbon stock dynamics +*' of natural vegetation are modeled endogenously. +*' The initial spatial distribution of the sub-land-types primary forest, +*' secondary forest and other natural land is based on the +*' LUH2 data set [@hurtt2018luh2]. +*' This realization also includes national policies implemented (NPI) and nationally +*' determined contributions to the Paris agreement (NDC) with regard to forest and other +*' land protection. The NPI/NDC polices ramp up until 2030 and are assumed constant +*' thereafter. NPI/NDC land conservation polices are applied on forest and other land, +*' depending on individual country reports. The NPI/NDC policies are treated as minimum +*' constraints and therefore are non-additive, if the land protection targets as provided by +*' the module `22_land_conservation` and the interface `pm_land_conservation` are larger. +*' Additionally, this module includes forest damage and provides the ability to +*' harvest natural vegetation for timber. Both wood and woodfuel can be produceed +*' from primary and secondary forest but other land is only allowed to be harvested +*' for woodfuel. +*' @stop + +*' +*' @limitations Initialization of both primary and secondary forest in highest +*' age class or equal distrivution of such areas in all age classes. Data exists +*' on a more emperically obtained distribution in different age classes based +*' on satellite data but this results is highly negative land-use change emissions. +*' Inclusion of this data in MAgPIE remains work in progess and is not available for release yet. +*' Additionally, in this module realization, harvested secondary forest stays +*' secondary forest and harvested primary forest is reclassified as secondary forest. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/35_natveg/dynamic_may24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/35_natveg/dynamic_may24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/35_natveg/dynamic_may24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/35_natveg/dynamic_may24/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/35_natveg/dynamic_may24/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/35_natveg/dynamic_may24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/35_natveg/dynamic_may24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/35_natveg/dynamic_may24/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/35_natveg/dynamic_may24/scaling.gms b/modules/35_natveg/dynamic_may24/scaling.gms new file mode 100644 index 0000000000..c4a52d9d82 --- /dev/null +++ b/modules/35_natveg/dynamic_may24/scaling.gms @@ -0,0 +1,8 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +vm_cost_hvarea_natveg.scale(i)$(s35_hvarea = 1 OR s35_hvarea = 2) = 10e4; diff --git a/modules/35_natveg/dynamic_may24/sets.gms b/modules/35_natveg/dynamic_may24/sets.gms new file mode 100644 index 0000000000..0ad78e215c --- /dev/null +++ b/modules/35_natveg/dynamic_may24/sets.gms @@ -0,0 +1,28 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +sets + + driver_source Source of deforestation drivers + / overall, deforestation, shifting_agriculture, + forestry, wildfire, urbanization / + + combined_loss(driver_source) Combined loss from fire plus agriculture + / shifting_agriculture,wildfire / + + pol35 Land protection policy + / none, npi, ndc / + + pol_stock35 Land types for land protection policies + / forest, other / + + + shock_scen Scenario name of forest carbon shock + / none, 002lin2030,004lin2030,008lin2030,016lin2030 + / + +; diff --git a/modules/35_natveg/module.gms b/modules/35_natveg/module.gms index 9fec0983aa..6ebab7afad 100644 --- a/modules/35_natveg/module.gms +++ b/modules/35_natveg/module.gms @@ -18,4 +18,5 @@ *###################### R SECTION START (MODULETYPES) ########################## $Ifi "%natveg%" == "dynamic_feb21" $include "./modules/35_natveg/dynamic_feb21/realization.gms" +$Ifi "%natveg%" == "dynamic_may24" $include "./modules/35_natveg/dynamic_may24/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ From 3d69a6b153d1a6b9b527bba915ddc4ca0e995a62 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 25 Apr 2024 16:48:48 +0200 Subject: [PATCH 052/280] new forest recovery based on potential forest area --- modules/35_natveg/dynamic_feb21/not_used.txt | 2 ++ modules/35_natveg/dynamic_may24/input.gms | 2 +- modules/35_natveg/dynamic_may24/presolve.gms | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 modules/35_natveg/dynamic_feb21/not_used.txt diff --git a/modules/35_natveg/dynamic_feb21/not_used.txt b/modules/35_natveg/dynamic_feb21/not_used.txt new file mode 100644 index 0000000000..810653acf1 --- /dev/null +++ b/modules/35_natveg/dynamic_feb21/not_used.txt @@ -0,0 +1,2 @@ +name,type,reason +vm_landexpansion_forestry, input, not needed diff --git a/modules/35_natveg/dynamic_may24/input.gms b/modules/35_natveg/dynamic_may24/input.gms index de5bef3564..0567f0ed39 100644 --- a/modules/35_natveg/dynamic_may24/input.gms +++ b/modules/35_natveg/dynamic_may24/input.gms @@ -55,7 +55,7 @@ $include "./modules/35_natveg/input/f35_gs_relativetarget.cs4" $offdelim /; -parameter fm_pot_forest_area(j) Potential forest area (mio. ha) +parameter f35_pot_forest_area(j) Potential forest area (mio. ha) / $ondelim $include "./modules/35_natveg/input/pot_forest_area.cs3" diff --git a/modules/35_natveg/dynamic_may24/presolve.gms b/modules/35_natveg/dynamic_may24/presolve.gms index b9146a9aea..d501c93da8 100644 --- a/modules/35_natveg/dynamic_may24/presolve.gms +++ b/modules/35_natveg/dynamic_may24/presolve.gms @@ -67,7 +67,7 @@ s35_shift = m_timestep_length_forestry/5; * -------------------------------------- * Forest recovery is constrained by the potential forest area in each cluster -p35_max_forest_recovery(j) = fm_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); +p35_max_forest_recovery(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); p35_max_forest_recovery(j)$(p35_max_forest_recovery(j) < 0) = 0; * ------------------------------------- From 65f8202cb9e2b4e5857eb97ef8fd86cf8f3a705d Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 25 Apr 2024 18:13:24 +0200 Subject: [PATCH 053/280] move of shifting from other land to secondary before age-class growth for consistency with carbon stocks and calculations in post-processing --- modules/35_natveg/dynamic_feb21/presolve.gms | 26 +++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/dynamic_feb21/presolve.gms index 9e757cbe3b..0a656ec42b 100644 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ b/modules/35_natveg/dynamic_feb21/presolve.gms @@ -47,6 +47,20 @@ pc35_secdforest(j,ac_sub) = pc35_secdforest(j,ac_sub) - p35_disturbance_loss_sec pcm_land(j,"primforest") = pcm_land(j,"primforest") - p35_disturbance_loss_primf(t,j); vm_land.l(j,"primforest") = pcm_land(j,"primforest"); +* -------------------------------------- +* Carbon threshold for secondary forest +* -------------------------------------- + +*' @code +*' If the vegetation carbon density in a simulation unit due to regrowth +*' exceeds a threshold of 20 tC/ha the respective area is shifted from other natural land to secondary forest. +p35_recovered_forest(t,j,ac)$(not sameas(ac,"acx")) = + p35_other(t,j,ac)$(pm_carbon_density_ac(t,j,ac,"vegc") > 20); +p35_other(t,j,ac) = p35_other(t,j,ac) - p35_recovered_forest(t,j,ac); +p35_secdforest(t,j,ac) = p35_secdforest(t,j,ac) + p35_recovered_forest(t,j,ac); +*' @stop + + * Regrowth of natural vegetation (natural succession) is modelled by shifting age-classes according to time step length. s35_shift = m_timestep_length_forestry/5; * example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) @@ -62,18 +76,6 @@ s35_shift = m_timestep_length_forestry/5; p35_secdforest(t,j,"acx") = p35_secdforest(t,j,"acx") + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_secdforest(j,ac)); -* -------------------------------------- -* Carbon threshold for secondary forest -* -------------------------------------- - -*' @code -*' If the vegetation carbon density in a simulation unit due to regrowth -*' exceeds a threshold of 20 tC/ha the respective area is shifted from other natural land to secondary forest. -p35_recovered_forest(t,j,ac)$(not sameas(ac,"acx")) = - p35_other(t,j,ac)$(pm_carbon_density_ac(t,j,ac,"vegc") > 20); -p35_other(t,j,ac) = p35_other(t,j,ac) - p35_recovered_forest(t,j,ac); -p35_secdforest(t,j,ac) = p35_secdforest(t,j,ac) + p35_recovered_forest(t,j,ac); -*' @stop pc35_secdforest(j,ac) = p35_secdforest(t,j,ac); v35_secdforest.l(j,ac) = pc35_secdforest(j,ac); From 02d5cf53a06cf6daaa881ef931cfe29d59feeb1f Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 25 Apr 2024 21:24:42 +0200 Subject: [PATCH 054/280] adjusted p35_forest_min --- modules/35_natveg/dynamic_may24/presolve.gms | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/35_natveg/dynamic_may24/presolve.gms b/modules/35_natveg/dynamic_may24/presolve.gms index d501c93da8..f3b813ec94 100644 --- a/modules/35_natveg/dynamic_may24/presolve.gms +++ b/modules/35_natveg/dynamic_may24/presolve.gms @@ -63,7 +63,7 @@ s35_shift = m_timestep_length_forestry/5; + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_secdforest(j,ac)); * -------------------------------------- -*Secondary forest recovery +* Secondary forest recovery * -------------------------------------- * Forest recovery is constrained by the potential forest area in each cluster @@ -156,6 +156,7 @@ p35_carbon_density_other(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools * ------------------ p35_min_forest(t,j)$(p35_min_forest(t,j) > pcm_land(j,"primforest") + pcm_land(j,"secdforest")) = pcm_land(j,"primforest") + pcm_land(j,"secdforest"); +p35_min_forest(t,j)$(p35_min_forest(t,j) > f35_pot_forest_area(j)) = f35_pot_forest_area(j); p35_min_other(t,j)$(p35_min_other(t,j) > pcm_land(j,"other")) = pcm_land(j,"other"); ** Display From 664d69a999f5dfb791765cc0eb67f55e46d8fc69 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Fri, 26 Apr 2024 09:37:18 +0200 Subject: [PATCH 055/280] set input vector to same version as Patricks PR --- config/default.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index da7c361c64..6daba02e79 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -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.107_h12_magpie.tgz", - cellular = "rev4.107_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.107_h12_validation.tgz", +cfg$input <- c(regional = "rev4.106_h12_magpie.tgz", + cellular = "rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.106_h12_validation.tgz", additional = "additional_data_rev4.48.tgz", calibration = "calibration_H12_26Mar24.tgz") From b4dcbb758dbfa29a199df4dc6c06b03c6098df06 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Fri, 26 Apr 2024 18:01:58 +0200 Subject: [PATCH 056/280] bugfixes in EAT project start scripts --- scripts/start/projects/project_EAT2p0.R | 73 +++++++++++++------ .../start/projects/project_EAT2p0_DeepDive.R | 46 ++++++------ 2 files changed, 75 insertions(+), 44 deletions(-) diff --git a/scripts/start/projects/project_EAT2p0.R b/scripts/start/projects/project_EAT2p0.R index 901aaa42d3..674b1c3c57 100644 --- a/scripts/start/projects/project_EAT2p0.R +++ b/scripts/start/projects/project_EAT2p0.R @@ -129,9 +129,6 @@ waste <- function(cfg) { # where miti is active. # Reference: Humpenöder, F., Popp, A., Merfort, L., Luderer, G., Weindl, I., Bodirsky, B., Stevanović, M., Klein, D., Rodrigues, R., Bauer, N., Dietrich, J., Lotze-Campen, H., & Rockström, J. (2023). Data repository - Dietary shifts increase the feasibility of 1.5°C pathways (Version 1) [Data set]. Zenodo. https://doi.org/10.5281/zenodo.8328217 miti <- function(cfg) { - # NDCs - cfg <- setScenario(cfg, c("SSP2", "NDC")) - # Mitigation: consistent with 1.5C considering diet change cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive/remind/output/C_SSP2EU-DSPkB500-noDS-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS-rem-5.mif" cfg$gms$c56_pollutant_prices <- "coupling" @@ -141,15 +138,6 @@ miti <- function(cfg) { return(cfg) } -### NoCC component ## -# No climate change impacts -noCC <- function(cfg) { - # deactivate climate change impacts - cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI")) - - return(cfg) -} - ### RCP 2.6 ### # Decomposition Scenario. Apply lower climate impacts based on RCP 2.6 to BAU using GFDL climate model. rcp26 <- function(cfg) { @@ -165,6 +153,9 @@ rcp26 <- function(cfg) { # Business as usual scenario based on SSP2 # with a higher climate impact reflected by RCP 7.0 cfg$title <- "BAU" +# standard setting +cfg <- setScenario(cfg, c("cc", "SSP2", "NPI")) +# scenario settings cfg <- bau(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -172,6 +163,9 @@ start_run(cfg, codeCheck = FALSE) # Decomposition scenario. Adds EL2.0 Diet to BAU: # Globally achieves EL2 diet by 2050 # To Do: Check implemention! cfg$title <- "BAU_DIET" +# standard setting +cfg <- setScenario(cfg, c("cc", "SSP2", "NPI")) +# scenario settings cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -179,6 +173,9 @@ start_run(cfg, codeCheck = FALSE) # BAU_PROD # # Decomposition scenario adds high productivity to BAU cfg$title <- "BAU_PROD" +# standard setting +cfg <- setScenario(cfg, c("cc", "SSP2", "NPI")) +# scenario settings cfg <- bau(cfg = cfg) cfg <- prod(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -186,6 +183,9 @@ start_run(cfg, codeCheck = FALSE) # BAU_WAST # # Decomposition scenario. Adds a reduction (halving) of food loss and waste cfg$title <- "BAU_WAST" +# standard setting +cfg <- setScenario(cfg, c("cc", "SSP2", "NPI")) +# scenario settings cfg <- bau(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -193,6 +193,9 @@ start_run(cfg, codeCheck = FALSE) # BAU_RCP26 # # Decomposition Scenario. Apply lower climate impacts based on RCP 2.6 to BAU cfg$title <- "BAU_RCP26" +# standard setting +cfg <- setScenario(cfg, c("cc", "SSP2", "NPI")) +# scenario settings cfg <- bau(cfg = cfg) cfg <- rcp26(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -200,20 +203,28 @@ start_run(cfg, codeCheck = FALSE) # BAU_NoCC # # Decomposition scenario. Remove climate impacts (NoCC) from BAU to isolate climate effects cfg$title <- "BAU_NoCC" +# standard setting, but without CC +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI")) +# scenario settings cfg <- bau(cfg = cfg) -cfg <- noCC(cfg = cfg) start_run(cfg, codeCheck = FALSE) # BAU_MITI # # Decomposition Scenario. Adds mitigation and land-use policies consistent with 1.5C by 2050 to BAU cfg$title <- "BAU_MITI" -cfg <- bau(cfg = cfg) +# standard setting, but with NDC activated (for miti) +cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) +# scenario settings cfg <- miti(cfg = cfg) +cfg <- bau(cfg = cfg) start_run(cfg, codeCheck = FALSE) # EL2 # # Full EAT-Lancet Scenario (diet, productivity, FLW) without mitigation and higher climate impacts based on RCP 7.0 cfg$title <- "EL2" +# standard setting +cfg <- setScenario(cfg, c("cc", "SSP2", "NPI")) +# scenario settings cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) @@ -223,68 +234,88 @@ start_run(cfg, codeCheck = FALSE) # ELM # # Full EAT-Lancet scenario (diet, productivity, FLW) with mitigation policies consistent with 1.5C. Climate based on a lower climate impacts with RCP 2.6 cfg$title <- "ELM" +# standard setting, but with NDC activated (for miti) +cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) +# scenario settings +cfg <- miti(cfg = cfg) cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) -cfg <- miti(cfg = cfg) cfg <- rcp26(cfg = cfg) start_run(cfg, codeCheck = FALSE) # ELM_Diet # # Decomposition Scenario. Removes Diet from ELM cfg$title <- "ELM_DIET" +# standard setting, but with NDC activated (for miti) +cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) +# scenario settings +cfg <- miti(cfg = cfg) cfg <- bau(cfg = cfg) cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) -cfg <- miti(cfg = cfg) cfg <- rcp26(cfg = cfg) start_run(cfg, codeCheck = FALSE) # ELM_PROD # # Decomposition Scenario. Removed productivity trend from ELM cfg$title <- "ELM_PROD" +# standard setting, but with NDC activated (for miti) +cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) +# scenario settings +cfg <- miti(cfg = cfg) cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- waste(cfg = cfg) -cfg <- miti(cfg = cfg) cfg <- rcp26(cfg = cfg) start_run(cfg, codeCheck = FALSE) # ELM_WAST # # Decomposition Scenario. Removes FLW from ELM cfg$title <- "ELM_WAST" +# standard setting, but with NDC activated (for miti) +cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) +# scenario settings +cfg <- miti(cfg = cfg) cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) -cfg <- miti(cfg = cfg) cfg <- rcp26(cfg = cfg) start_run(cfg, codeCheck = FALSE) # ELM_RCP70 # # Decomposition Scenario. Applies RCP 7.0 climate impacts to ELM cfg$title <- "ELM_RCP70" +# standard setting, but with NDC activated (for miti) +cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) +# scenario settings +cfg <- miti(cfg = cfg) cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) -cfg <- miti(cfg = cfg) start_run(cfg, codeCheck = FALSE) # ELM_NoCC # # Decomposition Scenario. Removes climate impacts (NoCC) from ELM cfg$title <- "ELM_NoCC" +# standard setting, but with NDC activated (for miti) and without CC +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC")) +# scenario settings +cfg <- miti(cfg = cfg) cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) -cfg <- miti(cfg = cfg) -cfg <- noCC(cfg = cfg) start_run(cfg, codeCheck = FALSE) # ELM_MITI # # Decomposition Scenario. Removes climate mitigation and LUC policies from ELM cfg$title <- "ELM_MITI" +# standard setting, but with NDC activated (for miti) +cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) +# scenario settings cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index bebf4dae73..0905c38a40 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -125,24 +125,19 @@ waste <- function(cfg) { # We use a GHG pricing pathway based on a peak budget of 500 with overshoot # starting from 2020 and diet shift. miti <- function(cfg) { - # NDCs - cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC")) # Mitigation: consistent with 1.5C considering Diet change cfg$gms$c56_pollutant_prices <- "coupling" cfg$gms$c60_2ndgen_biodem <- "coupling" - cfg$gms$c56_emis_policy <- "ecoSysProtAll" + cfg$gms$c56_emis_policy <- "ecoSysProtAll" return(cfg) } # Bioenergy demand only. No carbon price on land included. bioenergy <- function(cfg) { - # NDCs - cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC")) - # No ghg pricing in land system - # Bioenergy demand from coupled REMIND-MAgPIE run where 1.5 is reached with ghg prices on land and considering diet shift + # Mitigation: only Bioenergy demand from coupled REMIND-MAgPIE run where 1.5 is reached with ghg prices on land and considering diet shift cfg$gms$c60_2ndgen_biodem <- "coupling" return(cfg) @@ -150,24 +145,20 @@ bioenergy <- function(cfg) { # CO2 from land use change is priced. priceCO2 <- function(cfg) { - # NDCs - cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC")) - # Mitigation: consistent with 1.5C considering Diet change + # Mitigation: only price land CO2 cfg$gms$c56_pollutant_prices <- "coupling" - cfg$gms$c56_emis_policy <- "ecoSysProtAll" + cfg$gms$c56_emis_policy <- "ecoSysProtAll" return(cfg) } # Pricing of all CH4 and N2O emissions except for peatland priceNonCO2 <- function(cfg) { - # NDCs - cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC")) - # Mitigation: consistent with 1.5C considering Diet change + # Mitigation: only CH4 and N2O price cfg$gms$c56_pollutant_prices <- "coupling" - cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" + cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" return(cfg) } @@ -204,7 +195,7 @@ start_run(cfg, codeCheck = FALSE) cfg$title <- "BAU_Bioenergy" cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) -cfg <- bioenergy(cfg = cfg) +cfg <- bioenergy(cfg = cfg) # NDC or not? start_run(cfg, codeCheck = FALSE) # BAU + pricing of CO2 in land sector # @@ -226,18 +217,22 @@ start_run(cfg, codeCheck = FALSE) # MITI_Diet (mitigation - PHD) # # All production-side land-based mitigation measures, but no demand-side mitigation (diet change) cfg$title <- "MITI_Diet" +# standard setting, but with NDC for miti cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings cfg <- bau(cfg = cfg) -# Mititgation +# Mitigation cfg <- miti(cfg = cfg) start_run(cfg, codeCheck = FALSE) # MITI_Bioenergy (mitigation - bioenergy) # # CO2 and non-CO2 pricing and demand-side mitigation (diet change), but no bioenergy demand from REMIND cfg$title <- "MITI_Bioenergy" +# standard setting, but with NDC for miti cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings cfg <- bau(cfg = cfg) -# Mititgation +# Mitigation cfg <- miti(cfg = cfg) cfg$gms$c60_2ndgen_biodem <- "none" # PHD @@ -249,9 +244,11 @@ start_run(cfg, codeCheck = FALSE) # MITI_CO2 (mitigation - CO2) # # non-CO2 pricing and bioenergy demand from REMIND and demand-side mitigation (diet change), but no CO2 pricing in land-system cfg$title <- "MITI_CO2" +# standard setting, but with NDC for miti cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings cfg <- bau(cfg = cfg) -# Mititgation +# Mitigation cfg <- miti(cfg = cfg) cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" # PHD @@ -263,9 +260,11 @@ start_run(cfg, codeCheck = FALSE) # MITI_nonCO2 (mitigation - non-CO2) # # CO2 pricing and bioenergy demand from REMIND and demand-side mitigation (diet change), but no non-CO2 pricing in land-system cfg$title <- "MITI_nonCO2" +# standard setting, but with NDC for miti cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings cfg <- bau(cfg = cfg) -# Mititgation +# Mitigation cfg <- miti(cfg = cfg) cfg$gms$c56_emis_policy <- "ecoSysProtAll" # PHD @@ -274,15 +273,16 @@ cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) - # MITI_Full # # All production-side land-based mitigation measures and demand-side mitigation (diet change) cfg$title <- "MITI_Full" +# standard setting, but with NDC for miti cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings cfg <- bau(cfg = cfg) -# Mititgation +# Mitigation (CO2, non-CO2, bioenergy) cfg <- miti(cfg = cfg) -# PHD +# PHD (diet, prod, waste) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) From a4c48c4d3ff2cf9286b8be6d5ad1cbe392582543 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Fri, 26 Apr 2024 18:03:25 +0200 Subject: [PATCH 057/280] remove unneeded comment from start script --- scripts/start/projects/project_EAT2p0_DeepDive.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index 0905c38a40..26129cfaea 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -195,7 +195,7 @@ start_run(cfg, codeCheck = FALSE) cfg$title <- "BAU_Bioenergy" cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) -cfg <- bioenergy(cfg = cfg) # NDC or not? +cfg <- bioenergy(cfg = cfg) start_run(cfg, codeCheck = FALSE) # BAU + pricing of CO2 in land sector # From a755ee5ec8ef9f9272947bd084711f8e8e3bbf49 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 26 Apr 2024 22:28:29 +0200 Subject: [PATCH 058/280] bugfixes --- modules/29_cropland/detail_apr24/scaling.gms | 2 +- modules/32_forestry/dynamic_feb21/scaling.gms | 2 +- modules/35_natveg/dynamic_feb21/presolve.gms | 6 +++--- modules/35_natveg/dynamic_feb21/scaling.gms | 4 ++-- modules/80_optimization/nlp_par/solve.gms | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/29_cropland/detail_apr24/scaling.gms b/modules/29_cropland/detail_apr24/scaling.gms index ce898e661a..1a421079e2 100644 --- a/modules/29_cropland/detail_apr24/scaling.gms +++ b/modules/29_cropland/detail_apr24/scaling.gms @@ -5,4 +5,4 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -v29_treecover.scale(j,ac) = 1e-6; +v29_treecover.scale(j,ac) = 1e-3; diff --git a/modules/32_forestry/dynamic_feb21/scaling.gms b/modules/32_forestry/dynamic_feb21/scaling.gms index ba76c8104b..7b86cdf19a 100644 --- a/modules/32_forestry/dynamic_feb21/scaling.gms +++ b/modules/32_forestry/dynamic_feb21/scaling.gms @@ -10,4 +10,4 @@ v32_cost_recur.scale(i) = 10e4; vm_cost_fore.scale(i) = 10e4; v32_cost_hvarea.scale(i)$(s32_hvarea = 1 OR s32_hvarea = 2) = 10e3; vm_cdr_aff.scale(j,ac,aff_effect) = 10e-4; -v32_land.scale(j,type32,ac) = 1e-6; +v32_land.scale(j,type32,ac) = 1e-3; diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/dynamic_feb21/presolve.gms index 0a656ec42b..c2ad686cbe 100644 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ b/modules/35_natveg/dynamic_feb21/presolve.gms @@ -55,9 +55,9 @@ vm_land.l(j,"primforest") = pcm_land(j,"primforest"); *' If the vegetation carbon density in a simulation unit due to regrowth *' exceeds a threshold of 20 tC/ha the respective area is shifted from other natural land to secondary forest. p35_recovered_forest(t,j,ac)$(not sameas(ac,"acx")) = - p35_other(t,j,ac)$(pm_carbon_density_ac(t,j,ac,"vegc") > 20); -p35_other(t,j,ac) = p35_other(t,j,ac) - p35_recovered_forest(t,j,ac); -p35_secdforest(t,j,ac) = p35_secdforest(t,j,ac) + p35_recovered_forest(t,j,ac); + pc35_other(j,ac)$(pm_carbon_density_ac(t,j,ac,"vegc") > 20); +pc35_other(j,ac) = pc35_other(j,ac) - p35_recovered_forest(t,j,ac); +pc35_secdforest(j,ac) = pc35_secdforest(j,ac) + p35_recovered_forest(t,j,ac); *' @stop diff --git a/modules/35_natveg/dynamic_feb21/scaling.gms b/modules/35_natveg/dynamic_feb21/scaling.gms index a79952fc6f..e49ef49e78 100644 --- a/modules/35_natveg/dynamic_feb21/scaling.gms +++ b/modules/35_natveg/dynamic_feb21/scaling.gms @@ -6,5 +6,5 @@ *** | Contact: magpie@pik-potsdam.de vm_cost_hvarea_natveg.scale(i)$(s35_hvarea = 1 OR s35_hvarea = 2) = 10e4; -v35_other.scale(j,ac) = 1e-6; -v35_secdforest.scale(j,ac) = 1e-6; +v35_other.scale(j,ac) = 1e-3; +v35_secdforest.scale(j,ac) = 1e-3; diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 4db21bc22d..5af9ddba83 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -116,7 +116,7 @@ repeat j2(j) = no; ); ); -display$readyCollect(p80_handle,INF) 'Problem waiting for next instance to complete'; +*display$readyCollect(p80_handle,INF) 'Problem waiting for next instance to complete'; until card(p80_handle) = 0 OR smax(h, p80_counter(h)) >= s80_maxiter; if (smax(h,p80_modelstat(t,h)) > 2 and smax(h,p80_modelstat(t,h)) ne 7, From b6fb4891433b6d90ca5ea9d099b39ff8b07a9b9e Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 27 Apr 2024 09:39:25 +0200 Subject: [PATCH 059/280] bugfix --- scripts/output/extra/highres.R | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/output/extra/highres.R b/scripts/output/extra/highres.R index 3d250abb7a..b018934d7f 100644 --- a/scripts/output/extra/highres.R +++ b/scripts/output/extra/highres.R @@ -102,7 +102,6 @@ highres <- function(cfg) { cfg$files2export$start <- c(cfg$files2export$start, paste0(cfg$results_folder, "/", "magpie_y1995.gdx")) cfg$gms$s_use_gdx <- 1 - cfg$gms$s80_optfile <- 1 #max resources for parallel runs cfg$qos <- "standby_maxMem_dayMax" From c6c4756ce3b3c8d5d0488feed98332b7dfe14ad8 Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 28 Apr 2024 07:19:05 +0200 Subject: [PATCH 060/280] bugfix --- modules/80_optimization/nlp_par/declarations.gms | 2 +- modules/80_optimization/nlp_par/solve.gms | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/80_optimization/nlp_par/declarations.gms b/modules/80_optimization/nlp_par/declarations.gms index 7a8f5e5b71..1cbf6971aa 100644 --- a/modules/80_optimization/nlp_par/declarations.gms +++ b/modules/80_optimization/nlp_par/declarations.gms @@ -9,11 +9,11 @@ parameters p80_modelstat(t,h) modelstat indicator (1) p80_counter(h) counter (1) p80_handle(h) parallel mode handle parameter (1) + p80_resolve(h) indicator for restarting solve (1) ; scalars s80_counter counter (1) s80_modelstat_previter modelstat of previous iteration (1) s80_optfile_previter optfile used in previous iteration (1) - s80_resolve indicator for restarting solve (1) ; diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 5af9ddba83..a1ad4bf5cc 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -39,6 +39,7 @@ loop(h, i2(i)$supreg(h,i) = yes; loop(i2, j2(j)$cell(i2,j) = yes); solve magpie USING nlp MINIMIZING vm_cost_glo; + solve magpie USING nlp MINIMIZING vm_cost_glo; h2(h) = no; i2(i) = no; j2(j) = no; @@ -50,7 +51,7 @@ repeat loop(h$p80_handle(h), if(handleStatus(p80_handle(h)) = 2, p80_counter(h) = p80_counter(h) + 1; - s80_resolve = 1; + p80_resolve(h) = 1; magpie.handle = p80_handle(h); execute_loadhandle magpie; @@ -74,19 +75,19 @@ repeat option AsyncSolLst=1; display$handlecollect(p80_handle(h)) 're-collect'; option AsyncSolLst=0; - s80_resolve = 0; + p80_resolve(h) = 0; ); display$handledelete(p80_handle(h)) 'trouble deleting handles' ; if (p80_modelstat(t,h) <= 2, display "Model status <= 2. Handle cleared."; - s80_resolve = 0; + p80_resolve(h) = 0; p80_handle(h) = 0; ); if (s80_extra_solve = 1, - if (s80_resolve = 1, + if (p80_resolve(h) = 1, display "Resolve" if (p80_modelstat(t,h) ne s80_modelstat_previter, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; @@ -116,6 +117,7 @@ repeat j2(j) = no; ); ); +display$sleep(card(p80_handle)*60) 'sleep some time'; *display$readyCollect(p80_handle,INF) 'Problem waiting for next instance to complete'; until card(p80_handle) = 0 OR smax(h, p80_counter(h)) >= s80_maxiter; From f22f7361b47ee0dc3b6d0dd8897fc20bad027c5f Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 28 Apr 2024 08:32:32 +0200 Subject: [PATCH 061/280] bugfix --- modules/80_optimization/nlp_par/solve.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index a1ad4bf5cc..7be1af044b 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -117,8 +117,8 @@ repeat j2(j) = no; ); ); -display$sleep(card(p80_handle)*60) 'sleep some time'; -*display$readyCollect(p80_handle,INF) 'Problem waiting for next instance to complete'; +display$sleep(card(p80_handle)*0.2) 'sleep some time'; +display$readyCollect(p80_handle,INF) 'Problem waiting for next instance to complete'; until card(p80_handle) = 0 OR smax(h, p80_counter(h)) >= s80_maxiter; if (smax(h,p80_modelstat(t,h)) > 2 and smax(h,p80_modelstat(t,h)) ne 7, From 14eea422318b2b562a1a0490496c90439fa35a29 Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 28 Apr 2024 10:20:54 +0200 Subject: [PATCH 062/280] bugfix --- modules/80_optimization/nlp_par/solve.gms | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 7be1af044b..a2753f7565 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -92,15 +92,18 @@ repeat if (p80_modelstat(t,h) ne s80_modelstat_previter, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; solve magpie USING nlp MINIMIZING vm_cost_glo; + solve magpie USING nlp MINIMIZING vm_cost_glo; elseif p80_modelstat(t,h) = s80_modelstat_previter, if(magpie.optfile = s80_optfile_previter, display "Modelstat > 2 | Retry solve without CONOPT4 pre-processing"; magpie.optfile = 2; solve magpie USING nlp MINIMIZING vm_cost_glo; + solve magpie USING nlp MINIMIZING vm_cost_glo; else display "Modelstat > 2 | Retry solve with CONOPT3"; option nlp = conopt; solve magpie USING nlp MINIMIZING vm_cost_glo; + solve magpie USING nlp MINIMIZING vm_cost_glo; option nlp = conopt4; ); ); From a723bd9180784a88faab8270f095b38ee3b65015 Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 28 Apr 2024 12:34:54 +0200 Subject: [PATCH 063/280] bugfix --- config/default.cfg | 8 +------- .../80_optimization/lp_nlp_apr17/input.gms | 3 +-- .../80_optimization/lp_nlp_apr17/solve.gms | 19 +++++++++---------- modules/80_optimization/nlp_apr17/input.gms | 3 +-- modules/80_optimization/nlp_apr17/solve.gms | 4 +--- modules/80_optimization/nlp_par/input.gms | 3 +-- modules/80_optimization/nlp_par/solve.gms | 4 +--- 7 files changed, 15 insertions(+), 29 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 80c48514fb..ed15c35ff4 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1953,7 +1953,7 @@ cfg$gms$s73_expansion <- 0 # def = 0 cfg$gms$optimization <- "nlp_apr17" # def = nlp_apr17 # maximal number of solve iterations -cfg$gms$s80_maxiter <- 30 +cfg$gms$s80_maxiter <- 10 # def = 10 # Solver settings only for realization `lp_nlp_apr17`. All other realizations use `conopt4`. # * (conopt4): conopt4 @@ -1965,12 +1965,6 @@ cfg$gms$c80_nlp_solver <- "conopt4" # def = conopt4 # * 0: default settings (optfile will be ignored) cfg$gms$s80_optfile <- 0 # def = 0 -# switch to use alternative solver settings if CONOPT4 fails -# * 0: not used -# * 1: additional solve statements for CONOPT4 without preprocessing and CONOPT3 -# * Note: Option 1 is very time-consuming and usually does not provide a feasible solution. -cfg$gms$s80_extra_solve <- 0 # def = 0 - #*******************************END MODULE SETUP******************************** #### Other settings (e.g. clustering, gdx files, ...): #### diff --git a/modules/80_optimization/lp_nlp_apr17/input.gms b/modules/80_optimization/lp_nlp_apr17/input.gms index a157e8bf5a..83427b7cfe 100644 --- a/modules/80_optimization/lp_nlp_apr17/input.gms +++ b/modules/80_optimization/lp_nlp_apr17/input.gms @@ -6,11 +6,10 @@ *** | Contact: magpie@pik-potsdam.de scalars - s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / + s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 10 / s80_optfile switch to use specfied solver settings (1) / 0 / s80_add_cplex add cplex optimization after conopt4 (1) / 0 / s80_add_conopt3 add conopt3 optimization after conopt4 (1) / 0 / - s80_extra_solve switch to use alternative solver settings (1) / 0 / ; diff --git a/modules/80_optimization/lp_nlp_apr17/solve.gms b/modules/80_optimization/lp_nlp_apr17/solve.gms index 62650b1c1e..85ec1ef813 100644 --- a/modules/80_optimization/lp_nlp_apr17/solve.gms +++ b/modules/80_optimization/lp_nlp_apr17/solve.gms @@ -143,25 +143,24 @@ $batinclude "./modules/include.gms" nl_relax option nlp = conopt4; ); -if (s80_extra_solve = 1, * if solve stopped with an error, try it again without pre-processing if((magpie.modelstat = 13), display "WARNING: Modelstat 13 | retry without Conopt4 pre-processing"; - magpie.optfile = 2 + magpie.optfile = 2 solve magpie USING nlp MINIMIZING vm_cost_glo; solve magpie USING nlp MINIMIZING vm_cost_glo; magpie.optfile = s80_optfile ; ); * if solve stopped with an error, try it again with conopt3 - if ((magpie.modelstat = 13), - display "WARNING: Modelstat 13 | retry with CONOPT3!"; - option nlp = conopt; - solve magpie USING nlp MINIMIZING vm_cost_glo; - solve magpie USING nlp MINIMIZING vm_cost_glo; - option nlp = conopt4; - ); -); + if ((magpie.modelstat = 13), + display "WARNING: Modelstat 13 | retry with CONOPT3!"; + option nlp = conopt; + solve magpie USING nlp MINIMIZING vm_cost_glo; + solve magpie USING nlp MINIMIZING vm_cost_glo; + option nlp = conopt4; + ); + p80_modelstat(t) = magpie.modelstat; p80_num_nonopt(t) = magpie.numNOpt; diff --git a/modules/80_optimization/nlp_apr17/input.gms b/modules/80_optimization/nlp_apr17/input.gms index 16536ff584..b26b854d44 100644 --- a/modules/80_optimization/nlp_apr17/input.gms +++ b/modules/80_optimization/nlp_apr17/input.gms @@ -6,7 +6,6 @@ *** | Contact: magpie@pik-potsdam.de scalars - s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / + s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 10 / s80_optfile switch to use specfied solver settings (1) / 0 / - s80_extra_solve switch to use alternative solver settings (1) / 0 / ; diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index bb4edc2c31..bae758fec1 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -41,8 +41,7 @@ display vm_cost_glo.l; display magpie.modelstat; * in case of problems try different solvers and optfile settings -if (s80_extra_solve = 1, - if (magpie.modelstat > 2, +if (magpie.modelstat > 2, repeat( s80_counter = s80_counter + 1 ; @@ -83,7 +82,6 @@ if (s80_extra_solve = 1, until (magpie.modelstat <= 2 or s80_counter >= s80_maxiter) ); - ); ); p80_modelstat(t) = magpie.modelstat; diff --git a/modules/80_optimization/nlp_par/input.gms b/modules/80_optimization/nlp_par/input.gms index bc0dc6e7ce..eaf3fdd672 100644 --- a/modules/80_optimization/nlp_par/input.gms +++ b/modules/80_optimization/nlp_par/input.gms @@ -6,7 +6,6 @@ *** | Contact: magpie@pik-potsdam.de scalars - s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / + s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 10 / s80_optfile switch to use specfied solver settings (1) / 0 / - s80_extra_solve switch to use alternative solver settings (1) / 0 / ; diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index a2753f7565..8b95ef6ff2 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -86,8 +86,7 @@ repeat p80_handle(h) = 0; ); - if (s80_extra_solve = 1, - if (p80_resolve(h) = 1, + if (p80_resolve(h) = 1, display "Resolve" if (p80_modelstat(t,h) ne s80_modelstat_previter, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; @@ -113,7 +112,6 @@ repeat magpie.handle = 1; ); p80_handle(h) = magpie.handle; - ); ); h2(h) = no; i2(i) = no; From f80ee75ea92b60ed981b82cb838a942aab6f4b47 Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 28 Apr 2024 14:40:32 +0200 Subject: [PATCH 064/280] scaling --- modules/29_cropland/detail_apr24/scaling.gms | 2 -- modules/32_forestry/dynamic_feb21/scaling.gms | 1 - modules/35_natveg/dynamic_feb21/scaling.gms | 2 -- 3 files changed, 5 deletions(-) diff --git a/modules/29_cropland/detail_apr24/scaling.gms b/modules/29_cropland/detail_apr24/scaling.gms index 1a421079e2..3a209b115b 100644 --- a/modules/29_cropland/detail_apr24/scaling.gms +++ b/modules/29_cropland/detail_apr24/scaling.gms @@ -4,5 +4,3 @@ *** | AGPL-3.0, you are granted additional permissions described in the *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de - -v29_treecover.scale(j,ac) = 1e-3; diff --git a/modules/32_forestry/dynamic_feb21/scaling.gms b/modules/32_forestry/dynamic_feb21/scaling.gms index 7b86cdf19a..284349ec52 100644 --- a/modules/32_forestry/dynamic_feb21/scaling.gms +++ b/modules/32_forestry/dynamic_feb21/scaling.gms @@ -10,4 +10,3 @@ v32_cost_recur.scale(i) = 10e4; vm_cost_fore.scale(i) = 10e4; v32_cost_hvarea.scale(i)$(s32_hvarea = 1 OR s32_hvarea = 2) = 10e3; vm_cdr_aff.scale(j,ac,aff_effect) = 10e-4; -v32_land.scale(j,type32,ac) = 1e-3; diff --git a/modules/35_natveg/dynamic_feb21/scaling.gms b/modules/35_natveg/dynamic_feb21/scaling.gms index e49ef49e78..c4a52d9d82 100644 --- a/modules/35_natveg/dynamic_feb21/scaling.gms +++ b/modules/35_natveg/dynamic_feb21/scaling.gms @@ -6,5 +6,3 @@ *** | Contact: magpie@pik-potsdam.de vm_cost_hvarea_natveg.scale(i)$(s35_hvarea = 1 OR s35_hvarea = 2) = 10e4; -v35_other.scale(j,ac) = 1e-3; -v35_secdforest.scale(j,ac) = 1e-3; From ea597be7c8d77eb949f8f5154d81e879accf57a3 Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 28 Apr 2024 15:00:31 +0200 Subject: [PATCH 065/280] scaleopt --- config/default.cfg | 3 +++ modules/80_optimization/lp_nlp_apr17/input.gms | 1 + modules/80_optimization/lp_nlp_apr17/solve.gms | 2 +- modules/80_optimization/nlp_apr17/input.gms | 1 + modules/80_optimization/nlp_apr17/solve.gms | 2 +- modules/80_optimization/nlp_par/input.gms | 1 + modules/80_optimization/nlp_par/solve.gms | 2 +- 7 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index ed15c35ff4..e9e5d75ce0 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1965,6 +1965,9 @@ cfg$gms$c80_nlp_solver <- "conopt4" # def = conopt4 # * 0: default settings (optfile will be ignored) cfg$gms$s80_optfile <- 0 # def = 0 +# switch for scaling (1=on 0=off) +cfg$gms$s80_scaleopt <- 1 # def = 1 + #*******************************END MODULE SETUP******************************** #### Other settings (e.g. clustering, gdx files, ...): #### diff --git a/modules/80_optimization/lp_nlp_apr17/input.gms b/modules/80_optimization/lp_nlp_apr17/input.gms index 83427b7cfe..cd820db042 100644 --- a/modules/80_optimization/lp_nlp_apr17/input.gms +++ b/modules/80_optimization/lp_nlp_apr17/input.gms @@ -10,6 +10,7 @@ scalars s80_optfile switch to use specfied solver settings (1) / 0 / s80_add_cplex add cplex optimization after conopt4 (1) / 0 / s80_add_conopt3 add conopt3 optimization after conopt4 (1) / 0 / + s80_scaleopt switch to for scaling (1=on 0=off) / 1 / ; diff --git a/modules/80_optimization/lp_nlp_apr17/solve.gms b/modules/80_optimization/lp_nlp_apr17/solve.gms index 85ec1ef813..829a984953 100644 --- a/modules/80_optimization/lp_nlp_apr17/solve.gms +++ b/modules/80_optimization/lp_nlp_apr17/solve.gms @@ -12,7 +12,7 @@ p80_modelstat(t) = 1; *** solver settings magpie.optfile = s80_optfile ; -magpie.scaleopt = 1 ; +magpie.scaleopt = s80_scaleopt ; magpie.solprint = 0 ; magpie.holdfixed = 1 ; diff --git a/modules/80_optimization/nlp_apr17/input.gms b/modules/80_optimization/nlp_apr17/input.gms index b26b854d44..c1a0df02cc 100644 --- a/modules/80_optimization/nlp_apr17/input.gms +++ b/modules/80_optimization/nlp_apr17/input.gms @@ -8,4 +8,5 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 10 / s80_optfile switch to use specfied solver settings (1) / 0 / + s80_scaleopt switch to for scaling (1=on 0=off) / 1 / ; diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index bae758fec1..bd4ecef577 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -14,7 +14,7 @@ s80_optfile_previter = s80_optfile; *** solver settings option nlp = conopt4; magpie.optfile = s80_optfile; -magpie.scaleopt = 1 ; +magpie.scaleopt = s80_scaleopt ; magpie.solprint = 0 ; magpie.holdfixed = 1 ; diff --git a/modules/80_optimization/nlp_par/input.gms b/modules/80_optimization/nlp_par/input.gms index eaf3fdd672..24b78e9ea7 100644 --- a/modules/80_optimization/nlp_par/input.gms +++ b/modules/80_optimization/nlp_par/input.gms @@ -8,4 +8,5 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 10 / s80_optfile switch to use specfied solver settings (1) / 0 / + s80_scaleopt switch to for scaling (1=on 0=off) / 1 / ; diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 8b95ef6ff2..2021e8ddcd 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -14,7 +14,7 @@ p80_modelstat(t,h) = 14; option nlp = conopt4; magpie.solvelink = 3; magpie.optfile = s80_optfile ; -magpie.scaleopt = 1 ; +magpie.scaleopt = s80_scaleopt ; magpie.solprint = 0 ; magpie.holdfixed = 1 ; From e8fd179962927f1b804f8cf1fa35ff6ceba1c40f Mon Sep 17 00:00:00 2001 From: Felicitas Date: Mon, 29 Apr 2024 15:23:23 +0200 Subject: [PATCH 066/280] bugfixes in EL2 start script for Deep Dive --- .../start/projects/project_EAT2p0_DeepDive.R | 113 ++++++++++-------- 1 file changed, 62 insertions(+), 51 deletions(-) diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index 26129cfaea..9346c4af5d 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -28,15 +28,17 @@ cfg$force_download <- TRUE # Special outputs required for Deep Dive cfg$qos <- "standby_maxMem_dayMax" -cfg$output <- c("output_check", - "extra/highres", - "extra/disaggregation", - "projects/FSEC_nitrogenPollution", - "projects/FSEC_water", - "agmip_report", - "runBlackmagicc", - # add output file: pb_report (magpie (special mif created by getReportPBindicators & remind mif (REMIND_generic_scenName.mif)) - "rds_report") +cfg$output <- c( + "output_check", + "extra/highres", + "extra/disaggregation", + "projects/FSEC_nitrogenPollution", + "projects/FSEC_water", + "agmip_report", + "runBlackmagicc", + # add output file: pb_report (magpie (special mif created by getReportPBindicators & remind mif (REMIND_generic_scenName.mif)) + "rds_report" +) ####################### # SCENARIO DEFINITION # @@ -56,26 +58,25 @@ cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) # RCP/GCM: 7p0 shocks on crops, livestock, labor # Trade: BAU bau <- function(cfg) { - ### Components for Decomposition ### # Diets: exogenous EATLancet diet - cfg$gms$s15_exo_diet <- 0 # default + cfg$gms$s15_exo_diet <- 0 # default cfg$gms$c15_kcal_scen <- "healthy_BMI" # default (but not active b/c of s15_exo_diet = 0) - cfg$gms$c15_EAT_scen <- "FLX" # default (but not active b/c of s15_exo_diet = 0) + cfg$gms$c15_EAT_scen <- "FLX" # default (but not active b/c of s15_exo_diet = 0) # Waste: half food waste - cfg$gms$s15_exo_waste <- 0 # default - cfg$gms$s15_waste_scen <- 1.2 # default (but not active b/c of s15_exo_waste = 0) + cfg$gms$s15_exo_waste <- 0 # default + cfg$gms$s15_waste_scen <- 1.2 # default (but not active b/c of s15_exo_waste = 0) # Default interest rate (for default productivity) - cfg$gms$s12_interest_lic <- 0.1 # default - cfg$gms$s12_interest_hic <- 0.04 # default + cfg$gms$s12_interest_lic <- 0.1 # default + cfg$gms$s12_interest_hic <- 0.04 # default # Default livestock productivity - cfg$gms$c70_feed_scen <- "ssp2" # default - # Mitigation: no mitigation beyond NDC (NDC set in setScenario) - cfg$gms$c56_emis_policy <- "none" - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive/remind/output/C_SSP2EU-DSPkB500-noDS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS_betax-rem-5.mif" - cfg$gms$c56_pollutant_prices <- "none" - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive/remind/output/C_SSP2EU-DSPkB500-noDS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS_betax-rem-5.mif" - cfg$gms$c60_2ndgen_biodem <- "none" + cfg$gms$c70_feed_scen <- "ssp2" # default + # Mitigation: no mitigation beyond NPi + cfg$gms$c56_emis_policy <- "none" + cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-Npi_nonSus-rem-5/REMIND_generic_C_SSP2EU-Npi_nonSus-rem-5.mif" + cfg$gms$c56_pollutant_prices <- "coupling" + cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-Npi_nonSus-rem-5/REMIND_generic_C_SSP2EU-Npi_nonSus-rem-5.mif" + cfg$gms$c60_2ndgen_biodem <- "coupling" ### Deactivate certain sustainability standard settings # bioenergy plantations can be irrigated @@ -84,16 +85,16 @@ bau <- function(cfg) { cfg$gms$s32_aff_plantation <- 1 # Setting REMIND scenario for blackmagicc - cfg$magicc_emis_scen <- "SSP2EU-DSPkB500-DS_betax" - + cfg$magicc_emis_scen <- "SSP2EU-DSPkB650-DS_betax" + return(cfg) } ### Diet component ## # Globally achieves EL2 diet by 2050 diet <- function(cfg) { - cfg$gms$s15_exo_diet <- 3 - + cfg$gms$s15_exo_diet <- 3 + return(cfg) } @@ -114,7 +115,7 @@ prod <- function(cfg) { # Reduction (halving) of food loss and waste waste <- function(cfg) { # Waste: half food waste - cfg$gms$s15_exo_waste <- 1 + cfg$gms$s15_exo_waste <- 1 cfg$gms$s15_waste_scen <- 1.2 return(cfg) } @@ -125,40 +126,42 @@ waste <- function(cfg) { # We use a GHG pricing pathway based on a peak budget of 500 with overshoot # starting from 2020 and diet shift. miti <- function(cfg) { - # Mitigation: consistent with 1.5C considering Diet change + cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif" cfg$gms$c56_pollutant_prices <- "coupling" - cfg$gms$c60_2ndgen_biodem <- "coupling" - cfg$gms$c56_emis_policy <- "ecoSysProtAll" + cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif" + cfg$gms$c60_2ndgen_biodem <- "coupling" + # ecoSysProtAll: (Above ground CO2 emis from LUC in forest, forestry, natveg; All types of emis from peatland; All CH4 and N2O emis), + cfg$gms$c56_emis_policy <- "ecoSysProtAll" return(cfg) } # Bioenergy demand only. No carbon price on land included. bioenergy <- function(cfg) { - # Mitigation: only Bioenergy demand from coupled REMIND-MAgPIE run where 1.5 is reached with ghg prices on land and considering diet shift - cfg$gms$c60_2ndgen_biodem <- "coupling" + cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif" + cfg$gms$c60_2ndgen_biodem <- "coupling" return(cfg) } # CO2 from land use change is priced. priceCO2 <- function(cfg) { - # Mitigation: only price land CO2 cfg$gms$c56_pollutant_prices <- "coupling" - cfg$gms$c56_emis_policy <- "ecoSysProtAll" + cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif" + cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" #### double-check Florian return(cfg) } # Pricing of all CH4 and N2O emissions except for peatland priceNonCO2 <- function(cfg) { - # Mitigation: only CH4 and N2O price cfg$gms$c56_pollutant_prices <- "coupling" - cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" + cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif" + cfg$gms$c56_emis_policy <- "ecoSysProtOff" ### double-check Florian return(cfg) } @@ -170,20 +173,25 @@ priceNonCO2 <- function(cfg) { # BAU # # Business as usual scenario based on SSP2 cfg$title <- "BAU_NPi" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) cfg <- bau(cfg = cfg) start_run(cfg, codeCheck = FALSE) cfg$title <- "BAU_NDC" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_lessSus")) cfg <- bau(cfg = cfg) +# set path to bioenergy and prices to NDC run +cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NDC_nonSus-rem-5/REMIND_generic_C_SSP2EU-NDC_nonSus-rem-5.mif" +cfg$gms$c56_pollutant_prices <- "coupling" +cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NDC_nonSus-rem-5/REMIND_generic_C_SSP2EU-NDC_nonSus-rem-5.mif" +cfg$gms$c60_2ndgen_biodem <- "coupling" start_run(cfg, codeCheck = FALSE) # BAU + EL2-Diet # # Decomposition scenario. # Globally achieves EL2 (Diet+Waste+Prod) by 2050 cfg$title <- "BAU_Diet" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) @@ -193,7 +201,7 @@ start_run(cfg, codeCheck = FALSE) # BAU + Bioenergy # # Decomposition Scenario. Adds bioenergy demand from coupled run with land-use policies consistent with 1.5C by 2050 to BAU cfg$title <- "BAU_Bioenergy" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) cfg <- bau(cfg = cfg) cfg <- bioenergy(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -201,7 +209,7 @@ start_run(cfg, codeCheck = FALSE) # BAU + pricing of CO2 in land sector # # Decomposition Scenario. Adds CO2 pricing on land-use change emissions with ghg price from coupled run with land-use policies consistent with 1.5C by 2050 to BAU cfg$title <- "BAU_CO2" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) cfg <- bau(cfg = cfg) cfg <- priceCO2(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -209,7 +217,7 @@ start_run(cfg, codeCheck = FALSE) # BAU + NonCO2 pricing in land sector # # Decomposition Scenario. Adds non-CO2 pricing with ghg price from coupled run with land-use policies consistent with 1.5C by 2050 to BAU cfg$title <- "BAU_NonCO2" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) cfg <- bau(cfg = cfg) cfg <- priceNonCO2(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -218,7 +226,7 @@ start_run(cfg, codeCheck = FALSE) # All production-side land-based mitigation measures, but no demand-side mitigation (diet change) cfg$title <- "MITI_Diet" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_lessSus")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation @@ -229,12 +237,13 @@ start_run(cfg, codeCheck = FALSE) # CO2 and non-CO2 pricing and demand-side mitigation (diet change), but no bioenergy demand from REMIND cfg$title <- "MITI_Bioenergy" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_lessSus")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation cfg <- miti(cfg = cfg) -cfg$gms$c60_2ndgen_biodem <- "none" +cfg$gms$c60_2ndgen_biodem <- "coupling" +cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-Npi_nonSus-rem-5/REMIND_generic_C_SSP2EU-Npi_nonSus-rem-5.mif" # PHD cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) @@ -245,12 +254,13 @@ start_run(cfg, codeCheck = FALSE) # non-CO2 pricing and bioenergy demand from REMIND and demand-side mitigation (diet change), but no CO2 pricing in land-system cfg$title <- "MITI_CO2" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_lessSus")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation cfg <- miti(cfg = cfg) -cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" +# ecoSysProtOff: (All CH4 and N2O emis except peatland), +cfg$gms$c56_emis_policy <- "ecoSysProtOff" # PHD cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) @@ -261,12 +271,13 @@ start_run(cfg, codeCheck = FALSE) # CO2 pricing and bioenergy demand from REMIND and demand-side mitigation (diet change), but no non-CO2 pricing in land-system cfg$title <- "MITI_nonCO2" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_lessSus")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation cfg <- miti(cfg = cfg) -cfg$gms$c56_emis_policy <- "ecoSysProtAll" +# ecoSysProtAll_agMgmtOff: (Above ground CO2 emis from LUC in forest, forestry, natveg; All types of emis from peatland; No further CH4/N2O/other emis related to ag. management) +cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" # PHD cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) @@ -277,7 +288,7 @@ start_run(cfg, codeCheck = FALSE) # All production-side land-based mitigation measures and demand-side mitigation (diet change) cfg$title <- "MITI_Full" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_lessSus")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation (CO2, non-CO2, bioenergy) From dc127ed8e5c8e2ef1ba304683f148104656aed2a Mon Sep 17 00:00:00 2001 From: Felicitas Date: Mon, 29 Apr 2024 16:05:41 +0200 Subject: [PATCH 067/280] bugfix in project_EAT2p0 start script related to ordering of decomposition scenarios --- scripts/start/projects/project_EAT2p0.R | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/start/projects/project_EAT2p0.R b/scripts/start/projects/project_EAT2p0.R index 674b1c3c57..60b4b4e015 100644 --- a/scripts/start/projects/project_EAT2p0.R +++ b/scripts/start/projects/project_EAT2p0.R @@ -215,8 +215,8 @@ cfg$title <- "BAU_MITI" # standard setting, but with NDC activated (for miti) cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) # scenario settings -cfg <- miti(cfg = cfg) cfg <- bau(cfg = cfg) +cfg <- miti(cfg = cfg) start_run(cfg, codeCheck = FALSE) # EL2 # @@ -237,8 +237,8 @@ cfg$title <- "ELM" # standard setting, but with NDC activated (for miti) cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) # scenario settings -cfg <- miti(cfg = cfg) cfg <- bau(cfg = cfg) +cfg <- miti(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) @@ -251,8 +251,8 @@ cfg$title <- "ELM_DIET" # standard setting, but with NDC activated (for miti) cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) # scenario settings -cfg <- miti(cfg = cfg) cfg <- bau(cfg = cfg) +cfg <- miti(cfg = cfg) cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) cfg <- rcp26(cfg = cfg) @@ -264,8 +264,8 @@ cfg$title <- "ELM_PROD" # standard setting, but with NDC activated (for miti) cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) # scenario settings -cfg <- miti(cfg = cfg) cfg <- bau(cfg = cfg) +cfg <- miti(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- waste(cfg = cfg) cfg <- rcp26(cfg = cfg) @@ -277,8 +277,8 @@ cfg$title <- "ELM_WAST" # standard setting, but with NDC activated (for miti) cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) # scenario settings -cfg <- miti(cfg = cfg) cfg <- bau(cfg = cfg) +cfg <- miti(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) cfg <- rcp26(cfg = cfg) @@ -290,8 +290,8 @@ cfg$title <- "ELM_RCP70" # standard setting, but with NDC activated (for miti) cfg <- setScenario(cfg, c("cc", "SSP2", "NDC")) # scenario settings -cfg <- miti(cfg = cfg) cfg <- bau(cfg = cfg) +cfg <- miti(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) @@ -303,8 +303,8 @@ cfg$title <- "ELM_NoCC" # standard setting, but with NDC activated (for miti) and without CC cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC")) # scenario settings -cfg <- miti(cfg = cfg) cfg <- bau(cfg = cfg) +cfg <- miti(cfg = cfg) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) From d0c8388ba44824c575cc0017187f4b8b39d29f18 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 29 Apr 2024 17:16:49 +0200 Subject: [PATCH 068/280] revert --- modules/35_natveg/dynamic_feb21/presolve.gms | 27 ++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/dynamic_feb21/presolve.gms index c2ad686cbe..861236d9e5 100644 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ b/modules/35_natveg/dynamic_feb21/presolve.gms @@ -47,19 +47,6 @@ pc35_secdforest(j,ac_sub) = pc35_secdforest(j,ac_sub) - p35_disturbance_loss_sec pcm_land(j,"primforest") = pcm_land(j,"primforest") - p35_disturbance_loss_primf(t,j); vm_land.l(j,"primforest") = pcm_land(j,"primforest"); -* -------------------------------------- -* Carbon threshold for secondary forest -* -------------------------------------- - -*' @code -*' If the vegetation carbon density in a simulation unit due to regrowth -*' exceeds a threshold of 20 tC/ha the respective area is shifted from other natural land to secondary forest. -p35_recovered_forest(t,j,ac)$(not sameas(ac,"acx")) = - pc35_other(j,ac)$(pm_carbon_density_ac(t,j,ac,"vegc") > 20); -pc35_other(j,ac) = pc35_other(j,ac) - p35_recovered_forest(t,j,ac); -pc35_secdforest(j,ac) = pc35_secdforest(j,ac) + p35_recovered_forest(t,j,ac); -*' @stop - * Regrowth of natural vegetation (natural succession) is modelled by shifting age-classes according to time step length. s35_shift = m_timestep_length_forestry/5; @@ -77,6 +64,20 @@ s35_shift = m_timestep_length_forestry/5; + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_secdforest(j,ac)); +* -------------------------------------- +* Carbon threshold for secondary forest +* -------------------------------------- + +*' @code +*' If the vegetation carbon density in a simulation unit due to regrowth +*' exceeds a threshold of 20 tC/ha the respective area is shifted from other natural land to secondary forest. +p35_recovered_forest(t,j,ac)$(not sameas(ac,"acx")) = + p35_other(t,j,ac)$(pm_carbon_density_ac(t,j,ac,"vegc") > 20); +p35_other(t,j,ac) = p35_other(t,j,ac) - p35_recovered_forest(t,j,ac); +p35_secdforest(t,j,ac) = p35_secdforest(t,j,ac) + p35_recovered_forest(t,j,ac); +*' @stop + + pc35_secdforest(j,ac) = p35_secdforest(t,j,ac); v35_secdforest.l(j,ac) = pc35_secdforest(j,ac); vm_land.l(j,"secdforest") = sum(ac, pc35_secdforest(j,ac)); From 2143ba22f2092ff17170e127847aee2ecb054d93 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 29 Apr 2024 19:38:41 +0200 Subject: [PATCH 069/280] updates --- CHANGELOG.md | 6 +- config/default.cfg | 13 ++--- main.gms | 2 +- .../29_cropland/detail_apr24/declarations.gms | 4 ++ .../29_cropland/detail_apr24/equations.gms | 5 ++ .../29_cropland/detail_apr24/postsolve.gms | 8 +++ modules/29_cropland/detail_apr24/presolve.gms | 2 +- modules/29_cropland/detail_apr24/scaling.gms | 6 -- modules/29_cropland/detail_apr24/sets.gms | 3 - .../29_cropland/simple_apr24/declarations.gms | 12 ++++ .../29_cropland/simple_apr24/equations.gms | 19 +++++++ modules/29_cropland/simple_apr24/input.gms | 55 +++++++++++++++++++ modules/29_cropland/simple_apr24/not_used.txt | 3 - .../29_cropland/simple_apr24/postsolve.gms | 4 ++ modules/29_cropland/simple_apr24/preloop.gms | 28 +++++++++- modules/29_cropland/simple_apr24/presolve.gms | 28 ++++++++++ .../29_cropland/simple_apr24/realization.gms | 5 +- modules/29_cropland/simple_apr24/sets.gms | 6 ++ .../macceff_aug22/equations.gms | 2 + .../59_som/cellpool_aug16/declarations.gms | 3 +- modules/59_som/cellpool_aug16/equations.gms | 7 ++- modules/59_som/cellpool_aug16/preloop.gms | 3 + modules/59_som/cellpool_jan23/equations.gms | 7 ++- modules/59_som/static_jan19/equations.gms | 3 +- modules/59_som/static_jan19/not_used.txt | 2 - .../80_optimization/lp_nlp_apr17/input.gms | 1 - .../80_optimization/lp_nlp_apr17/solve.gms | 2 +- modules/80_optimization/nlp_apr17/input.gms | 1 - modules/80_optimization/nlp_apr17/solve.gms | 2 +- modules/80_optimization/nlp_par/input.gms | 1 - modules/80_optimization/nlp_par/solve.gms | 2 +- 31 files changed, 199 insertions(+), 46 deletions(-) delete mode 100644 modules/29_cropland/detail_apr24/scaling.gms diff --git a/CHANGELOG.md b/CHANGELOG.md index d2d5591367..0ff9dc5957 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,13 +9,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### changed - **29_ageclass** module 29_ageclass has been renamed to 28_ageclass to make space for `29_cropland` just before `30_croparea` - **30_crop** module `30_crop` renamed to `30_croparea`, which now only accounts for crop area. -- **30_crop** SNV implementation has been moved from `30_crop` to `29_cropland/detail_apr24` +- **30_crop** SNV implementation has been moved from `30_crop` to `29_cropland` - **30_crop** the two realizations `penalty_apr22` and `rotation_apr22` have been merged into a single `30_croparea/detail_apr24` realization - **30_crop** the previous `30_crop/endo_apr21` realization has been moved to `30_croparea/simple_apr24` -- **80_optimization** added option `s80_extra_solve`, which is deactivated by default to shorten the run time of infeasible model runs +- **default.cfg** cfg$gms$s80_maxiter reduced from 30 to 10 ### added -- **29_cropland** new module `29_cropland` accounting for crop area, fallow cropland and tree cover on cropland with two realizations: `detail_apr24` (default) and `simple_apr24`. +- **29_cropland** new module `29_cropland` accounting for crop area, fallow cropland and tree cover on cropland with two realizations: `detail_apr24` and `simple_apr24` (default). - **10_land** added interface `pm_land_hist` with historic land use patterns - **32_forestry** added technical balance term `v32_land_missing_ndc` diff --git a/config/default.cfg b/config/default.cfg index e9e5d75ce0..cdaba9e998 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -672,10 +672,10 @@ cfg$gms$ageclass <- "feb21" # def = feb21 # * Cropland is defined as the sum of croparea, fallow land and tree cover # * Croparea is provided by 30_crop. # * Fallow land and tree cover are defined by 29_cropland, -# * (simple_apr24): Fallow land is fixed to zero and tree cover on cropland does not exist, no SNV options -# * (detail_apr24): Fallow land and tree cover based on rules or incentives, SNV options included +# * (simple_apr24): Fallow land and tree cover on cropland are fixed to zero +# * (detail_apr24): Fallow land and tree cover based on rules or incentives # NOTE: It is recommended to recalibrate the model when changing this setting! -cfg$gms$cropland <- "detail_apr24" # def = detail_apr24 +cfg$gms$cropland <- "simple_apr24" # def = simple_apr24 # *** Options for all cropland realizations *** @@ -688,8 +688,6 @@ cfg$gms$cropland <- "detail_apr24" # def = detail_apr24 # * with observed cropland patterns and is recommended for productive runs. cfg$gms$c29_marginal_land <- "q33_marginal" # def = "q33_marginal" -# *** Options only available for `detail_apr24` realization *** - # * Share of available cropland that is withheld for maintaining semi-natural vegetation (SNV) # * in each square km in cropland areas, including grassland, forest and other land. For example, # * a share of 0.2 corresponds to 20 % of SNV in terms of the available cropland. @@ -717,6 +715,8 @@ cfg$gms$policy_countries29 <- all_iso_countries # * "secdforest, past, other" etc. cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, forestry, past, other" +# *** Options only available for `detail_apr24` realization *** + # * Minimum cluster share of treecover on total cropland area (including croparea, fallow land and tree cover). # * s29_treecover_target is faded in linearly between s29_treecover_scenario_start and s29_treecover_scenario_target. cfg$gms$s29_treecover_target <- 0 # def = 0 @@ -1965,9 +1965,6 @@ cfg$gms$c80_nlp_solver <- "conopt4" # def = conopt4 # * 0: default settings (optfile will be ignored) cfg$gms$s80_optfile <- 0 # def = 0 -# switch for scaling (1=on 0=off) -cfg$gms$s80_scaleopt <- 1 # def = 1 - #*******************************END MODULE SETUP******************************** #### Other settings (e.g. clustering, gdx files, ...): #### diff --git a/main.gms b/main.gms index 939c2a3839..f6c8419d44 100644 --- a/main.gms +++ b/main.gms @@ -249,7 +249,7 @@ $setglobal land_conservation area_based_apr22 $setglobal ageclass feb21 -$setglobal cropland detail_apr24 +$setglobal cropland simple_apr24 $setglobal croparea simple_apr24 $setglobal past endo_jun13 diff --git a/modules/29_cropland/detail_apr24/declarations.gms b/modules/29_cropland/detail_apr24/declarations.gms index 386fb8b999..81699b8691 100644 --- a/modules/29_cropland/detail_apr24/declarations.gms +++ b/modules/29_cropland/detail_apr24/declarations.gms @@ -36,6 +36,7 @@ parameters positive variables vm_cost_cropland(j) Cost for total cropland (mio. USD05MER per yr) + vm_treecover(j) Cropland tree cover (mio. ha) v29_treecover(j,ac) Cropland tree cover per age class (mio. ha) v29_treecover_missing(j) Missing treecover area towards target (mio. ha) v29_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr) @@ -54,6 +55,7 @@ equations q29_fallow_min(j) Missing fallow land towards target (mio. ha) q29_fallow_max(j) Maximum fallow land towards target (mio. ha) q29_fallow_bv(j,potnatveg) Biodiversity value for fallow land (mio. ha) + q29_treecover(j) Cropland tree cover (mio. ha) q29_treecover_min(j) Missing treecover area towards target (mio. ha) q29_treecover_max(j) Maximum treecover area (mio. ha) q29_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (mio. ha) @@ -65,6 +67,7 @@ equations *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov_cost_cropland(t,j,type) Cost for total cropland (mio. USD05MER per yr) + ov_treecover(t,j,type) Cropland tree cover (mio. ha) ov29_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha) ov29_treecover_missing(t,j,type) Missing treecover area towards target (mio. ha) ov29_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr) @@ -80,6 +83,7 @@ parameters oq29_fallow_min(t,j,type) Missing fallow land towards target (mio. ha) oq29_fallow_max(t,j,type) Maximum fallow land towards target (mio. ha) oq29_fallow_bv(t,j,potnatveg,type) Biodiversity value for fallow land (mio. ha) + oq29_treecover(t,j,type) Cropland tree cover (mio. ha) oq29_treecover_min(t,j,type) Missing treecover area towards target (mio. ha) oq29_treecover_max(t,j,type) Maximum treecover area (mio. ha) oq29_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (mio. ha) diff --git a/modules/29_cropland/detail_apr24/equations.gms b/modules/29_cropland/detail_apr24/equations.gms index 6767a341d5..b5eab82988 100644 --- a/modules/29_cropland/detail_apr24/equations.gms +++ b/modules/29_cropland/detail_apr24/equations.gms @@ -78,6 +78,11 @@ vm_fallow(j2) * fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg); +*' Interface vm_treecover for other modules. + + q29_treecover(j2) .. + vm_treecover(j2) =e= sum(ac, v29_treecover(j2,ac)); + *' A penalty is applied for the violation of treecover rules. *' The penalty applies to the missing treecover area, i.e. where treecover area *' is lower than a certain fraction of total cropland. diff --git a/modules/29_cropland/detail_apr24/postsolve.gms b/modules/29_cropland/detail_apr24/postsolve.gms index 1f6b4d64e6..43d88e04c7 100644 --- a/modules/29_cropland/detail_apr24/postsolve.gms +++ b/modules/29_cropland/detail_apr24/postsolve.gms @@ -9,6 +9,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_cost_cropland(t,j,"marginal") = vm_cost_cropland.m(j); + ov_treecover(t,j,"marginal") = vm_treecover.m(j); ov29_treecover(t,j,ac,"marginal") = v29_treecover.m(j,ac); ov29_treecover_missing(t,j,"marginal") = v29_treecover_missing.m(j); ov29_cost_treecover_est(t,j,"marginal") = v29_cost_treecover_est.m(j); @@ -24,6 +25,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_fallow_min(t,j,"marginal") = q29_fallow_min.m(j); oq29_fallow_max(t,j,"marginal") = q29_fallow_max.m(j); oq29_fallow_bv(t,j,potnatveg,"marginal") = q29_fallow_bv.m(j,potnatveg); + oq29_treecover(t,j,"marginal") = q29_treecover.m(j); oq29_treecover_min(t,j,"marginal") = q29_treecover_min.m(j); oq29_treecover_max(t,j,"marginal") = q29_treecover_max.m(j); oq29_treecover_bv(t,j,potnatveg,"marginal") = q29_treecover_bv.m(j,potnatveg); @@ -31,6 +33,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_cost_treecover_recur(t,j,"marginal") = q29_cost_treecover_recur.m(j); oq29_treecover_est(t,j,ac,"marginal") = q29_treecover_est.m(j,ac); ov_cost_cropland(t,j,"level") = vm_cost_cropland.l(j); + ov_treecover(t,j,"level") = vm_treecover.l(j); ov29_treecover(t,j,ac,"level") = v29_treecover.l(j,ac); ov29_treecover_missing(t,j,"level") = v29_treecover_missing.l(j); ov29_cost_treecover_est(t,j,"level") = v29_cost_treecover_est.l(j); @@ -46,6 +49,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_fallow_min(t,j,"level") = q29_fallow_min.l(j); oq29_fallow_max(t,j,"level") = q29_fallow_max.l(j); oq29_fallow_bv(t,j,potnatveg,"level") = q29_fallow_bv.l(j,potnatveg); + oq29_treecover(t,j,"level") = q29_treecover.l(j); oq29_treecover_min(t,j,"level") = q29_treecover_min.l(j); oq29_treecover_max(t,j,"level") = q29_treecover_max.l(j); oq29_treecover_bv(t,j,potnatveg,"level") = q29_treecover_bv.l(j,potnatveg); @@ -53,6 +57,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_cost_treecover_recur(t,j,"level") = q29_cost_treecover_recur.l(j); oq29_treecover_est(t,j,ac,"level") = q29_treecover_est.l(j,ac); ov_cost_cropland(t,j,"upper") = vm_cost_cropland.up(j); + ov_treecover(t,j,"upper") = vm_treecover.up(j); ov29_treecover(t,j,ac,"upper") = v29_treecover.up(j,ac); ov29_treecover_missing(t,j,"upper") = v29_treecover_missing.up(j); ov29_cost_treecover_est(t,j,"upper") = v29_cost_treecover_est.up(j); @@ -68,6 +73,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_fallow_min(t,j,"upper") = q29_fallow_min.up(j); oq29_fallow_max(t,j,"upper") = q29_fallow_max.up(j); oq29_fallow_bv(t,j,potnatveg,"upper") = q29_fallow_bv.up(j,potnatveg); + oq29_treecover(t,j,"upper") = q29_treecover.up(j); oq29_treecover_min(t,j,"upper") = q29_treecover_min.up(j); oq29_treecover_max(t,j,"upper") = q29_treecover_max.up(j); oq29_treecover_bv(t,j,potnatveg,"upper") = q29_treecover_bv.up(j,potnatveg); @@ -75,6 +81,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_cost_treecover_recur(t,j,"upper") = q29_cost_treecover_recur.up(j); oq29_treecover_est(t,j,ac,"upper") = q29_treecover_est.up(j,ac); ov_cost_cropland(t,j,"lower") = vm_cost_cropland.lo(j); + ov_treecover(t,j,"lower") = vm_treecover.lo(j); ov29_treecover(t,j,ac,"lower") = v29_treecover.lo(j,ac); ov29_treecover_missing(t,j,"lower") = v29_treecover_missing.lo(j); ov29_cost_treecover_est(t,j,"lower") = v29_cost_treecover_est.lo(j); @@ -90,6 +97,7 @@ pc29_treecover(j,ac) = v29_treecover.l(j,ac); oq29_fallow_min(t,j,"lower") = q29_fallow_min.lo(j); oq29_fallow_max(t,j,"lower") = q29_fallow_max.lo(j); oq29_fallow_bv(t,j,potnatveg,"lower") = q29_fallow_bv.lo(j,potnatveg); + oq29_treecover(t,j,"lower") = q29_treecover.lo(j); oq29_treecover_min(t,j,"lower") = q29_treecover_min.lo(j); oq29_treecover_max(t,j,"lower") = q29_treecover_max.lo(j); oq29_treecover_bv(t,j,potnatveg,"lower") = q29_treecover_bv.lo(j,potnatveg); diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index 54fe3c9120..39a064bbeb 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -23,7 +23,7 @@ p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t- *' Global Land Service (@buchhorn_copernicus_2020)) and in *' cases of cropland reduction p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * pcm_land(j,"crop") - - sum(ac, pc29_treecover(j,ac)); + - vm_treecover.l(j); p29_max_snv_relocation(t,j)$(p29_max_snv_relocation(t,j) < 0) = 0; p29_snv_relocation(t,j)$(p29_snv_relocation(t, j) > p29_max_snv_relocation(t,j)) = p29_max_snv_relocation(t,j); diff --git a/modules/29_cropland/detail_apr24/scaling.gms b/modules/29_cropland/detail_apr24/scaling.gms deleted file mode 100644 index 3a209b115b..0000000000 --- a/modules/29_cropland/detail_apr24/scaling.gms +++ /dev/null @@ -1,6 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de diff --git a/modules/29_cropland/detail_apr24/sets.gms b/modules/29_cropland/detail_apr24/sets.gms index ce67e81d5a..e5d8286326 100644 --- a/modules/29_cropland/detail_apr24/sets.gms +++ b/modules/29_cropland/detail_apr24/sets.gms @@ -16,7 +16,4 @@ sets relocation_target29 Cropland requiring relocation based on different SNV targets / SNV20TargetCropland, SNV50TargetCropland / - fallow29 fallow rules - / fallow20, fallow80 / - ; diff --git a/modules/29_cropland/simple_apr24/declarations.gms b/modules/29_cropland/simple_apr24/declarations.gms index c63daf0be8..1f02098fb4 100644 --- a/modules/29_cropland/simple_apr24/declarations.gms +++ b/modules/29_cropland/simple_apr24/declarations.gms @@ -7,23 +7,35 @@ parameters p29_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) + p29_country_snv_weight(i) SNV policy country weight per region (1) + p29_snv_shr(t,j) Share of semi-natural vegetation in cropland areas (1) + i29_snv_relocation_target(j) Overall cropland area that requires relocation due to SNV policy (mio. ha) + p29_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha) + p29_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) + p29_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1) + i29_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) + i29_snv_scenario_fader(t_all) SNV scenario fader (1) ; positive variables vm_cost_cropland(j) Cost for total cropland (mio. USD05MER per yr) vm_fallow(j) Fallow land is temporarily fallow cropland (mio. ha) + vm_treecover(j) Cropland tree cover (mio. ha) ; equations q29_cropland(j) Total cropland calculation (mio. ha) q29_avl_cropland(j) Available cropland constraint (mio. ha) q29_carbon(j,ag_pools,stockType) Cropland above ground carbon content calculation (mio. tC) + q29_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha) + q29_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov_cost_cropland(t,j,type) Cost for total cropland (mio. USD05MER per yr) ov_fallow(t,j,type) Fallow land is temporarily fallow cropland (mio. ha) + ov_treecover(t,j,type) Cropland tree cover (mio. ha) oq29_cropland(t,j,type) Total cropland calculation (mio. ha) oq29_avl_cropland(t,j,type) Available cropland constraint (mio. ha) oq29_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) diff --git a/modules/29_cropland/simple_apr24/equations.gms b/modules/29_cropland/simple_apr24/equations.gms index a5cd2a0dd2..376cf3e2c8 100644 --- a/modules/29_cropland/simple_apr24/equations.gms +++ b/modules/29_cropland/simple_apr24/equations.gms @@ -12,6 +12,7 @@ q29_cropland(j2) .. vm_land(j2,"crop") =e= sum((kcr,w), vm_area(j2,kcr,w)); + *' We assume that crop production can only take place on suitable cropland area. *' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas *' from cropland production that have a low suitability, e.g. due to steep slopes, @@ -28,3 +29,21 @@ q29_carbon(j2,ag_pools,stockType) .. vm_carbon_stock(j2,"crop",ag_pools,stockType) =e= vm_carbon_stock_croparea(j2,ag_pools); + + +*' The semi-natural land constraint in cropland areas for sustaining critical regulating NCP +*' for agricultural production is added on top of land conserved for other reasons +*' (e.g. conservation of intact ecosystems or protection of biodiversity hotspots). + + q29_land_snv(j2) .. + sum(land_snv, vm_land(j2,land_snv)) =g= + sum(ct, p29_snv_shr(ct,j2)) * vm_land(j2,"crop") + + sum((ct,land_snv,consv_type), pm_land_conservation(ct,j2,land_snv,consv_type)); + +*' The semi-natural vegetation constraint for cropland areas has been suggested at the per square +*' kilometer scale. The amount of cropland requiring relocation has therefore been derived from +*' exogeneous high-resolution land cover information from the Copernicus Global Land Service +*' (@buchhorn_copernicus_2020). + + q29_land_snv_trans(j2) .. + sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p29_snv_relocation(ct,j2)); diff --git a/modules/29_cropland/simple_apr24/input.gms b/modules/29_cropland/simple_apr24/input.gms index 8780993d11..eb33c95ec9 100644 --- a/modules/29_cropland/simple_apr24/input.gms +++ b/modules/29_cropland/simple_apr24/input.gms @@ -8,6 +8,47 @@ $setglobal c29_marginal_land q33_marginal * options: all_marginal, q33_marginal, no_marginal +scalars + s29_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / + s29_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / + s29_snv_scenario_start SNV scenario start year / 2020 / + s29_snv_scenario_target SNV scenario target year / 2029 / + s29_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / + s29_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / +; + +* Set-switch for countries affected by regional SNV policy +* Default: all iso countries selected +sets + policy_countries29(iso) countries to be affected by SNV policy / ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, + ASM,ATA,ATF,ATG,AUS,AUT,AZE,BDI,BEL,BEN, + BES,BFA,BGD,BGR,BHR,BHS,BIH,BLM,BLR,BLZ, + BMU,BOL,BRA,BRB,BRN,BTN,BVT,BWA,CAF,CAN, + CCK,CHN,CHE,CHL,CIV,CMR,COD,COG,COK,COL, + COM,CPV,CRI,CUB,CUW,CXR,CYM,CYP,CZE,DEU, + DJI,DMA,DNK,DOM,DZA,ECU,EGY,ERI,ESH,ESP, + EST,ETH,FIN,FJI,FLK,FRA,FRO,FSM,GAB,GBR, + GEO,GGY,GHA,GIB,GIN,GLP,GMB,GNB,GNQ,GRC, + GRD,GRL,GTM,GUF,GUM,GUY,HKG,HMD,HND,HRV, + HTI,HUN,IDN,IMN,IND,IOT,IRL,IRN,IRQ,ISL, + ISR,ITA,JAM,JEY,JOR,JPN,KAZ,KEN,KGZ,KHM, + KIR,KNA,KOR,KWT,LAO,LBN,LBR,LBY,LCA,LIE, + LKA,LSO,LTU,LUX,LVA,MAC,MAF,MAR,MCO,MDA, + MDG,MDV,MEX,MHL,MKD,MLI,MLT,MMR,MNE,MNG, + MNP,MOZ,MRT,MSR,MTQ,MUS,MWI,MYS,MYT,NAM, + NCL,NER,NFK,NGA,NIC,NIU,NLD,NOR,NPL,NRU, + NZL,OMN,PAK,PAN,PCN,PER,PHL,PLW,PNG,POL, + PRI,PRK,PRT,PRY,PSE,PYF,QAT,REU,ROU,RUS, + RWA,SAU,SDN,SEN,SGP,SGS,SHN,SJM,SLB,SLE, + SLV,SMR,SOM,SPM,SRB,SSD,STP,SUR,SVK,SVN, + SWE,SWZ,SXM,SYC,SYR,TCA,TCD,TGO,THA,TJK, + TKL,TKM,TLS,TON,TTO,TUN,TUR,TUV,TWN,TZA, + UGA,UKR,UMI,URY,USA,UZB,VAT,VCT,VEN,VGB, + VIR,VNM,VUT,WLF,WSM,YEM,ZAF,ZMB,ZWE / + +land_snv(land) land types allowed in the SNV policy / secdforest, forestry, past, other / +; + ********* AVAILABLE CROPLAND ******************************************* table f29_avl_cropland(j,marginal_land29) Available land area for cropland (mio. ha) @@ -15,3 +56,17 @@ $ondelim $include "./modules/29_cropland/input/avl_cropland.cs3" $offdelim ; + +table f29_avl_cropland_iso(iso,marginal_land29) Available land area for cropland at ISO level (mio. ha) +$ondelim +$include "./modules/29_cropland/input/avl_cropland_iso.cs3" +$offdelim +; + +********* SNV TARGET CROPLAND ******************************************* + +table f29_snv_target_cropland(j,relocation_target29) Cropland in 2019 requiring relocation due to SNV policy (mio. ha) +$ondelim +$include "./modules/29_cropland/input/SNVTargetCropland.cs3" +$offdelim +; diff --git a/modules/29_cropland/simple_apr24/not_used.txt b/modules/29_cropland/simple_apr24/not_used.txt index 6102fa8d55..a60069f62b 100644 --- a/modules/29_cropland/simple_apr24/not_used.txt +++ b/modules/29_cropland/simple_apr24/not_used.txt @@ -1,10 +1,7 @@ name,type,reason -vm_lu_transitions,input,not needed pm_land_hist,input,not needed -pcm_land,input,not needed fm_luh2_side_layers,input,not needed pm_interest,input,not needed -pm_land_conservation,input,not needed fm_bii_coeff,input,not needed pm_carbon_density_ac,input,not needed pm_carbon_density_ac_forestry,input,not needed diff --git a/modules/29_cropland/simple_apr24/postsolve.gms b/modules/29_cropland/simple_apr24/postsolve.gms index 3a389fbe97..aaa4624b50 100644 --- a/modules/29_cropland/simple_apr24/postsolve.gms +++ b/modules/29_cropland/simple_apr24/postsolve.gms @@ -8,21 +8,25 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_cost_cropland(t,j,"marginal") = vm_cost_cropland.m(j); ov_fallow(t,j,"marginal") = vm_fallow.m(j); + ov_treecover(t,j,"marginal") = vm_treecover.m(j); oq29_cropland(t,j,"marginal") = q29_cropland.m(j); oq29_avl_cropland(t,j,"marginal") = q29_avl_cropland.m(j); oq29_carbon(t,j,ag_pools,stockType,"marginal") = q29_carbon.m(j,ag_pools,stockType); ov_cost_cropland(t,j,"level") = vm_cost_cropland.l(j); ov_fallow(t,j,"level") = vm_fallow.l(j); + ov_treecover(t,j,"level") = vm_treecover.l(j); oq29_cropland(t,j,"level") = q29_cropland.l(j); oq29_avl_cropland(t,j,"level") = q29_avl_cropland.l(j); oq29_carbon(t,j,ag_pools,stockType,"level") = q29_carbon.l(j,ag_pools,stockType); ov_cost_cropland(t,j,"upper") = vm_cost_cropland.up(j); ov_fallow(t,j,"upper") = vm_fallow.up(j); + ov_treecover(t,j,"upper") = vm_treecover.up(j); oq29_cropland(t,j,"upper") = q29_cropland.up(j); oq29_avl_cropland(t,j,"upper") = q29_avl_cropland.up(j); oq29_carbon(t,j,ag_pools,stockType,"upper") = q29_carbon.up(j,ag_pools,stockType); ov_cost_cropland(t,j,"lower") = vm_cost_cropland.lo(j); ov_fallow(t,j,"lower") = vm_fallow.lo(j); + ov_treecover(t,j,"lower") = vm_treecover.lo(j); oq29_cropland(t,j,"lower") = q29_cropland.lo(j); oq29_avl_cropland(t,j,"lower") = q29_avl_cropland.lo(j); oq29_carbon(t,j,ag_pools,stockType,"lower") = q29_carbon.lo(j,ag_pools,stockType); diff --git a/modules/29_cropland/simple_apr24/preloop.gms b/modules/29_cropland/simple_apr24/preloop.gms index 9ac96ee8aa..3113ccb053 100644 --- a/modules/29_cropland/simple_apr24/preloop.gms +++ b/modules/29_cropland/simple_apr24/preloop.gms @@ -7,8 +7,32 @@ vm_cost_cropland.fx(j) = 0; vm_fallow.fx(j) = 0; +vm_treecover.fx(j) = 0; vm_bv.fx(j,"crop_fallow",potnatveg) = 0; vm_bv.fx(j,"crop_tree",potnatveg) = 0; -*' Area potentially available for cropping -p29_avl_cropland(t,j) = f29_avl_cropland(j,"%c29_marginal_land%"); +** Trajectory for cropland scenarios +* sigmoidal interpolation between start year and target year +m_sigmoid_time_interpol(i29_snv_scenario_fader,s29_snv_scenario_start,s29_snv_scenario_target,0,1); + +* linear interpolation to estimate the cropland that +* requires relocation due to SNV policy +if (s29_snv_shr = 0, + i29_snv_relocation_target(j) = 0; +elseif s29_snv_shr <= s29_snv_relocation_data_x1, + m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,0,s29_snv_relocation_data_x1,0, f29_snv_target_cropland(j, "SNV20TargetCropland")); +elseif s29_snv_shr > s29_snv_relocation_data_x1, + m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,s29_snv_relocation_data_x1, s29_snv_relocation_data_x2,f29_snv_target_cropland(j, "SNV20TargetCropland"), f29_snv_target_cropland(j, "SNV50TargetCropland")); +); + +****** Regional share of semi-natural vegetation (SNV) in cropland areas for selective countries: +* Country switch to determine countries for which a SNV policy shall be applied. +* In the default case, the SNV policy affects all countries when activated. +p29_country_dummy(iso) = 0; +p29_country_dummy(policy_countries29) = 1; +* Because MAgPIE is not run at country-level, but at region level, a region +* share is calculated that translates the countries' influence to regional level. +* Countries are weighted by available cropland area. +i29_avl_cropland_iso(iso) = f29_avl_cropland_iso(iso,"%c29_marginal_land%"); +p29_country_snv_weight(i) = sum(i_to_iso(i,iso), p29_country_dummy(iso) * i29_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i29_avl_cropland_iso(iso)); + diff --git a/modules/29_cropland/simple_apr24/presolve.gms b/modules/29_cropland/simple_apr24/presolve.gms index ae47145544..cebdb11b33 100644 --- a/modules/29_cropland/simple_apr24/presolve.gms +++ b/modules/29_cropland/simple_apr24/presolve.gms @@ -4,3 +4,31 @@ *** | AGPL-3.0, you are granted additional permissions described in the *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de + + +*' @code +*' Minimum semi-natural vegetation (SNV) share is fading in after 2020 +p29_snv_shr(t,j) = i29_snv_scenario_fader(t) * + (s29_snv_shr * sum(cell(i,j), p29_country_snv_weight(i)) + + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_snv_weight(i))); + +*' Cropland relocation in response to SNV policy is based on exogeneous land +*' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). +*' The rate of the policy implementation is derived based +*' on the difference of scenario fader values in consecutive time steps +p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * + (i29_snv_relocation_target(j) * sum(cell(i,j), p29_country_snv_weight(i)) + + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_snv_weight(i))); +*' The following lines take care of mismatches in the input +*' data (derived from satellite imagery from the Copernicus +*' Global Land Service (@buchhorn_copernicus_2020)) and in +*' cases of cropland reduction +p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * pcm_land(j,"crop") + - vm_treecover.l(j); +p29_max_snv_relocation(t,j)$(p29_max_snv_relocation(t,j) < 0) = 0; +p29_snv_relocation(t,j)$(p29_snv_relocation(t, j) > p29_max_snv_relocation(t,j)) = p29_max_snv_relocation(t,j); + +*' Area potentially available for cropping +p29_avl_cropland(t,j) = f29_avl_cropland(j,"%c29_marginal_land%") * (1 - p29_snv_shr(t,j)); +*' @stop + diff --git a/modules/29_cropland/simple_apr24/realization.gms b/modules/29_cropland/simple_apr24/realization.gms index 7abf5c89fa..3257388faa 100644 --- a/modules/29_cropland/simple_apr24/realization.gms +++ b/modules/29_cropland/simple_apr24/realization.gms @@ -6,13 +6,12 @@ *** | Contact: magpie@pik-potsdam.de *' @description In this realization, total cropland equals croparea because -*' fallow land is fixed to zero and tree cover on cropland does not exist. +*' fallow land and tree cover on cropland are fixed to zero. *' Therefore, also cropland carbon stocks consist only of croparea carbon stocks. *' Biodiversity BII values are fixed to zero. *' Costs are fixed to zero. -*' No options for semi-natural land in cropland landscapes exist. -*' @limitations Fallow land is fixed to zero and tree cover on cropland does not exist +*' @limitations Fallow land and tree cover on cropland are fixed to zero *####################### R SECTION START (PHASES) ############################## $Ifi "%phase%" == "sets" $include "./modules/29_cropland/simple_apr24/sets.gms" diff --git a/modules/29_cropland/simple_apr24/sets.gms b/modules/29_cropland/simple_apr24/sets.gms index 6c56fcb13d..e5d8286326 100644 --- a/modules/29_cropland/simple_apr24/sets.gms +++ b/modules/29_cropland/simple_apr24/sets.gms @@ -10,4 +10,10 @@ sets marginal_land29 Marginal land scenarios / all_marginal, q33_marginal, no_marginal / + policy_target29 Target year for cropland policy + / none, by2029, by2050 / + + relocation_target29 Cropland requiring relocation based on different SNV targets + / SNV20TargetCropland, SNV50TargetCropland / + ; diff --git a/modules/50_nr_soil_budget/macceff_aug22/equations.gms b/modules/50_nr_soil_budget/macceff_aug22/equations.gms index b6993d4f3d..f292521c1b 100644 --- a/modules/50_nr_soil_budget/macceff_aug22/equations.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/equations.gms @@ -24,6 +24,8 @@ q50_nr_inputs(i2) .. vm_res_recycling(i2,"nr") + sum((cell(i2,j2),kcr,w), vm_area(j2,kcr,w) * f50_nr_fix_area(kcr)) + sum(cell(i2,j2),vm_fallow(j2) * f50_nr_fix_area("tece")) +* Commented out for consistency with q50_nr_surplus_nonagland +* + sum(cell(i2,j2),vm_treecover(j2)) * sum(ct,f50_nr_fixation_rates_nonagland(ct,i2)) + vm_manure_recycling(i2,"nr") + sum(kli, vm_manure(i2, kli, "stubble_grazing","nr")) + vm_nr_inorg_fert_reg(i2,"crop") diff --git a/modules/59_som/cellpool_aug16/declarations.gms b/modules/59_som/cellpool_aug16/declarations.gms index 46831d6429..80e3155d46 100644 --- a/modules/59_som/cellpool_aug16/declarations.gms +++ b/modules/59_som/cellpool_aug16/declarations.gms @@ -12,7 +12,8 @@ parameters i59_input_share(i,inputs59) Share of land under input class (1) i59_cratio(j,kcr,w) Ratio of carbon density of land relative to natural vegetaion (1) i59_cratio_fallow(j) Ratio of carbon density of fallow land relative to natural vegetation (1) - p59_som_pool(j,land) Actual C pool (mio. tC) + i59_cratio_treecover Ratio of carbon density of tree cover on cropland relative to natural vegetation (1) + p59_som_pool(j,land) Actual C pool (mio. tC) i59_subsoilc_density(t_all,j) Subsoil carbon density of a hectare of land (tC per ha) p59_land_before(j,land) Land area in previous time step (mio. ha) ; diff --git a/modules/59_som/cellpool_aug16/equations.gms b/modules/59_som/cellpool_aug16/equations.gms index ddf8108683..376aa9fe47 100644 --- a/modules/59_som/cellpool_aug16/equations.gms +++ b/modules/59_som/cellpool_aug16/equations.gms @@ -13,9 +13,10 @@ q59_som_target_cropland(j2) .. v59_som_target(j2,"crop") =e= (sum((kcr,w), vm_area(j2,kcr,w) * i59_cratio(j2,kcr,w)) - + vm_fallow(j2) * i59_cratio_fallow(j2)) * - sum(ct,f59_topsoilc_density(ct,j2)) - ; + + vm_fallow(j2) * i59_cratio_fallow(j2) + + vm_treecover(j2) * i59_cratio_treecover) + * sum(ct,f59_topsoilc_density(ct,j2)); + *' as well as for all non cropland given by q59_som_target_noncropland(j2,noncropland59) .. diff --git a/modules/59_som/cellpool_aug16/preloop.gms b/modules/59_som/cellpool_aug16/preloop.gms index b75a85f126..41fc1b9447 100644 --- a/modules/59_som/cellpool_aug16/preloop.gms +++ b/modules/59_som/cellpool_aug16/preloop.gms @@ -73,6 +73,9 @@ i59_cratio_fallow(j) = sum(climate59, * f59_cratio_landuse(climate59,"maiz") * f59_cratio_tillage(climate59,"reduced_tillage") * f59_cratio_inputs(climate59,"low_input")); + +i59_cratio_treecover = 1; + *' @stop p59_carbon_density(t,j,land) = 0; diff --git a/modules/59_som/cellpool_jan23/equations.gms b/modules/59_som/cellpool_jan23/equations.gms index ddf8108683..376aa9fe47 100644 --- a/modules/59_som/cellpool_jan23/equations.gms +++ b/modules/59_som/cellpool_jan23/equations.gms @@ -13,9 +13,10 @@ q59_som_target_cropland(j2) .. v59_som_target(j2,"crop") =e= (sum((kcr,w), vm_area(j2,kcr,w) * i59_cratio(j2,kcr,w)) - + vm_fallow(j2) * i59_cratio_fallow(j2)) * - sum(ct,f59_topsoilc_density(ct,j2)) - ; + + vm_fallow(j2) * i59_cratio_fallow(j2) + + vm_treecover(j2) * i59_cratio_treecover) + * sum(ct,f59_topsoilc_density(ct,j2)); + *' as well as for all non cropland given by q59_som_target_noncropland(j2,noncropland59) .. diff --git a/modules/59_som/static_jan19/equations.gms b/modules/59_som/static_jan19/equations.gms index ce63cccdb9..4bc852de30 100644 --- a/modules/59_som/static_jan19/equations.gms +++ b/modules/59_som/static_jan19/equations.gms @@ -10,7 +10,8 @@ *' and the reference soil carbon densities of the subsoil. q59_soilcarbon_cropland(j2,stockType) .. vm_carbon_stock(j2,"crop","soilc",stockType) =e= - vm_land(j2,"crop") * sum(ct, i59_topsoilc_density(ct,j2) + i59_subsoilc_density(ct,j2)); + (sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2)) * sum(ct, i59_topsoilc_density(ct,j2) + i59_subsoilc_density(ct,j2)) + + vm_treecover(j2) * sum(ct, fm_carbon_density(ct,j2,"secdforest","soilc")); *' The soil carbon content for all other land use types is calculated based on the full profile soil carbon density: q59_soilcarbon_noncropland(j2,noncropland59,stockType) .. diff --git a/modules/59_som/static_jan19/not_used.txt b/modules/59_som/static_jan19/not_used.txt index 9bd4f91711..22a291399b 100644 --- a/modules/59_som/static_jan19/not_used.txt +++ b/modules/59_som/static_jan19/not_used.txt @@ -1,8 +1,6 @@ name,type,reason pm_land_start,input,questionnaire fm_croparea,input,questionnaire -vm_area,input,questionnaire vm_landexpansion,input,questionnaire vm_lu_transitions,input,questionnaire pm_climate_class,input,questionnaire -vm_fallow,input,questionnaire diff --git a/modules/80_optimization/lp_nlp_apr17/input.gms b/modules/80_optimization/lp_nlp_apr17/input.gms index cd820db042..83427b7cfe 100644 --- a/modules/80_optimization/lp_nlp_apr17/input.gms +++ b/modules/80_optimization/lp_nlp_apr17/input.gms @@ -10,7 +10,6 @@ scalars s80_optfile switch to use specfied solver settings (1) / 0 / s80_add_cplex add cplex optimization after conopt4 (1) / 0 / s80_add_conopt3 add conopt3 optimization after conopt4 (1) / 0 / - s80_scaleopt switch to for scaling (1=on 0=off) / 1 / ; diff --git a/modules/80_optimization/lp_nlp_apr17/solve.gms b/modules/80_optimization/lp_nlp_apr17/solve.gms index 829a984953..85ec1ef813 100644 --- a/modules/80_optimization/lp_nlp_apr17/solve.gms +++ b/modules/80_optimization/lp_nlp_apr17/solve.gms @@ -12,7 +12,7 @@ p80_modelstat(t) = 1; *** solver settings magpie.optfile = s80_optfile ; -magpie.scaleopt = s80_scaleopt ; +magpie.scaleopt = 1 ; magpie.solprint = 0 ; magpie.holdfixed = 1 ; diff --git a/modules/80_optimization/nlp_apr17/input.gms b/modules/80_optimization/nlp_apr17/input.gms index c1a0df02cc..b26b854d44 100644 --- a/modules/80_optimization/nlp_apr17/input.gms +++ b/modules/80_optimization/nlp_apr17/input.gms @@ -8,5 +8,4 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 10 / s80_optfile switch to use specfied solver settings (1) / 0 / - s80_scaleopt switch to for scaling (1=on 0=off) / 1 / ; diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index bd4ecef577..bae758fec1 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -14,7 +14,7 @@ s80_optfile_previter = s80_optfile; *** solver settings option nlp = conopt4; magpie.optfile = s80_optfile; -magpie.scaleopt = s80_scaleopt ; +magpie.scaleopt = 1 ; magpie.solprint = 0 ; magpie.holdfixed = 1 ; diff --git a/modules/80_optimization/nlp_par/input.gms b/modules/80_optimization/nlp_par/input.gms index 24b78e9ea7..eaf3fdd672 100644 --- a/modules/80_optimization/nlp_par/input.gms +++ b/modules/80_optimization/nlp_par/input.gms @@ -8,5 +8,4 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 10 / s80_optfile switch to use specfied solver settings (1) / 0 / - s80_scaleopt switch to for scaling (1=on 0=off) / 1 / ; diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 2021e8ddcd..8b95ef6ff2 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -14,7 +14,7 @@ p80_modelstat(t,h) = 14; option nlp = conopt4; magpie.solvelink = 3; magpie.optfile = s80_optfile ; -magpie.scaleopt = s80_scaleopt ; +magpie.scaleopt = 1 ; magpie.solprint = 0 ; magpie.holdfixed = 1 ; From 0b74f687e0a63adba30e83f9f14f415820e29953 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 29 Apr 2024 19:46:38 +0200 Subject: [PATCH 070/280] lines --- modules/35_natveg/dynamic_feb21/presolve.gms | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/dynamic_feb21/presolve.gms index 861236d9e5..9e757cbe3b 100644 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ b/modules/35_natveg/dynamic_feb21/presolve.gms @@ -47,7 +47,6 @@ pc35_secdforest(j,ac_sub) = pc35_secdforest(j,ac_sub) - p35_disturbance_loss_sec pcm_land(j,"primforest") = pcm_land(j,"primforest") - p35_disturbance_loss_primf(t,j); vm_land.l(j,"primforest") = pcm_land(j,"primforest"); - * Regrowth of natural vegetation (natural succession) is modelled by shifting age-classes according to time step length. s35_shift = m_timestep_length_forestry/5; * example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) @@ -63,7 +62,6 @@ s35_shift = m_timestep_length_forestry/5; p35_secdforest(t,j,"acx") = p35_secdforest(t,j,"acx") + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_secdforest(j,ac)); - * -------------------------------------- * Carbon threshold for secondary forest * -------------------------------------- @@ -77,7 +75,6 @@ p35_other(t,j,ac) = p35_other(t,j,ac) - p35_recovered_forest(t,j,ac); p35_secdforest(t,j,ac) = p35_secdforest(t,j,ac) + p35_recovered_forest(t,j,ac); *' @stop - pc35_secdforest(j,ac) = p35_secdforest(t,j,ac); v35_secdforest.l(j,ac) = pc35_secdforest(j,ac); vm_land.l(j,"secdforest") = sum(ac, pc35_secdforest(j,ac)); From 364f7abafbe960b58eca3165eee391e1d2ae5a42 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Mon, 29 Apr 2024 20:04:25 +0200 Subject: [PATCH 071/280] max forest restoration fixes --- modules/35_natveg/dynamic_may24/declarations.gms | 5 +++-- modules/35_natveg/dynamic_may24/equations.gms | 6 ++++-- modules/35_natveg/dynamic_may24/presolve.gms | 10 ++++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/modules/35_natveg/dynamic_may24/declarations.gms b/modules/35_natveg/dynamic_may24/declarations.gms index ec3dad2e85..3966e4db63 100644 --- a/modules/35_natveg/dynamic_may24/declarations.gms +++ b/modules/35_natveg/dynamic_may24/declarations.gms @@ -19,7 +19,7 @@ parameters p35_min_forest(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_damage_fader(t_all) Fader for forest damage (1) - p35_max_forest_recovery(j) Forest recovery potential (mio. ha) + p35_max_forest_recovery(j) Forest recovery potential (mio. ha) p35_carbon_density_secdforest(t,j,ac,ag_pools) Carbon density secdforest (tC per ha) p35_carbon_density_other(t,j,ac,ag_pools) Carbon density other land (tC per ha) p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) @@ -31,6 +31,7 @@ parameters p35_land_start_ac(j,ac,land_natveg) Initial Natural vegetation area (mio. ha) p35_protection_dist(j,ac) Distribution of secondary forest protection (1) p35_land_restoration(j,land_natveg) Actual secondary forest and other land restoration area (mio. ha) + p35_restoration_shift(j) Restoration of other land instead of secdforest (mio. ha) ; equations @@ -48,7 +49,7 @@ equations q35_secdforest_reduction(j,ac) Secdforest reduction (mio. ha) q35_primforest_reduction(j) Primforest reduction (mio. ha) q35_secdforest_regeneration(j) Secondary forest remains secondary forest (mio. ha) - q35_max_secdforest_regeneration(j) Secondary (mio. ha) + q35_max_secdforest_regeneration(j) Maximum forest regeneration (mio. ha) q35_other_regeneration(j) Other land remains other land (mio. ha) q35_other_est(j,ac) Distribution of other land additions over ac_est (mio. ha) q35_secdforest_est(j,ac) Distribution of secdforest additions over ac_est (mio. ha) diff --git a/modules/35_natveg/dynamic_may24/equations.gms b/modules/35_natveg/dynamic_may24/equations.gms index 72c3c71047..a863a9c36c 100644 --- a/modules/35_natveg/dynamic_may24/equations.gms +++ b/modules/35_natveg/dynamic_may24/equations.gms @@ -185,9 +185,11 @@ q35_secdforest_regeneration(j2).. q35_max_secdforest_regeneration(j2).. sum(ac_est, v35_secdforest(j2,ac_est)) - + sum(type32, vm_landexpansion_forestry(j2,type32)) + + sum(type32, vm_landexpansion_forestry(j2,type32)) =l= - p35_max_forest_recovery(j2) + + sum(ac_sub,v35_hvarea_secdforest(j2,ac_sub)) + + v35_hvarea_primforest(j2) + + p35_max_forest_recovery(j2) ; *' Harvested other land is still considered other land diff --git a/modules/35_natveg/dynamic_may24/presolve.gms b/modules/35_natveg/dynamic_may24/presolve.gms index f3b813ec94..3d63213dee 100644 --- a/modules/35_natveg/dynamic_may24/presolve.gms +++ b/modules/35_natveg/dynamic_may24/presolve.gms @@ -120,6 +120,13 @@ p35_land_restoration(j,"secdforest") = pm_land_conservation(t,j,"secdforest","re * Do not restore secdforest in areas where total natural * land area meets the total natural land conservation target p35_land_restoration(j,"secdforest")$(sum(land_natveg, pcm_land(j,land_natveg)) >= sum((land_natveg, consv_type), pm_land_conservation(t,j,land_natveg,consv_type))) = 0; + + +p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - p35_max_forest_recovery(j); +p35_restoration_shift(j)$(p35_restoration_shift(j) < 0) = 0 +p35_land_restoration(j,"secdforest") = p35_land_restoration(j,"secdforest") - p35_restoration_shift(j); + + * set conservation bound vm_land.lo(j,"secdforest") = pm_land_conservation(t,j,"secdforest","protect") + p35_land_restoration(j,"secdforest"); @@ -136,7 +143,7 @@ m_boundfix(v35_other,(j,ac_sub),l,10e-5); * protection bound fix pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_other(j,ac_sub)); * set restoration target -p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); +p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore") + p35_restoration_shift(j); * Do not restore other land in areas where total natural * land area meets the total natural land conservation target p35_land_restoration(j,"other")$(sum(land_natveg, pcm_land(j,land_natveg)) >= sum((land_natveg, consv_type), pm_land_conservation(t,j,land_natveg,consv_type))) = 0; @@ -156,7 +163,6 @@ p35_carbon_density_other(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools * ------------------ p35_min_forest(t,j)$(p35_min_forest(t,j) > pcm_land(j,"primforest") + pcm_land(j,"secdforest")) = pcm_land(j,"primforest") + pcm_land(j,"secdforest"); -p35_min_forest(t,j)$(p35_min_forest(t,j) > f35_pot_forest_area(j)) = f35_pot_forest_area(j); p35_min_other(t,j)$(p35_min_other(t,j) > pcm_land(j,"other")) = pcm_land(j,"other"); ** Display From 952c15cd2462ad733153d54c7ab225e22e329cb1 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Mon, 29 Apr 2024 20:25:05 +0200 Subject: [PATCH 072/280] bugfix --- modules/35_natveg/dynamic_may24/presolve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/35_natveg/dynamic_may24/presolve.gms b/modules/35_natveg/dynamic_may24/presolve.gms index 3d63213dee..c91b0f057c 100644 --- a/modules/35_natveg/dynamic_may24/presolve.gms +++ b/modules/35_natveg/dynamic_may24/presolve.gms @@ -123,7 +123,7 @@ p35_land_restoration(j,"secdforest")$(sum(land_natveg, pcm_land(j,land_natveg)) p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - p35_max_forest_recovery(j); -p35_restoration_shift(j)$(p35_restoration_shift(j) < 0) = 0 +p35_restoration_shift(j)$(p35_restoration_shift(j) < 0) = 0; p35_land_restoration(j,"secdforest") = p35_land_restoration(j,"secdforest") - p35_restoration_shift(j); From 8d3df52dd0e71cb87f345dc26ff5cad3807040f5 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 29 Apr 2024 23:18:38 +0200 Subject: [PATCH 073/280] bugfix --- .../80_optimization/nlp_par/declarations.gms | 2 +- modules/80_optimization/nlp_par/solve.gms | 23 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/modules/80_optimization/nlp_par/declarations.gms b/modules/80_optimization/nlp_par/declarations.gms index 1cbf6971aa..ef24019753 100644 --- a/modules/80_optimization/nlp_par/declarations.gms +++ b/modules/80_optimization/nlp_par/declarations.gms @@ -9,7 +9,7 @@ parameters p80_modelstat(t,h) modelstat indicator (1) p80_counter(h) counter (1) p80_handle(h) parallel mode handle parameter (1) - p80_resolve(h) indicator for restarting solve (1) + p80_extra_solve(h) indicator for extra solve (1) ; scalars diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 8b95ef6ff2..5bb8d12579 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -39,7 +39,6 @@ loop(h, i2(i)$supreg(h,i) = yes; loop(i2, j2(j)$cell(i2,j) = yes); solve magpie USING nlp MINIMIZING vm_cost_glo; - solve magpie USING nlp MINIMIZING vm_cost_glo; h2(h) = no; i2(i) = no; j2(j) = no; @@ -51,7 +50,7 @@ repeat loop(h$p80_handle(h), if(handleStatus(p80_handle(h)) = 2, p80_counter(h) = p80_counter(h) + 1; - p80_resolve(h) = 1; + p80_extra_solve(h) = 1; magpie.handle = p80_handle(h); execute_loadhandle magpie; @@ -75,34 +74,38 @@ repeat option AsyncSolLst=1; display$handlecollect(p80_handle(h)) 're-collect'; option AsyncSolLst=0; - p80_resolve(h) = 0; + p80_extra_solve(h) = 0; ); display$handledelete(p80_handle(h)) 'trouble deleting handles' ; if (p80_modelstat(t,h) <= 2, - display "Model status <= 2. Handle cleared."; - p80_resolve(h) = 0; - p80_handle(h) = 0; + if (p80_counter(h) < 2, + display "Model status <= 2. Starting second solve"; + solve magpie USING nlp MINIMIZING vm_cost_glo; + p80_handle(h) = magpie.handle; + p80_extra_solve(h) = 0; + else + display "Model status <= 2. Handle cleared."; + p80_extra_solve(h) = 0; + p80_handle(h) = 0; + ); ); - if (p80_resolve(h) = 1, + if (p80_extra_solve(h) = 1, display "Resolve" if (p80_modelstat(t,h) ne s80_modelstat_previter, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; solve magpie USING nlp MINIMIZING vm_cost_glo; - solve magpie USING nlp MINIMIZING vm_cost_glo; elseif p80_modelstat(t,h) = s80_modelstat_previter, if(magpie.optfile = s80_optfile_previter, display "Modelstat > 2 | Retry solve without CONOPT4 pre-processing"; magpie.optfile = 2; solve magpie USING nlp MINIMIZING vm_cost_glo; - solve magpie USING nlp MINIMIZING vm_cost_glo; else display "Modelstat > 2 | Retry solve with CONOPT3"; option nlp = conopt; solve magpie USING nlp MINIMIZING vm_cost_glo; - solve magpie USING nlp MINIMIZING vm_cost_glo; option nlp = conopt4; ); ); From b4064984ae9bec49a96e95ed8045b0ff894fc5fd Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 29 Apr 2024 23:40:22 +0200 Subject: [PATCH 074/280] bugfix --- modules/80_optimization/nlp_par/declarations.gms | 1 + modules/80_optimization/nlp_par/solve.gms | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/80_optimization/nlp_par/declarations.gms b/modules/80_optimization/nlp_par/declarations.gms index ef24019753..b375d607e3 100644 --- a/modules/80_optimization/nlp_par/declarations.gms +++ b/modules/80_optimization/nlp_par/declarations.gms @@ -10,6 +10,7 @@ parameters p80_counter(h) counter (1) p80_handle(h) parallel mode handle parameter (1) p80_extra_solve(h) indicator for extra solve (1) + p80_counter_modelstat(h) counter for modelstat <= 2 (1) ; scalars diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 5bb8d12579..8c7e9d5a1d 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -8,6 +8,7 @@ p80_counter(h) = 0; p80_modelstat(t,h) = 14; +p80_counter_modelstat(h) = 0; *** solver settings @@ -80,7 +81,8 @@ repeat display$handledelete(p80_handle(h)) 'trouble deleting handles' ; if (p80_modelstat(t,h) <= 2, - if (p80_counter(h) < 2, + p80_counter_modelstat(h) = p80_counter_modelstat(h) + 1; + if (p80_counter_modelstat(h) < 2, display "Model status <= 2. Starting second solve"; solve magpie USING nlp MINIMIZING vm_cost_glo; p80_handle(h) = magpie.handle; From 29ec05ac46b0136624650de91caa52660f8d9314 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 30 Apr 2024 10:32:06 +0200 Subject: [PATCH 075/280] bugfix --- modules/29_cropland/detail_apr24/realization.gms | 1 - modules/29_cropland/simple_apr24/declarations.gms | 2 ++ modules/29_cropland/simple_apr24/postsolve.gms | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/29_cropland/detail_apr24/realization.gms b/modules/29_cropland/detail_apr24/realization.gms index c9b62fec84..071000bd1e 100644 --- a/modules/29_cropland/detail_apr24/realization.gms +++ b/modules/29_cropland/detail_apr24/realization.gms @@ -25,7 +25,6 @@ $Ifi "%phase%" == "sets" $include "./modules/29_cropland/detail_apr24/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/29_cropland/detail_apr24/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/29_cropland/detail_apr24/input.gms" $Ifi "%phase%" == "equations" $include "./modules/29_cropland/detail_apr24/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/29_cropland/detail_apr24/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/29_cropland/detail_apr24/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/29_cropland/detail_apr24/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/29_cropland/detail_apr24/postsolve.gms" diff --git a/modules/29_cropland/simple_apr24/declarations.gms b/modules/29_cropland/simple_apr24/declarations.gms index 1f02098fb4..34207a40de 100644 --- a/modules/29_cropland/simple_apr24/declarations.gms +++ b/modules/29_cropland/simple_apr24/declarations.gms @@ -39,6 +39,8 @@ parameters oq29_cropland(t,j,type) Total cropland calculation (mio. ha) oq29_avl_cropland(t,j,type) Available cropland constraint (mio. ha) oq29_carbon(t,j,ag_pools,stockType,type) Cropland above ground carbon content calculation (mio. tC) + oq29_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha) + oq29_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/29_cropland/simple_apr24/postsolve.gms b/modules/29_cropland/simple_apr24/postsolve.gms index aaa4624b50..450d616814 100644 --- a/modules/29_cropland/simple_apr24/postsolve.gms +++ b/modules/29_cropland/simple_apr24/postsolve.gms @@ -12,23 +12,31 @@ oq29_cropland(t,j,"marginal") = q29_cropland.m(j); oq29_avl_cropland(t,j,"marginal") = q29_avl_cropland.m(j); oq29_carbon(t,j,ag_pools,stockType,"marginal") = q29_carbon.m(j,ag_pools,stockType); + oq29_land_snv(t,j,"marginal") = q29_land_snv.m(j); + oq29_land_snv_trans(t,j,"marginal") = q29_land_snv_trans.m(j); ov_cost_cropland(t,j,"level") = vm_cost_cropland.l(j); ov_fallow(t,j,"level") = vm_fallow.l(j); ov_treecover(t,j,"level") = vm_treecover.l(j); oq29_cropland(t,j,"level") = q29_cropland.l(j); oq29_avl_cropland(t,j,"level") = q29_avl_cropland.l(j); oq29_carbon(t,j,ag_pools,stockType,"level") = q29_carbon.l(j,ag_pools,stockType); + oq29_land_snv(t,j,"level") = q29_land_snv.l(j); + oq29_land_snv_trans(t,j,"level") = q29_land_snv_trans.l(j); ov_cost_cropland(t,j,"upper") = vm_cost_cropland.up(j); ov_fallow(t,j,"upper") = vm_fallow.up(j); ov_treecover(t,j,"upper") = vm_treecover.up(j); oq29_cropland(t,j,"upper") = q29_cropland.up(j); oq29_avl_cropland(t,j,"upper") = q29_avl_cropland.up(j); oq29_carbon(t,j,ag_pools,stockType,"upper") = q29_carbon.up(j,ag_pools,stockType); + oq29_land_snv(t,j,"upper") = q29_land_snv.up(j); + oq29_land_snv_trans(t,j,"upper") = q29_land_snv_trans.up(j); ov_cost_cropland(t,j,"lower") = vm_cost_cropland.lo(j); ov_fallow(t,j,"lower") = vm_fallow.lo(j); ov_treecover(t,j,"lower") = vm_treecover.lo(j); oq29_cropland(t,j,"lower") = q29_cropland.lo(j); oq29_avl_cropland(t,j,"lower") = q29_avl_cropland.lo(j); oq29_carbon(t,j,ag_pools,stockType,"lower") = q29_carbon.lo(j,ag_pools,stockType); + oq29_land_snv(t,j,"lower") = q29_land_snv.lo(j); + oq29_land_snv_trans(t,j,"lower") = q29_land_snv_trans.lo(j); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### From 176fa1c108cc56130ef823e987f135c70c3bacaf Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 30 Apr 2024 10:38:10 +0200 Subject: [PATCH 076/280] bugfix --- modules/29_cropland/detail_apr24/presolve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index 39a064bbeb..7d58830fe5 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -23,7 +23,7 @@ p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t- *' Global Land Service (@buchhorn_copernicus_2020)) and in *' cases of cropland reduction p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * pcm_land(j,"crop") - - vm_treecover.l(j); + - sum(ac, pc29_treecover(j,ac_sub)); p29_max_snv_relocation(t,j)$(p29_max_snv_relocation(t,j) < 0) = 0; p29_snv_relocation(t,j)$(p29_snv_relocation(t, j) > p29_max_snv_relocation(t,j)) = p29_max_snv_relocation(t,j); From ccaf380de6c8a5cb4bfd28da11d35606b3872e6a Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 30 Apr 2024 10:39:00 +0200 Subject: [PATCH 077/280] bugfix --- modules/29_cropland/detail_apr24/presolve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index 7d58830fe5..54fe3c9120 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -23,7 +23,7 @@ p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t- *' Global Land Service (@buchhorn_copernicus_2020)) and in *' cases of cropland reduction p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * pcm_land(j,"crop") - - sum(ac, pc29_treecover(j,ac_sub)); + - sum(ac, pc29_treecover(j,ac)); p29_max_snv_relocation(t,j)$(p29_max_snv_relocation(t,j) < 0) = 0; p29_snv_relocation(t,j)$(p29_snv_relocation(t, j) > p29_max_snv_relocation(t,j)) = p29_max_snv_relocation(t,j); From 1745fcdb2f63bc188f61862b49da6df7f341744d Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 30 Apr 2024 11:54:51 +0200 Subject: [PATCH 078/280] update calibration --- config/default.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.cfg b/config/default.cfg index cdaba9e998..5832345699 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -26,7 +26,7 @@ cfg$input <- c(regional = "rev4.104_h12_magpie.tgz", cellular = "rev4.104_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", validation = "rev4.104_h12_validation.tgz", additional = "additional_data_rev4.48.tgz", - calibration = "calibration_H12_cropareaSimple_21Apr24.tgz") + calibration = "calibration_H12_default_30Apr24.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, From 3514353fc80436f772c06fd78378c61e8672d5b7 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 30 Apr 2024 16:02:12 +0200 Subject: [PATCH 079/280] bugfix in scneario_config related to EL2 settings --- config/scenario_config.csv | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/scenario_config.csv b/config/scenario_config.csv index 4c1657a7d8..81b7126f6c 100755 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -54,15 +54,15 @@ gms$c50_scen_neff;;;;baseeff_add3_add10_add20_max75;baseeff_add3_add5_add10_max6 gms$c50_scen_neff_noselect;;;;baseeff_add3_add10_add20_max75;baseeff_add3_add5_add10_max65;baseeff_add3_add5_add10_max65;baseeff_add3_add0_add0_max55;baseeff_add3_add10_add15_max75;baseeff_add3_add5_add15_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max65;baseeff_add3_add15_add25_max75;;;;;;;baseeff_add3_add15_add25_max75;;;;;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;;;;;;;;;;;;;;;;;;; gms$c55_scen_conf;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;ssp1;ssp1;ssp1;ssp1;;;;;;;ssp1;;;;;ssp1;ssp1;ssp1;ssp1;ssp1;;;;;;;;;;;;;;;;;;; gms$c55_scen_conf_noselect;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;ssp1;ssp1;ssp1;ssp1;;;;;;;ssp1;;;;;ssp4;ssp4;ssp1;ssp4;ssp1;;;;;;;;;;;;;;;;;;; -gms$c56_pollutant_prices;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;none;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;; -gms$c56_pollutant_prices_noselect;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;none;none;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;; +gms$c56_pollutant_prices;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;;;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;; +gms$c56_pollutant_prices_noselect;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;;;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;; gms$s56_c_price_exp_aff;;;;50;50;50;50;50;50;50;30;50;50;;;;;;;50;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s56_buffer_aff;;;;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.2;0.3;;;;;;;0.5;;;;;;;;;;;;;;;;;;;;;;;;;;;; -gms$c56_emis_policy;;;;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;redd_nosoil;all_nosoil;;;;;;;reddnatveg_nosoil;;;none;none;;;;;;;;;;;;;;;;;;;;;;;; +gms$c56_emis_policy;;;;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;redd_nosoil;all_nosoil;;;;;;;reddnatveg_nosoil;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s56_minimum_cprice;;;;;;;;;;;;;;0;0;18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$maccs;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -gms$c60_2ndgen_biodem;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;none;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;; -gms$c60_2ndgen_biodem_noselect;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;none;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;; +gms$c60_2ndgen_biodem;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;;;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;; +gms$c60_2ndgen_biodem_noselect;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;;;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;; gms$c60_1stgen_biodem;;;;phaseout2020;const2020;const2020;const2030;const2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;;;;;;;phaseout2020;;;;;phaseout2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;;;;;;;;;;;;;;;;;;; gms$c60_biodem_level;;;;;;;;;;;;;;;;;1;0;;;;;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;; gms$c60_bioenergy_subsidy;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; From 77cba2806f85535d01dfff12cb6c4d37a89bd3f8 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Tue, 30 Apr 2024 18:01:16 +0200 Subject: [PATCH 080/280] fixes for forest damage and regeneration --- .../35_natveg/dynamic_may24/declarations.gms | 3 ++- modules/35_natveg/dynamic_may24/equations.gms | 15 ++++++++++-- modules/35_natveg/dynamic_may24/presolve.gms | 23 +++++++++++++++---- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/modules/35_natveg/dynamic_may24/declarations.gms b/modules/35_natveg/dynamic_may24/declarations.gms index 3966e4db63..d34e40abed 100644 --- a/modules/35_natveg/dynamic_may24/declarations.gms +++ b/modules/35_natveg/dynamic_may24/declarations.gms @@ -49,7 +49,8 @@ equations q35_secdforest_reduction(j,ac) Secdforest reduction (mio. ha) q35_primforest_reduction(j) Primforest reduction (mio. ha) q35_secdforest_regeneration(j) Secondary forest remains secondary forest (mio. ha) - q35_max_secdforest_regeneration(j) Maximum forest regeneration (mio. ha) + q35_max_secdforest_regeneration(j) Maximum secdforest regeneration (mio. ha) + q35_max_foresty_expansion(j) Maximum forestry regeneration based on potential forest area (mio. ha) q35_other_regeneration(j) Other land remains other land (mio. ha) q35_other_est(j,ac) Distribution of other land additions over ac_est (mio. ha) q35_secdforest_est(j,ac) Distribution of secdforest additions over ac_est (mio. ha) diff --git a/modules/35_natveg/dynamic_may24/equations.gms b/modules/35_natveg/dynamic_may24/equations.gms index a863a9c36c..a2560d0121 100644 --- a/modules/35_natveg/dynamic_may24/equations.gms +++ b/modules/35_natveg/dynamic_may24/equations.gms @@ -82,7 +82,7 @@ q35_other_expansion(j2) .. v35_other_expansion(j2) =e= - sum(ac_est, v35_other(j2,ac_est) + v35_secdforest(j2,ac_est)); + sum(ac_est, v35_other(j2,ac_est)); q35_other_reduction(j2,ac_sub) .. v35_other_reduction(j2,ac_sub) =e= @@ -183,15 +183,26 @@ q35_secdforest_regeneration(j2).. + p35_land_restoration(j2,"secdforest") ; +*' The upper bound for the new establishment of forested areas is given +*' by the harvested area plus the remaining potential forest area, which is derived +*' from the potential natural forest area in each cluster. + q35_max_secdforest_regeneration(j2).. sum(ac_est, v35_secdforest(j2,ac_est)) - + sum(type32, vm_landexpansion_forestry(j2,type32)) =l= + sum(ac_sub,v35_hvarea_secdforest(j2,ac_sub)) + v35_hvarea_primforest(j2) + p35_max_forest_recovery(j2) ; +*' Forestry establishment is also constrained by the remaining potential forest area. +q35_max_foresty_expansion(j2).. + sum(type32, vm_landexpansion_forestry(j2,type32)) + =l= + p35_max_forest_recovery(j2) + ; + + *' Harvested other land is still considered other land q35_other_regeneration(j2).. diff --git a/modules/35_natveg/dynamic_may24/presolve.gms b/modules/35_natveg/dynamic_may24/presolve.gms index c91b0f057c..c3e81e18c1 100644 --- a/modules/35_natveg/dynamic_may24/presolve.gms +++ b/modules/35_natveg/dynamic_may24/presolve.gms @@ -62,11 +62,24 @@ s35_shift = m_timestep_length_forestry/5; p35_secdforest(t,j,"acx") = p35_secdforest(t,j,"acx") + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_secdforest(j,ac)); + +pc35_secdforest(j,ac) = p35_secdforest(t,j,ac); +v35_secdforest.l(j,ac) = pc35_secdforest(j,ac); +vm_land.l(j,"secdforest") = sum(ac, pc35_secdforest(j,ac)); +pcm_land(j,"secdforest") = sum(ac, pc35_secdforest(j,ac)); + +pc35_other(j,ac) = p35_other(t,j,ac); +v35_other.l(j,ac) = pc35_other(j,ac); +vm_land.l(j,"other") = sum(ac, pc35_other(j,ac)); +pcm_land(j,"other") = sum(ac, pc35_other(j,ac)); + * -------------------------------------- -* Secondary forest recovery +* Secondary forest recovery bound * -------------------------------------- -* Forest recovery is constrained by the potential forest area in each cluster +* Forest recovery is constrained by the potential forest area in each cluster. +* Hence, the potential area for forest recovery is given by the potential forest +* area minus all forest areas in the previous time step. p35_max_forest_recovery(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); p35_max_forest_recovery(j)$(p35_max_forest_recovery(j) < 0) = 0; @@ -122,10 +135,12 @@ p35_land_restoration(j,"secdforest") = pm_land_conservation(t,j,"secdforest","re p35_land_restoration(j,"secdforest")$(sum(land_natveg, pcm_land(j,land_natveg)) >= sum((land_natveg, consv_type), pm_land_conservation(t,j,land_natveg,consv_type))) = 0; +* Since forest restoration cannot be bigger than the maximum area for forest recovery, +* any remaining restoration area is substracted and shifted to other land restoration. p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - p35_max_forest_recovery(j); p35_restoration_shift(j)$(p35_restoration_shift(j) < 0) = 0; p35_land_restoration(j,"secdforest") = p35_land_restoration(j,"secdforest") - p35_restoration_shift(j); - +pm_land_conservation(t,j,"other","restore") = pm_land_conservation(t,j,"other","restore") + p35_restoration_shift(j); * set conservation bound vm_land.lo(j,"secdforest") = pm_land_conservation(t,j,"secdforest","protect") + p35_land_restoration(j,"secdforest"); @@ -143,7 +158,7 @@ m_boundfix(v35_other,(j,ac_sub),l,10e-5); * protection bound fix pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_other(j,ac_sub)); * set restoration target -p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore") + p35_restoration_shift(j); +p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); * Do not restore other land in areas where total natural * land area meets the total natural land conservation target p35_land_restoration(j,"other")$(sum(land_natveg, pcm_land(j,land_natveg)) >= sum((land_natveg, consv_type), pm_land_conservation(t,j,land_natveg,consv_type))) = 0; From 4d2b2e3d6fee04de9f3958897997d927a6ce268d Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 1 May 2024 08:13:03 +0200 Subject: [PATCH 081/280] highres --- CHANGELOG.md | 1 + scripts/output/extra/highres.R | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ff9dc5957..e3e166f765 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **scenario_fsec.csv** scenario settings - **start/projects/fsec.R** scenario settings - **80_optimization** fixed a bug in nlp_apr17; cycling through CONOPT4, CONOPT4 without preprocessing and CONOPT3 was not working +- **80_optimization** bugfix in nlp_par. Double solve statement was not working - **58_peatland** Added balance variable to avoid random infeasibilites diff --git a/scripts/output/extra/highres.R b/scripts/output/extra/highres.R index b018934d7f..809868fef6 100644 --- a/scripts/output/extra/highres.R +++ b/scripts/output/extra/highres.R @@ -100,8 +100,8 @@ highres <- function(cfg) { #copy gdx file for 1st time step from low resolution run for better starting point #note: using gdx files for more than the 1st time step sometimes pushes the model into corner solutions, which might result in infeasibilites. cfg$files2export$start <- c(cfg$files2export$start, - paste0(cfg$results_folder, "/", "magpie_y1995.gdx")) - cfg$gms$s_use_gdx <- 1 + paste0(cfg$results_folder, "/", "magpie_y*.gdx")) + cfg$gms$s_use_gdx <- 2 #max resources for parallel runs cfg$qos <- "standby_maxMem_dayMax" From 55a812592a970af811460239fcfcad6a95bf6df0 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 2 May 2024 11:50:24 +0200 Subject: [PATCH 082/280] removed ndc forestry conflict --- core/sets.gms | 2 +- modules/32_forestry/dynamic_feb21/presolve.gms | 8 ++++++-- modules/35_natveg/dynamic_feb21/input.gms | 8 ++++++++ modules/35_natveg/dynamic_feb21/preloop.gms | 3 +++ modules/35_natveg/dynamic_may24/input.gms | 2 +- modules/35_natveg/dynamic_may24/presolve.gms | 2 +- 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/core/sets.gms b/core/sets.gms index e506848e8b..5ee0ef2fe4 100644 --- a/core/sets.gms +++ b/core/sets.gms @@ -248,7 +248,7 @@ sets / crop, past / land_timber(land) land from which timber can be taken away - / forestry, primforest, secdforest,other / + / forestry, primforest, secdforest, other / land_forest(land) Forested land pools / forestry, primforest, secdforest / diff --git a/modules/32_forestry/dynamic_feb21/presolve.gms b/modules/32_forestry/dynamic_feb21/presolve.gms index 819189ae54..78db4d62ff 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_feb21/presolve.gms @@ -21,7 +21,11 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; p32_aff_pol_timestep("y1995",j) = 0; p32_aff_pol_timestep(t,j)$(ord(t)>1) = p32_aff_pol(t,j) - p32_aff_pol(t-1,j); * Suitable area (`p32_aff_pot`) for NPI/NDC afforestation - p32_aff_pot(t,j) = (vm_land.l(j,"crop") - vm_land.lo(j,"crop")) + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore"); + p32_aff_pot(t,j) = (vm_land.l(j,"crop") - vm_land.lo(j,"crop")) + + (vm_land.l(j,"past") - vm_land.lo(j,"past")) + - pm_land_conservation(t,j,"other","restore"); + p32_aff_pot(t,j)$(p32_aff_pot(t,j) > (fm_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)))) + = (fm_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest))); * suitable area `p32_aff_pot` can be negative, if land restoration is switched on (level smaller than lower bound), therefore set negative values to 0 p32_aff_pot(t,j)$(p32_aff_pot(t,j) < 0) = 0; * Limit prescribed NPI/NDC afforestation in `p32_aff_pol_timestep` if not enough suitable area (`p32_aff_pot`) for afforestation is available @@ -143,7 +147,7 @@ if(s32_aff_prot = 0, v32_land.fx(j,"aff",ac)$(ac.off <= s32_planing_horizon/5) = pc32_land(j,"aff",ac); v32_land.up(j,"aff",ac)$(ac.off > s32_planing_horizon/5) = pc32_land(j,"aff",ac); elseif s32_aff_prot = 1, - v32_land.fx(j,"aff",ac) = pc32_land(j,"aff",ac); + v32_land.fx(j,"aff",ac) = pc32_land(j,"aff",ac); ); v32_land.lo(j,"aff",ac_est) = 0; v32_land.up(j,"aff",ac_est) = Inf; diff --git a/modules/35_natveg/dynamic_feb21/input.gms b/modules/35_natveg/dynamic_feb21/input.gms index 89828c827e..0510a69d3f 100644 --- a/modules/35_natveg/dynamic_feb21/input.gms +++ b/modules/35_natveg/dynamic_feb21/input.gms @@ -54,3 +54,11 @@ $ondelim $include "./modules/35_natveg/input/f35_gs_relativetarget.cs4" $offdelim /; + +parameter fm_pot_forest_area(j) Potential forest area (mio. ha) +/ +$ondelim +$include "./modules/35_natveg/input/pot_forest_area.cs3" +$offdelim +/; + diff --git a/modules/35_natveg/dynamic_feb21/preloop.gms b/modules/35_natveg/dynamic_feb21/preloop.gms index 85a49664f4..5b357bedc7 100644 --- a/modules/35_natveg/dynamic_feb21/preloop.gms +++ b/modules/35_natveg/dynamic_feb21/preloop.gms @@ -43,6 +43,9 @@ p35_secdforest(t,j,ac) = 0; p35_disturbance_loss_secdf(t,j,ac) = 0; p35_disturbance_loss_primf(t,j) = 0; +* In this realisation, the potential forest area is not applied +fm_pot_forest_area(j) = Inf; + * ----------------------------------------- * Land conservation for climate mitigation * ----------------------------------------- diff --git a/modules/35_natveg/dynamic_may24/input.gms b/modules/35_natveg/dynamic_may24/input.gms index 0567f0ed39..de5bef3564 100644 --- a/modules/35_natveg/dynamic_may24/input.gms +++ b/modules/35_natveg/dynamic_may24/input.gms @@ -55,7 +55,7 @@ $include "./modules/35_natveg/input/f35_gs_relativetarget.cs4" $offdelim /; -parameter f35_pot_forest_area(j) Potential forest area (mio. ha) +parameter fm_pot_forest_area(j) Potential forest area (mio. ha) / $ondelim $include "./modules/35_natveg/input/pot_forest_area.cs3" diff --git a/modules/35_natveg/dynamic_may24/presolve.gms b/modules/35_natveg/dynamic_may24/presolve.gms index c3e81e18c1..68c9aff345 100644 --- a/modules/35_natveg/dynamic_may24/presolve.gms +++ b/modules/35_natveg/dynamic_may24/presolve.gms @@ -80,7 +80,7 @@ pcm_land(j,"other") = sum(ac, pc35_other(j,ac)); * Forest recovery is constrained by the potential forest area in each cluster. * Hence, the potential area for forest recovery is given by the potential forest * area minus all forest areas in the previous time step. -p35_max_forest_recovery(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); +p35_max_forest_recovery(j) = fm_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); p35_max_forest_recovery(j)$(p35_max_forest_recovery(j) < 0) = 0; * ------------------------------------- From 584aac53520d0e3ff8fe316267f917eb15ad06a9 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 2 May 2024 12:50:37 +0200 Subject: [PATCH 083/280] nlp par update --- modules/80_optimization/lp_nlp_apr17/not_used.txt | 2 ++ modules/80_optimization/nlp_apr17/not_used.txt | 1 + modules/80_optimization/nlp_par/solve.gms | 11 ++++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 modules/80_optimization/lp_nlp_apr17/not_used.txt diff --git a/modules/80_optimization/lp_nlp_apr17/not_used.txt b/modules/80_optimization/lp_nlp_apr17/not_used.txt new file mode 100644 index 0000000000..4dd79412da --- /dev/null +++ b/modules/80_optimization/lp_nlp_apr17/not_used.txt @@ -0,0 +1,2 @@ +name,type,reason +sm_fix_SSP2,input,not needed diff --git a/modules/80_optimization/nlp_apr17/not_used.txt b/modules/80_optimization/nlp_apr17/not_used.txt index ea605f3b35..7a59e90855 100644 --- a/modules/80_optimization/nlp_apr17/not_used.txt +++ b/modules/80_optimization/nlp_apr17/not_used.txt @@ -1,2 +1,3 @@ name,type,reason vm_landdiff,input,questionnaire +sm_fix_SSP2,input,not needed diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 8c7e9d5a1d..1a79df95d1 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -111,6 +111,9 @@ repeat option nlp = conopt4; ); ); + if (execerror > 0 AND ord(t) > 1, + Execute_Loadpoint "magpie_p.gdx"; + ); execerror = 0; if (magpie.handle = 0, display "Problem. Handle is zero despite resolve. Setting handle to 1 for continuation."; @@ -127,12 +130,18 @@ display$sleep(card(p80_handle)*0.2) 'sleep some time'; display$readyCollect(p80_handle,INF) 'Problem waiting for next instance to complete'; until card(p80_handle) = 0 OR smax(h, p80_counter(h)) >= s80_maxiter; +* Save results to gdx files after historical period. +* Historical period is excluded to avoid diversion of results compared to other model runs if restarted with s_use_gdx = 2. +if (smax(h,p80_modelstat(t,h)) <= 2 AND m_year(t) > sm_fix_SSP2, + put_utility 'shell' / 'cp -f magpie_p.gdx magpie_' t.tl:0'.gdx'; +); + if (smax(h,p80_modelstat(t,h)) > 2 and smax(h,p80_modelstat(t,h)) ne 7, Execute_Unload "fulldata.gdx"; abort "No feasible solution found!"; ); -* handleSubmit does not work as expected. Does not restart from saved state. +* handleSubmit does not work because it requires the script `gmsrerun.cmd` or `gmsrerun.run` in the grid directory. * Therefore, solve statements are used. * display$handleSubmit(p80_handle(h)) 'trouble resubmitting handles' ; From 6c23a00275ecfec965b64587d968b50127b530a8 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 2 May 2024 13:26:20 +0200 Subject: [PATCH 084/280] update --- modules/80_optimization/nlp_par/solve.gms | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 1a79df95d1..2638d90161 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -112,7 +112,8 @@ repeat ); ); if (execerror > 0 AND ord(t) > 1, - Execute_Loadpoint "magpie_p.gdx"; + display "Execution error. Loading solution from last feasible timestep for retry."; + Execute_Loadpoint "magpie_p_last_timestep.gdx"; ); execerror = 0; if (magpie.handle = 0, @@ -133,7 +134,8 @@ until card(p80_handle) = 0 OR smax(h, p80_counter(h)) >= s80_maxiter; * Save results to gdx files after historical period. * Historical period is excluded to avoid diversion of results compared to other model runs if restarted with s_use_gdx = 2. if (smax(h,p80_modelstat(t,h)) <= 2 AND m_year(t) > sm_fix_SSP2, - put_utility 'shell' / 'cp -f magpie_p.gdx magpie_' t.tl:0'.gdx'; + put_utility 'shell' / 'cp -f magpie_p.gdx magpie_p_last_timestep.gdx'; + put_utility 'shell' / 'mv -f magpie_p.gdx magpie_' t.tl:0'.gdx'; ); if (smax(h,p80_modelstat(t,h)) > 2 and smax(h,p80_modelstat(t,h)) ne 7, From 444eaaf98db2fce2243ca445826aee4fbffa38a2 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 2 May 2024 14:56:21 +0200 Subject: [PATCH 085/280] update --- modules/80_optimization/nlp_par/solve.gms | 40 +++++++++++++---------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 2638d90161..5c5c8f1d34 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -49,18 +49,12 @@ loop(h, *collection loop repeat loop(h$p80_handle(h), - if(handleStatus(p80_handle(h)) = 2, + if(handleStatus(p80_handle(h)) = 2, // process solutions which are ready p80_counter(h) = p80_counter(h) + 1; p80_extra_solve(h) = 1; - magpie.handle = p80_handle(h); - execute_loadhandle magpie; - magpie.modelStat$(magpie.modelStat=NA) = 13; - - s80_modelstat_previter = p80_modelstat(t,h); - p80_modelstat(t,h) = magpie.modelStat; - s80_optfile_previter = magpie.optfile; - magpie.optfile = s80_optfile; + magpie.handle = p80_handle(h); // assign handle to extract solution + execute_loadhandle magpie; // load point h2(h) = yes; i2(i)$supreg(h,i) = yes; @@ -69,6 +63,18 @@ repeat s80_counter = sum(h2,p80_counter(h2)); display s80_counter; display magpie.modelStat; + magpie.modelStat$(magpie.modelStat=NA) = 13; + + if (magpie.modelStat > 2 AND ord(t) > 1, + display "No feasible solution or Execution error. Loading solution from last feasible timestep for retry."; + Execute_Loadpoint "magpie_p_last_timestep.gdx"; + ); + execerror = 0; + + s80_modelstat_previter = p80_modelstat(t,h); + p80_modelstat(t,h) = magpie.modelStat; + s80_optfile_previter = magpie.optfile; + magpie.optfile = s80_optfile; if ((p80_counter(h) >= s80_maxiter AND p80_modelstat(t,h) > 2), display "No feasible solution found. Writing LST file."; @@ -111,11 +117,6 @@ repeat option nlp = conopt4; ); ); - if (execerror > 0 AND ord(t) > 1, - display "Execution error. Loading solution from last feasible timestep for retry."; - Execute_Loadpoint "magpie_p_last_timestep.gdx"; - ); - execerror = 0; if (magpie.handle = 0, display "Problem. Handle is zero despite resolve. Setting handle to 1 for continuation."; magpie.handle = 1; @@ -131,11 +132,14 @@ display$sleep(card(p80_handle)*0.2) 'sleep some time'; display$readyCollect(p80_handle,INF) 'Problem waiting for next instance to complete'; until card(p80_handle) = 0 OR smax(h, p80_counter(h)) >= s80_maxiter; -* Save results to gdx files after historical period. -* Historical period is excluded to avoid diversion of results compared to other model runs if restarted with s_use_gdx = 2. -if (smax(h,p80_modelstat(t,h)) <= 2 AND m_year(t) > sm_fix_SSP2, +* Save results to gdx point files +* Historical period for magpie_p_y[XXXX].gdx files is excluded to avoid diversion of results compared to other model runs if restarted with s_use_gdx = 2. +if (smax(h,p80_modelstat(t,h)) <= 2, put_utility 'shell' / 'cp -f magpie_p.gdx magpie_p_last_timestep.gdx'; - put_utility 'shell' / 'mv -f magpie_p.gdx magpie_' t.tl:0'.gdx'; + if (m_year(t) > sm_fix_SSP2, + put_utility 'shell' / 'cp -f magpie_p.gdx magpie_' t.tl:0'.gdx'; + ); + put_utility 'shell' / 'rm -f magpie_p.gdx; ); if (smax(h,p80_modelstat(t,h)) > 2 and smax(h,p80_modelstat(t,h)) ne 7, From d4f25ff434815af2c13f0960ee59faee2a2a5907 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 2 May 2024 15:00:13 +0200 Subject: [PATCH 086/280] update --- modules/80_optimization/nlp_par/solve.gms | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 5c5c8f1d34..49ab922446 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -66,8 +66,13 @@ repeat magpie.modelStat$(magpie.modelStat=NA) = 13; if (magpie.modelStat > 2 AND ord(t) > 1, - display "No feasible solution or Execution error. Loading solution from last feasible timestep for retry."; - Execute_Loadpoint "magpie_p_last_timestep.gdx"; + if (p80_counter_modelstat(h) <= 5, + display "No feasible solution or Execution error. Loading solution from last feasible timestep for retry."; + Execute_Loadpoint "magpie_p_last_timestep.gdx"; + else + display "No feasible solution or Execution error. Loading solution from first feasible timestep for retry."; + Execute_Loadpoint "magpie_y1995.gdx"; + ); ); execerror = 0; From 8e61949073ab4384a3e3abcd996d96d049db10c9 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 2 May 2024 15:11:00 +0200 Subject: [PATCH 087/280] bugfix --- modules/80_optimization/nlp_par/solve.gms | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 49ab922446..c28ebf840a 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -49,12 +49,12 @@ loop(h, *collection loop repeat loop(h$p80_handle(h), - if(handleStatus(p80_handle(h)) = 2, // process solutions which are ready + if(handleStatus(p80_handle(h)) = 2, p80_counter(h) = p80_counter(h) + 1; p80_extra_solve(h) = 1; - magpie.handle = p80_handle(h); // assign handle to extract solution - execute_loadhandle magpie; // load point + magpie.handle = p80_handle(h); + execute_loadhandle magpie; h2(h) = yes; i2(i)$supreg(h,i) = yes; From 3389360ecfb05758659859343ea8d58cde8118cd Mon Sep 17 00:00:00 2001 From: Felicitas Date: Thu, 2 May 2024 15:23:44 +0200 Subject: [PATCH 088/280] adjustments in output scripts --- scripts/output/projects/inms_reporting_reg.R | 30 ++++++++++--------- scripts/start/projects/project_EAT2p0.R | 4 +-- .../start/projects/project_EAT2p0_DeepDive.R | 4 +-- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/scripts/output/projects/inms_reporting_reg.R b/scripts/output/projects/inms_reporting_reg.R index bcc2abd4ce..b4cd9aac27 100644 --- a/scripts/output/projects/inms_reporting_reg.R +++ b/scripts/output/projects/inms_reporting_reg.R @@ -24,15 +24,15 @@ print("Start inms reporting reg runscript") if(!exists("source_include")) { - title <- "inms_SSP2_RCP4p5_PolicyLow_v4" - outputdir <- "output/inms_SSP2_RCP4p5_PolicyLow_v4_2020-07-13_15.37.07" + title <- "inms_SSP2_RCP4p5_PolicyLow_v4" + outputdir <- "output/inms_SSP2_RCP4p5_PolicyLow_v4_2020-07-13_15.37.07" ###Define arguments that can be read from command line - readArgs("outputdir","title") + readArgs("outputdir", "title") } ######################################################################################### -print(paste0("script started for output directory",outputdir)) +print(paste0("script started for output directory", outputdir)) withr::local_dir(outputdir) @@ -41,24 +41,26 @@ title <- cfg$title print("generating INMS output for the run: ") print(title) -filename=paste0("report_",title,".mif") -gdx=paste0("fulldata.gdx") -a=getReportINMS(gdx,file=filename,scenario = title,dir=".") +filename <- paste0("report_", title, ".mif") +gdx <- paste0("fulldata.gdx") +a <- getReportINMS(gdx, file = filename, scenario = title, dir = ".") print(filename) -mif=read.report(filename) +mif <- read.report(filename) -missingyears=function(x){ - history=paste0("y",1965+((0:5)*5)) - x[[1]][[1]] <- time_interpolate(x[[1]][[1]],interpolated_year = c(history,paste0("y",2005+((0:9)*10))),integrate_interpolated_years = TRUE) - x[[1]][[1]][,history,] = 0 +missingyears <- function(x) { + history <- paste0("y", 1965 + ((0:5) * 5)) + x[[1]][[1]] <- time_interpolate(x[[1]][[1]], + interpolated_year = c(history,paste0("y",2005+((0:9)*10))), + integrate_interpolated_years = TRUE) + x[[1]][[1]][, history, ] <- 0 return(x) } #a=c(missingyears(ssp1),missingyears(ssp2)) -a=missingyears(mif) +a <- missingyears(mif) -write.reportProject(a,mapping=paste0(wdbefore,"/mapping_inms.csv"),file="report_inms.mif") +write.reportProject(a, mapping = paste0(wdbefore, "/mapping_inms.csv"), file = "report_inms.mif") #write.report(a,file="magpie_results_nov2019.mif") warnings() diff --git a/scripts/start/projects/project_EAT2p0.R b/scripts/start/projects/project_EAT2p0.R index 60b4b4e015..434b8a0d85 100644 --- a/scripts/start/projects/project_EAT2p0.R +++ b/scripts/start/projects/project_EAT2p0.R @@ -33,9 +33,9 @@ cfg$output <- c("output_check", "extra/disaggregation", # "projects/FSEC_nitrogenPollution", # do manually on last (high-res) magpie run # "projects/FSEC_water", # do manually on last (high-res) magpie run - "agmip_report", # add output file: pb_report (magpie (special mif created by getReportPBindicators & remind mif (REMIND_generic_scenName.mif)) - "rds_report") + "rds_report", + "agmip_report") ####################### # SCENARIO DEFINITION # diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index 9346c4af5d..246c1a8d72 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -35,9 +35,9 @@ cfg$output <- c( "projects/FSEC_nitrogenPollution", "projects/FSEC_water", "agmip_report", - "runBlackmagicc", # add output file: pb_report (magpie (special mif created by getReportPBindicators & remind mif (REMIND_generic_scenName.mif)) - "rds_report" + "rds_report", + "runBlackmagicc" ) ####################### From 518c25d960efe4f06f9e0a43d41c557074c5b4dc Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 2 May 2024 16:20:21 +0200 Subject: [PATCH 089/280] bugfix --- modules/80_optimization/nlp_par/solve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index c28ebf840a..1bd8bf2691 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -144,7 +144,7 @@ if (smax(h,p80_modelstat(t,h)) <= 2, if (m_year(t) > sm_fix_SSP2, put_utility 'shell' / 'cp -f magpie_p.gdx magpie_' t.tl:0'.gdx'; ); - put_utility 'shell' / 'rm -f magpie_p.gdx; + put_utility 'shell' / 'rm -f magpie_p.gdx'; ); if (smax(h,p80_modelstat(t,h)) > 2 and smax(h,p80_modelstat(t,h)) ne 7, From fcc0f4a61b24e09504c4bf306cea9e2a47cf7ca1 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 2 May 2024 16:38:13 +0200 Subject: [PATCH 090/280] use carbon density of other land where forest potential is zero --- modules/52_carbon/normal_dec17/input.gms | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/52_carbon/normal_dec17/input.gms b/modules/52_carbon/normal_dec17/input.gms index a7f8de3df7..7aa7a75499 100644 --- a/modules/52_carbon/normal_dec17/input.gms +++ b/modules/52_carbon/normal_dec17/input.gms @@ -23,7 +23,14 @@ $if "%c52_carbon_scenario%" == "nocc" fm_carbon_density(t_all,j,land,c_pools) = $if "%c52_carbon_scenario%" == "nocc_hist" fm_carbon_density(t_all,j,land,c_pools)$(m_year(t_all) > sm_fix_cc) = fm_carbon_density(t_all,j,land,c_pools)$(m_year(t_all) = sm_fix_cc); m_fillmissingyears(fm_carbon_density,"j,land,c_pools"); -* Fix urban area soilc to natural land soilc as long as preprocessed +* Where no forest carbon density is reported, because the potential +* forest area is zero, use the carbon density of other land instead. +* This affects areas, where the land use intialisation reports some +* forest, although the forest potential is zero. Forest expansion in +* these cells is constrained by fm_pot_forest_area. +fm_carbon_density(t_all,j,land_forest,c_pools)$(fm_carbon_density(t_all,j,land_forest,c_pools) = 0) = fm_carbon_density(t_all,j,"other",c_pools); + +* Fix urban area soilc to natural land soilc as long as preprocessed * fm_carbon_density does not provide meaningful numbers for urban. fm_carbon_density(t_all,j,"urban","soilc") = fm_carbon_density(t_all,j,"other","soilc") @@ -37,7 +44,7 @@ $offdelim * Note: Land carbon sink adjustment factors from Grassie et al 2021 (DOI 10.1038/s41558-021-01033-6) * are needed in the post-processing in https://github.com/pik-piam/magpie4/blob/master/R/reportEmissions.R -* To facilitate the choice of the corresponding RCP, the adjustment factors are read-in here and +* To facilitate the choice of the corresponding RCP, the adjustment factors are read-in here and * stored in i52_land_carbon_sink for use in the R post-processing. * Land carbon sink adjustment factors are NOT used within MAgPIE. $onEmpty @@ -50,10 +57,10 @@ $offEmpty $ifthen "%c52_land_carbon_sink_rcp%" == "nocc" i52_land_carbon_sink(t_all,i) = f52_land_carbon_sink("y1995",i,"RCPBU"); -$elseif "%c52_land_carbon_sink_rcp%" == "nocc_hist" +$elseif "%c52_land_carbon_sink_rcp%" == "nocc_hist" i52_land_carbon_sink(t_all,i) = f52_land_carbon_sink(t_all,i,"RCPBU"); i52_land_carbon_sink(t_all,i)$(m_year(t_all) > sm_fix_cc) = f52_land_carbon_sink(t_all,i,"RCPBU")$(m_year(t_all) = sm_fix_cc); -$else +$else i52_land_carbon_sink(t_all,i) = f52_land_carbon_sink(t_all,i,"%c52_land_carbon_sink_rcp%"); i52_land_carbon_sink(t_all,i)$(m_year(t_all) <= sm_fix_cc) = f52_land_carbon_sink(t_all,i,"RCPBU")$(m_year(t_all) <= sm_fix_cc); $endif From 21fedf2d12ae628596acd4e718655eb624f597a2 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 2 May 2024 17:07:36 +0200 Subject: [PATCH 091/280] new realisation name --- modules/35_natveg/input/files | 2 ++ modules/35_natveg/module.gms | 2 +- .../declarations.gms | 0 .../equations.gms | 0 .../input.gms | 0 .../postsolve.gms | 0 .../preloop.gms | 0 .../presolve.gms | 0 .../realization.gms | 18 +++++++++--------- .../scaling.gms | 0 .../sets.gms | 0 11 files changed, 12 insertions(+), 10 deletions(-) rename modules/35_natveg/{dynamic_may24 => pot_forest_may24}/declarations.gms (100%) rename modules/35_natveg/{dynamic_may24 => pot_forest_may24}/equations.gms (100%) rename modules/35_natveg/{dynamic_may24 => pot_forest_may24}/input.gms (100%) rename modules/35_natveg/{dynamic_may24 => pot_forest_may24}/postsolve.gms (100%) rename modules/35_natveg/{dynamic_may24 => pot_forest_may24}/preloop.gms (100%) rename modules/35_natveg/{dynamic_may24 => pot_forest_may24}/presolve.gms (100%) rename modules/35_natveg/{dynamic_may24 => pot_forest_may24}/realization.gms (73%) rename modules/35_natveg/{dynamic_may24 => pot_forest_may24}/scaling.gms (100%) rename modules/35_natveg/{dynamic_may24 => pot_forest_may24}/sets.gms (100%) diff --git a/modules/35_natveg/input/files b/modules/35_natveg/input/files index f1603f4a64..8b65a1fd46 100644 --- a/modules/35_natveg/input/files +++ b/modules/35_natveg/input/files @@ -4,3 +4,5 @@ f35_forest_disturbance_share.cs4 f35_forest_lost_share.cs3 f35_gs_relativetarget.cs4 f35_forest_shock.csv +pot_forest_area.cs3 +pot_forest_area_0.5.mz diff --git a/modules/35_natveg/module.gms b/modules/35_natveg/module.gms index 6ebab7afad..ad5f60d91d 100644 --- a/modules/35_natveg/module.gms +++ b/modules/35_natveg/module.gms @@ -18,5 +18,5 @@ *###################### R SECTION START (MODULETYPES) ########################## $Ifi "%natveg%" == "dynamic_feb21" $include "./modules/35_natveg/dynamic_feb21/realization.gms" -$Ifi "%natveg%" == "dynamic_may24" $include "./modules/35_natveg/dynamic_may24/realization.gms" +$Ifi "%natveg%" == "pot_forest_may24" $include "./modules/35_natveg/pot_forest_may24/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/35_natveg/dynamic_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms similarity index 100% rename from modules/35_natveg/dynamic_may24/declarations.gms rename to modules/35_natveg/pot_forest_may24/declarations.gms diff --git a/modules/35_natveg/dynamic_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms similarity index 100% rename from modules/35_natveg/dynamic_may24/equations.gms rename to modules/35_natveg/pot_forest_may24/equations.gms diff --git a/modules/35_natveg/dynamic_may24/input.gms b/modules/35_natveg/pot_forest_may24/input.gms similarity index 100% rename from modules/35_natveg/dynamic_may24/input.gms rename to modules/35_natveg/pot_forest_may24/input.gms diff --git a/modules/35_natveg/dynamic_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms similarity index 100% rename from modules/35_natveg/dynamic_may24/postsolve.gms rename to modules/35_natveg/pot_forest_may24/postsolve.gms diff --git a/modules/35_natveg/dynamic_may24/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms similarity index 100% rename from modules/35_natveg/dynamic_may24/preloop.gms rename to modules/35_natveg/pot_forest_may24/preloop.gms diff --git a/modules/35_natveg/dynamic_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms similarity index 100% rename from modules/35_natveg/dynamic_may24/presolve.gms rename to modules/35_natveg/pot_forest_may24/presolve.gms diff --git a/modules/35_natveg/dynamic_may24/realization.gms b/modules/35_natveg/pot_forest_may24/realization.gms similarity index 73% rename from modules/35_natveg/dynamic_may24/realization.gms rename to modules/35_natveg/pot_forest_may24/realization.gms index af25d81fa5..a726d8d650 100644 --- a/modules/35_natveg/dynamic_may24/realization.gms +++ b/modules/35_natveg/pot_forest_may24/realization.gms @@ -5,7 +5,7 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*' @description In the dynamic_may24 realization, land and carbon stock dynamics +*' @description In the pot_forest_may24 realization, land and carbon stock dynamics *' of natural vegetation are modeled endogenously. *' The initial spatial distribution of the sub-land-types primary forest, *' secondary forest and other natural land is based on the @@ -33,12 +33,12 @@ *' secondary forest and harvested primary forest is reclassified as secondary forest. *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/35_natveg/dynamic_may24/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/35_natveg/dynamic_may24/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/35_natveg/dynamic_may24/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/35_natveg/dynamic_may24/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/35_natveg/dynamic_may24/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/35_natveg/dynamic_may24/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/35_natveg/dynamic_may24/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/35_natveg/dynamic_may24/postsolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/35_natveg/pot_forest_may24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/35_natveg/pot_forest_may24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/35_natveg/pot_forest_may24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/35_natveg/pot_forest_may24/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/35_natveg/pot_forest_may24/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/35_natveg/pot_forest_may24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/35_natveg/pot_forest_may24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/35_natveg/pot_forest_may24/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/35_natveg/dynamic_may24/scaling.gms b/modules/35_natveg/pot_forest_may24/scaling.gms similarity index 100% rename from modules/35_natveg/dynamic_may24/scaling.gms rename to modules/35_natveg/pot_forest_may24/scaling.gms diff --git a/modules/35_natveg/dynamic_may24/sets.gms b/modules/35_natveg/pot_forest_may24/sets.gms similarity index 100% rename from modules/35_natveg/dynamic_may24/sets.gms rename to modules/35_natveg/pot_forest_may24/sets.gms From 9d7befcd92791c791af3e0fce4832dd401ae5778 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 2 May 2024 18:43:08 +0200 Subject: [PATCH 092/280] update --- .../80_optimization/nlp_par/declarations.gms | 3 +- modules/80_optimization/nlp_par/solve.gms | 70 +++++++++++-------- 2 files changed, 42 insertions(+), 31 deletions(-) diff --git a/modules/80_optimization/nlp_par/declarations.gms b/modules/80_optimization/nlp_par/declarations.gms index b375d607e3..1f927a251f 100644 --- a/modules/80_optimization/nlp_par/declarations.gms +++ b/modules/80_optimization/nlp_par/declarations.gms @@ -10,7 +10,8 @@ parameters p80_counter(h) counter (1) p80_handle(h) parallel mode handle parameter (1) p80_extra_solve(h) indicator for extra solve (1) - p80_counter_modelstat(h) counter for modelstat <= 2 (1) + p80_counter_modelstat(h) counter for modelstat <= 2 (1) + p80_resolve_option(h) option for resolve (1) ; scalars diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 1bd8bf2691..c17c6b97d7 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -9,9 +9,9 @@ p80_counter(h) = 0; p80_modelstat(t,h) = 14; p80_counter_modelstat(h) = 0; +p80_resolve_option(h) = 1; *** solver settings - option nlp = conopt4; magpie.solvelink = 3; magpie.optfile = s80_optfile ; @@ -63,23 +63,12 @@ repeat s80_counter = sum(h2,p80_counter(h2)); display s80_counter; display magpie.modelStat; + display vm_cost_glo.l; magpie.modelStat$(magpie.modelStat=NA) = 13; - if (magpie.modelStat > 2 AND ord(t) > 1, - if (p80_counter_modelstat(h) <= 5, - display "No feasible solution or Execution error. Loading solution from last feasible timestep for retry."; - Execute_Loadpoint "magpie_p_last_timestep.gdx"; - else - display "No feasible solution or Execution error. Loading solution from first feasible timestep for retry."; - Execute_Loadpoint "magpie_y1995.gdx"; - ); - ); - execerror = 0; - s80_modelstat_previter = p80_modelstat(t,h); p80_modelstat(t,h) = magpie.modelStat; s80_optfile_previter = magpie.optfile; - magpie.optfile = s80_optfile; if ((p80_counter(h) >= s80_maxiter AND p80_modelstat(t,h) > 2), display "No feasible solution found. Writing LST file."; @@ -107,32 +96,53 @@ repeat if (p80_extra_solve(h) = 1, display "Resolve" - if (p80_modelstat(t,h) ne s80_modelstat_previter, - display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; - solve magpie USING nlp MINIMIZING vm_cost_glo; - elseif p80_modelstat(t,h) = s80_modelstat_previter, - if(magpie.optfile = s80_optfile_previter, - display "Modelstat > 2 | Retry solve without CONOPT4 pre-processing"; - magpie.optfile = 2; - solve magpie USING nlp MINIMIZING vm_cost_glo; + if (ord(t) > 1, + if (p80_counter(h) <= s80_maxiter/2, + display "No feasible solution or Execution error. Loading solution from last feasible timestep for retry."; + Execute_Loadpoint "magpie_p_last_timestep.gdx"; else - display "Modelstat > 2 | Retry solve with CONOPT3"; - option nlp = conopt; - solve magpie USING nlp MINIMIZING vm_cost_glo; - option nlp = conopt4; + display "No feasible solution or Execution error. Loading solution from first feasible timestep for retry."; + Execute_Loadpoint "magpie_y1995.gdx"; ); ); - if (magpie.handle = 0, - display "Problem. Handle is zero despite resolve. Setting handle to 1 for continuation."; - magpie.handle = 1; + display vm_cost_glo.l; + execerror$(execerror > 0) = 0; + if (p80_resolve_option(h) = 1, + display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; + solve magpie USING nlp MINIMIZING vm_cost_glo; + else if (p80_resolve_option(h) = 2) + display "Modelstat > 2 | Retry solve with CONOPT4 and OPTFILE"; + magpie.optfile = 1; + solve magpie USING nlp MINIMIZING vm_cost_glo; + magpie.optfile = s80_optfile; + else if (p80_resolve_option(h) = 3) + display "Modelstat > 2 | Retry solve without CONOPT4 pre-processing"; + magpie.optfile = 2; + solve magpie USING nlp MINIMIZING vm_cost_glo; + magpie.optfile = s80_optfile; + else if (p80_resolve_option(h) = 4) + display "Modelstat > 2 | Retry solve with CONOPT3"; + option nlp = conopt; + solve magpie USING nlp MINIMIZING vm_cost_glo; + option nlp = conopt4; + ); + if (p80_resolve_option(h) < 4, + p80_resolve_option(h) = p80_resolve_option(h) + 1; + else + p80_resolve_option(h) = 1; ); - p80_handle(h) = magpie.handle; ); + if (magpie.handle = 0, + display "Problem. Handle is zero despite resolve. Setting handle to 1 for continuation."; + magpie.handle = 1; + ); + p80_handle(h) = magpie.handle; + ); h2(h) = no; i2(i) = no; j2(j) = no; - ); ); +); display$sleep(card(p80_handle)*0.2) 'sleep some time'; display$readyCollect(p80_handle,INF) 'Problem waiting for next instance to complete'; until card(p80_handle) = 0 OR smax(h, p80_counter(h)) >= s80_maxiter; From d8eb4e9512d46e75413a740be61f0b9e7fd49d9e Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 2 May 2024 19:00:56 +0200 Subject: [PATCH 093/280] bugfix --- modules/80_optimization/nlp_par/solve.gms | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index c17c6b97d7..3ba08aa2c7 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -63,6 +63,7 @@ repeat s80_counter = sum(h2,p80_counter(h2)); display s80_counter; display magpie.modelStat; + display "vm_cost_glo.l"; display vm_cost_glo.l; magpie.modelStat$(magpie.modelStat=NA) = 13; @@ -105,22 +106,23 @@ repeat Execute_Loadpoint "magpie_y1995.gdx"; ); ); + display "vm_cost_glo.l"; display vm_cost_glo.l; execerror$(execerror > 0) = 0; if (p80_resolve_option(h) = 1, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; solve magpie USING nlp MINIMIZING vm_cost_glo; - else if (p80_resolve_option(h) = 2) + elseif p80_resolve_option(h) = 2, display "Modelstat > 2 | Retry solve with CONOPT4 and OPTFILE"; magpie.optfile = 1; solve magpie USING nlp MINIMIZING vm_cost_glo; magpie.optfile = s80_optfile; - else if (p80_resolve_option(h) = 3) + elseif p80_resolve_option(h) = 3, display "Modelstat > 2 | Retry solve without CONOPT4 pre-processing"; magpie.optfile = 2; solve magpie USING nlp MINIMIZING vm_cost_glo; magpie.optfile = s80_optfile; - else if (p80_resolve_option(h) = 4) + elseif p80_resolve_option(h) = 4, display "Modelstat > 2 | Retry solve with CONOPT3"; option nlp = conopt; solve magpie USING nlp MINIMIZING vm_cost_glo; From 9f2acf41e38eccd84bdefd5aa19001c1cdbbe624 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 2 May 2024 19:20:35 +0200 Subject: [PATCH 094/280] bugfix --- modules/80_optimization/nlp_par/solve.gms | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 3ba08aa2c7..2fdf169802 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -144,7 +144,6 @@ repeat i2(i) = no; j2(j) = no; ); -); display$sleep(card(p80_handle)*0.2) 'sleep some time'; display$readyCollect(p80_handle,INF) 'Problem waiting for next instance to complete'; until card(p80_handle) = 0 OR smax(h, p80_counter(h)) >= s80_maxiter; From f7125acd51c1b8416eb97d68aef760fd9d09c83d Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 3 May 2024 00:32:58 +0200 Subject: [PATCH 095/280] bugfix --- modules/80_optimization/nlp_par/solve.gms | 44 +++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 2fdf169802..5b14cb4475 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -71,19 +71,19 @@ repeat p80_modelstat(t,h) = magpie.modelStat; s80_optfile_previter = magpie.optfile; - if ((p80_counter(h) >= s80_maxiter AND p80_modelstat(t,h) > 2), + if(p80_counter(h) >= s80_maxiter AND p80_modelstat(t,h) > 2, display "No feasible solution found. Writing LST file."; option AsyncSolLst=1; display$handlecollect(p80_handle(h)) 're-collect'; option AsyncSolLst=0; p80_extra_solve(h) = 0; - ); + ); display$handledelete(p80_handle(h)) 'trouble deleting handles' ; - if (p80_modelstat(t,h) <= 2, + if(p80_modelstat(t,h) <= 2, p80_counter_modelstat(h) = p80_counter_modelstat(h) + 1; - if (p80_counter_modelstat(h) < 2, + if(p80_counter_modelstat(h) < 2, display "Model status <= 2. Starting second solve"; solve magpie USING nlp MINIMIZING vm_cost_glo; p80_handle(h) = magpie.handle; @@ -92,24 +92,24 @@ repeat display "Model status <= 2. Handle cleared."; p80_extra_solve(h) = 0; p80_handle(h) = 0; - ); - ); + ); + ); - if (p80_extra_solve(h) = 1, + if(p80_extra_solve(h) = 1, display "Resolve" - if (ord(t) > 1, - if (p80_counter(h) <= s80_maxiter/2, + if(ord(t) > 1, + if(p80_counter(h) <= s80_maxiter/2, display "No feasible solution or Execution error. Loading solution from last feasible timestep for retry."; Execute_Loadpoint "magpie_p_last_timestep.gdx"; else display "No feasible solution or Execution error. Loading solution from first feasible timestep for retry."; Execute_Loadpoint "magpie_y1995.gdx"; - ); - ); + ); + ); display "vm_cost_glo.l"; display vm_cost_glo.l; execerror$(execerror > 0) = 0; - if (p80_resolve_option(h) = 1, + if(p80_resolve_option(h) = 1, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; solve magpie USING nlp MINIMIZING vm_cost_glo; elseif p80_resolve_option(h) = 2, @@ -127,23 +127,23 @@ repeat option nlp = conopt; solve magpie USING nlp MINIMIZING vm_cost_glo; option nlp = conopt4; - ); + ); if (p80_resolve_option(h) < 4, p80_resolve_option(h) = p80_resolve_option(h) + 1; else p80_resolve_option(h) = 1; - ); - ); - if (magpie.handle = 0, - display "Problem. Handle is zero despite resolve. Setting handle to 1 for continuation."; - magpie.handle = 1; - ); - p80_handle(h) = magpie.handle; - ); + ); + if(magpie.handle = 0, + display "Problem. Handle is zero despite resolve. Setting handle to 1 for continuation."; + magpie.handle = 1; + ); + p80_handle(h) = magpie.handle; + ); h2(h) = no; i2(i) = no; j2(j) = no; - ); + ); + ); display$sleep(card(p80_handle)*0.2) 'sleep some time'; display$readyCollect(p80_handle,INF) 'Problem waiting for next instance to complete'; until card(p80_handle) = 0 OR smax(h, p80_counter(h)) >= s80_maxiter; From 46e2285fa2bb6b3c18f10bb62bde3b8e332b775d Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 3 May 2024 10:30:17 +0200 Subject: [PATCH 096/280] update --- modules/80_optimization/nlp_par/solve.gms | 54 +++++++++++++---------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 5b14cb4475..4fe79bb1a9 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -63,8 +63,8 @@ repeat s80_counter = sum(h2,p80_counter(h2)); display s80_counter; display magpie.modelStat; - display "vm_cost_glo.l"; - display vm_cost_glo.l; + display "v11_cost_reg.l"; + display v11_cost_reg.l; magpie.modelStat$(magpie.modelStat=NA) = 13; s80_modelstat_previter = p80_modelstat(t,h); @@ -72,6 +72,7 @@ repeat s80_optfile_previter = magpie.optfile; if(p80_counter(h) >= s80_maxiter AND p80_modelstat(t,h) > 2, + if (p80_modelstat(t,h) = 13, execute 'gmszip -r magpie_problem_' h.tl:0'_' t.tl:0'.zip "%gams.scrdir%"'); display "No feasible solution found. Writing LST file."; option AsyncSolLst=1; display$handlecollect(p80_handle(h)) 're-collect'; @@ -97,38 +98,43 @@ repeat if(p80_extra_solve(h) = 1, display "Resolve" - if(ord(t) > 1, - if(p80_counter(h) <= s80_maxiter/2, - display "No feasible solution or Execution error. Loading solution from last feasible timestep for retry."; - Execute_Loadpoint "magpie_p_last_timestep.gdx"; - else - display "No feasible solution or Execution error. Loading solution from first feasible timestep for retry."; - Execute_Loadpoint "magpie_y1995.gdx"; - ); - ); - display "vm_cost_glo.l"; - display vm_cost_glo.l; + display "v11_cost_reg.l"; + display v11_cost_reg.l; execerror$(execerror > 0) = 0; if(p80_resolve_option(h) = 1, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; + magpie.optfile = 0; solve magpie USING nlp MINIMIZING vm_cost_glo; elseif p80_resolve_option(h) = 2, - display "Modelstat > 2 | Retry solve with CONOPT4 and OPTFILE"; - magpie.optfile = 1; + display "Modelstat > 2 | Retry solve with CONOPT4 default setting and magpie_p_last_timestep.gdx"; + magpie.optfile = 0; + Execute_Loadpoint "magpie_p_last_timestep.gdx"; + execerror$(execerror > 0) = 0; solve magpie USING nlp MINIMIZING vm_cost_glo; - magpie.optfile = s80_optfile; - elseif p80_resolve_option(h) = 3, - display "Modelstat > 2 | Retry solve without CONOPT4 pre-processing"; - magpie.optfile = 2; + elseif p80_resolve_option(h) = 3, + display "Modelstat > 2 | Retry solve with CONOPT4 default setting and magpie_y2020.gdx"; + magpie.optfile = 0; + Execute_Loadpoint "magpie_y2020.gdx"; + execerror$(execerror > 0) = 0; solve magpie USING nlp MINIMIZING vm_cost_glo; - magpie.optfile = s80_optfile; elseif p80_resolve_option(h) = 4, - display "Modelstat > 2 | Retry solve with CONOPT3"; - option nlp = conopt; + display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE"; + magpie.optfile = 1; + solve magpie USING nlp MINIMIZING vm_cost_glo; + elseif p80_resolve_option(h) = 5, + display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE and magpie_p_last_timestep.gdx"; + magpie.optfile = 1; + Execute_Loadpoint "magpie_p_last_timestep.gdx"; + execerror$(execerror > 0) = 0; + solve magpie USING nlp MINIMIZING vm_cost_glo; + elseif p80_resolve_option(h) = 6, + display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE and magpie_y2020.gdx"; + magpie.optfile = 1; + Execute_Loadpoint "magpie_y2020.gdx"; + execerror$(execerror > 0) = 0; solve magpie USING nlp MINIMIZING vm_cost_glo; - option nlp = conopt4; ); - if (p80_resolve_option(h) < 4, + if (p80_resolve_option(h) < 6, p80_resolve_option(h) = p80_resolve_option(h) + 1; else p80_resolve_option(h) = 1; From 286d9c581d80d4cb6a7c8ed6b9a18e616e78516e Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 3 May 2024 10:44:51 +0200 Subject: [PATCH 097/280] bugfix --- modules/80_optimization/nlp_par/solve.gms | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 4fe79bb1a9..5aa4c7a959 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -72,7 +72,10 @@ repeat s80_optfile_previter = magpie.optfile; if(p80_counter(h) >= s80_maxiter AND p80_modelstat(t,h) > 2, - if (p80_modelstat(t,h) = 13, execute 'gmszip -r magpie_problem_' h.tl:0'_' t.tl:0'.zip "%gams.scrdir%"'); + if(p80_modelstat(t,h) = 13, + execute 'gmszip -r magpie_problem.zip "%gams.scrdir%"' + put_utility 'shell' / 'mv -f magpie_problem.zip magpie_problem_' h.tl:0'_' t.tl:0'.zip'; + ); display "No feasible solution found. Writing LST file."; option AsyncSolLst=1; display$handlecollect(p80_handle(h)) 're-collect'; From ac4c24976b69a6462085ac49d507ada123ee724e Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 3 May 2024 12:18:27 +0200 Subject: [PATCH 098/280] update --- modules/80_optimization/nlp_par/declarations.gms | 1 + modules/80_optimization/nlp_par/solve.gms | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/80_optimization/nlp_par/declarations.gms b/modules/80_optimization/nlp_par/declarations.gms index 1f927a251f..95454dded2 100644 --- a/modules/80_optimization/nlp_par/declarations.gms +++ b/modules/80_optimization/nlp_par/declarations.gms @@ -16,6 +16,7 @@ parameters scalars s80_counter counter (1) + s80_objective objective function value (mio. USD05MER per yr) s80_modelstat_previter modelstat of previous iteration (1) s80_optfile_previter optfile used in previous iteration (1) ; diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 5aa4c7a959..92ed30b06b 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -61,10 +61,10 @@ repeat loop(i2, j2(j)$cell(i2,j) = yes); display h2; s80_counter = sum(h2,p80_counter(h2)); + s80_objective = sum(h2,v11_cost_reg.l(h2)); display s80_counter; display magpie.modelStat; - display "v11_cost_reg.l"; - display v11_cost_reg.l; + display s80_objective; magpie.modelStat$(magpie.modelStat=NA) = 13; s80_modelstat_previter = p80_modelstat(t,h); @@ -101,8 +101,6 @@ repeat if(p80_extra_solve(h) = 1, display "Resolve" - display "v11_cost_reg.l"; - display v11_cost_reg.l; execerror$(execerror > 0) = 0; if(p80_resolve_option(h) = 1, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; @@ -137,6 +135,8 @@ repeat execerror$(execerror > 0) = 0; solve magpie USING nlp MINIMIZING vm_cost_glo; ); + s80_objective = sum(h2,v11_cost_reg.l(h2)); + display s80_objective; if (p80_resolve_option(h) < 6, p80_resolve_option(h) = p80_resolve_option(h) + 1; else From bc4c3cf1c4f5599dedd2ab5c715bae6a9853d1a4 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 3 May 2024 12:37:14 +0200 Subject: [PATCH 099/280] bugfix --- modules/80_optimization/nlp_par/solve.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 92ed30b06b..fe8d5c63b1 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -61,7 +61,7 @@ repeat loop(i2, j2(j)$cell(i2,j) = yes); display h2; s80_counter = sum(h2,p80_counter(h2)); - s80_objective = sum(h2,v11_cost_reg.l(h2)); + s80_objective = sum(i2,v11_cost_reg.l(i2)); display s80_counter; display magpie.modelStat; display s80_objective; @@ -135,7 +135,7 @@ repeat execerror$(execerror > 0) = 0; solve magpie USING nlp MINIMIZING vm_cost_glo; ); - s80_objective = sum(h2,v11_cost_reg.l(h2)); + s80_objective = sum(i2,v11_cost_reg.l(i2)); display s80_objective; if (p80_resolve_option(h) < 6, p80_resolve_option(h) = p80_resolve_option(h) + 1; From 6365decee4ab7f5f5d7c70070c31908b2dd1ff0e Mon Sep 17 00:00:00 2001 From: Felicitas Date: Fri, 3 May 2024 12:53:45 +0200 Subject: [PATCH 100/280] changed settings in scenario config --- config/scenario_config.csv | 2 +- scripts/start/projects/project_EAT2p0_DeepDive.R | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/scenario_config.csv b/config/scenario_config.csv index 81b7126f6c..25d7930f35 100755 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -87,4 +87,4 @@ gms$c52_land_carbon_sink_rcp;;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c57_macc_version;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PBL_2022;PBL_2022;PBL_2022;PBL_2022;;;;;;;;;;;;;;; gms$c57_macc_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Default;Optimistic;Default;Optimistic;;;;;;;;;;;;;;; gms$s58_rewetting_switch;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0;1;0;1;;;;;;;;;;;;;;; -magicc_emis_scen;;;;;;;;;;;;;;;;;;;;;;SSP2EU-DSPkB500-DS_betax.mif;SSP2EU-DSPkB500-DS_betax.mif;SSP2EU-DSPkB500-DS_betax.mif;;;;;;;;;;;;;;;;;;;;;;;; +magicc_emis_scen;;;;;;;;;;;;;;;;;;;;;;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index 246c1a8d72..1ae5541373 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -35,15 +35,16 @@ cfg$output <- c( "projects/FSEC_nitrogenPollution", "projects/FSEC_water", "agmip_report", - # add output file: pb_report (magpie (special mif created by getReportPBindicators & remind mif (REMIND_generic_scenName.mif)) "rds_report", "runBlackmagicc" + # add output file: pb_report (magpie (special mif created by getReportPBindicators & remind mif (REMIND_generic_scenName.mif)) + ) ####################### # SCENARIO DEFINITION # ####################### -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) # To Do: Choose whether EL2_default or EL2_lessSus should be used! # Note: The climate change impacts setting differs from the global AgMIP model comparision set-up. # We do not include climate change impacts in the coupled REMIND-MAgPIE runs for the PB Deep Dive # because we focus exclusively on the mitigation aspect without climate change impacts. From 4ff98348fe39edfba36844a06c843f27602d15db Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 3 May 2024 13:02:56 +0200 Subject: [PATCH 101/280] bugfix --- modules/80_optimization/nlp_par/solve.gms | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index fe8d5c63b1..ae525173c6 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -101,42 +101,33 @@ repeat if(p80_extra_solve(h) = 1, display "Resolve" - execerror$(execerror > 0) = 0; if(p80_resolve_option(h) = 1, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; magpie.optfile = 0; - solve magpie USING nlp MINIMIZING vm_cost_glo; elseif p80_resolve_option(h) = 2, display "Modelstat > 2 | Retry solve with CONOPT4 default setting and magpie_p_last_timestep.gdx"; magpie.optfile = 0; Execute_Loadpoint "magpie_p_last_timestep.gdx"; - execerror$(execerror > 0) = 0; - solve magpie USING nlp MINIMIZING vm_cost_glo; elseif p80_resolve_option(h) = 3, display "Modelstat > 2 | Retry solve with CONOPT4 default setting and magpie_y2020.gdx"; magpie.optfile = 0; Execute_Loadpoint "magpie_y2020.gdx"; - execerror$(execerror > 0) = 0; - solve magpie USING nlp MINIMIZING vm_cost_glo; elseif p80_resolve_option(h) = 4, display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE"; magpie.optfile = 1; - solve magpie USING nlp MINIMIZING vm_cost_glo; elseif p80_resolve_option(h) = 5, display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE and magpie_p_last_timestep.gdx"; magpie.optfile = 1; Execute_Loadpoint "magpie_p_last_timestep.gdx"; - execerror$(execerror > 0) = 0; - solve magpie USING nlp MINIMIZING vm_cost_glo; elseif p80_resolve_option(h) = 6, display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE and magpie_y2020.gdx"; magpie.optfile = 1; Execute_Loadpoint "magpie_y2020.gdx"; - execerror$(execerror > 0) = 0; - solve magpie USING nlp MINIMIZING vm_cost_glo; ); + if(execerror > 0, execerror = 0); s80_objective = sum(i2,v11_cost_reg.l(i2)); display s80_objective; + solve magpie USING nlp MINIMIZING vm_cost_glo; if (p80_resolve_option(h) < 6, p80_resolve_option(h) = p80_resolve_option(h) + 1; else From fd50ef4642a6609b044fb17503f40703069d18be Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Fri, 3 May 2024 17:09:28 +0200 Subject: [PATCH 102/280] reworked forest regeneration --- core/sets.gms | 3 + modules/10_land/landmatrix_dec18/presolve.gms | 3 + .../35_natveg/dynamic_feb21/declarations.gms | 128 ----------- modules/35_natveg/dynamic_feb21/equations.gms | 202 ------------------ modules/35_natveg/dynamic_feb21/input.gms | 64 ------ modules/35_natveg/dynamic_feb21/not_used.txt | 2 - modules/35_natveg/dynamic_feb21/postsolve.gms | 179 ---------------- modules/35_natveg/dynamic_feb21/preloop.gms | 71 ------ modules/35_natveg/dynamic_feb21/presolve.gms | 200 ----------------- .../35_natveg/dynamic_feb21/realization.gms | 44 ---- modules/35_natveg/dynamic_feb21/scaling.gms | 8 - modules/35_natveg/dynamic_feb21/sets.gms | 28 --- .../pot_forest_may24/declarations.gms | 1 + .../35_natveg/pot_forest_may24/equations.gms | 23 +- .../35_natveg/pot_forest_may24/presolve.gms | 5 + 15 files changed, 20 insertions(+), 941 deletions(-) delete mode 100644 modules/35_natveg/dynamic_feb21/declarations.gms delete mode 100644 modules/35_natveg/dynamic_feb21/equations.gms delete mode 100644 modules/35_natveg/dynamic_feb21/input.gms delete mode 100644 modules/35_natveg/dynamic_feb21/not_used.txt delete mode 100644 modules/35_natveg/dynamic_feb21/postsolve.gms delete mode 100644 modules/35_natveg/dynamic_feb21/preloop.gms delete mode 100644 modules/35_natveg/dynamic_feb21/presolve.gms delete mode 100644 modules/35_natveg/dynamic_feb21/realization.gms delete mode 100644 modules/35_natveg/dynamic_feb21/scaling.gms delete mode 100644 modules/35_natveg/dynamic_feb21/sets.gms diff --git a/core/sets.gms b/core/sets.gms index 5ee0ef2fe4..041abb63b3 100644 --- a/core/sets.gms +++ b/core/sets.gms @@ -247,6 +247,9 @@ sets land_ag(land) Agricultural land pools / crop, past / + land_agfo(land) Agricultural and forestry land + / crop, past, forestry / + land_timber(land) land from which timber can be taken away / forestry, primforest, secdforest, other / diff --git a/modules/10_land/landmatrix_dec18/presolve.gms b/modules/10_land/landmatrix_dec18/presolve.gms index edee5163dc..b3bd374f4c 100644 --- a/modules/10_land/landmatrix_dec18/presolve.gms +++ b/modules/10_land/landmatrix_dec18/presolve.gms @@ -20,6 +20,9 @@ vm_lu_transitions.fx(j,"secdforest","other") = 0; vm_lu_transitions.fx(j,land_from,"primforest") = 0; vm_lu_transitions.up(j,"primforest","primforest") = Inf; +*' Forestry can only be converted into secdforest but not other +vm_lu_transitions.fx(j,"forestry","other") = 0; + *' @stop m_boundfix(vm_land,(j,land),up,10e-5); diff --git a/modules/35_natveg/dynamic_feb21/declarations.gms b/modules/35_natveg/dynamic_feb21/declarations.gms deleted file mode 100644 index e949a349a4..0000000000 --- a/modules/35_natveg/dynamic_feb21/declarations.gms +++ /dev/null @@ -1,128 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -scalars - s35_shift number of 5-year age-classes corresponding to current time step length (1) -; - -parameters - i35_secdforest(j,ac) Initial secdforest (mio. ha) - i35_other(j,ac) Initial other land (mio. ha) - p35_secdforest(t,j,ac) Secdforest per age class (mio. ha) - p35_other(t,j,ac) Other land per age class (mio. ha) - pc35_secdforest(j,ac) Secdforest per age class in current time step (mio. ha) - pc35_other(j,ac) Other land per age class in current time step (mio. ha) - p35_min_forest(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) - p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) - p35_damage_fader(t_all) Fader for forest damage (1) - p35_recovered_forest(t,j,ac) Recovered forest (mio. ha) - p35_carbon_density_secdforest(t,j,ac,ag_pools) Carbon density secdforest (tC per ha) - p35_carbon_density_other(t,j,ac,ag_pools) Carbon density other land (tC per ha) - p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) - p35_disturbance_loss_primf(t,j) Loss due to disturbances in primary forest (mio. ha) - i35_plantedclass_ac(j,ac) Area of age-classes in secondary forest (1) - p35_poulter_dist(j,ac) Share of age-classes in secondary forest (1) - p35_land(t,j,land_natveg,ac) Natural vegetation area (mio. ha) - p35_updated_gs_natfor(t,i) Updated growing stock in natural forests after calibration (m3 per ha) - p35_land_start_ac(j,ac,land_natveg) Initial Natural vegetation area (mio. ha) - p35_protection_dist(j,ac) Distribution of secondary forest protection (1) - p35_land_restoration(j,land_natveg) Actual secondary forest and other land restoration area (mio. ha) -; - -equations - q35_land_secdforest(j) Secdforest land pool calculation (mio. ha) - q35_land_other(j) Other land pool calculation (mio. ha) - q35_carbon_primforest(j,ag_pools,stockType) Primforest carbon stock calculation (mio tC) - q35_carbon_secdforest(j,ag_pools,stockType) Secdforest carbon stock calculation (mio tC) - q35_carbon_other(j,ag_pools,stockType) Other land carbon stock calculation (mio tC) - q35_min_forest(j) Minimum forest land constraint (mio. ha) - q35_min_other(j) Minimum other land constraint (mio. ha) - q35_landdiff Difference in natveg land (mio. ha) - q35_other_expansion(j) Other land expansion (mio. ha) - q35_other_reduction(j,ac) Other land reduction (mio. ha) - q35_secdforest_expansion(j) Secdforest reduction (mio. ha) - q35_secdforest_reduction(j,ac) Secdforest reduction (mio. ha) - q35_primforest_reduction(j) Primforest reduction (mio. ha) - q35_secdforest_regeneration(j) Secondary forest remains secondary forest (mio. ha) - q35_other_regeneration(j) Other land remains other land (mio. ha) - q35_other_est(j,ac) Distribution of other land additions over ac_est (mio. ha) - q35_secdforest_est(j,ac) Distribution of secdforest additions over ac_est (mio. ha) - q35_hvarea_other(j,ac) Harvested area other land (mio. ha) - q35_hvarea_secdforest(j,ac) Harvested area secdforest (mio. ha) - q35_hvarea_primforest(j) Harvested area primforest (mio. ha) - q35_prod_secdforest(j) Production of woody biomass from secondary forests (mio. tDM per yr) - q35_prod_primforest(j) Production of woody biomass from primary forests (mio. tDM per yr) - q35_prod_other(j) Production of woody biomass from other land (mio. tDM per yr) - q35_cost_hvarea(i) Cost of harvesting natural vegetation (mio. USD) - q35_bv_primforest(j,potnatveg) Biodiversity value of primary forest (mio. ha) - q35_bv_secdforest(j,potnatveg) Biodiversity value of secondary forest (mio. ha) - q35_bv_other(j,potnatveg) Biodiversity value of other land (mio. ha) - q35_natveg_conservation(j) Total natural vegetation conservation constraint (mio. ha) -; - -positive variables - v35_secdforest(j,ac) Detailed stock of secdforest (mio. ha) - v35_other(j,ac) Detailed stock of other land (mio. ha) - vm_landdiff_natveg Aggregated difference in natveg land compared to previous timestep (mio. ha) - v35_other_expansion(j) Other land expansion compared to previous timestep (mio. ha) - v35_other_reduction(j,ac) Other land reduction compared to previous timestep (mio. ha) - v35_secdforest_expansion(j) Secdforest reduction compared to previous timestep (mio. ha) - v35_secdforest_reduction(j,ac) Secdforest reduction compared to previous timestep (mio. ha) - v35_primforest_reduction(j) Primforest reduction compared to previous timestep (mio. ha) - v35_hvarea_secdforest(j,ac) Harvested area from secondary forest (mio. ha) - v35_hvarea_other(j,ac) Harvested area from other land (mio. ha) - v35_hvarea_primforest(j) Harvested area from primary forest (mio. ha) - vm_prod_natveg(j,land_natveg,kforestry) Production of woody biomass from natural vegetation (mio. tDM per yr) - vm_cost_hvarea_natveg(i) Cost of harvesting natural vegetation (mio. USD) -; - - -*#################### R SECTION START (OUTPUT DECLARATIONS) #################### -parameters - ov35_secdforest(t,j,ac,type) Detailed stock of secdforest (mio. ha) - ov35_other(t,j,ac,type) Detailed stock of other land (mio. ha) - ov_landdiff_natveg(t,type) Aggregated difference in natveg land compared to previous timestep (mio. ha) - ov35_other_expansion(t,j,type) Other land expansion compared to previous timestep (mio. ha) - ov35_other_reduction(t,j,ac,type) Other land reduction compared to previous timestep (mio. ha) - ov35_secdforest_expansion(t,j,type) Secdforest reduction compared to previous timestep (mio. ha) - ov35_secdforest_reduction(t,j,ac,type) Secdforest reduction compared to previous timestep (mio. ha) - ov35_primforest_reduction(t,j,type) Primforest reduction compared to previous timestep (mio. ha) - ov35_hvarea_secdforest(t,j,ac,type) Harvested area from secondary forest (mio. ha) - ov35_hvarea_other(t,j,ac,type) Harvested area from other land (mio. ha) - ov35_hvarea_primforest(t,j,type) Harvested area from primary forest (mio. ha) - ov_prod_natveg(t,j,land_natveg,kforestry,type) Production of woody biomass from natural vegetation (mio. tDM per yr) - ov_cost_hvarea_natveg(t,i,type) Cost of harvesting natural vegetation (mio. USD) - oq35_land_secdforest(t,j,type) Secdforest land pool calculation (mio. ha) - oq35_land_other(t,j,type) Other land pool calculation (mio. ha) - oq35_carbon_primforest(t,j,ag_pools,stockType,type) Primforest carbon stock calculation (mio tC) - oq35_carbon_secdforest(t,j,ag_pools,stockType,type) Secdforest carbon stock calculation (mio tC) - oq35_carbon_other(t,j,ag_pools,stockType,type) Other land carbon stock calculation (mio tC) - oq35_min_forest(t,j,type) Minimum forest land constraint (mio. ha) - oq35_min_other(t,j,type) Minimum other land constraint (mio. ha) - oq35_landdiff(t,type) Difference in natveg land (mio. ha) - oq35_other_expansion(t,j,type) Other land expansion (mio. ha) - oq35_other_reduction(t,j,ac,type) Other land reduction (mio. ha) - oq35_secdforest_expansion(t,j,type) Secdforest reduction (mio. ha) - oq35_secdforest_reduction(t,j,ac,type) Secdforest reduction (mio. ha) - oq35_primforest_reduction(t,j,type) Primforest reduction (mio. ha) - oq35_secdforest_regeneration(t,j,type) Secondary forest remains secondary forest (mio. ha) - oq35_other_regeneration(t,j,type) Other land remains other land (mio. ha) - oq35_other_est(t,j,ac,type) Distribution of other land additions over ac_est (mio. ha) - oq35_secdforest_est(t,j,ac,type) Distribution of secdforest additions over ac_est (mio. ha) - oq35_hvarea_other(t,j,ac,type) Harvested area other land (mio. ha) - oq35_hvarea_secdforest(t,j,ac,type) Harvested area secdforest (mio. ha) - oq35_hvarea_primforest(t,j,type) Harvested area primforest (mio. ha) - oq35_prod_secdforest(t,j,type) Production of woody biomass from secondary forests (mio. tDM per yr) - oq35_prod_primforest(t,j,type) Production of woody biomass from primary forests (mio. tDM per yr) - oq35_prod_other(t,j,type) Production of woody biomass from other land (mio. tDM per yr) - oq35_cost_hvarea(t,i,type) Cost of harvesting natural vegetation (mio. USD) - oq35_bv_primforest(t,j,potnatveg,type) Biodiversity value of primary forest (mio. ha) - oq35_bv_secdforest(t,j,potnatveg,type) Biodiversity value of secondary forest (mio. ha) - oq35_bv_other(t,j,potnatveg,type) Biodiversity value of other land (mio. ha) - oq35_natveg_conservation(t,j,type) Total natural vegetation conservation constraint (mio. ha) -; -*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/35_natveg/dynamic_feb21/equations.gms b/modules/35_natveg/dynamic_feb21/equations.gms deleted file mode 100644 index 9b3f100c5b..0000000000 --- a/modules/35_natveg/dynamic_feb21/equations.gms +++ /dev/null @@ -1,202 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @equations -*' The interface `vm_land` provides aggregated natveg land pools (`ac`) to other modules. - - q35_land_secdforest(j2) .. vm_land(j2,"secdforest") =e= sum(ac, v35_secdforest(j2,ac)); - - q35_land_other(j2) .. vm_land(j2,"other") =e= sum(ac, v35_other(j2,ac)); - -*' The total natural land area cannot be smaller than the total natural land conservation target. -*' Area requirements for natural land conservation are derived from WDPA and formulated based on -*' conservation priority areas during future time steps. - - q35_natveg_conservation(j2) .. - sum(land_natveg, vm_land(j2,land_natveg)) - =g= - sum((ct,land_natveg,consv_type), pm_land_conservation(ct,j2,land_natveg,consv_type)); - -*' Carbon stocks for primary forest, secondary forest or other natural land are calculated -*' as the product of respective area and carbon density. -*' Carbon stocks decline if the area decreases -*' (e.g. due to cropland expansion into forests). -*' In case of abandoned agricultural land (increase of other natural land), -*' natural succession, represented by age-class growth, results in increasing carbon stocks. - - q35_carbon_primforest(j2,ag_pools,stockType) .. - vm_carbon_stock(j2,"primforest",ag_pools,stockType) =e= - m_carbon_stock(vm_land,fm_carbon_density,"primforest"); - - q35_carbon_secdforest(j2,ag_pools,stockType) .. - vm_carbon_stock(j2,"secdforest",ag_pools,stockType) =e= - m_carbon_stock_ac(v35_secdforest,pm_carbon_density_ac,"ac","ac_sub"); - - q35_carbon_other(j2,ag_pools,stockType) .. - vm_carbon_stock(j2,"other",ag_pools,stockType) =e= - m_carbon_stock_ac(v35_other,pm_carbon_density_ac,"ac","ac_sub"); - -*' The biodiversity value (BV) of primary forest, secondary forest and other land is computed by multiplying their respective land area with bii coefficients, which depend on the age class and whether the potential natural vegetation forest or non-forest (luh2 side layers). - - q35_bv_primforest(j2,potnatveg) .. vm_bv(j2,"primforest",potnatveg) - =e= - vm_land(j2,"primforest") * fm_bii_coeff("primary",potnatveg) * fm_luh2_side_layers(j2,potnatveg); - - q35_bv_secdforest(j2,potnatveg) .. vm_bv(j2,"secdforest",potnatveg) - =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v35_secdforest(j2,ac)) * - fm_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); - - q35_bv_other(j2,potnatveg) .. vm_bv(j2,"other",potnatveg) - =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v35_other(j2,ac)) * - fm_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); - -*' NPI/NDC land protection policies based on country reports are implemented as -*' minium forest and other land stocks. They are not interchangeable (as compared to -*' the natural land conservation constraint) and specifically formulated for forest and -*' other land stocks. - - q35_min_forest(j2) .. vm_land(j2,"primforest") + vm_land(j2,"secdforest") - =g= - sum(ct, p35_min_forest(ct,j2)); - - q35_min_other(j2) .. vm_land(j2,"other") =g= sum(ct, p35_min_other(ct,j2)); - -*' The following technical calculations are needed for reducing differences in land-use patterns between time steps. -*' The gross change in natural vegetation is calculated based on land expansion and -*' land contraction of other land, and land reduction of primary and secondary forest. -*' This information is then passed to the land module ([10_land]): - - q35_landdiff .. vm_landdiff_natveg =e= - sum(j2, - v35_other_expansion(j2) - + sum(ac_sub, v35_other_reduction(j2,ac_sub)) - + v35_secdforest_expansion(j2) - + sum(ac_sub, v35_secdforest_reduction(j2,ac_sub)) - + v35_primforest_reduction(j2)); - - q35_other_expansion(j2) .. - v35_other_expansion(j2) =e= - sum(ac_est, v35_other(j2,ac_est)); - - q35_other_reduction(j2,ac_sub) .. - v35_other_reduction(j2,ac_sub) =e= - pc35_other(j2,ac_sub) - v35_other(j2,ac_sub); - - q35_secdforest_expansion(j2) .. - v35_secdforest_expansion(j2) =e= - sum(ac_est, v35_secdforest(j2,ac_est)); - - q35_secdforest_reduction(j2,ac_sub) .. - v35_secdforest_reduction(j2,ac_sub) =e= - pc35_secdforest(j2,ac_sub) - v35_secdforest(j2,ac_sub); - - q35_primforest_reduction(j2) .. - v35_primforest_reduction(j2) =e= - pcm_land(j2,"primforest") - vm_land(j2,"primforest"); - -******************************************************************* -**** Timber production related equations in natural vegetation **** -******************************************************************* - -*' For natural forest, per-hectare harvesting costs are positive to make sure that older -*' forest with higher growing stock is preferred over younger forest. -*' To mimic the difficulties in accessing primary forest, per-hectare harvesting -*' costs for primary forest are higher than for secondary forest. Harvesting costs -*' are paid everytime natural vegetation is harvested. The "real" harvested area -*' are received from the timber module [73_timber]. - -q35_cost_hvarea(i2).. - vm_cost_hvarea_natveg(i2) - =e= - sum((ct,cell(i2,j2),ac_sub), v35_hvarea_secdforest(j2,ac_sub)) * s35_timber_harvest_cost_secdforest - + sum((ct,cell(i2,j2),ac_sub), v35_hvarea_other(j2, ac_sub)) * s35_timber_harvest_cost_other - + sum((ct,cell(i2,j2)), v35_hvarea_primforest(j2)) * s35_timber_harvest_cost_primforest - ; - -** Secondary forest -*' Woody biomass production from secondary forests is calculated by multiplying the -*' area under production with corresponding yields of secondary forests, divided by the timestep length. - -q35_prod_secdforest(j2).. - sum(kforestry, vm_prod_natveg(j2,"secdforest",kforestry)) - =e= - sum(ac_sub, v35_hvarea_secdforest(j2,ac_sub) * sum(ct,pm_timber_yield(ct,j2,ac_sub,"secdforest"))) / m_timestep_length_forestry; - -** Primary forest -*' Woody biomass production from primary forests is calculated by multiplying the -*' area under production with corresponding yields of primary forests, divided by the timestep length. - -q35_prod_primforest(j2).. - sum(kforestry, vm_prod_natveg(j2,"primforest",kforestry)) - =e= - v35_hvarea_primforest(j2) * sum(ct, pm_timber_yield(ct,j2,"acx","primforest")) / m_timestep_length_forestry; - -** Other land -*' Wood-fuel production from other land is calculated by multiplying the area under -*' production with corresponding yields of other land, divided by the timestep length. -*' Wood production from other landis not allowed. - -q35_prod_other(j2).. - vm_prod_natveg(j2,"other","woodfuel") - =e= - sum(ac_sub, v35_hvarea_other(j2,ac_sub) * sum(ct, pm_timber_yield(ct,j2,ac_sub,"other"))) / m_timestep_length_forestry - ; - -*' Following equations show the harvested area from natural vegetation i.e. primary -*' forests, secondary forests and other land. Important to note here that no wood -*' production should be realized from other land. Harvested area for production -*' purposes can be lower oe equal than land reduction in natural vegetation as -*' not all lost area is (or should be) used for production. - -q35_hvarea_secdforest(j2,ac_sub).. - v35_hvarea_secdforest(j2,ac_sub) - =l= - v35_secdforest_reduction(j2,ac_sub); - -q35_hvarea_primforest(j2).. - v35_hvarea_primforest(j2) - =l= - v35_primforest_reduction(j2); - -q35_hvarea_other(j2,ac_sub).. - v35_hvarea_other(j2,ac_sub) - =l= - v35_other_reduction(j2,ac_sub); - - -*' Harvested secondary forest is still considered secondary forests due to -*' restrictive NPI definitions. Also primary forest harvested will be considered -*' to be secondary forest i.e., harvested primary forest gets reclassified as -*' secondary forest and ends up in the youngest age-class (and follows regrowth) - -q35_secdforest_regeneration(j2).. - sum(ac_est, v35_secdforest(j2,ac_est)) - =e= - sum(ac_sub,v35_hvarea_secdforest(j2,ac_sub)) - + v35_hvarea_primforest(j2) - + p35_land_restoration(j2,"secdforest") - ; - -*' Harvested other land is still considered other land - -q35_other_regeneration(j2).. - sum(ac_est, v35_other(j2,ac_est)) - =g= - sum(ac_sub,v35_hvarea_other(j2,ac_sub)) - ; - -*' The following two constraints distribute additions to secdforest and other land -*' over ac_est, which depends on the time step length (e.g. ac0 and ac5 for a 10 year time step). - -q35_secdforest_est(j2,ac_est) .. -v35_secdforest(j2,ac_est) =e= sum(ac_est2, v35_secdforest(j2,ac_est2))/card(ac_est2); - -q35_other_est(j2,ac_est) .. -v35_other(j2,ac_est) =e= sum(ac_est2, v35_other(j2,ac_est2))/card(ac_est2); - diff --git a/modules/35_natveg/dynamic_feb21/input.gms b/modules/35_natveg/dynamic_feb21/input.gms deleted file mode 100644 index 0510a69d3f..0000000000 --- a/modules/35_natveg/dynamic_feb21/input.gms +++ /dev/null @@ -1,64 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -$setglobal c35_ad_policy npi -$setglobal c35_aolc_policy npi -$setglobal c35_shock_scenario none - -scalars -s35_hvarea Flag for harvested area (0=zero 1=exognous 2=endogneous) / 0 / -s35_hvarea_secdforest annual secdforest harvest rate for s35_hvarea equals 1 (percent per year) / 0 / -s35_hvarea_primforest annual primforest harvest rate for s35_hvarea equals 1 (percent per year) / 0 / -s35_hvarea_other annual other land harvest rate for s35_hvarea equals 1 (percent per year) / 0 / -s35_timber_harvest_cost_secdforest Cost for harvesting from secondary forest (USD per ha) / 2000/ -s35_timber_harvest_cost_other Cost for harvesting from other land (USD per ha) / 1500 / -s35_timber_harvest_cost_primforest Cost for harvesting from primary forest (USD per ha) / 3000/ -s35_natveg_harvest_shr Constrains the allowed wood harvest from natural vegetation (1=unconstrained) (1) /1/ -s35_secdf_distribution Flag for secdf initialization (0=all secondary forest in highest age class 1=Equal distribution among all age classes 2=Poulter distribution from MODIS satellite data) (1) / 0 / -s35_forest_damage Damage simulation in forests (0=none 1=shifting agriculture 2= Damage from shifting agriculture is faded out by c35_forest_damage_end 4= f35_forest_shock scenario) / 2 / -s35_forest_damage_end Year of forest damage end (1) / 2050 / -; - -table f35_forest_lost_share(i,driver_source) Share of area damanged by forest fires (1) -$ondelim -$include "./modules/35_natveg/input/f35_forest_lost_share.cs3" -$offdelim -; - -table f35_min_land_stock(t_all,j,pol35,pol_stock35) Avoided deforestation and land protection policies [minimum land stock] (Mha) -$ondelim -$include "./modules/35_natveg/input/npi_ndc_ad_aolc_pol.cs3" -$offdelim -; - -table f35_forest_shock(t_all, shock_scen) Forest carbon shock scenarios (area share affected per year) -$ondelim -$include "./modules/35_natveg/input/f35_forest_shock.csv" -$offdelim -; - -parameter f35_forest_disturbance_share(i) Share of area damanged by forest disturbances (1) -/ -$ondelim -$include "./modules/35_natveg/input/f35_forest_disturbance_share.cs4" -$offdelim -/; - -parameter f35_gs_relativetarget(i) Relative growing stock target in each region (m3 per ha) -/ -$ondelim -$include "./modules/35_natveg/input/f35_gs_relativetarget.cs4" -$offdelim -/; - -parameter fm_pot_forest_area(j) Potential forest area (mio. ha) -/ -$ondelim -$include "./modules/35_natveg/input/pot_forest_area.cs3" -$offdelim -/; - diff --git a/modules/35_natveg/dynamic_feb21/not_used.txt b/modules/35_natveg/dynamic_feb21/not_used.txt deleted file mode 100644 index 810653acf1..0000000000 --- a/modules/35_natveg/dynamic_feb21/not_used.txt +++ /dev/null @@ -1,2 +0,0 @@ -name,type,reason -vm_landexpansion_forestry, input, not needed diff --git a/modules/35_natveg/dynamic_feb21/postsolve.gms b/modules/35_natveg/dynamic_feb21/postsolve.gms deleted file mode 100644 index 41f427750b..0000000000 --- a/modules/35_natveg/dynamic_feb21/postsolve.gms +++ /dev/null @@ -1,179 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*secdforest age class calculation -p35_secdforest(t,j,ac) = v35_secdforest.l(j,ac); - -*other land age class calculation -p35_other(t,j,ac) = v35_other.l(j,ac); - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); - ov35_other(t,j,ac,"marginal") = v35_other.m(j,ac); - ov_landdiff_natveg(t,"marginal") = vm_landdiff_natveg.m; - ov35_other_expansion(t,j,"marginal") = v35_other_expansion.m(j); - ov35_other_reduction(t,j,ac,"marginal") = v35_other_reduction.m(j,ac); - ov35_secdforest_expansion(t,j,"marginal") = v35_secdforest_expansion.m(j); - ov35_secdforest_reduction(t,j,ac,"marginal") = v35_secdforest_reduction.m(j,ac); - ov35_primforest_reduction(t,j,"marginal") = v35_primforest_reduction.m(j); - ov35_hvarea_secdforest(t,j,ac,"marginal") = v35_hvarea_secdforest.m(j,ac); - ov35_hvarea_other(t,j,ac,"marginal") = v35_hvarea_other.m(j,ac); - ov35_hvarea_primforest(t,j,"marginal") = v35_hvarea_primforest.m(j); - ov_prod_natveg(t,j,land_natveg,kforestry,"marginal") = vm_prod_natveg.m(j,land_natveg,kforestry); - ov_cost_hvarea_natveg(t,i,"marginal") = vm_cost_hvarea_natveg.m(i); - oq35_land_secdforest(t,j,"marginal") = q35_land_secdforest.m(j); - oq35_land_other(t,j,"marginal") = q35_land_other.m(j); - oq35_carbon_primforest(t,j,ag_pools,stockType,"marginal") = q35_carbon_primforest.m(j,ag_pools,stockType); - oq35_carbon_secdforest(t,j,ag_pools,stockType,"marginal") = q35_carbon_secdforest.m(j,ag_pools,stockType); - oq35_carbon_other(t,j,ag_pools,stockType,"marginal") = q35_carbon_other.m(j,ag_pools,stockType); - oq35_min_forest(t,j,"marginal") = q35_min_forest.m(j); - oq35_min_other(t,j,"marginal") = q35_min_other.m(j); - oq35_landdiff(t,"marginal") = q35_landdiff.m; - oq35_other_expansion(t,j,"marginal") = q35_other_expansion.m(j); - oq35_other_reduction(t,j,ac,"marginal") = q35_other_reduction.m(j,ac); - oq35_secdforest_expansion(t,j,"marginal") = q35_secdforest_expansion.m(j); - oq35_secdforest_reduction(t,j,ac,"marginal") = q35_secdforest_reduction.m(j,ac); - oq35_primforest_reduction(t,j,"marginal") = q35_primforest_reduction.m(j); - oq35_secdforest_regeneration(t,j,"marginal") = q35_secdforest_regeneration.m(j); - oq35_other_regeneration(t,j,"marginal") = q35_other_regeneration.m(j); - oq35_other_est(t,j,ac,"marginal") = q35_other_est.m(j,ac); - oq35_secdforest_est(t,j,ac,"marginal") = q35_secdforest_est.m(j,ac); - oq35_hvarea_other(t,j,ac,"marginal") = q35_hvarea_other.m(j,ac); - oq35_hvarea_secdforest(t,j,ac,"marginal") = q35_hvarea_secdforest.m(j,ac); - oq35_hvarea_primforest(t,j,"marginal") = q35_hvarea_primforest.m(j); - oq35_prod_secdforest(t,j,"marginal") = q35_prod_secdforest.m(j); - oq35_prod_primforest(t,j,"marginal") = q35_prod_primforest.m(j); - oq35_prod_other(t,j,"marginal") = q35_prod_other.m(j); - oq35_cost_hvarea(t,i,"marginal") = q35_cost_hvarea.m(i); - oq35_bv_primforest(t,j,potnatveg,"marginal") = q35_bv_primforest.m(j,potnatveg); - oq35_bv_secdforest(t,j,potnatveg,"marginal") = q35_bv_secdforest.m(j,potnatveg); - oq35_bv_other(t,j,potnatveg,"marginal") = q35_bv_other.m(j,potnatveg); - oq35_natveg_conservation(t,j,"marginal") = q35_natveg_conservation.m(j); - ov35_secdforest(t,j,ac,"level") = v35_secdforest.l(j,ac); - ov35_other(t,j,ac,"level") = v35_other.l(j,ac); - ov_landdiff_natveg(t,"level") = vm_landdiff_natveg.l; - ov35_other_expansion(t,j,"level") = v35_other_expansion.l(j); - ov35_other_reduction(t,j,ac,"level") = v35_other_reduction.l(j,ac); - ov35_secdforest_expansion(t,j,"level") = v35_secdforest_expansion.l(j); - ov35_secdforest_reduction(t,j,ac,"level") = v35_secdforest_reduction.l(j,ac); - ov35_primforest_reduction(t,j,"level") = v35_primforest_reduction.l(j); - ov35_hvarea_secdforest(t,j,ac,"level") = v35_hvarea_secdforest.l(j,ac); - ov35_hvarea_other(t,j,ac,"level") = v35_hvarea_other.l(j,ac); - ov35_hvarea_primforest(t,j,"level") = v35_hvarea_primforest.l(j); - ov_prod_natveg(t,j,land_natveg,kforestry,"level") = vm_prod_natveg.l(j,land_natveg,kforestry); - ov_cost_hvarea_natveg(t,i,"level") = vm_cost_hvarea_natveg.l(i); - oq35_land_secdforest(t,j,"level") = q35_land_secdforest.l(j); - oq35_land_other(t,j,"level") = q35_land_other.l(j); - oq35_carbon_primforest(t,j,ag_pools,stockType,"level") = q35_carbon_primforest.l(j,ag_pools,stockType); - oq35_carbon_secdforest(t,j,ag_pools,stockType,"level") = q35_carbon_secdforest.l(j,ag_pools,stockType); - oq35_carbon_other(t,j,ag_pools,stockType,"level") = q35_carbon_other.l(j,ag_pools,stockType); - oq35_min_forest(t,j,"level") = q35_min_forest.l(j); - oq35_min_other(t,j,"level") = q35_min_other.l(j); - oq35_landdiff(t,"level") = q35_landdiff.l; - oq35_other_expansion(t,j,"level") = q35_other_expansion.l(j); - oq35_other_reduction(t,j,ac,"level") = q35_other_reduction.l(j,ac); - oq35_secdforest_expansion(t,j,"level") = q35_secdforest_expansion.l(j); - oq35_secdforest_reduction(t,j,ac,"level") = q35_secdforest_reduction.l(j,ac); - oq35_primforest_reduction(t,j,"level") = q35_primforest_reduction.l(j); - oq35_secdforest_regeneration(t,j,"level") = q35_secdforest_regeneration.l(j); - oq35_other_regeneration(t,j,"level") = q35_other_regeneration.l(j); - oq35_other_est(t,j,ac,"level") = q35_other_est.l(j,ac); - oq35_secdforest_est(t,j,ac,"level") = q35_secdforest_est.l(j,ac); - oq35_hvarea_other(t,j,ac,"level") = q35_hvarea_other.l(j,ac); - oq35_hvarea_secdforest(t,j,ac,"level") = q35_hvarea_secdforest.l(j,ac); - oq35_hvarea_primforest(t,j,"level") = q35_hvarea_primforest.l(j); - oq35_prod_secdforest(t,j,"level") = q35_prod_secdforest.l(j); - oq35_prod_primforest(t,j,"level") = q35_prod_primforest.l(j); - oq35_prod_other(t,j,"level") = q35_prod_other.l(j); - oq35_cost_hvarea(t,i,"level") = q35_cost_hvarea.l(i); - oq35_bv_primforest(t,j,potnatveg,"level") = q35_bv_primforest.l(j,potnatveg); - oq35_bv_secdforest(t,j,potnatveg,"level") = q35_bv_secdforest.l(j,potnatveg); - oq35_bv_other(t,j,potnatveg,"level") = q35_bv_other.l(j,potnatveg); - oq35_natveg_conservation(t,j,"level") = q35_natveg_conservation.l(j); - ov35_secdforest(t,j,ac,"upper") = v35_secdforest.up(j,ac); - ov35_other(t,j,ac,"upper") = v35_other.up(j,ac); - ov_landdiff_natveg(t,"upper") = vm_landdiff_natveg.up; - ov35_other_expansion(t,j,"upper") = v35_other_expansion.up(j); - ov35_other_reduction(t,j,ac,"upper") = v35_other_reduction.up(j,ac); - ov35_secdforest_expansion(t,j,"upper") = v35_secdforest_expansion.up(j); - ov35_secdforest_reduction(t,j,ac,"upper") = v35_secdforest_reduction.up(j,ac); - ov35_primforest_reduction(t,j,"upper") = v35_primforest_reduction.up(j); - ov35_hvarea_secdforest(t,j,ac,"upper") = v35_hvarea_secdforest.up(j,ac); - ov35_hvarea_other(t,j,ac,"upper") = v35_hvarea_other.up(j,ac); - ov35_hvarea_primforest(t,j,"upper") = v35_hvarea_primforest.up(j); - ov_prod_natveg(t,j,land_natveg,kforestry,"upper") = vm_prod_natveg.up(j,land_natveg,kforestry); - ov_cost_hvarea_natveg(t,i,"upper") = vm_cost_hvarea_natveg.up(i); - oq35_land_secdforest(t,j,"upper") = q35_land_secdforest.up(j); - oq35_land_other(t,j,"upper") = q35_land_other.up(j); - oq35_carbon_primforest(t,j,ag_pools,stockType,"upper") = q35_carbon_primforest.up(j,ag_pools,stockType); - oq35_carbon_secdforest(t,j,ag_pools,stockType,"upper") = q35_carbon_secdforest.up(j,ag_pools,stockType); - oq35_carbon_other(t,j,ag_pools,stockType,"upper") = q35_carbon_other.up(j,ag_pools,stockType); - oq35_min_forest(t,j,"upper") = q35_min_forest.up(j); - oq35_min_other(t,j,"upper") = q35_min_other.up(j); - oq35_landdiff(t,"upper") = q35_landdiff.up; - oq35_other_expansion(t,j,"upper") = q35_other_expansion.up(j); - oq35_other_reduction(t,j,ac,"upper") = q35_other_reduction.up(j,ac); - oq35_secdforest_expansion(t,j,"upper") = q35_secdforest_expansion.up(j); - oq35_secdforest_reduction(t,j,ac,"upper") = q35_secdforest_reduction.up(j,ac); - oq35_primforest_reduction(t,j,"upper") = q35_primforest_reduction.up(j); - oq35_secdforest_regeneration(t,j,"upper") = q35_secdforest_regeneration.up(j); - oq35_other_regeneration(t,j,"upper") = q35_other_regeneration.up(j); - oq35_other_est(t,j,ac,"upper") = q35_other_est.up(j,ac); - oq35_secdforest_est(t,j,ac,"upper") = q35_secdforest_est.up(j,ac); - oq35_hvarea_other(t,j,ac,"upper") = q35_hvarea_other.up(j,ac); - oq35_hvarea_secdforest(t,j,ac,"upper") = q35_hvarea_secdforest.up(j,ac); - oq35_hvarea_primforest(t,j,"upper") = q35_hvarea_primforest.up(j); - oq35_prod_secdforest(t,j,"upper") = q35_prod_secdforest.up(j); - oq35_prod_primforest(t,j,"upper") = q35_prod_primforest.up(j); - oq35_prod_other(t,j,"upper") = q35_prod_other.up(j); - oq35_cost_hvarea(t,i,"upper") = q35_cost_hvarea.up(i); - oq35_bv_primforest(t,j,potnatveg,"upper") = q35_bv_primforest.up(j,potnatveg); - oq35_bv_secdforest(t,j,potnatveg,"upper") = q35_bv_secdforest.up(j,potnatveg); - oq35_bv_other(t,j,potnatveg,"upper") = q35_bv_other.up(j,potnatveg); - oq35_natveg_conservation(t,j,"upper") = q35_natveg_conservation.up(j); - ov35_secdforest(t,j,ac,"lower") = v35_secdforest.lo(j,ac); - ov35_other(t,j,ac,"lower") = v35_other.lo(j,ac); - ov_landdiff_natveg(t,"lower") = vm_landdiff_natveg.lo; - ov35_other_expansion(t,j,"lower") = v35_other_expansion.lo(j); - ov35_other_reduction(t,j,ac,"lower") = v35_other_reduction.lo(j,ac); - ov35_secdforest_expansion(t,j,"lower") = v35_secdforest_expansion.lo(j); - ov35_secdforest_reduction(t,j,ac,"lower") = v35_secdforest_reduction.lo(j,ac); - ov35_primforest_reduction(t,j,"lower") = v35_primforest_reduction.lo(j); - ov35_hvarea_secdforest(t,j,ac,"lower") = v35_hvarea_secdforest.lo(j,ac); - ov35_hvarea_other(t,j,ac,"lower") = v35_hvarea_other.lo(j,ac); - ov35_hvarea_primforest(t,j,"lower") = v35_hvarea_primforest.lo(j); - ov_prod_natveg(t,j,land_natveg,kforestry,"lower") = vm_prod_natveg.lo(j,land_natveg,kforestry); - ov_cost_hvarea_natveg(t,i,"lower") = vm_cost_hvarea_natveg.lo(i); - oq35_land_secdforest(t,j,"lower") = q35_land_secdforest.lo(j); - oq35_land_other(t,j,"lower") = q35_land_other.lo(j); - oq35_carbon_primforest(t,j,ag_pools,stockType,"lower") = q35_carbon_primforest.lo(j,ag_pools,stockType); - oq35_carbon_secdforest(t,j,ag_pools,stockType,"lower") = q35_carbon_secdforest.lo(j,ag_pools,stockType); - oq35_carbon_other(t,j,ag_pools,stockType,"lower") = q35_carbon_other.lo(j,ag_pools,stockType); - oq35_min_forest(t,j,"lower") = q35_min_forest.lo(j); - oq35_min_other(t,j,"lower") = q35_min_other.lo(j); - oq35_landdiff(t,"lower") = q35_landdiff.lo; - oq35_other_expansion(t,j,"lower") = q35_other_expansion.lo(j); - oq35_other_reduction(t,j,ac,"lower") = q35_other_reduction.lo(j,ac); - oq35_secdforest_expansion(t,j,"lower") = q35_secdforest_expansion.lo(j); - oq35_secdforest_reduction(t,j,ac,"lower") = q35_secdforest_reduction.lo(j,ac); - oq35_primforest_reduction(t,j,"lower") = q35_primforest_reduction.lo(j); - oq35_secdforest_regeneration(t,j,"lower") = q35_secdforest_regeneration.lo(j); - oq35_other_regeneration(t,j,"lower") = q35_other_regeneration.lo(j); - oq35_other_est(t,j,ac,"lower") = q35_other_est.lo(j,ac); - oq35_secdforest_est(t,j,ac,"lower") = q35_secdforest_est.lo(j,ac); - oq35_hvarea_other(t,j,ac,"lower") = q35_hvarea_other.lo(j,ac); - oq35_hvarea_secdforest(t,j,ac,"lower") = q35_hvarea_secdforest.lo(j,ac); - oq35_hvarea_primforest(t,j,"lower") = q35_hvarea_primforest.lo(j); - oq35_prod_secdforest(t,j,"lower") = q35_prod_secdforest.lo(j); - oq35_prod_primforest(t,j,"lower") = q35_prod_primforest.lo(j); - oq35_prod_other(t,j,"lower") = q35_prod_other.lo(j); - oq35_cost_hvarea(t,i,"lower") = q35_cost_hvarea.lo(i); - oq35_bv_primforest(t,j,potnatveg,"lower") = q35_bv_primforest.lo(j,potnatveg); - oq35_bv_secdforest(t,j,potnatveg,"lower") = q35_bv_secdforest.lo(j,potnatveg); - oq35_bv_other(t,j,potnatveg,"lower") = q35_bv_other.lo(j,potnatveg); - oq35_natveg_conservation(t,j,"lower") = q35_natveg_conservation.lo(j); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/35_natveg/dynamic_feb21/preloop.gms b/modules/35_natveg/dynamic_feb21/preloop.gms deleted file mode 100644 index 5b357bedc7..0000000000 --- a/modules/35_natveg/dynamic_feb21/preloop.gms +++ /dev/null @@ -1,71 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -** initialize other land -i35_other(j,ac) = 0; -i35_other(j,"acx") = pcm_land(j,"other"); - -** initialize secdforest area depending on switch. -if(s35_secdf_distribution = 0, - i35_secdforest(j,"acx") = pcm_land(j,"secdforest"); -elseif s35_secdf_distribution = 1, -* ac0 is excluded here. Therefore no initial shifting is needed. - i35_secdforest(j,ac)$(not sameas(ac,"ac0")) = pcm_land(j,"secdforest")/(card(ac)-1); -elseif s35_secdf_distribution = 2, -*classes 1, 2, 3 include plantation and are therefore excluded -*As disturbance history (fire) would affect the age structure -*We use the sahre from class 4 to be in class 1,2,3 -*class 15 is primary forest and is therefore excluded - i35_plantedclass_ac(j,ac) = im_plantedclass_ac(j,ac); - i35_plantedclass_ac(j,ac_planted)$(i35_plantedclass_ac(j,ac_planted) > im_plantedclass_ac(j,"ac35")) = im_plantedclass_ac(j,"ac35"); - -* Distribute this area correctly - p35_poulter_dist(j,ac) = 0; - p35_poulter_dist(j,ac) = (i35_plantedclass_ac(j,ac)/sum(ac2,i35_plantedclass_ac(j,ac2)))$(sum(ac2,i35_plantedclass_ac(j,ac2))>0); - i35_secdforest(j,ac)$(not sameas(ac,"ac0")) = pcm_land(j,"secdforest")*p35_poulter_dist(j,ac); -); - -*use residual approach to avoid rounding errors -i35_secdforest(j,"acx") = i35_secdforest(j,"acx") + (pcm_land(j,"secdforest") - sum(ac, i35_secdforest(j,ac))); - -** Initialize values to be used in presolve -p35_recovered_forest(t,j,ac) = 0; - -*initialize parameter -p35_other(t,j,ac) = 0; -p35_secdforest(t,j,ac) = 0; - -* initialize forest disturbance losses -p35_disturbance_loss_secdf(t,j,ac) = 0; -p35_disturbance_loss_primf(t,j) = 0; - -* In this realisation, the potential forest area is not applied -fm_pot_forest_area(j) = Inf; - -* ----------------------------------------- -* Land conservation for climate mitigation -* ----------------------------------------- - -p35_min_forest(t,j) = f35_min_land_stock(t,j,"%c35_ad_policy%","forest"); -p35_min_other(t,j) = f35_min_land_stock(t,j,"%c35_ad_policy%","other"); - - -* ---------------------------------------- -* Calibrate Natural vegetation yields -* ---------------------------------------- - -** Initialize with 0 cvalues -p35_land_start_ac(j,ac,land_natveg) = 0; -** Capture natural forest values (primary forest + secondary forest) -p35_land_start_ac(j,"acx","primforest") = pcm_land(j,"primforest"); -p35_land_start_ac(j,ac,"secdforest") = i35_secdforest(j,ac); - - -* ----------------------------- -* Set forest damage trajectory -* ----------------------------- -m_sigmoid_time_interpol(p35_damage_fader,sm_fix_SSP2,s35_forest_damage_end,0,1); diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/dynamic_feb21/presolve.gms deleted file mode 100644 index 97a6f33b35..0000000000 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ /dev/null @@ -1,200 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -if((ord(t) = 1), - pc35_secdforest(j,ac) = i35_secdforest(j,ac); - pc35_other(j,ac) = i35_other(j,ac); -else - pc35_secdforest(j,ac) = p35_secdforest(t-1,j,ac); - pc35_other(j,ac) = p35_other(t-1,j,ac); -); - -* ---------------------------------------------------- -* Shift ageclasses due to shifting agriculture fires -* ---------------------------------------------------- - -* first calculate damages -if(s35_forest_damage=1, - p35_disturbance_loss_secdf(t,j,ac_sub) = pc35_secdforest(j,ac_sub) * sum(cell(i,j),f35_forest_lost_share(i,"shifting_agriculture"))*m_timestep_length_forestry; - p35_disturbance_loss_primf(t,j) = pcm_land(j,"primforest") * sum(cell(i,j),f35_forest_lost_share(i,"shifting_agriculture"))*m_timestep_length_forestry; - ); - -* shifting cultivation is faded out -if(s35_forest_damage=2, - p35_disturbance_loss_secdf(t,j,ac_sub) = pc35_secdforest(j,ac_sub) * sum(cell(i,j),f35_forest_lost_share(i,"shifting_agriculture"))*m_timestep_length_forestry*(1 - p35_damage_fader(t)); - p35_disturbance_loss_primf(t,j) = pcm_land(j,"primforest") * sum(cell(i,j),f35_forest_lost_share(i,"shifting_agriculture"))*m_timestep_length_forestry*(1 - p35_damage_fader(t)); - ); - -if(s35_forest_damage=3, - p35_disturbance_loss_secdf(t,j,ac_sub) = pc35_secdforest(j,ac_sub) * sum((cell(i,j),combined_loss),f35_forest_lost_share(i,combined_loss))*m_timestep_length_forestry; - p35_disturbance_loss_primf(t,j) = pcm_land(j,"primforest") * sum((cell(i,j),combined_loss),f35_forest_lost_share(i,combined_loss))*m_timestep_length_forestry; - ); - -* generic disturbance scenarios -if(s35_forest_damage=4, - p35_disturbance_loss_secdf(t,j,ac_sub) = pc35_secdforest(j,ac_sub) * f35_forest_shock(t,"%c35_shock_scenario%") * m_timestep_length; - p35_disturbance_loss_primf(t,j) = pcm_land(j,"primforest") * f35_forest_shock(t,"%c35_shock_scenario%") * m_timestep_length; - ); - -* Distribution of damages correctly -pc35_secdforest(j,ac_est) = pc35_secdforest(j,ac_est) + sum(ac_sub,p35_disturbance_loss_secdf(t,j,ac_sub))/card(ac_est2) + p35_disturbance_loss_primf(t,j)/card(ac_est2); - -pc35_secdforest(j,ac_sub) = pc35_secdforest(j,ac_sub) - p35_disturbance_loss_secdf(t,j,ac_sub); -pcm_land(j,"primforest") = pcm_land(j,"primforest") - p35_disturbance_loss_primf(t,j); -vm_land.l(j,"primforest") = pcm_land(j,"primforest"); - -* Regrowth of natural vegetation (natural succession) is modelled by shifting age-classes according to time step length. -s35_shift = m_timestep_length_forestry/5; -* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) - p35_other(t,j,ac)$(ord(ac) > s35_shift) = pc35_other(j,ac-s35_shift); -* account for cases at the end of the age class set (s35_shift > 1) which are not shifted by the above calculation - p35_other(t,j,"acx") = p35_other(t,j,"acx") - + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_other(j,ac)); - -* Usual shift -* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) - p35_secdforest(t,j,ac)$(ord(ac) > s35_shift) = pc35_secdforest(j,ac-s35_shift); -* account for cases at the end of the age class set (s35_shift > 1) which are not shifted by the above calculation - p35_secdforest(t,j,"acx") = p35_secdforest(t,j,"acx") - + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_secdforest(j,ac)); - -* -------------------------------------- -* Carbon threshold for secondary forest -* -------------------------------------- - -*' @code -*' If the vegetation carbon density in a simulation unit due to regrowth -*' exceeds a threshold of 20 tC/ha the respective area is shifted from other natural land to secondary forest. -p35_recovered_forest(t,j,ac)$(not sameas(ac,"acx")) = - p35_other(t,j,ac)$(pm_carbon_density_ac(t,j,ac,"vegc") > 20); -p35_other(t,j,ac) = p35_other(t,j,ac) - p35_recovered_forest(t,j,ac); -p35_secdforest(t,j,ac) = p35_secdforest(t,j,ac) + p35_recovered_forest(t,j,ac); -*' @stop - -pc35_secdforest(j,ac) = p35_secdforest(t,j,ac); -v35_secdforest.l(j,ac) = pc35_secdforest(j,ac); -vm_land.l(j,"secdforest") = sum(ac, pc35_secdforest(j,ac)); -pcm_land(j,"secdforest") = sum(ac, pc35_secdforest(j,ac)); - -pc35_other(j,ac) = p35_other(t,j,ac); -v35_other.l(j,ac) = pc35_other(j,ac); -vm_land.l(j,"other") = sum(ac, pc35_other(j,ac)); -pcm_land(j,"other") = sum(ac, pc35_other(j,ac)); - -* Correct land conservation for damage -pm_land_conservation(t,j,land_natveg,"protect")$(pm_land_conservation(t,j,land_natveg,"protect") > pcm_land(j,land_natveg)) = pcm_land(j,land_natveg); - -* ------------------------------------- -* Set bounds based on land conservation -* ------------------------------------- - -* Within the optimization, primary and secondary forests can only decrease -* (e.g. for cropland expansion). -* In contrast, other natural land can decrease and increase within the optimization. -* For instance, other natural land increases if agricultural land is abandoned. - -** Setting bounds for only allowing s35_natveg_harvest_shr percentage of available forest to be harvested (highest age class) - -* Primary forest - -** Allowing selective logging only after historical period -if (sum(sameas(t_past,t),1) = 1, -vm_land.lo(j,"primforest") = 0; -else -vm_land.lo(j,"primforest") = (1-s35_natveg_harvest_shr) * pcm_land(j,"primforest"); -); -* Primary forest conservation -vm_land.lo(j,"primforest")$(vm_land.lo(j,"primforest") < pm_land_conservation(t,j,"primforest","protect")) = pm_land_conservation(t,j,"primforest","protect"); -vm_land.up(j,"primforest") = pcm_land(j,"primforest"); - -* Secondary forest - -*reset bound -v35_secdforest.lo(j,ac) = 0; -v35_secdforest.up(j,ac) = Inf; - -p35_protection_dist(j,ac_sub) = (pc35_secdforest(j,ac_sub)/sum(ac_sub2,pc35_secdforest(j,ac_sub2)))$(sum(ac_sub2,pc35_secdforest(j,ac_sub2))>0); -if (sum(sameas(t_past,t),1) = 1, -v35_secdforest.lo(j,ac_sub) = pm_land_conservation(t,j,"secdforest","protect") * p35_protection_dist(j,ac_sub); -else -v35_secdforest.lo(j,ac_sub) = max((1-s35_natveg_harvest_shr) * pc35_secdforest(j,ac_sub), pm_land_conservation(t,j,"secdforest","protect") * p35_protection_dist(j,ac_sub)); -); -* upper bound -v35_secdforest.up(j,ac_sub) = pc35_secdforest(j,ac_sub); -m_boundfix(v35_secdforest,(j,ac_sub),l,10e-5); - -* Secondary forest conservation -* protection bound fix -pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_secdforest(j,ac_sub)); -* set restoration target -p35_land_restoration(j,"secdforest") = pm_land_conservation(t,j,"secdforest","restore"); -* Do not restore secdforest in areas where total natural -* land area meets the total natural land conservation target -p35_land_restoration(j,"secdforest")$(sum(land_natveg, pcm_land(j,land_natveg)) >= sum((land_natveg, consv_type), pm_land_conservation(t,j,land_natveg,consv_type))) = 0; -* set conservation bound -vm_land.lo(j,"secdforest") = pm_land_conservation(t,j,"secdforest","protect") + p35_land_restoration(j,"secdforest"); - -** Other land - -*reset bounds -v35_other.lo(j,ac) = 0; -v35_other.up(j,ac) = Inf; -*set upper bound -v35_other.up(j,ac_sub) = pc35_other(j,ac_sub); -m_boundfix(v35_other,(j,ac_sub),l,10e-5); - -* Other land conservation -* protection bound fix -pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_other(j,ac_sub)); -* set restoration target -p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); -* Do not restore other land in areas where total natural -* land area meets the total natural land conservation target -p35_land_restoration(j,"other")$(sum(land_natveg, pcm_land(j,land_natveg)) >= sum((land_natveg, consv_type), pm_land_conservation(t,j,land_natveg,consv_type))) = 0; -* set conservation bound -vm_land.lo(j,"other") = pm_land_conservation(t,j,"other","protect") + p35_land_restoration(j,"other"); - -* ------------------------------ -* Calculate carbon density -* ------------------------------ - -* highest carbon density 1st time step to account for reshuffling -p35_carbon_density_secdforest(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); -p35_carbon_density_other(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); - -* ------------------ -* NPI/NDC policy -* ------------------ - -p35_min_forest(t,j)$(p35_min_forest(t,j) > pcm_land(j,"primforest") + pcm_land(j,"secdforest")) = pcm_land(j,"primforest") + pcm_land(j,"secdforest"); -p35_min_other(t,j)$(p35_min_other(t,j) > pcm_land(j,"other")) = pcm_land(j,"other"); - -** Display -p35_land(t,j,land_natveg,ac) = 0; -p35_land(t,j,"primforest","acx") = pcm_land(j,"primforest"); -p35_land(t,j,"secdforest",ac) = p35_secdforest(t,j,ac); -*p35_land(t,j,"other",ac) = p35_other(t,j,ac): -p35_updated_gs_natfor(t,i) = 0; -p35_updated_gs_natfor(t,i)$(sum((cell(i,j),ac,land_natveg), p35_land(t,j,land_natveg,ac))>0) = (sum((cell(i,j),ac,land_natveg),(pm_timber_yield(t,j,ac,land_natveg) / sm_wood_density) * p35_land(t,j,land_natveg,ac))/ sum((cell(i,j),ac,land_natveg), p35_land(t,j,land_natveg,ac))); - -** Youngest age classes are not allowed to be harvested -v35_hvarea_secdforest.fx(j,ac_est) = 0; -v35_hvarea_other.fx(j,ac_est) = 0; -v35_secdforest_reduction.fx(j,ac_est) = 0; -v35_other_reduction.fx(j,ac_est) = 0; - -vm_prod_natveg.fx(j,"other","wood") = 0; - -if(s35_hvarea = 0, - v35_hvarea_secdforest.fx(j,ac_sub) = 0; - v35_hvarea_primforest.fx(j) = 0; - v35_hvarea_other.fx(j,ac_sub) = 0; -elseif s35_hvarea = 1, - v35_hvarea_secdforest.fx(j,ac_sub) = (v35_secdforest.l(j,ac_sub) - v35_secdforest.lo(j,ac_sub))*s35_hvarea_secdforest*m_timestep_length_forestry; - v35_hvarea_primforest.fx(j) = (vm_land.l(j,"primforest") - vm_land.lo(j,"primforest"))*s35_hvarea_primforest*m_timestep_length_forestry; - v35_hvarea_other.fx(j,ac_sub) = (v35_other.l(j,ac_sub) - v35_other.lo(j,ac_sub))*s35_hvarea_other*m_timestep_length_forestry; -); diff --git a/modules/35_natveg/dynamic_feb21/realization.gms b/modules/35_natveg/dynamic_feb21/realization.gms deleted file mode 100644 index 8f357c35db..0000000000 --- a/modules/35_natveg/dynamic_feb21/realization.gms +++ /dev/null @@ -1,44 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -*' @description In the dynamic_feb21 realization, land and carbon stock dynamics -*' of natural vegetation are modeled endogenously. -*' The initial spatial distribution of the sub-land-types primary forest, -*' secondary forest and other natural land is based on the -*' LUH2 data set [@hurtt2018luh2]. -*' This realization also includes national policies implemented (NPI) and nationally -*' determined contributions to the Paris agreement (NDC) with regard to forest and other -*' land protection. The NPI/NDC polices ramp up until 2030 and are assumed constant -*' thereafter. NPI/NDC land conservation polices are applied on forest and other land, -*' depending on individual country reports. The NPI/NDC policies are treated as minimum -*' constraints and therefore are non-additive, if the land protection targets as provided by -*' the module `22_land_conservation` and the interface `pm_land_conservation` are larger. -*' Additionally, this module includes forest damage and provides the ability to -*' harvest natural vegetation for timber. Both wood and woodfuel can be produceed -*' from primary and secondary forest but other land is only allowed to be harvested -*' for woodfuel. -*' @stop - -*' -*' @limitations Initialization of both primary and secondary forest in highest -*' age class or equal distrivution of such areas in all age classes. Data exists -*' on a more emperically obtained distribution in different age classes based -*' on satellite data but this results is highly negative land-use change emissions. -*' Inclusion of this data in MAgPIE remains work in progess and is not available for release yet. -*' Additionally, in this module realization, harvested secondary forest stays -*' secondary forest and harvested primary forest is reclassified as secondary forest. - -*####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/35_natveg/dynamic_feb21/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/35_natveg/dynamic_feb21/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/35_natveg/dynamic_feb21/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/35_natveg/dynamic_feb21/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/35_natveg/dynamic_feb21/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/35_natveg/dynamic_feb21/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/35_natveg/dynamic_feb21/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/35_natveg/dynamic_feb21/postsolve.gms" -*######################## R SECTION END (PHASES) ############################### diff --git a/modules/35_natveg/dynamic_feb21/scaling.gms b/modules/35_natveg/dynamic_feb21/scaling.gms deleted file mode 100644 index c4a52d9d82..0000000000 --- a/modules/35_natveg/dynamic_feb21/scaling.gms +++ /dev/null @@ -1,8 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -vm_cost_hvarea_natveg.scale(i)$(s35_hvarea = 1 OR s35_hvarea = 2) = 10e4; diff --git a/modules/35_natveg/dynamic_feb21/sets.gms b/modules/35_natveg/dynamic_feb21/sets.gms deleted file mode 100644 index 0ad78e215c..0000000000 --- a/modules/35_natveg/dynamic_feb21/sets.gms +++ /dev/null @@ -1,28 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - -sets - - driver_source Source of deforestation drivers - / overall, deforestation, shifting_agriculture, - forestry, wildfire, urbanization / - - combined_loss(driver_source) Combined loss from fire plus agriculture - / shifting_agriculture,wildfire / - - pol35 Land protection policy - / none, npi, ndc / - - pol_stock35 Land types for land protection policies - / forest, other / - - - shock_scen Scenario name of forest carbon shock - / none, 002lin2030,004lin2030,008lin2030,016lin2030 - / - -; diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index d34e40abed..632fd26e8b 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -20,6 +20,7 @@ parameters p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_damage_fader(t_all) Fader for forest damage (1) p35_max_forest_recovery(j) Forest recovery potential (mio. ha) + p35_forest_recovery_shr(j) Forest share in the regeneration of natural vegetation (1) p35_carbon_density_secdforest(t,j,ac,ag_pools) Carbon density secdforest (tC per ha) p35_carbon_density_other(t,j,ac,ag_pools) Carbon density other land (tC per ha) p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index a2560d0121..4ea85ba88e 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -177,38 +177,31 @@ q35_hvarea_other(j2,ac_sub).. q35_secdforest_regeneration(j2).. sum(ac_est, v35_secdforest(j2,ac_est)) - =g= + =e= sum(ac_sub,v35_hvarea_secdforest(j2,ac_sub)) + v35_hvarea_primforest(j2) + p35_land_restoration(j2,"secdforest") + + sum(land_ag, vm_lu_transitions(j2,land_ag,"other")) * p35_forest_recovery_shr(j2) + + vm_lu_transitions(j2,"forestry","secdforest") ; -*' The upper bound for the new establishment of forested areas is given -*' by the harvested area plus the remaining potential forest area, which is derived -*' from the potential natural forest area in each cluster. - -q35_max_secdforest_regeneration(j2).. - sum(ac_est, v35_secdforest(j2,ac_est)) - =l= - + sum(ac_sub,v35_hvarea_secdforest(j2,ac_sub)) - + v35_hvarea_primforest(j2) - + p35_max_forest_recovery(j2) - ; +*' The constraint for forest establishment is given by the +*' remaining potential forest area, which was calculated based +*' on the potential natural forest area in each cluster. -*' Forestry establishment is also constrained by the remaining potential forest area. q35_max_foresty_expansion(j2).. - sum(type32, vm_landexpansion_forestry(j2,type32)) + sum(land_forest, vm_landexpansion(j2,land_forest)) =l= p35_max_forest_recovery(j2) ; - *' Harvested other land is still considered other land q35_other_regeneration(j2).. sum(ac_est, v35_other(j2,ac_est)) =g= sum(ac_sub,v35_hvarea_other(j2,ac_sub)) + + sum(land_ag, vm_lu_transitions(j2,land_ag,"other")) * (1 - p35_forest_recovery_shr(j2)) ; *' The following two constraints distribute additions to secdforest and other land diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 68c9aff345..5346fb9187 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -83,6 +83,11 @@ pcm_land(j,"other") = sum(ac, pc35_other(j,ac)); p35_max_forest_recovery(j) = fm_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); p35_max_forest_recovery(j)$(p35_max_forest_recovery(j) < 0) = 0; +* The forest recovery share is given by the relation between the forest recovery potential +* and the agricultural land area of the previous time step. +p35_forest_recovery_shr(j) = p35_max_forest_recovery(j) / sum(land_ag, pcm_land(j,land_ag)); +p35_forest_recovery_shr(j)$(p35_forest_recovery_shr(j) > 1) = 1; + * ------------------------------------- * Set bounds based on land conservation * ------------------------------------- From ff4ec9a6b33d4b31910b810dfab331b599759490 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Fri, 3 May 2024 17:25:47 +0200 Subject: [PATCH 103/280] fixes --- config/default.cfg | 4 ++-- main.gms | 2 +- modules/35_natveg/module.gms | 1 - modules/35_natveg/pot_forest_may24/declarations.gms | 12 ++++++------ modules/35_natveg/pot_forest_may24/equations.gms | 2 +- modules/35_natveg/pot_forest_may24/postsolve.gms | 4 ++++ 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index f9e8df050c..38a31515cf 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -935,8 +935,8 @@ cfg$gms$c34_urban_scenario <- "SSP2" # def = SSP2 # ***--------------------- 35_natveg -------------------------------------- # * 35_natveg includes primforest, secdforest and other land -# * (dynamic_feb21): Dynamic natural vegetation land with detailed age-classes -cfg$gms$natveg <- "dynamic_feb21" # def = dynamic_feb21 +# * (pot_forest_may24): Dynamic natural vegetation land with detailed age-classes +cfg$gms$natveg <- "pot_forest_may24" # def = pot_forest_may24 # Avoided Deforestation policy # * ("none"): no avoided deforestation diff --git a/main.gms b/main.gms index 413135031c..92a3122af6 100644 --- a/main.gms +++ b/main.gms @@ -255,7 +255,7 @@ $setglobal past endo_jun13 $setglobal forestry dynamic_feb21 $setglobal urban exo_nov21 -$setglobal natveg dynamic_feb21 +$setglobal natveg pot_forest_may24 $setglobal employment exo_may22 $setglobal labor_prod off diff --git a/modules/35_natveg/module.gms b/modules/35_natveg/module.gms index ad5f60d91d..8a39eecaa9 100644 --- a/modules/35_natveg/module.gms +++ b/modules/35_natveg/module.gms @@ -17,6 +17,5 @@ *' @authors Florian Humpenöder, Abhijeet Mishra, Patrick v. Jeetze *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%natveg%" == "dynamic_feb21" $include "./modules/35_natveg/dynamic_feb21/realization.gms" $Ifi "%natveg%" == "pot_forest_may24" $include "./modules/35_natveg/pot_forest_may24/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index 632fd26e8b..5e08255b8e 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -49,10 +49,9 @@ equations q35_secdforest_expansion(j) Secdforest reduction (mio. ha) q35_secdforest_reduction(j,ac) Secdforest reduction (mio. ha) q35_primforest_reduction(j) Primforest reduction (mio. ha) - q35_secdforest_regeneration(j) Secondary forest remains secondary forest (mio. ha) - q35_max_secdforest_regeneration(j) Maximum secdforest regeneration (mio. ha) - q35_max_foresty_expansion(j) Maximum forestry regeneration based on potential forest area (mio. ha) - q35_other_regeneration(j) Other land remains other land (mio. ha) + q35_secdforest_regeneration(j) Secondary forest regeneration (mio. ha) + q35_max_forest_expansion(j) Maximum forestry regeneration based on potential forest area (mio. ha) + q35_other_regeneration(j) Other land regeneration (mio. ha) q35_other_est(j,ac) Distribution of other land additions over ac_est (mio. ha) q35_secdforest_est(j,ac) Distribution of secdforest additions over ac_est (mio. ha) q35_hvarea_other(j,ac) Harvested area other land (mio. ha) @@ -113,8 +112,9 @@ parameters oq35_secdforest_expansion(t,j,type) Secdforest reduction (mio. ha) oq35_secdforest_reduction(t,j,ac,type) Secdforest reduction (mio. ha) oq35_primforest_reduction(t,j,type) Primforest reduction (mio. ha) - oq35_secdforest_regeneration(t,j,type) Secondary forest remains secondary forest (mio. ha) - oq35_other_regeneration(t,j,type) Other land remains other land (mio. ha) + oq35_secdforest_regeneration(t,j,type) Secondary forest regeneration (mio. ha) + oq35_max_forest_expansion(t,j,type) Maximum forestry regeneration based on potential forest area (mio. ha) + oq35_other_regeneration(t,j,type) Other land regeneration (mio. ha) oq35_other_est(t,j,ac,type) Distribution of other land additions over ac_est (mio. ha) oq35_secdforest_est(t,j,ac,type) Distribution of secdforest additions over ac_est (mio. ha) oq35_hvarea_other(t,j,ac,type) Harvested area other land (mio. ha) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 4ea85ba88e..6657d8e7f9 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -189,7 +189,7 @@ q35_secdforest_regeneration(j2).. *' remaining potential forest area, which was calculated based *' on the potential natural forest area in each cluster. -q35_max_foresty_expansion(j2).. +q35_max_forest_expansion(j2).. sum(land_forest, vm_landexpansion(j2,land_forest)) =l= p35_max_forest_recovery(j2) diff --git a/modules/35_natveg/pot_forest_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms index 41f427750b..859c858748 100644 --- a/modules/35_natveg/pot_forest_may24/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -39,6 +39,7 @@ p35_other(t,j,ac) = v35_other.l(j,ac); oq35_secdforest_reduction(t,j,ac,"marginal") = q35_secdforest_reduction.m(j,ac); oq35_primforest_reduction(t,j,"marginal") = q35_primforest_reduction.m(j); oq35_secdforest_regeneration(t,j,"marginal") = q35_secdforest_regeneration.m(j); + oq35_max_forest_expansion(t,j,"marginal") = q35_max_forest_expansion.m(j); oq35_other_regeneration(t,j,"marginal") = q35_other_regeneration.m(j); oq35_other_est(t,j,ac,"marginal") = q35_other_est.m(j,ac); oq35_secdforest_est(t,j,ac,"marginal") = q35_secdforest_est.m(j,ac); @@ -80,6 +81,7 @@ p35_other(t,j,ac) = v35_other.l(j,ac); oq35_secdforest_reduction(t,j,ac,"level") = q35_secdforest_reduction.l(j,ac); oq35_primforest_reduction(t,j,"level") = q35_primforest_reduction.l(j); oq35_secdforest_regeneration(t,j,"level") = q35_secdforest_regeneration.l(j); + oq35_max_forest_expansion(t,j,"level") = q35_max_forest_expansion.l(j); oq35_other_regeneration(t,j,"level") = q35_other_regeneration.l(j); oq35_other_est(t,j,ac,"level") = q35_other_est.l(j,ac); oq35_secdforest_est(t,j,ac,"level") = q35_secdforest_est.l(j,ac); @@ -121,6 +123,7 @@ p35_other(t,j,ac) = v35_other.l(j,ac); oq35_secdforest_reduction(t,j,ac,"upper") = q35_secdforest_reduction.up(j,ac); oq35_primforest_reduction(t,j,"upper") = q35_primforest_reduction.up(j); oq35_secdforest_regeneration(t,j,"upper") = q35_secdforest_regeneration.up(j); + oq35_max_forest_expansion(t,j,"upper") = q35_max_forest_expansion.up(j); oq35_other_regeneration(t,j,"upper") = q35_other_regeneration.up(j); oq35_other_est(t,j,ac,"upper") = q35_other_est.up(j,ac); oq35_secdforest_est(t,j,ac,"upper") = q35_secdforest_est.up(j,ac); @@ -162,6 +165,7 @@ p35_other(t,j,ac) = v35_other.l(j,ac); oq35_secdforest_reduction(t,j,ac,"lower") = q35_secdforest_reduction.lo(j,ac); oq35_primforest_reduction(t,j,"lower") = q35_primforest_reduction.lo(j); oq35_secdforest_regeneration(t,j,"lower") = q35_secdforest_regeneration.lo(j); + oq35_max_forest_expansion(t,j,"lower") = q35_max_forest_expansion.lo(j); oq35_other_regeneration(t,j,"lower") = q35_other_regeneration.lo(j); oq35_other_est(t,j,ac,"lower") = q35_other_est.lo(j,ac); oq35_secdforest_est(t,j,ac,"lower") = q35_secdforest_est.lo(j,ac); From ab85d32c09631d58e4aecdc27e39c81898fd7a4a Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Fri, 3 May 2024 17:43:18 +0200 Subject: [PATCH 104/280] land_agfo set not needed --- core/sets.gms | 3 --- 1 file changed, 3 deletions(-) diff --git a/core/sets.gms b/core/sets.gms index 041abb63b3..5ee0ef2fe4 100644 --- a/core/sets.gms +++ b/core/sets.gms @@ -247,9 +247,6 @@ sets land_ag(land) Agricultural land pools / crop, past / - land_agfo(land) Agricultural and forestry land - / crop, past, forestry / - land_timber(land) land from which timber can be taken away / forestry, primforest, secdforest, other / From 09535ff25dff9257e5742cc07d39f4cb84d36b43 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 4 May 2024 11:15:00 +0200 Subject: [PATCH 105/280] updates --- CHANGELOG.md | 4 +- config/default.cfg | 5 +- .../80_optimization/lp_nlp_apr17/input.gms | 3 +- .../80_optimization/lp_nlp_apr17/solve.gms | 22 ++++---- .../nlp_apr17/declarations.gms | 5 +- modules/80_optimization/nlp_apr17/input.gms | 3 +- modules/80_optimization/nlp_apr17/solve.gms | 51 ++++++++--------- .../80_optimization/nlp_par/declarations.gms | 2 - modules/80_optimization/nlp_par/input.gms | 3 +- modules/80_optimization/nlp_par/solve.gms | 56 +++++-------------- scripts/output/extra/highres.R | 2 +- 11 files changed, 65 insertions(+), 91 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3e166f765..7f64500b7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,12 +12,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **30_crop** SNV implementation has been moved from `30_crop` to `29_cropland` - **30_crop** the two realizations `penalty_apr22` and `rotation_apr22` have been merged into a single `30_croparea/detail_apr24` realization - **30_crop** the previous `30_crop/endo_apr21` realization has been moved to `30_croparea/simple_apr24` -- **default.cfg** cfg$gms$s80_maxiter reduced from 30 to 10 +- **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE and CONOPT3. REMOVED CONOPT4 without preprocessing, which usually only increases run time without feasbile solution. ### added - **29_cropland** new module `29_cropland` accounting for crop area, fallow cropland and tree cover on cropland with two realizations: `detail_apr24` and `simple_apr24` (default). - **10_land** added interface `pm_land_hist` with historic land use patterns - **32_forestry** added technical balance term `v32_land_missing_ndc` +- **default.cfg** cfg$gms$s80_secondsolve option for second solve statement with 0=off as default ### removed - **scripts/output/extra** removed scripts disaggregation_cropsplit and disaggregation_transitions @@ -29,7 +30,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **scenario_config.csv** same revision for input files as in default.cfg - **scenario_fsec.csv** scenario settings - **start/projects/fsec.R** scenario settings -- **80_optimization** fixed a bug in nlp_apr17; cycling through CONOPT4, CONOPT4 without preprocessing and CONOPT3 was not working - **80_optimization** bugfix in nlp_par. Double solve statement was not working - **58_peatland** Added balance variable to avoid random infeasibilites diff --git a/config/default.cfg b/config/default.cfg index 5832345699..2457dd5f7d 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1953,7 +1953,7 @@ cfg$gms$s73_expansion <- 0 # def = 0 cfg$gms$optimization <- "nlp_apr17" # def = nlp_apr17 # maximal number of solve iterations -cfg$gms$s80_maxiter <- 10 # def = 10 +cfg$gms$s80_maxiter <- 30 # def = 30 # Solver settings only for realization `lp_nlp_apr17`. All other realizations use `conopt4`. # * (conopt4): conopt4 @@ -1965,6 +1965,9 @@ cfg$gms$c80_nlp_solver <- "conopt4" # def = conopt4 # * 0: default settings (optfile will be ignored) cfg$gms$s80_optfile <- 0 # def = 0 +# * Optional second solve statement (0=off, 1=on) +cfg$gms$s80_secondsolve <- 0 # def = 0 + #*******************************END MODULE SETUP******************************** #### Other settings (e.g. clustering, gdx files, ...): #### diff --git a/modules/80_optimization/lp_nlp_apr17/input.gms b/modules/80_optimization/lp_nlp_apr17/input.gms index 83427b7cfe..3e8b6bcfd0 100644 --- a/modules/80_optimization/lp_nlp_apr17/input.gms +++ b/modules/80_optimization/lp_nlp_apr17/input.gms @@ -6,10 +6,11 @@ *** | Contact: magpie@pik-potsdam.de scalars - s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 10 / + s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / s80_optfile switch to use specfied solver settings (1) / 0 / s80_add_cplex add cplex optimization after conopt4 (1) / 0 / s80_add_conopt3 add conopt3 optimization after conopt4 (1) / 0 / + s80_secondsolve second solve statement (binary) / 0 / ; diff --git a/modules/80_optimization/lp_nlp_apr17/solve.gms b/modules/80_optimization/lp_nlp_apr17/solve.gms index 85ec1ef813..b399e37c21 100644 --- a/modules/80_optimization/lp_nlp_apr17/solve.gms +++ b/modules/80_optimization/lp_nlp_apr17/solve.gms @@ -65,7 +65,7 @@ $batinclude "./modules/include.gms" nl_fix *' in particular for matching LHS and RHS of equations. solve magpie USING nlp MINIMIZING vm_cost_glo; - solve magpie USING nlp MINIMIZING vm_cost_glo; + if(s80_secondsolve = 1, solve magpie USING nlp MINIMIZING vm_cost_glo; ); *' A second optimization makes sure that in case of a flat optimum that solution *' is chosen for which the difference in land changes compared to the previous @@ -76,7 +76,7 @@ $batinclude "./modules/include.gms" nl_fix if ((magpie.modelstat=1 or magpie.modelstat = 7), vm_cost_glo.up = vm_cost_glo.l; solve magpie USING nlp MINIMIZING vm_landdiff; - solve magpie USING nlp MINIMIZING vm_landdiff; + if(s80_secondsolve = 1, solve magpie USING nlp MINIMIZING vm_landdiff; ); vm_cost_glo.up = Inf; ); @@ -130,7 +130,7 @@ $batinclude "./modules/include.gms" nl_relax *' the nonlinear optimization of the model in its full complexity. solve magpie USING nlp MINIMIZING vm_cost_glo; - solve magpie USING nlp MINIMIZING vm_cost_glo; + if(s80_secondsolve = 1, solve magpie USING nlp MINIMIZING vm_cost_glo; ); *' @stop @@ -139,16 +139,17 @@ $batinclude "./modules/include.gms" nl_relax display "Additional solve with CONOPT3!"; option nlp = conopt; solve magpie USING nlp MINIMIZING vm_cost_glo; - solve magpie USING nlp MINIMIZING vm_cost_glo; + if(s80_secondsolve = 1, solve magpie USING nlp MINIMIZING vm_cost_glo; ); option nlp = conopt4; ); -* if solve stopped with an error, try it again without pre-processing +* if solve stopped with an error, try it again with CONOPT4 and OPTFILE if((magpie.modelstat = 13), - display "WARNING: Modelstat 13 | retry without Conopt4 pre-processing"; - magpie.optfile = 2 - solve magpie USING nlp MINIMIZING vm_cost_glo; + display "WARNING: Modelstat 13 | retry with CONOPT4 OPTFILE"; + option nlp = conopt4; + magpie.optfile = 1 solve magpie USING nlp MINIMIZING vm_cost_glo; + if(s80_secondsolve = 1, solve magpie USING nlp MINIMIZING vm_cost_glo; ); magpie.optfile = s80_optfile ; ); @@ -157,7 +158,7 @@ $batinclude "./modules/include.gms" nl_relax display "WARNING: Modelstat 13 | retry with CONOPT3!"; option nlp = conopt; solve magpie USING nlp MINIMIZING vm_cost_glo; - solve magpie USING nlp MINIMIZING vm_cost_glo; + if(s80_secondsolve = 1, solve magpie USING nlp MINIMIZING vm_cost_glo; ); option nlp = conopt4; ); @@ -188,13 +189,14 @@ magpie.trylinear = 1; $batinclude "./modules/include.gms" nl_fix solve magpie USING nlp MINIMIZING vm_cost_glo; -solve magpie USING nlp MINIMIZING vm_cost_glo; +if(s80_secondsolve = 1, solve magpie USING nlp MINIMIZING vm_cost_glo; ); $batinclude "./modules/include.gms" nl_release if((magpie.modelstat=1 or magpie.modelstat = 7), vm_cost_glo.up = vm_cost_glo.l; solve magpie USING nlp MINIMIZING vm_landdiff; + if(s80_secondsolve = 1, solve magpie USING nlp MINIMIZING vm_landdiff; ); vm_cost_glo.up = Inf; ); diff --git a/modules/80_optimization/nlp_apr17/declarations.gms b/modules/80_optimization/nlp_apr17/declarations.gms index be5b332fc0..df685b2608 100644 --- a/modules/80_optimization/nlp_apr17/declarations.gms +++ b/modules/80_optimization/nlp_apr17/declarations.gms @@ -11,7 +11,6 @@ parameters ; scalars - s80_counter counter (1) - s80_modelstat_previter modelstat of previous iteration (1) - s80_optfile_previter optfile used in previous iteration (1) + s80_counter counter (1) + s80_resolve_option option for resolve (1) ; diff --git a/modules/80_optimization/nlp_apr17/input.gms b/modules/80_optimization/nlp_apr17/input.gms index b26b854d44..5c645af1c2 100644 --- a/modules/80_optimization/nlp_apr17/input.gms +++ b/modules/80_optimization/nlp_apr17/input.gms @@ -6,6 +6,7 @@ *** | Contact: magpie@pik-potsdam.de scalars - s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 10 / + s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / s80_optfile switch to use specfied solver settings (1) / 0 / + s80_secondsolve second solve statement (binary) / 0 / ; diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index bae758fec1..5fed3ef9fb 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -8,8 +8,7 @@ s80_counter = 0; p80_modelstat(t) = 14; -s80_modelstat_previter = 14; -s80_optfile_previter = s80_optfile; +s80_resolve_option = 1; *** solver settings option nlp = conopt4; @@ -30,10 +29,9 @@ Flg_Prep = FALSE $offecho *' @code -*' Solve statement is put twice for improved model results, -*' in particular for matching LHS and RHS of equations. -solve magpie USING nlp MINIMIZING vm_cost_glo; solve magpie USING nlp MINIMIZING vm_cost_glo; +*' Optional second solve statement +if(s80_secondsolve = 1, solve magpie USING nlp MINIMIZING vm_cost_glo; ); *' @stop display "vm_cost_glo.l"; @@ -44,30 +42,24 @@ display magpie.modelstat; if (magpie.modelstat > 2, repeat( s80_counter = s80_counter + 1 ; - - if (magpie.modelstat ne s80_modelstat_previter, + if(s80_resolve_option = 1, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; - solve magpie USING nlp MINIMIZING vm_cost_glo; - solve magpie USING nlp MINIMIZING vm_cost_glo; - elseif magpie.modelstat = s80_modelstat_previter, - if (magpie.optfile = s80_optfile_previter, - display "Modelstat > 2 | Retry solve without CONOPT4 pre-processing"; - magpie.optfile = 2; - solve magpie USING nlp MINIMIZING vm_cost_glo; - solve magpie USING nlp MINIMIZING vm_cost_glo; - else - display "Modelstat > 2 | Retry solve with CONOPT3"; - option nlp = conopt; - solve magpie USING nlp MINIMIZING vm_cost_glo; - solve magpie USING nlp MINIMIZING vm_cost_glo; - option nlp = conopt4; - ); - ); - - s80_modelstat_previter = magpie.modelstat; - s80_optfile_previter = magpie.optfile; -* reset `magpie.optfile` to default after saving value to `s80_optfile_previter` - magpie.optfile = s80_optfile; + option nlp = conopt4; + magpie.optfile = 0; + elseif s80_resolve_option = 2, + display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE"; + option nlp = conopt4; + magpie.optfile = 1; + elseif s80_resolve_option = 3, + display "Modelstat > 2 | Retry solve with CONOPT3"; + option nlp = conopt; + magpie.optfile = 0; + ); + + solve magpie USING nlp MINIMIZING vm_cost_glo; + if(s80_secondsolve = 1, solve magpie USING nlp MINIMIZING vm_cost_glo; ); + option nlp = conopt4; + magpie.optfile = s80_optfile; display "vm_cost_glo.l"; display vm_cost_glo.l; @@ -79,6 +71,9 @@ if (magpie.modelstat > 2, display s80_counter; display magpie.modelstat; + + s80_resolve_option$(s80_resolve_option < 3) = s80_resolve_option + 1; + s80_resolve_option$(s80_resolve_option >= 3) = 1; until (magpie.modelstat <= 2 or s80_counter >= s80_maxiter) ); diff --git a/modules/80_optimization/nlp_par/declarations.gms b/modules/80_optimization/nlp_par/declarations.gms index 95454dded2..3627704eb7 100644 --- a/modules/80_optimization/nlp_par/declarations.gms +++ b/modules/80_optimization/nlp_par/declarations.gms @@ -17,6 +17,4 @@ parameters scalars s80_counter counter (1) s80_objective objective function value (mio. USD05MER per yr) - s80_modelstat_previter modelstat of previous iteration (1) - s80_optfile_previter optfile used in previous iteration (1) ; diff --git a/modules/80_optimization/nlp_par/input.gms b/modules/80_optimization/nlp_par/input.gms index eaf3fdd672..1004040b7e 100644 --- a/modules/80_optimization/nlp_par/input.gms +++ b/modules/80_optimization/nlp_par/input.gms @@ -6,6 +6,7 @@ *** | Contact: magpie@pik-potsdam.de scalars - s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 10 / + s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / s80_optfile switch to use specfied solver settings (1) / 0 / + s80_secondsolve second solve statement (binary) / 0 / ; diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index ae525173c6..e33de6b697 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -67,9 +67,7 @@ repeat display s80_objective; magpie.modelStat$(magpie.modelStat=NA) = 13; - s80_modelstat_previter = p80_modelstat(t,h); p80_modelstat(t,h) = magpie.modelStat; - s80_optfile_previter = magpie.optfile; if(p80_counter(h) >= s80_maxiter AND p80_modelstat(t,h) > 2, if(p80_modelstat(t,h) = 13, @@ -87,7 +85,7 @@ repeat if(p80_modelstat(t,h) <= 2, p80_counter_modelstat(h) = p80_counter_modelstat(h) + 1; - if(p80_counter_modelstat(h) < 2, + if(p80_counter_modelstat(h) < 2 AND s80_secondsolve = 1, display "Model status <= 2. Starting second solve"; solve magpie USING nlp MINIMIZING vm_cost_glo; p80_handle(h) = magpie.handle; @@ -103,41 +101,27 @@ repeat display "Resolve" if(p80_resolve_option(h) = 1, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; + option nlp = conopt4; magpie.optfile = 0; elseif p80_resolve_option(h) = 2, - display "Modelstat > 2 | Retry solve with CONOPT4 default setting and magpie_p_last_timestep.gdx"; - magpie.optfile = 0; - Execute_Loadpoint "magpie_p_last_timestep.gdx"; - elseif p80_resolve_option(h) = 3, - display "Modelstat > 2 | Retry solve with CONOPT4 default setting and magpie_y2020.gdx"; - magpie.optfile = 0; - Execute_Loadpoint "magpie_y2020.gdx"; - elseif p80_resolve_option(h) = 4, display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE"; - magpie.optfile = 1; - elseif p80_resolve_option(h) = 5, - display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE and magpie_p_last_timestep.gdx"; - magpie.optfile = 1; - Execute_Loadpoint "magpie_p_last_timestep.gdx"; - elseif p80_resolve_option(h) = 6, - display "Modelstat > 2 | Retry solve with CONOPT4 OPTFILE and magpie_y2020.gdx"; - magpie.optfile = 1; - Execute_Loadpoint "magpie_y2020.gdx"; + option nlp = conopt4; + magpie.optfile = 1; + elseif p80_resolve_option(h) = 3, + display "Modelstat > 2 | Retry solve with CONOPT3"; + option nlp = conopt; + magpie.optfile = 0; ); if(execerror > 0, execerror = 0); - s80_objective = sum(i2,v11_cost_reg.l(i2)); - display s80_objective; + solve magpie USING nlp MINIMIZING vm_cost_glo; - if (p80_resolve_option(h) < 6, - p80_resolve_option(h) = p80_resolve_option(h) + 1; - else - p80_resolve_option(h) = 1; - ); - if(magpie.handle = 0, - display "Problem. Handle is zero despite resolve. Setting handle to 1 for continuation."; - magpie.handle = 1; - ); + magpie.handle$(magpie.handle = 0) = 1; p80_handle(h) = magpie.handle; + option nlp = conopt4; + magpie.optfile = s80_optfile; + + p80_resolve_option(h)$(p80_resolve_option(h) < 3) = p80_resolve_option(h) + 1; + p80_resolve_option(h)$(p80_resolve_option(h) >= 3) = 1; ); h2(h) = no; i2(i) = no; @@ -148,16 +132,6 @@ display$sleep(card(p80_handle)*0.2) 'sleep some time'; display$readyCollect(p80_handle,INF) 'Problem waiting for next instance to complete'; until card(p80_handle) = 0 OR smax(h, p80_counter(h)) >= s80_maxiter; -* Save results to gdx point files -* Historical period for magpie_p_y[XXXX].gdx files is excluded to avoid diversion of results compared to other model runs if restarted with s_use_gdx = 2. -if (smax(h,p80_modelstat(t,h)) <= 2, - put_utility 'shell' / 'cp -f magpie_p.gdx magpie_p_last_timestep.gdx'; - if (m_year(t) > sm_fix_SSP2, - put_utility 'shell' / 'cp -f magpie_p.gdx magpie_' t.tl:0'.gdx'; - ); - put_utility 'shell' / 'rm -f magpie_p.gdx'; -); - if (smax(h,p80_modelstat(t,h)) > 2 and smax(h,p80_modelstat(t,h)) ne 7, Execute_Unload "fulldata.gdx"; abort "No feasible solution found!"; diff --git a/scripts/output/extra/highres.R b/scripts/output/extra/highres.R index 809868fef6..63c57f0e88 100644 --- a/scripts/output/extra/highres.R +++ b/scripts/output/extra/highres.R @@ -101,7 +101,7 @@ highres <- function(cfg) { #note: using gdx files for more than the 1st time step sometimes pushes the model into corner solutions, which might result in infeasibilites. cfg$files2export$start <- c(cfg$files2export$start, paste0(cfg$results_folder, "/", "magpie_y*.gdx")) - cfg$gms$s_use_gdx <- 2 + cfg$gms$s_use_gdx <- 0 #max resources for parallel runs cfg$qos <- "standby_maxMem_dayMax" From 4e94659b18e923d3a8629ee8c23d0e78e6185ddc Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 4 May 2024 11:23:09 +0200 Subject: [PATCH 106/280] update --- modules/80_optimization/nlp_apr17/solve.gms | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index 5fed3ef9fb..b30a7dfa17 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -87,6 +87,8 @@ if ((p80_modelstat(t) <= 2), ); if ((p80_modelstat(t) > 2 and p80_modelstat(t) ne 7), + execute 'gmszip -r magpie_problem.zip "%gams.scrdir%"' + put_utility 'shell' / 'mv -f magpie_problem.zip magpie_problem_' t.tl:0'.zip'; Execute_Unload "fulldata.gdx"; abort "no feasible solution found!"; ); From 2f79c13364ec1ef8170daba18bea207c5ea6810e Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 4 May 2024 15:52:40 +0200 Subject: [PATCH 107/280] bugfix --- modules/80_optimization/nlp_par/declarations.gms | 1 + modules/80_optimization/nlp_par/solve.gms | 14 ++++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/80_optimization/nlp_par/declarations.gms b/modules/80_optimization/nlp_par/declarations.gms index 3627704eb7..1734708bc8 100644 --- a/modules/80_optimization/nlp_par/declarations.gms +++ b/modules/80_optimization/nlp_par/declarations.gms @@ -17,4 +17,5 @@ parameters scalars s80_counter counter (1) s80_objective objective function value (mio. USD05MER per yr) + s80_resolve_option option for resolve (1) ; diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index e33de6b697..c35af4fa48 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -60,6 +60,7 @@ repeat i2(i)$supreg(h,i) = yes; loop(i2, j2(j)$cell(i2,j) = yes); display h2; + display i2; s80_counter = sum(h2,p80_counter(h2)); s80_objective = sum(i2,v11_cost_reg.l(i2)); display s80_counter; @@ -70,10 +71,8 @@ repeat p80_modelstat(t,h) = magpie.modelStat; if(p80_counter(h) >= s80_maxiter AND p80_modelstat(t,h) > 2, - if(p80_modelstat(t,h) = 13, execute 'gmszip -r magpie_problem.zip "%gams.scrdir%"' put_utility 'shell' / 'mv -f magpie_problem.zip magpie_problem_' h.tl:0'_' t.tl:0'.zip'; - ); display "No feasible solution found. Writing LST file."; option AsyncSolLst=1; display$handlecollect(p80_handle(h)) 're-collect'; @@ -99,6 +98,9 @@ repeat if(p80_extra_solve(h) = 1, display "Resolve" + execute_loadpoint 'fulldata.gdx'; + s80_resolve_option = sum(h2,p80_resolve_option(h2)); + display s80_resolve_option; if(p80_resolve_option(h) = 1, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; option nlp = conopt4; @@ -108,6 +110,10 @@ repeat option nlp = conopt4; magpie.optfile = 1; elseif p80_resolve_option(h) = 3, + display "Modelstat > 2 | Retry solve with CONOPT4 w/o preprocessing"; + option nlp = conopt4; + magpie.optfile = 2; + elseif p80_resolve_option(h) = 4, display "Modelstat > 2 | Retry solve with CONOPT3"; option nlp = conopt; magpie.optfile = 0; @@ -120,8 +126,8 @@ repeat option nlp = conopt4; magpie.optfile = s80_optfile; - p80_resolve_option(h)$(p80_resolve_option(h) < 3) = p80_resolve_option(h) + 1; - p80_resolve_option(h)$(p80_resolve_option(h) >= 3) = 1; + p80_resolve_option(h)$(p80_resolve_option(h) < 4) = p80_resolve_option(h) + 1; + p80_resolve_option(h)$(p80_resolve_option(h) >= 4) = 1; ); h2(h) = no; i2(i) = no; From 8fa321792a129f288d95e476ddef61c56c237d50 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 4 May 2024 16:43:19 +0200 Subject: [PATCH 108/280] test --- modules/80_optimization/nlp_par/solve.gms | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index c35af4fa48..d0b8e59b2f 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -18,6 +18,7 @@ magpie.optfile = s80_optfile ; magpie.scaleopt = 1 ; magpie.solprint = 0 ; magpie.holdfixed = 1 ; +magpie.savepoint = 2; $onecho > conopt4.opt Tol_Obj_Change = 3.0e-6 @@ -54,6 +55,7 @@ repeat p80_extra_solve(h) = 1; magpie.handle = p80_handle(h); + display magpie.handle; execute_loadhandle magpie; h2(h) = yes; @@ -112,7 +114,7 @@ repeat elseif p80_resolve_option(h) = 3, display "Modelstat > 2 | Retry solve with CONOPT4 w/o preprocessing"; option nlp = conopt4; - magpie.optfile = 2; + magpie.optfile = 0; elseif p80_resolve_option(h) = 4, display "Modelstat > 2 | Retry solve with CONOPT3"; option nlp = conopt; From fdbbc1cffd4dffb77f9fdb5dc9b6188d6e81bc3e Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 4 May 2024 17:40:45 +0200 Subject: [PATCH 109/280] test --- modules/80_optimization/nlp_par/solve.gms | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index d0b8e59b2f..3ef2c52736 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -9,7 +9,7 @@ p80_counter(h) = 0; p80_modelstat(t,h) = 14; p80_counter_modelstat(h) = 0; -p80_resolve_option(h) = 1; +p80_resolve_option(h) = 0; *** solver settings option nlp = conopt4; @@ -18,7 +18,7 @@ magpie.optfile = s80_optfile ; magpie.scaleopt = 1 ; magpie.solprint = 0 ; magpie.holdfixed = 1 ; -magpie.savepoint = 2; +magpie.savepoint = 3; $onecho > conopt4.opt Tol_Obj_Change = 3.0e-6 @@ -100,6 +100,7 @@ repeat if(p80_extra_solve(h) = 1, display "Resolve" + p80_resolve_option(h) = p80_resolve_option(h) + 1; execute_loadpoint 'fulldata.gdx'; s80_resolve_option = sum(h2,p80_resolve_option(h2)); display s80_resolve_option; @@ -128,8 +129,7 @@ repeat option nlp = conopt4; magpie.optfile = s80_optfile; - p80_resolve_option(h)$(p80_resolve_option(h) < 4) = p80_resolve_option(h) + 1; - p80_resolve_option(h)$(p80_resolve_option(h) >= 4) = 1; + p80_resolve_option(h)$(p80_resolve_option(h) >= 4) = 0; ); h2(h) = no; i2(i) = no; From 47256b8dc6545ae952911d1007fe1980e50c82ac Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 4 May 2024 17:51:53 +0200 Subject: [PATCH 110/280] bugfix --- modules/80_optimization/nlp_par/solve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 3ef2c52736..d0d08f9150 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -99,7 +99,7 @@ repeat ); if(p80_extra_solve(h) = 1, - display "Resolve" + display "Resolve"; p80_resolve_option(h) = p80_resolve_option(h) + 1; execute_loadpoint 'fulldata.gdx'; s80_resolve_option = sum(h2,p80_resolve_option(h2)); From ce923a390c5ff487eead41913e64b66c7a5d5bbe Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 4 May 2024 23:10:28 +0200 Subject: [PATCH 111/280] update --- CHANGELOG.md | 2 +- modules/80_optimization/lp_nlp_apr17/solve.gms | 4 ++-- modules/80_optimization/nlp_apr17/solve.gms | 11 ++++++++--- modules/80_optimization/nlp_par/solve.gms | 4 +--- scripts/output/extra/highres.R | 2 +- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f64500b7b..bd69fe994a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **30_crop** SNV implementation has been moved from `30_crop` to `29_cropland` - **30_crop** the two realizations `penalty_apr22` and `rotation_apr22` have been merged into a single `30_croparea/detail_apr24` realization - **30_crop** the previous `30_crop/endo_apr21` realization has been moved to `30_croparea/simple_apr24` -- **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE and CONOPT3. REMOVED CONOPT4 without preprocessing, which usually only increases run time without feasbile solution. +- **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE, CONOPT4 without preprocessing and CONOPT3. ### added - **29_cropland** new module `29_cropland` accounting for crop area, fallow cropland and tree cover on cropland with two realizations: `detail_apr24` and `simple_apr24` (default). diff --git a/modules/80_optimization/lp_nlp_apr17/solve.gms b/modules/80_optimization/lp_nlp_apr17/solve.gms index b399e37c21..5749c3db5a 100644 --- a/modules/80_optimization/lp_nlp_apr17/solve.gms +++ b/modules/80_optimization/lp_nlp_apr17/solve.gms @@ -145,9 +145,9 @@ $batinclude "./modules/include.gms" nl_relax * if solve stopped with an error, try it again with CONOPT4 and OPTFILE if((magpie.modelstat = 13), - display "WARNING: Modelstat 13 | retry with CONOPT4 OPTFILE"; + display "WARNING: Modelstat 13 | retry without Conopt4 pre-processing"; option nlp = conopt4; - magpie.optfile = 1 + magpie.optfile = 2 solve magpie USING nlp MINIMIZING vm_cost_glo; if(s80_secondsolve = 1, solve magpie USING nlp MINIMIZING vm_cost_glo; ); magpie.optfile = s80_optfile ; diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index b30a7dfa17..d6a436a21b 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -8,7 +8,7 @@ s80_counter = 0; p80_modelstat(t) = 14; -s80_resolve_option = 1; +s80_resolve_option = 0; *** solver settings option nlp = conopt4; @@ -42,6 +42,8 @@ display magpie.modelstat; if (magpie.modelstat > 2, repeat( s80_counter = s80_counter + 1 ; + s80_resolve_option = s80_resolve_option + 1; + if(s80_resolve_option = 1, display "Modelstat > 2 | Retry solve with CONOPT4 default setting"; option nlp = conopt4; @@ -51,6 +53,10 @@ if (magpie.modelstat > 2, option nlp = conopt4; magpie.optfile = 1; elseif s80_resolve_option = 3, + display "Modelstat > 2 | Retry solve with CONOPT4 w/o preprocessing"; + option nlp = conopt4; + magpie.optfile = 2; + elseif s80_resolve_option = 4, display "Modelstat > 2 | Retry solve with CONOPT3"; option nlp = conopt; magpie.optfile = 0; @@ -72,8 +78,7 @@ if (magpie.modelstat > 2, display s80_counter; display magpie.modelstat; - s80_resolve_option$(s80_resolve_option < 3) = s80_resolve_option + 1; - s80_resolve_option$(s80_resolve_option >= 3) = 1; + s80_resolve_option$(s80_resolve_option >= 4) = 0; until (magpie.modelstat <= 2 or s80_counter >= s80_maxiter) ); diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index d0d08f9150..a992c479db 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -55,14 +55,12 @@ repeat p80_extra_solve(h) = 1; magpie.handle = p80_handle(h); - display magpie.handle; execute_loadhandle magpie; h2(h) = yes; i2(i)$supreg(h,i) = yes; loop(i2, j2(j)$cell(i2,j) = yes); display h2; - display i2; s80_counter = sum(h2,p80_counter(h2)); s80_objective = sum(i2,v11_cost_reg.l(i2)); display s80_counter; @@ -115,7 +113,7 @@ repeat elseif p80_resolve_option(h) = 3, display "Modelstat > 2 | Retry solve with CONOPT4 w/o preprocessing"; option nlp = conopt4; - magpie.optfile = 0; + magpie.optfile = 2; elseif p80_resolve_option(h) = 4, display "Modelstat > 2 | Retry solve with CONOPT3"; option nlp = conopt; diff --git a/scripts/output/extra/highres.R b/scripts/output/extra/highres.R index 63c57f0e88..809868fef6 100644 --- a/scripts/output/extra/highres.R +++ b/scripts/output/extra/highres.R @@ -101,7 +101,7 @@ highres <- function(cfg) { #note: using gdx files for more than the 1st time step sometimes pushes the model into corner solutions, which might result in infeasibilites. cfg$files2export$start <- c(cfg$files2export$start, paste0(cfg$results_folder, "/", "magpie_y*.gdx")) - cfg$gms$s_use_gdx <- 0 + cfg$gms$s_use_gdx <- 2 #max resources for parallel runs cfg$qos <- "standby_maxMem_dayMax" From 3747457d0a55e20318fd6fc244196993151eb7ac Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 4 May 2024 23:13:57 +0200 Subject: [PATCH 112/280] update --- modules/80_optimization/nlp_par/solve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index a992c479db..be16edae5f 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -18,7 +18,7 @@ magpie.optfile = s80_optfile ; magpie.scaleopt = 1 ; magpie.solprint = 0 ; magpie.holdfixed = 1 ; -magpie.savepoint = 3; +magpie.savepoint = 0; $onecho > conopt4.opt Tol_Obj_Change = 3.0e-6 From b4a596d710c85191ed926c1ed26309a1dbf1f2e6 Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 5 May 2024 12:52:57 +0200 Subject: [PATCH 113/280] update --- modules/80_optimization/nlp_par/solve.gms | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index be16edae5f..3b06cbcbf0 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -99,6 +99,7 @@ repeat if(p80_extra_solve(h) = 1, display "Resolve"; p80_resolve_option(h) = p80_resolve_option(h) + 1; + display "Load solution from last time step as starting point"; execute_loadpoint 'fulldata.gdx'; s80_resolve_option = sum(h2,p80_resolve_option(h2)); display s80_resolve_option; From 9e175b4d3974a5e8c2bb217ca70afb8afd54e394 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 6 May 2024 20:06:09 +0200 Subject: [PATCH 114/280] bugfix --- modules/29_cropland/detail_apr24/presolve.gms | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index 54fe3c9120..6f0deb94ca 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -53,15 +53,10 @@ if (s29_treecover_keep = 1, i29_treecover_target(t,j)$(i29_treecover_target(t,j) < pc29_treecover_share(j)) = pc29_treecover_share(j); ); -v29_treecover.lo(j,ac_est) = 0; -v29_treecover.up(j,ac_est) = Inf; -v29_treecover.lo(j,ac_sub) = 0; -v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); -m_boundfix(v29_treecover,(j,ac_sub),l,1e-6); - if (m_year(t) <= s29_treecover_scenario_start, i29_treecover_penalty(t) = 0; v29_treecover_missing.fx(j) = 0; + v29_treecover.fx(j,ac) = pc29_treecover(j,ac); else i29_treecover_penalty(t) = s29_treecover_penalty; if (i29_treecover_penalty(t) > 0, @@ -70,6 +65,11 @@ else else v29_treecover_missing.fx(j) = 0; ); + v29_treecover.lo(j,ac_est) = 0; + v29_treecover.up(j,ac_est) = Inf; + v29_treecover.lo(j,ac_sub) = 0; + v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); + m_boundfix(v29_treecover,(j,ac_sub),l,1e-6); ); * create fallow land target and penalty scenario From 72ce77ef0fd55579ad6a54b2079447c00e04f16f Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 7 May 2024 08:19:11 +0200 Subject: [PATCH 115/280] updates --- config/default.cfg | 9 ++++-- modules/29_cropland/detail_apr24/presolve.gms | 28 +++++++++---------- modules/80_optimization/nlp_apr17/solve.gms | 8 +++++- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 2457dd5f7d..4f4d18ab7d 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -720,7 +720,8 @@ cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, f # * Minimum cluster share of treecover on total cropland area (including croparea, fallow land and tree cover). # * s29_treecover_target is faded in linearly between s29_treecover_scenario_start and s29_treecover_scenario_target. cfg$gms$s29_treecover_target <- 0 # def = 0 -# * Avoid loss of existing treecover (1=yes 0=no) +# * Avoid loss of existing treecover (1=yes 0=no). +# * If set to 1, `s29_treecover_target` will be adjusted based existing treecover area. cfg$gms$s29_treecover_keep <- 1 # def = 1 # * Maximum share of treecover on total cropland (1) cfg$gms$s29_treecover_max <- 0.4 # def = 0.4 @@ -728,12 +729,14 @@ cfg$gms$s29_treecover_max <- 0.4 # def = 0.4 cfg$gms$s29_treecover_scenario_start <- 2020 # def = 2020 # * Target year (year when full implementation is reached): cfg$gms$s29_treecover_scenario_target <- 2050 # def = 2050 +# * Penalty for violation of treecover target before scenario start (USD05MER per ha) +cfg$gms$s29_treecover_penalty_before <- 2000 # def = 2000 +# * Penalty for violation of treecover target after scenario start (USD05MER per ha) +cfg$gms$s29_treecover_penalty <- 2000 # def = 2000 # * Tree cover establishment cost (USD05MER per ha) cfg$gms$s29_cost_treecover_est <- 2000 # def = 2000 # * Tree cover recurring cost (USD05MER per ha) cfg$gms$s29_cost_treecover_recur <- 500 # def = 500 -# * Penalty for violation of treecover target (USD05MER per ha) -cfg$gms$s29_treecover_penalty <- 2000 # def = 2000 # * Minimum cluster share of fallow land on total cropland area (including croparea, fallow land and tree cover). # * s29_fallow_target is faded in linearly between s29_fallow_scenario_start and s29_fallow_scenario_target. diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index 6f0deb94ca..6894f2bacd 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -53,23 +53,23 @@ if (s29_treecover_keep = 1, i29_treecover_target(t,j)$(i29_treecover_target(t,j) < pc29_treecover_share(j)) = pc29_treecover_share(j); ); +v29_treecover.lo(j,ac_est) = 0; +v29_treecover.up(j,ac_est) = Inf; +v29_treecover.lo(j,ac_sub) = 0; +v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); +m_boundfix(v29_treecover,(j,ac_sub),l,1e-6); + if (m_year(t) <= s29_treecover_scenario_start, - i29_treecover_penalty(t) = 0; - v29_treecover_missing.fx(j) = 0; - v29_treecover.fx(j,ac) = pc29_treecover(j,ac); + i29_treecover_penalty(t) = s29_treecover_penalty_before; else i29_treecover_penalty(t) = s29_treecover_penalty; - if (i29_treecover_penalty(t) > 0, - v29_treecover_missing.lo(j) = 0; - v29_treecover_missing.up(j) = Inf; - else - v29_treecover_missing.fx(j) = 0; - ); - v29_treecover.lo(j,ac_est) = 0; - v29_treecover.up(j,ac_est) = Inf; - v29_treecover.lo(j,ac_sub) = 0; - v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); - m_boundfix(v29_treecover,(j,ac_sub),l,1e-6); +); + +if (i29_treecover_penalty(t) > 0, + v29_treecover_missing.lo(j) = 0; + v29_treecover_missing.up(j) = Inf; +else + v29_treecover_missing.fx(j) = 0; ); * create fallow land target and penalty scenario diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index d6a436a21b..165044891f 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -38,6 +38,9 @@ display "vm_cost_glo.l"; display vm_cost_glo.l; display magpie.modelstat; +* set modelstat to 13 in case of NA for continuation +magpie.modelStat$(magpie.modelStat=NA) = 13; + * in case of problems try different solvers and optfile settings if (magpie.modelstat > 2, repeat( @@ -70,13 +73,16 @@ if (magpie.modelstat > 2, display "vm_cost_glo.l"; display vm_cost_glo.l; -* write extended run information in list file in the case that the final solution is infeasible +* write extended run information in list file in the case that the final solution is infeasible if ((s80_counter >= (s80_maxiter-1) and magpie.modelstat > 2), magpie.solprint = 1 ); display s80_counter; display magpie.modelstat; +* Set modelstat to 13 in case of NA for the `until` check of the repeat loop. +* Otherwise, the repeat loop will never end. + magpie.modelStat$(magpie.modelStat=NA) = 13; s80_resolve_option$(s80_resolve_option >= 4) = 0; From 2ce5f4b0ad1db633d9673d7e7e1852825a6581e3 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 7 May 2024 08:50:20 +0200 Subject: [PATCH 116/280] bugfix --- modules/29_cropland/detail_apr24/input.gms | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms index af51a029e4..ad9fa127b3 100644 --- a/modules/29_cropland/detail_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -24,7 +24,8 @@ scalars s29_treecover_target Target share of treecover on total cropland (1) / 0 / s29_treecover_keep Avoid loss of existing treecover (1=yes 0=no) / 1 / s29_treecover_max Maximum share of treecover on total cropland (1) / 0.4 / - s29_treecover_penalty Penalty for violation of treecover target (USD05MER per ha) / 2000 / + s29_treecover_penalty_before Penalty for violation of treecover target before scenario start (USD05MER per ha) / 2000 / + s29_treecover_penalty Penalty for violation of treecover target after sceanrio start (USD05MER per ha) / 2000 / s29_fallow_scenario_start Fallow land scenario start year / 2020 / s29_fallow_scenario_target Fallow land scenario target year / 2050 / s29_fallow_target Target share of fallow land on total cropland (1) / 0 / From 7be483eb293ed60f824399b9bce4e842bcea4644 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 7 May 2024 16:03:06 +0200 Subject: [PATCH 117/280] update optfile --- modules/80_optimization/lp_nlp_apr17/solve.gms | 5 +---- modules/80_optimization/nlp_apr17/solve.gms | 5 +---- modules/80_optimization/nlp_par/solve.gms | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/modules/80_optimization/lp_nlp_apr17/solve.gms b/modules/80_optimization/lp_nlp_apr17/solve.gms index 5749c3db5a..7252140a62 100644 --- a/modules/80_optimization/lp_nlp_apr17/solve.gms +++ b/modules/80_optimization/lp_nlp_apr17/solve.gms @@ -34,10 +34,7 @@ $elseif "%c80_nlp_solver%" == "conopt4+conopt3" $endif $onecho > conopt4.opt -Tol_Obj_Change = 3.0e-6 -Tol_Feas_Min = 4.0e-10 -Tol_Feas_Max = 4.0e-6 -Tol_Feas_Tria = 4.0e-6 +Lim_Variable = 1.e25 $offecho $onecho > conopt4.op2 diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index 165044891f..42984f030b 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -18,10 +18,7 @@ magpie.solprint = 0 ; magpie.holdfixed = 1 ; $onecho > conopt4.opt -Tol_Obj_Change = 3.0e-6 -Tol_Feas_Min = 4.0e-10 -Tol_Feas_Max = 4.0e-6 -Tol_Feas_Tria = 4.0e-6 +Lim_Variable = 1.e25 $offecho $onecho > conopt4.op2 diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 3b06cbcbf0..64beff7501 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -21,10 +21,7 @@ magpie.holdfixed = 1 ; magpie.savepoint = 0; $onecho > conopt4.opt -Tol_Obj_Change = 3.0e-6 -Tol_Feas_Min = 4.0e-10 -Tol_Feas_Max = 4.0e-6 -Tol_Feas_Tria = 4.0e-6 +Lim_Variable = 1.e25 $offecho $onecho > conopt4.op2 From 1d7b333ff0947e42ef17f9f8320dc084f01135ba Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 7 May 2024 18:03:19 +0200 Subject: [PATCH 118/280] update additional data --- config/default.cfg | 2 +- modules/15_food/anthro_iso_jun22/sets.gms | 46 ++++++++++++++++--- .../15_food/anthropometrics_jan18/sets.gms | 46 ++++++++++++++++--- modules/56_ghg_policy/price_aug22/sets.gms | 4 ++ modules/70_livestock/fbask_jan16/sets.gms | 45 ++++++++++++++++-- scripts/start_functions.R | 20 ++++++++ 6 files changed, 145 insertions(+), 18 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 4f4d18ab7d..1062936334 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -25,7 +25,7 @@ cfg$model <- "main.gms" #def = "main.gms" cfg$input <- c(regional = "rev4.104_h12_magpie.tgz", cellular = "rev4.104_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", validation = "rev4.104_h12_validation.tgz", - additional = "additional_data_rev4.48.tgz", + additional = "additional_data_rev4.51.tgz", calibration = "calibration_H12_default_30Apr24.tgz") # NOTE: It is recommended to recalibrate the model when changing cellular input data diff --git a/modules/15_food/anthro_iso_jun22/sets.gms b/modules/15_food/anthro_iso_jun22/sets.gms index 269ae4f7ad..99b6b94959 100644 --- a/modules/15_food/anthro_iso_jun22/sets.gms +++ b/modules/15_food/anthro_iso_jun22/sets.gms @@ -5,6 +5,46 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de +*############################################################################### +*######################## R SECTION START (SETS) ############################### +* THIS CODE IS CREATED AUTOMATICALLY, DO NOT MODIFY THESE LINES DIRECTLY +* ANY DIRECT MODIFICATION WILL BE LOST AFTER NEXT AUTOMATIC UPDATE! + +sets + + fadeoutscen15 Food substitution scenarios including functional forms with targets and transition periods + / constant, + lin_zero_10_50, + lin_50pc_10_50_extend90, + lin_75pc_10_50_extend90, + lin_zero_20_50, + lin_zero_20_30, + lin_zero_20_70, + lin_50pc_20_50, + lin_50pc_20_50_extend65, + lin_50pc_20_50_extend80, + lin_80pc_20_50, + lin_80pc_20_50_extend95, + lin_90pc_20_50_extend95, + lin_99-98-90pc_20_50-60-100, + lin_zero_25_50, + lin_zero_25_30, + lin_zero_25_70, + lin_zero_25_75, + lin_50pc_25_50, + lin_50pc_25_50_extend65, + lin_50pc_25_50_extend75, + sigmoid_20pc_20_50, + sigmoid_50pc_20_50, + sigmoid_80pc_20_50, + sigmoid_25pc_25_50, + sigmoid_50pc_25_50, + sigmoid_75pc_25_50 / + +; +*######################### R SECTION END (SETS) ################################ +*############################################################################### + sets iter15 iterations between food demand model and magpie @@ -155,12 +195,6 @@ sets kfo_rd(kfo) Ruminant meat and dairy food products / livst_rum,livst_milk / - fadeoutscen15 Food substitution scenarios including functional forms with targets and transition periods - / constant, - lin_zero_10_50, lin_zero_20_50, lin_zero_20_30, lin_zero_20_70, lin_50pc_20_50, lin_50pc_20_50_extend65, lin_50pc_20_50_extend80, - lin_50pc_10_50_extend90, lin_75pc_10_50_extend90, lin_80pc_20_50, lin_80pc_20_50_extend95, lin_90pc_20_50_extend95, - lin_99-98-90pc_20_50-60-100, sigmoid_20pc_20_50, sigmoid_50pc_20_50, sigmoid_80pc_20_50 / - t_scen15(t_all) Target years for transition to exogenous scenario diets / y2010, y2030, y2050 / diff --git a/modules/15_food/anthropometrics_jan18/sets.gms b/modules/15_food/anthropometrics_jan18/sets.gms index 86a7bbe4a9..2bee821a5e 100644 --- a/modules/15_food/anthropometrics_jan18/sets.gms +++ b/modules/15_food/anthropometrics_jan18/sets.gms @@ -5,6 +5,46 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de +*############################################################################### +*######################## R SECTION START (SETS) ############################### +* THIS CODE IS CREATED AUTOMATICALLY, DO NOT MODIFY THESE LINES DIRECTLY +* ANY DIRECT MODIFICATION WILL BE LOST AFTER NEXT AUTOMATIC UPDATE! + +sets + + fadeoutscen15 Food substitution scenarios including functional forms with targets and transition periods + / constant, + lin_zero_10_50, + lin_50pc_10_50_extend90, + lin_75pc_10_50_extend90, + lin_zero_20_50, + lin_zero_20_30, + lin_zero_20_70, + lin_50pc_20_50, + lin_50pc_20_50_extend65, + lin_50pc_20_50_extend80, + lin_80pc_20_50, + lin_80pc_20_50_extend95, + lin_90pc_20_50_extend95, + lin_99-98-90pc_20_50-60-100, + lin_zero_25_50, + lin_zero_25_30, + lin_zero_25_70, + lin_zero_25_75, + lin_50pc_25_50, + lin_50pc_25_50_extend65, + lin_50pc_25_50_extend75, + sigmoid_20pc_20_50, + sigmoid_50pc_20_50, + sigmoid_80pc_20_50, + sigmoid_25pc_25_50, + sigmoid_50pc_25_50, + sigmoid_75pc_25_50 / + +; +*######################### R SECTION END (SETS) ################################ +*############################################################################### + sets iter15 iterations between food demand model and magpie @@ -149,12 +189,6 @@ sets kfo_rd(kfo) Ruminant meat and dairy food products / livst_rum,livst_milk / - fadeoutscen15 Food substitution scenarios including functional forms with targets and transition periods - / constant, - lin_zero_10_50, lin_zero_20_50, lin_zero_20_30, lin_zero_20_70, lin_50pc_20_50, lin_50pc_20_50_extend65, lin_50pc_20_50_extend80, - lin_50pc_10_50_extend90, lin_75pc_10_50_extend90, lin_80pc_20_50, lin_80pc_20_50_extend95, lin_90pc_20_50_extend95, - lin_99-98-90pc_20_50-60-100, sigmoid_20pc_20_50, sigmoid_50pc_20_50, sigmoid_80pc_20_50 / - t_scen15(t_all) Target years for transition to exogenous scenario diets / y2010, y2030, y2050 / diff --git a/modules/56_ghg_policy/price_aug22/sets.gms b/modules/56_ghg_policy/price_aug22/sets.gms index 7bb8f6bde9..014de3106f 100644 --- a/modules/56_ghg_policy/price_aug22/sets.gms +++ b/modules/56_ghg_policy/price_aug22/sets.gms @@ -102,15 +102,19 @@ sets all, all_nosoil, redd_nosoil, + redd_nosoil_CH4GWP20, redd_nosoil_nopeat, redd_nosoil_peatCO2only, reddnatveg_nosoil, + reddnatveg_nosoil_CH4GWP20, reddnatveg_nosoil_nopeat, reddnatveg_nosoil_peatCO2only, redd+_nosoil, + redd+_nosoil_CH4GWP20, redd+_nosoil_nopeat, redd+_nosoil_peatCO2only, redd+natveg_nosoil, + redd+natveg_nosoil_CH4GWP20, redd+natveg_nosoil_nopeat, redd+natveg_nosoil_peatCO2only, all_vegc, diff --git a/modules/70_livestock/fbask_jan16/sets.gms b/modules/70_livestock/fbask_jan16/sets.gms index 2382b598f7..3c219ab94b 100644 --- a/modules/70_livestock/fbask_jan16/sets.gms +++ b/modules/70_livestock/fbask_jan16/sets.gms @@ -5,6 +5,46 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de +*############################################################################### +*######################## R SECTION START (SETS) ############################### +* THIS CODE IS CREATED AUTOMATICALLY, DO NOT MODIFY THESE LINES DIRECTLY +* ANY DIRECT MODIFICATION WILL BE LOST AFTER NEXT AUTOMATIC UPDATE! + +sets + + fadeoutscen70 Feed substitution scenarios including functional forms with targets and transition periods + / constant, + lin_zero_10_50, + lin_50pc_10_50_extend90, + lin_75pc_10_50_extend90, + lin_zero_20_50, + lin_zero_20_30, + lin_zero_20_70, + lin_50pc_20_50, + lin_50pc_20_50_extend65, + lin_50pc_20_50_extend80, + lin_80pc_20_50, + lin_80pc_20_50_extend95, + lin_90pc_20_50_extend95, + lin_99-98-90pc_20_50-60-100, + lin_zero_25_50, + lin_zero_25_30, + lin_zero_25_70, + lin_zero_25_75, + lin_50pc_25_50, + lin_50pc_25_50_extend65, + lin_50pc_25_50_extend75, + sigmoid_20pc_20_50, + sigmoid_50pc_20_50, + sigmoid_80pc_20_50, + sigmoid_25pc_25_50, + sigmoid_50pc_25_50, + sigmoid_75pc_25_50 / + +; +*######################### R SECTION END (SETS) ################################ +*############################################################################### + sets cost_regr Cost regression parameters @@ -38,9 +78,4 @@ sets kcer70(kall) Cereals / tece, maiz, trce, rice_pro / - fadeoutscen70 Feed substitution scenarios including functional forms with targets and transition periods - / constant, - lin_zero_10_50, lin_zero_20_50, lin_zero_20_30, lin_zero_20_70, lin_50pc_20_50, lin_50pc_20_50_extend65, lin_50pc_20_50_extend80, - lin_50pc_10_50_extend90, lin_75pc_10_50_extend90, lin_80pc_20_50, lin_80pc_20_50_extend95, lin_90pc_20_50_extend95, - lin_99-98-90pc_20_50-60-100, sigmoid_20pc_20_50, sigmoid_50pc_20_50, sigmoid_80pc_20_50 / ; diff --git a/scripts/start_functions.R b/scripts/start_functions.R index 4074b48c69..871544aeab 100644 --- a/scripts/start_functions.R +++ b/scripts/start_functions.R @@ -73,6 +73,16 @@ .update_sets_modules <- function() { require(gms) + ### 15_food + fadeoutscen15 <- magclass::read.magpie("modules/15_food/input/f15_food_substitution_fader.csv") + fadeoutscen15 <- magclass::getNames(fadeoutscen15,dim=1) + + sets <- list(list(name = "fadeoutscen15", + desc = "Food substitution scenarios including functional forms with targets and transition periods", + items = fadeoutscen15)) + + gms::writeSets(sets , "modules/15_food/anthropometrics_jan18/sets.gms") + gms::writeSets(sets , "modules/15_food/anthro_iso_jun22/sets.gms") ### 56_ghg_policy ghgscen56 <- magclass::read.magpie("modules/56_ghg_policy/input/f56_pollutant_prices.cs3") @@ -99,6 +109,16 @@ items = scen2nd60)) gms::writeSets(sets , "modules/60_bioenergy/1stgen_priced_dec18/sets.gms") + + ### 70_livestock + fadeoutscen70 <- magclass::read.magpie("modules/70_livestock/fbask_jan16/input/f70_feed_substitution_fader.csv") + fadeoutscen70 <- magclass::getNames(fadeoutscen70,dim=1) + + sets <- list(list(name = "fadeoutscen70", + desc = "Feed substitution scenarios including functional forms with targets and transition periods", + items = fadeoutscen70)) + + gms::writeSets(sets , "modules/70_livestock/fbask_jan16/sets.gms") } # Function to extract information from info.txt From 574f54d4912c33218c8e6bfe8eee5a88108fb827 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 8 May 2024 07:17:42 +0200 Subject: [PATCH 119/280] bugfix --- config/scenario_fsec.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/scenario_fsec.csv b/config/scenario_fsec.csv index cd0fc1a682..e3d78a8b9e 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -79,6 +79,6 @@ gms$c73_build_demand;;;;;;;;;;;;;;;;;;;;;;;;50pc;;;;;;;;;;;;;;;;;;;;;;;;;;; input['cellular'];rev4.104_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.104_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.104_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.104_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.104_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.104_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.104_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;; input['regional'];rev4.104_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['validation'];rev4.104_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['additional'];additional_data_rev4.48.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['additional'];additional_data_rev4.51.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['calibration'];calibration_FSEC_26Mar24.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; magicc_emis_scen;bjoernAR6_C_SSP2-NDC.mif;;;bjoernAR6_C_SSP2-PkBudg900.mif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bjoernAR6_C_SSP1-NDC.mif;;;;;;;;;;;;bjoernAR6_C_RemSDP-900-MagSSP1.mif;; From 6f70949254069713bdcdc7ea2a9148d58de36999 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Wed, 8 May 2024 13:44:25 +0200 Subject: [PATCH 120/280] added decomposition of diet scenarios for BAU to Deep Dive script --- .../start/projects/project_EAT2p0_DeepDive.R | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index 1ae5541373..13c3a25c51 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -191,14 +191,33 @@ start_run(cfg, codeCheck = FALSE) # BAU + EL2-Diet # # Decomposition scenario. # Globally achieves EL2 (Diet+Waste+Prod) by 2050 +cfg$title <- "BAU_PHD" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) +cfg <- bau(cfg = cfg) +cfg <- diet(cfg = cfg) +cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + cfg$title <- "BAU_Diet" cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +cfg$title <- "BAU_Prod" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) +cfg <- bau(cfg = cfg) cfg <- prod(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +cfg$title <- "BAU_Waste" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) +cfg <- bau(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) + # BAU + Bioenergy # # Decomposition Scenario. Adds bioenergy demand from coupled run with land-use policies consistent with 1.5C by 2050 to BAU cfg$title <- "BAU_Bioenergy" From 0a3ffb6eeae6e48ba1affc033f1cd984e3e049b9 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 9 May 2024 16:49:36 +0200 Subject: [PATCH 121/280] forestryMay24 --- modules/16_demand/sector_may15/sets.gms | 1 + modules/21_trade/selfsuff_reduced/input.gms | 1 + modules/21_trade/selfsuff_reduced/preloop.gms | 3 + .../declarations.gms | 27 +++-- .../equations.gms | 59 +++++----- .../input.gms | 32 ++---- .../postsolve.gms | 28 +++-- .../preloop.gms | 107 ++---------------- .../presolve.gms | 34 +++--- .../realization.gms | 16 +-- .../scaling.gms | 0 .../{dynamic_feb21 => dynamic_may24}/sets.gms | 0 modules/32_forestry/input/files | 3 - modules/32_forestry/module.gms | 2 +- modules/73_timber/default/declarations.gms | 3 +- modules/73_timber/default/preloop.gms | 8 ++ modules/73_timber/default/presolve.gms | 15 ++- 17 files changed, 139 insertions(+), 200 deletions(-) rename modules/32_forestry/{dynamic_feb21 => dynamic_may24}/declarations.gms (86%) rename modules/32_forestry/{dynamic_feb21 => dynamic_may24}/equations.gms (80%) rename modules/32_forestry/{dynamic_feb21 => dynamic_may24}/input.gms (84%) rename modules/32_forestry/{dynamic_feb21 => dynamic_may24}/postsolve.gms (89%) rename modules/32_forestry/{dynamic_feb21 => dynamic_may24}/preloop.gms (62%) rename modules/32_forestry/{dynamic_feb21 => dynamic_may24}/presolve.gms (83%) rename modules/32_forestry/{dynamic_feb21 => dynamic_may24}/realization.gms (94%) rename modules/32_forestry/{dynamic_feb21 => dynamic_may24}/scaling.gms (100%) rename modules/32_forestry/{dynamic_feb21 => dynamic_may24}/sets.gms (100%) diff --git a/modules/16_demand/sector_may15/sets.gms b/modules/16_demand/sector_may15/sets.gms index bca7e9f565..1e31617a36 100644 --- a/modules/16_demand/sector_may15/sets.gms +++ b/modules/16_demand/sector_may15/sets.gms @@ -30,3 +30,4 @@ sets ; alias(kap,kap4); +alias(kforestry,kforestry2); diff --git a/modules/21_trade/selfsuff_reduced/input.gms b/modules/21_trade/selfsuff_reduced/input.gms index e8e98ff152..19a8d28d00 100644 --- a/modules/21_trade/selfsuff_reduced/input.gms +++ b/modules/21_trade/selfsuff_reduced/input.gms @@ -16,6 +16,7 @@ sets scalars s21_trade_tariff Trade tariff switch (1=on 0=off) (1) / 1 / s21_cost_import Cost for additional imports to maintain feasibility (USD05MER per tDM) / 10000 / + s21_min_trade_margin_forestry Minimum trade margin for forestry products (USD05MER per tDM) / 50 / ; table f21_trade_bal_reduction(t_all,trade_groups21,trade_regime21) Share of inelastic trade pool (1) diff --git a/modules/21_trade/selfsuff_reduced/preloop.gms b/modules/21_trade/selfsuff_reduced/preloop.gms index 9a91265c27..ff5c35c5a2 100644 --- a/modules/21_trade/selfsuff_reduced/preloop.gms +++ b/modules/21_trade/selfsuff_reduced/preloop.gms @@ -16,6 +16,9 @@ elseif (s21_trade_tariff=0), i21_trade_tariff(h,k_trade) = 0; ); +i21_trade_margin(h,"wood")$(i21_trade_margin(h,"wood") < s21_min_trade_margin_forestry) = s21_min_trade_margin_forestry; +i21_trade_margin(h,"woodfuel")$(i21_trade_margin(h,"woodfuel") < s21_min_trade_margin_forestry) = s21_min_trade_margin_forestry; + pm_selfsuff_ext(t_ext,h,kforestry) = f21_self_suff("y2150",h,kforestry); pm_selfsuff_ext(t_all,h,kforestry) = f21_self_suff(t_all,h,kforestry); *Implausible jumps in selfsuff for wood in some regions. diff --git a/modules/32_forestry/dynamic_feb21/declarations.gms b/modules/32_forestry/dynamic_may24/declarations.gms similarity index 86% rename from modules/32_forestry/dynamic_feb21/declarations.gms rename to modules/32_forestry/dynamic_may24/declarations.gms index 199e78df99..be974ad32d 100644 --- a/modules/32_forestry/dynamic_feb21/declarations.gms +++ b/modules/32_forestry/dynamic_may24/declarations.gms @@ -57,16 +57,22 @@ parameters p32_ac_dist(j,ac) Actual share of age-class distribution (1) p32_avg_increment(t_all,j,ac) Mean annual increment (tC per ha per year) p32_bii_coeff(type32,bii_class_secd,potnatveg) bii coeff (1) - p32_c_density_ac_fast_forestry(t_all,j,ac) Carbon densities in plantations based on Braakhekke et al (tC per ha) p32_disturbance_loss_ftype32(t,j,type32,ac) Loss due to disturbances in all plantation type forests (mio. ha) pcm_land_forestry(j,type32) Forestry land pools (mio. ha) + pc32_prod_forestry_ini(i) Initial procution from timber plantations (mio. tDM per yr) + pc32_plant_contr_ini(i) Inital share of roundwood production coming from timber plantations (percent) + i32_plant_contr_growth_fader(t_all) Fader for growth rate of timber plantation share (percent) + p32_plant_contr(t,i) Share of roundwood production coming from timber plantations (percent) + p32_forestry_product_dist(t,i,kforestry) Distribution of wood products (1) + p32_future_to_current_demand_ratio(t,i) Ratio of future and current timber demand (1) ; positive variables vm_cost_fore(i) Forestry costs (Mio USD) v32_cost_hvarea(i) Cost of harvesting timber from forests (mio. USD per yr) v32_land(j,type32,ac) Forestry land pools (mio. ha) - v32_land_missing(j) Forestry land which can be used at extrmemly high costs in case not enough area is available for new establishment (mio. ha) + v32_land_missing(j) Technical area balance term for timber plantation establishment (mio. ha) + v32_land_missing_ndc(j) Technical area balance term for NPI NDC reforestation (mio. ha) vm_landdiff_forestry Aggregated difference in forestry land compared to previous timestep (mio. ha) v32_cost_recur(i) Recurring forest management costs (USD per ha) v32_land_expansion(j,type32) Forestry land expansion (mio. ha) @@ -77,6 +83,7 @@ positive variables vm_landexpansion_forestry(j,type32) Forestry land expansion (mio. ha) vm_landreduction_forestry(j,type32) Forestry land reduction (mio. ha) vm_land_forestry(j,type32) Forestry land pools (mio. ha) + v32_prod_forestry_future(i) Future expected production of woody biomass from commercial plantations (mio. tDM per yr) ; variables @@ -86,7 +93,7 @@ variables equations q32_cost_total(i) Total forestry costs constraint (mio. USD) q32_land(j) Land constraint (mio. ha) - q32_land_type32(j,type32) Land constraint (mio. ha) + q32_land_type32(j,type32) Land constraint (mio. ha) q32_cdr_aff(j,ac) Calculation of CDR from afforestation (mio. tC) q32_carbon(j,ag_pools,stockType) Forestry carbon stock calculation (mio. tC) q32_land_diff Aggregated difference in forestry land compared to previous timestep (mio. ha) @@ -96,8 +103,9 @@ equations q32_aff_est(j) Afforestation constraint for establishment age classes (mio. ha) q32_hvarea_forestry(j,ac) Plantations area harvest (mio. ha) q32_cost_recur(i) Recurruing costs (mio. USD) - q32_establishment_dynamic(i) Establishment in current time step for future demand (mio. ha) - q32_establishment_dynamic_yield(i) Regional timber yield (tDM per ha) + q32_prod_forestry_future(i) Future expected production of woody biomass from commercial plantations (mio. tDM per yr) + q32_establishment_demand(i) Future expected production of woody biomass from commercial plantations (mio. tDM per yr) + q32_establishment_hvarea(j) Establishment in current time step for future demand (mio. ha) q32_establishment_fixed(j) Establishment in current time step for future demand (mio. ha) q32_land_expansion(j,type32) Land expansion (mio. ha) q32_land_reduction(j,type32,ac) Land contraction (mio. ha) @@ -119,7 +127,8 @@ parameters ov_cost_fore(t,i,type) Forestry costs (Mio USD) ov32_cost_hvarea(t,i,type) Cost of harvesting timber from forests (mio. USD per yr) ov32_land(t,j,type32,ac,type) Forestry land pools (mio. ha) - ov32_land_missing(t,j,type) Forestry land which can be used at extrmemly high costs in case not enough area is available for new establishment (mio. ha) + ov32_land_missing(t,j,type) Technical area balance term for timber plantation establishment (mio. ha) + ov32_land_missing_ndc(t,j,type) Technical area balance term for NPI NDC reforestation (mio. ha) ov_landdiff_forestry(t,type) Aggregated difference in forestry land compared to previous timestep (mio. ha) ov32_cost_recur(t,i,type) Recurring forest management costs (USD per ha) ov32_land_expansion(t,j,type32,type) Forestry land expansion (mio. ha) @@ -130,6 +139,7 @@ parameters ov_landexpansion_forestry(t,j,type32,type) Forestry land expansion (mio. ha) ov_landreduction_forestry(t,j,type32,type) Forestry land reduction (mio. ha) ov_land_forestry(t,j,type32,type) Forestry land pools (mio. ha) + ov32_prod_forestry_future(t,i,type) Future expected production of woody biomass from commercial plantations (mio. tDM per yr) ov_cdr_aff(t,j,ac,aff_effect,type) Expected bgc (CDR) and local bph effects of afforestation depending on planning horizon (mio. tC) oq32_cost_total(t,i,type) Total forestry costs constraint (mio. USD) oq32_land(t,j,type) Land constraint (mio. ha) @@ -143,8 +153,9 @@ parameters oq32_aff_est(t,j,type) Afforestation constraint for establishment age classes (mio. ha) oq32_hvarea_forestry(t,j,ac,type) Plantations area harvest (mio. ha) oq32_cost_recur(t,i,type) Recurruing costs (mio. USD) - oq32_establishment_dynamic(t,i,type) Establishment in current time step for future demand (mio. ha) - oq32_establishment_dynamic_yield(t,i,type) Regional timber yield (tDM per ha) + oq32_prod_forestry_future(t,i,type) Future expected production of woody biomass from commercial plantations (mio. tDM per yr) + oq32_establishment_demand(t,i,type) Future expected production of woody biomass from commercial plantations (mio. tDM per yr) + oq32_establishment_hvarea(t,j,type) Establishment in current time step for future demand (mio. ha) oq32_establishment_fixed(t,j,type) Establishment in current time step for future demand (mio. ha) oq32_land_expansion(t,j,type32,type) Land expansion (mio. ha) oq32_land_reduction(t,j,type32,ac,type) Land contraction (mio. ha) diff --git a/modules/32_forestry/dynamic_feb21/equations.gms b/modules/32_forestry/dynamic_may24/equations.gms similarity index 80% rename from modules/32_forestry/dynamic_feb21/equations.gms rename to modules/32_forestry/dynamic_may24/equations.gms index 259fdc7206..5143936da3 100644 --- a/modules/32_forestry/dynamic_feb21/equations.gms +++ b/modules/32_forestry/dynamic_may24/equations.gms @@ -24,7 +24,7 @@ q32_cost_total(i2) .. vm_cost_fore(i2) =e= v32_cost_recur(i2) + v32_cost_establishment(i2) + v32_cost_hvarea(i2) - + sum(cell(i2,j2), v32_land_missing(j2)) * s32_free_land_cost + + sum(cell(i2,j2), v32_land_missing(j2) + v32_land_missing_ndc(j2)) * s32_free_land_cost ; *----------------------------------------------- @@ -68,7 +68,7 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( *' The constraint `q32_aff_pol` accounts for the exogenous afforestation prescribed by NPI/NDC policies. q32_aff_pol(j2) .. - sum(ac_est, v32_land(j2,"ndc",ac_est)) =e= sum(ct, p32_aff_pol_timestep(ct,j2)); + sum(ac_est, v32_land(j2,"ndc",ac_est)) + v32_land_missing_ndc(j2) =e= sum(ct, p32_aff_pol_timestep(ct,j2)); *' The constraint `q32_max_aff` accounts for the allowed maximum global endogenous *' afforestation defined in `i32_max_aff_area_glo`. @@ -141,11 +141,12 @@ q32_bv_plant(j2,potnatveg) .. vm_bv(j2,"plant",potnatveg) *' investment over time. q32_cost_establishment(i2).. - v32_cost_establishment(i2) - =e= - (sum((cell(i2,j2),type32,ac_est), v32_land(j2,type32,ac_est) * s32_reESTBcost) - ) - * sum(ct,pm_interest(ct,i2)/(1+pm_interest(ct,i2))); + v32_cost_establishment(i2) + =e= + (sum((cell(i2,j2),type32,ac_est), v32_land(j2,type32,ac_est) * s32_reESTBcost)) + * sum(ct,pm_interest(ct,i2)/(1+pm_interest(ct,i2))) + + sum((ct,kforestry), v32_prod_forestry_future(i2) * p32_forestry_product_dist(ct,i2,kforestry) * im_timber_prod_cost(kforestry)) + / ((1+sum(ct,pm_interest(ct,i2))**sum(ct, pm_representative_rotation(ct,i2)*5))); *' Recurring costs are paid for plantations where the trees have to be regularly monitored @@ -159,33 +160,39 @@ q32_cost_recur(i2) .. v32_cost_recur(i2) =e= **** New establishment decision *------------------------------ -*' New plantations are already established in the optimization step based on a certain -*' percentage (`p32_plantation_contribution`) of current demand (`pm_demand_forestry_future`). -*' Its called `pm_demand_forestry_future` because the model also has a foresight switch which -*' give the model an ability to account for future changes in demand. By default `pm_demand_forestry_future` -*' is set to existing roundwood demand. As plantation establishment decisions should +*' New plantations are established in the optimization step based on a certain +*' percentage (`p32_plant_contr`) of expected future demand (`pm_demand_forestry_future`). +*' As plantation establishment decisions should *' also know some indication of expected future yields, we calculate how much yield *' newly established plantation can realize based on rotation lengths. This is defined as -*' the expected future yield (`pc32_yield_forestry_future`) at harvest (year in time -*' step are accounted for). +*' the expected future yield (`pc32_yield_forestry_future`) at harvest. -*' Area constraint for plantation establishment based on expected average regional timber yield at rotation age -*' (`pc32_yield_forestry_future_reg`) to ovoid overspecialization of plantation establishment towards highly productive cells. +*' Future expected production is calculated for the establishment decision below and the costs above +*' based on newly established areas and expected future yields. -q32_establishment_dynamic(i2)$s32_establishment_dynamic .. - sum(cell(i2,j2), ((sum(ac_est, v32_land(j2,"plant",ac_est)) + v32_land_missing(j2)) / m_timestep_length_forestry) * pc32_yield_forestry_future_reg(i2)) +q32_prod_forestry_future(i2) .. + v32_prod_forestry_future(i2) =e= - sum((ct,kforestry), pm_demand_forestry_future(i2,kforestry) * min(s32_max_self_suff, sum(supreg(h2,i2),pm_selfsuff_ext(ct,h2,kforestry))) * p32_plantation_contribution(ct,i2) * f32_estb_calib(i2)) + sum(cell(i2,j2), (sum(ac_est, v32_land(j2,"plant",ac_est)) + v32_land_missing(j2)) * pc32_yield_forestry_future(j2)) / m_timestep_length_forestry ; -*' Constraint to maintain the average regional timber yield at rotation age, accounting for the cellular timber yield (`pc32_yield_forestry_future`). +*' Future expected production has to be equal or larger than future demand multiplied with the plantation contribution factor. -q32_establishment_dynamic_yield(i2)$s32_establishment_dynamic .. - sum(cell(i2,j2), (sum(ac_est, v32_land(j2,"plant",ac_est))+v32_land_missing(j2)) * pc32_yield_forestry_future(j2)) - =e= - pc32_yield_forestry_future_reg(i2) * (sum(cell(i2,j2), sum(ac_est, v32_land(j2,"plant",ac_est))+v32_land_missing(j2))); +q32_establishment_demand(i2)$s32_establishment_dynamic .. + v32_prod_forestry_future(i2) + =g= + sum((ct,kforestry), pm_demand_forestry_future(ct,i2,kforestry)) * sum(ct, p32_plant_contr(ct,i2)) + ; + +*' Harvested areas are fully re-established at cell level, unless the ratio of future and current demand drops below 1. + +q32_establishment_hvarea(j2)$s32_establishment_dynamic .. + sum(ac_est, v32_land(j2,"plant",ac_est)) + =g= + sum(ac_sub, v32_hvarea_forestry(j2,ac_sub)) * sum(cell(i2,j2), min(1, sum(ct, p32_future_to_current_demand_ratio(ct,i2)))) + ; -*' If plantations have to be static (defined by `s32_establishment_static`) then +*' If plantations should be static (defined by `s32_establishment_static`) then *' the model simply establishes the amount of plantations which are harvested. *' this keeps the plantation area static but accounts for age-class changes and *' regrowth during every time step. @@ -205,7 +212,7 @@ v32_land(j2,type32,ac_est) =e= sum(ac_est2, v32_land(j2,type32,ac_est2))/card(ac q32_hvarea_forestry(j2,ac_sub) .. v32_hvarea_forestry(j2,ac_sub) - =l= + =e= v32_land_reduction(j2,"plant",ac_sub); ** Timber plantation diff --git a/modules/32_forestry/dynamic_feb21/input.gms b/modules/32_forestry/dynamic_may24/input.gms similarity index 84% rename from modules/32_forestry/dynamic_feb21/input.gms rename to modules/32_forestry/dynamic_may24/input.gms index 961bb68cb5..d072426e61 100644 --- a/modules/32_forestry/dynamic_feb21/input.gms +++ b/modules/32_forestry/dynamic_may24/input.gms @@ -29,16 +29,16 @@ $setglobal c32_shock_scenario none scalars - s32_hvarea Flag for harvested area and establishemt (0=zero 1=exognous 2=endogneous) / 0 / + s32_hvarea Flag for harvested area and establishemt (0=zero 1=exognous 2=endogneous) / 2 / s32_reESTBcost Re establishment cost (USD per ha) / 2000 / s32_recurring_cost Recurring costs (USD per ha) / 500 / s32_harvesting_cost Harvesting cost (USD per ha) / 1000 / s32_planing_horizon Afforestation planing horizon (years) / 50 / s32_rotation_extension Rotation extension factor 1=original rotations 2=100 percent increase in rotations etc (1) / 1 / s32_faustmann_rotation Switch to activate faustmann rotations (1=on 0=off) / 0 / - s32_initial_distribution Switch to Activate ageclass distribution in plantations 0=off 1=equal distribution 2=FAO distribution 3=Poulter distribution 4=Manual distribution (1) / 0 / + s32_initial_distribution Switch to Activate ageclass distribution in plantations 1=equal distribution (1) / 1 / s32_price Price for timber (USD) / 45 / - s32_free_land_cost Very high cost for using non existing land for plantation establishment (USD per ha) /1000000/ + s32_free_land_cost Penalty for technial area balance term (USD per ha) / 1e+06 / s32_max_aff_area Maximum total global afforestation (mio. ha) / Inf / s32_aff_plantation Switch for using growth curves for afforestation 0=natveg 1=plantations (1) / 0 / s32_tcre_local Switch for local (1) or global (0) TRCE factors (1) / 1 / @@ -47,6 +47,11 @@ scalars s32_aff_bii_coeff BII coefficent to be used for CO2 price driven afforestation 0=natural vegetation 1=plantation (1) / 0 / s32_max_aff_area_glo Switch for global or regional afforestation constraint (1) / 1 / s32_aff_prot Switch for protection of afforested areas (0=until end of planning horizon 1=forever) / 1 / + s32_plant_contr_growth_startyear Start year for plantation contribution growth fader (year) / 2020 / + s32_plant_contr_growth_endyear End year for plantation contribution growth fader (year) / 2050 / + s32_plant_contr_growth_startvalue Start value for plantation contribution growth fader (percent per year) / 0.05 / + s32_plant_contr_growth_endvalue End value for plantation contribution growth fader (percent per year) / 0 / + s32_plant_contr_max Maximum plantation contribution for establishment decision (percent) / 0.5 / ; parameter f32_aff_mask(j) afforestation mask (binary) @@ -73,14 +78,6 @@ $include "./modules/32_forestry/input/npi_ndc_aff_pol.cs3" $offdelim ; -parameter f32_plant_prod_share(t_all) Share of overall production coming from plantations (1) -/ -$ondelim -$include "./modules/32_forestry/input/f32_plant_prod_share.csv" -$offdelim -/ -; - table f32_aff_bgp(j,bgp32) Biogeophysical temperature change of afforestation (degree C) $ondelim $include "./modules/32_forestry/input/f32_bph_effect_noTCRE.cs3" @@ -107,12 +104,6 @@ $include "./modules/32_forestry/input/f32_gs_relativetarget.cs4" $offdelim /; -table f32_plantation_contribution(t_ext,i,inter32,scen32) Share of roundwood production coming from timber plantations (percent) -$ondelim -$include "./modules/32_forestry/input/f32_plantation_contribution.cs3" -$ondelim -; - parameter f32_plantedforest(i) Share of plantation forest in planted forest (1) / $ondelim @@ -120,13 +111,6 @@ $include "./modules/32_forestry/input/f32_plantedforest.cs4" $offdelim /; -parameter f32_estb_calib(i) Calibration factor for plantation forest establishment (1) -/ -$ondelim -$include "./modules/32_forestry/input/f32_estb_calib.cs4" -$offdelim -/; - table f32_forest_shock(t_all, shock_scen32) Forest carbon shock scenarios (area share affected per year) $ondelim $include "./modules/32_forestry/input/f32_forest_shock.csv" diff --git a/modules/32_forestry/dynamic_feb21/postsolve.gms b/modules/32_forestry/dynamic_may24/postsolve.gms similarity index 89% rename from modules/32_forestry/dynamic_feb21/postsolve.gms rename to modules/32_forestry/dynamic_may24/postsolve.gms index 69a4b4e0de..1ec319b88b 100644 --- a/modules/32_forestry/dynamic_feb21/postsolve.gms +++ b/modules/32_forestry/dynamic_may24/postsolve.gms @@ -14,6 +14,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_hvarea(t,i,"marginal") = v32_cost_hvarea.m(i); ov32_land(t,j,type32,ac,"marginal") = v32_land.m(j,type32,ac); ov32_land_missing(t,j,"marginal") = v32_land_missing.m(j); + ov32_land_missing_ndc(t,j,"marginal") = v32_land_missing_ndc.m(j); ov_landdiff_forestry(t,"marginal") = vm_landdiff_forestry.m; ov32_cost_recur(t,i,"marginal") = v32_cost_recur.m(i); ov32_land_expansion(t,j,type32,"marginal") = v32_land_expansion.m(j,type32); @@ -24,6 +25,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov_landexpansion_forestry(t,j,type32,"marginal") = vm_landexpansion_forestry.m(j,type32); ov_landreduction_forestry(t,j,type32,"marginal") = vm_landreduction_forestry.m(j,type32); ov_land_forestry(t,j,type32,"marginal") = vm_land_forestry.m(j,type32); + ov32_prod_forestry_future(t,i,"marginal") = v32_prod_forestry_future.m(i); ov_cdr_aff(t,j,ac,aff_effect,"marginal") = vm_cdr_aff.m(j,ac,aff_effect); oq32_cost_total(t,i,"marginal") = q32_cost_total.m(i); oq32_land(t,j,"marginal") = q32_land.m(j); @@ -37,8 +39,9 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_aff_est(t,j,"marginal") = q32_aff_est.m(j); oq32_hvarea_forestry(t,j,ac,"marginal") = q32_hvarea_forestry.m(j,ac); oq32_cost_recur(t,i,"marginal") = q32_cost_recur.m(i); - oq32_establishment_dynamic(t,i,"marginal") = q32_establishment_dynamic.m(i); - oq32_establishment_dynamic_yield(t,i,"marginal") = q32_establishment_dynamic_yield.m(i); + oq32_prod_forestry_future(t,i,"marginal") = q32_prod_forestry_future.m(i); + oq32_establishment_demand(t,i,"marginal") = q32_establishment_demand.m(i); + oq32_establishment_hvarea(t,j,"marginal") = q32_establishment_hvarea.m(j); oq32_establishment_fixed(t,j,"marginal") = q32_establishment_fixed.m(j); oq32_land_expansion(t,j,type32,"marginal") = q32_land_expansion.m(j,type32); oq32_land_reduction(t,j,type32,ac,"marginal") = q32_land_reduction.m(j,type32,ac); @@ -56,6 +59,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_hvarea(t,i,"level") = v32_cost_hvarea.l(i); ov32_land(t,j,type32,ac,"level") = v32_land.l(j,type32,ac); ov32_land_missing(t,j,"level") = v32_land_missing.l(j); + ov32_land_missing_ndc(t,j,"level") = v32_land_missing_ndc.l(j); ov_landdiff_forestry(t,"level") = vm_landdiff_forestry.l; ov32_cost_recur(t,i,"level") = v32_cost_recur.l(i); ov32_land_expansion(t,j,type32,"level") = v32_land_expansion.l(j,type32); @@ -66,6 +70,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov_landexpansion_forestry(t,j,type32,"level") = vm_landexpansion_forestry.l(j,type32); ov_landreduction_forestry(t,j,type32,"level") = vm_landreduction_forestry.l(j,type32); ov_land_forestry(t,j,type32,"level") = vm_land_forestry.l(j,type32); + ov32_prod_forestry_future(t,i,"level") = v32_prod_forestry_future.l(i); ov_cdr_aff(t,j,ac,aff_effect,"level") = vm_cdr_aff.l(j,ac,aff_effect); oq32_cost_total(t,i,"level") = q32_cost_total.l(i); oq32_land(t,j,"level") = q32_land.l(j); @@ -79,8 +84,9 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_aff_est(t,j,"level") = q32_aff_est.l(j); oq32_hvarea_forestry(t,j,ac,"level") = q32_hvarea_forestry.l(j,ac); oq32_cost_recur(t,i,"level") = q32_cost_recur.l(i); - oq32_establishment_dynamic(t,i,"level") = q32_establishment_dynamic.l(i); - oq32_establishment_dynamic_yield(t,i,"level") = q32_establishment_dynamic_yield.l(i); + oq32_prod_forestry_future(t,i,"level") = q32_prod_forestry_future.l(i); + oq32_establishment_demand(t,i,"level") = q32_establishment_demand.l(i); + oq32_establishment_hvarea(t,j,"level") = q32_establishment_hvarea.l(j); oq32_establishment_fixed(t,j,"level") = q32_establishment_fixed.l(j); oq32_land_expansion(t,j,type32,"level") = q32_land_expansion.l(j,type32); oq32_land_reduction(t,j,type32,ac,"level") = q32_land_reduction.l(j,type32,ac); @@ -98,6 +104,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_hvarea(t,i,"upper") = v32_cost_hvarea.up(i); ov32_land(t,j,type32,ac,"upper") = v32_land.up(j,type32,ac); ov32_land_missing(t,j,"upper") = v32_land_missing.up(j); + ov32_land_missing_ndc(t,j,"upper") = v32_land_missing_ndc.up(j); ov_landdiff_forestry(t,"upper") = vm_landdiff_forestry.up; ov32_cost_recur(t,i,"upper") = v32_cost_recur.up(i); ov32_land_expansion(t,j,type32,"upper") = v32_land_expansion.up(j,type32); @@ -108,6 +115,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov_landexpansion_forestry(t,j,type32,"upper") = vm_landexpansion_forestry.up(j,type32); ov_landreduction_forestry(t,j,type32,"upper") = vm_landreduction_forestry.up(j,type32); ov_land_forestry(t,j,type32,"upper") = vm_land_forestry.up(j,type32); + ov32_prod_forestry_future(t,i,"upper") = v32_prod_forestry_future.up(i); ov_cdr_aff(t,j,ac,aff_effect,"upper") = vm_cdr_aff.up(j,ac,aff_effect); oq32_cost_total(t,i,"upper") = q32_cost_total.up(i); oq32_land(t,j,"upper") = q32_land.up(j); @@ -121,8 +129,9 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_aff_est(t,j,"upper") = q32_aff_est.up(j); oq32_hvarea_forestry(t,j,ac,"upper") = q32_hvarea_forestry.up(j,ac); oq32_cost_recur(t,i,"upper") = q32_cost_recur.up(i); - oq32_establishment_dynamic(t,i,"upper") = q32_establishment_dynamic.up(i); - oq32_establishment_dynamic_yield(t,i,"upper") = q32_establishment_dynamic_yield.up(i); + oq32_prod_forestry_future(t,i,"upper") = q32_prod_forestry_future.up(i); + oq32_establishment_demand(t,i,"upper") = q32_establishment_demand.up(i); + oq32_establishment_hvarea(t,j,"upper") = q32_establishment_hvarea.up(j); oq32_establishment_fixed(t,j,"upper") = q32_establishment_fixed.up(j); oq32_land_expansion(t,j,type32,"upper") = q32_land_expansion.up(j,type32); oq32_land_reduction(t,j,type32,ac,"upper") = q32_land_reduction.up(j,type32,ac); @@ -140,6 +149,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_hvarea(t,i,"lower") = v32_cost_hvarea.lo(i); ov32_land(t,j,type32,ac,"lower") = v32_land.lo(j,type32,ac); ov32_land_missing(t,j,"lower") = v32_land_missing.lo(j); + ov32_land_missing_ndc(t,j,"lower") = v32_land_missing_ndc.lo(j); ov_landdiff_forestry(t,"lower") = vm_landdiff_forestry.lo; ov32_cost_recur(t,i,"lower") = v32_cost_recur.lo(i); ov32_land_expansion(t,j,type32,"lower") = v32_land_expansion.lo(j,type32); @@ -150,6 +160,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov_landexpansion_forestry(t,j,type32,"lower") = vm_landexpansion_forestry.lo(j,type32); ov_landreduction_forestry(t,j,type32,"lower") = vm_landreduction_forestry.lo(j,type32); ov_land_forestry(t,j,type32,"lower") = vm_land_forestry.lo(j,type32); + ov32_prod_forestry_future(t,i,"lower") = v32_prod_forestry_future.lo(i); ov_cdr_aff(t,j,ac,aff_effect,"lower") = vm_cdr_aff.lo(j,ac,aff_effect); oq32_cost_total(t,i,"lower") = q32_cost_total.lo(i); oq32_land(t,j,"lower") = q32_land.lo(j); @@ -163,8 +174,9 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_aff_est(t,j,"lower") = q32_aff_est.lo(j); oq32_hvarea_forestry(t,j,ac,"lower") = q32_hvarea_forestry.lo(j,ac); oq32_cost_recur(t,i,"lower") = q32_cost_recur.lo(i); - oq32_establishment_dynamic(t,i,"lower") = q32_establishment_dynamic.lo(i); - oq32_establishment_dynamic_yield(t,i,"lower") = q32_establishment_dynamic_yield.lo(i); + oq32_prod_forestry_future(t,i,"lower") = q32_prod_forestry_future.lo(i); + oq32_establishment_demand(t,i,"lower") = q32_establishment_demand.lo(i); + oq32_establishment_hvarea(t,j,"lower") = q32_establishment_hvarea.lo(j); oq32_establishment_fixed(t,j,"lower") = q32_establishment_fixed.lo(j); oq32_land_expansion(t,j,type32,"lower") = q32_land_expansion.lo(j,type32); oq32_land_reduction(t,j,type32,ac,"lower") = q32_land_reduction.lo(j,type32,ac); diff --git a/modules/32_forestry/dynamic_feb21/preloop.gms b/modules/32_forestry/dynamic_may24/preloop.gms similarity index 62% rename from modules/32_forestry/dynamic_feb21/preloop.gms rename to modules/32_forestry/dynamic_may24/preloop.gms index fae349543f..4d4ede2052 100644 --- a/modules/32_forestry/dynamic_feb21/preloop.gms +++ b/modules/32_forestry/dynamic_may24/preloop.gms @@ -4,6 +4,10 @@ *** | AGPL-3.0, you are granted additional permissions described in the *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de + +*m_sigmoid_time_interpol(i32_plant_contr_fader,2020,2050,0.05,0); +m_sigmoid_time_interpol(i32_plant_contr_growth_fader,s32_plant_contr_growth_startyear,s32_plant_contr_growth_endyear,s32_plant_contr_growth_startvalue,s32_plant_contr_growth_endvalue); + ** Calculation of Single rotation model rotation lengths ** Using forestry carbon densitiy here via carbon density data exchange from carbon module. p32_carbon_density_ac_forestry(t_all,j,ac) = pm_carbon_density_ac_forestry(t_all,j,ac,"vegc"); @@ -96,7 +100,8 @@ p32_ncells(i) = sum(cell(i,j),1); **** Representative regional rotation loop(t_all, p32_rotation_regional(t_all,i) = ceil(sum(cell(i,j), p32_rot_length_ac_eqivalent(t_all,j))/p32_ncells(i)); - pm_representative_rotation(t_all,i) = ord(t_all) + ceil(sum(cell(i,j),p32_rot_length_ac_eqivalent(t_all,j))/p32_ncells(i)); +* pm_representative_rotation(t_all,i) = ord(t_all) + ceil(sum(cell(i,j),p32_rot_length_ac_eqivalent(t_all,j))/p32_ncells(i)); + pm_representative_rotation(t_all,i) = ceil(sum(cell(i,j),p32_rot_length_ac_eqivalent(t_all,j))/p32_ncells(i)); ); ** Earlier we converted rotation lengths to absolute numbers, now we make the Conversion @@ -141,73 +146,14 @@ ini32(j,ac) = no; ini32(j,ac) = yes$(ord(ac) >= 1 AND ac.off < p32_rotation_cellular_harvesting("y1995",j)); ** divide initial forestry area by number of age classes within ini32 -if(s32_initial_distribution = 0, -** Initialize with highest age class - p32_land_start_ac(j,"plant","acx") = pcm_land(j,"forestry") * sum(cell(i,j),f32_plantedforest(i)); - p32_land_start_ac(j,"ndc","acx") = pcm_land(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i)); - -elseif s32_initial_distribution = 1, +if(s32_initial_distribution = 1, ** Initialize with equal distribution among rotation age classes ** Plantated forest area is divided into ndcs (other planted forest) and plantations p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = p32_plant_ini_ac(j); p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1- f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - -elseif s32_initial_distribution = 2, -** Initialize with distribution based on FAO data (but this distribution is applied to all cells globally) -** Plantated forest area is divided into ndcs (other planted forest) and plantations - p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i)); - p32_land_start_ac(j,"plant",ac) = p32_plant_ini_ac(j) * f32_ac_dist(ac); - p32_land_start_ac(j,"ndc",ac) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i)) * f32_ac_dist(ac); - -elseif s32_initial_distribution = 3, -** Initialize with Poulter distribution among rotation age classes -** Plantated forest area is divided into ndcs (other planted forest) and plantations - p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i)); - p32_rotation_dist(j,ac) = (im_plantedclass_ac(j,ac)$(ini32(j,ac))/sum(ac2,im_plantedclass_ac(j,ac2)$(ini32(j,ac2))))$(sum(ac2,im_plantedclass_ac(j,ac2)$(ini32(j,ac2)))); - p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = p32_plant_ini_ac(j) * p32_rotation_dist(j,ac); - p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i)) * p32_rotation_dist(j,ac); - -*use residual approach to avoid distributional errors i.e., poulter set with no plantations but luh reporting plantations in a cell - loop (j, - if(sum(ac,p32_land_start_ac(j,"plant",ac)$(ini32(j,ac))) = 0, - p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - ); - ); - -elseif s32_initial_distribution = 4, -** Initialize with Manual distribution among rotation age classes -** Plantated forest area is divided into ndcs (other planted forest) and plantations - loop(j, -** Set all acs to 0 - p32_ac_dist_flag(j,ac) = 0; -** Calculate reverse of age-classes, if rotation is 11acs, then ac0 should get a value of 11, 11th ac should get value of 1 - p32_ac_dist_flag(j,ac) = (10*p32_rotation_cellular_harvesting("y1995",j)-((ord(ac)-1))*5)$(ord(ac) <= p32_rotation_cellular_harvesting("y1995",j)); -** Calculate the weights, youngest age-class will have highest weight - p32_ac_dist(j,ac) = (p32_ac_dist_flag(j,ac) / (sum(ac2,p32_ac_dist_flag(j,ac2)) + ord(ac)))$(ord(ac) <= p32_rotation_cellular_harvesting("y1995",j)); -** there can be isntances where this distribution is not summing up to 1, in that case we take the excess and remove it evenly from all age-classes -** In case the sum of distribution is > 1 : Remove the excess from ac0 - p32_ac_dist(j,"ac0")$(sum(ac2, p32_ac_dist(j,ac2))>1) = p32_ac_dist(j,"ac0") - (sum(ac2, p32_ac_dist(j,ac2))-1); -** In case the sum of distribution is < 1 : Add the shortage to ac0 - p32_ac_dist(j,"ac0")$(sum(ac2, p32_ac_dist(j,ac2))<1) = p32_ac_dist(j,"ac0") + (1-sum(ac2, p32_ac_dist(j,ac2))); - ); -** Isolate plantations from planted forest (forestry) - p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i)); -** Divide plantations according to distribution - p32_land_start_ac(j,"plant",ac) = p32_plant_ini_ac(j) * p32_ac_dist(j,ac); -** Divide NDCs according to same distribution - p32_land_start_ac(j,"ndc",ac) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i)) * p32_ac_dist(j,ac); - -*use residual approach to avoid distributional errors i.e., poulter set with no plantations but luh reporting plantations in a cell - loop (j, - if(sum(ac,p32_land_start_ac(j,"plant",ac)$(ini32(j,ac))) = 0, - p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - ); - ); - ); + ** Redistribute to youngest age class in case the distribution to plantations and ** ndcs does not match fully with LUH initialized data loop(j, @@ -252,43 +198,10 @@ if(s32_tcre_local = 1, p32_aff_bgp(j,ac_bph) = f32_aff_bgp(j,"%c32_aff_bgp%")/f32_tcre(j,"%c32_tcre_ctrl%")/card(ac_bph); else *m_weightedmean returns a global value, which is then used assigned to all j. We use land area as weight. - p32_tcre_glo(j2) = m_weightedmean(f32_tcre(j,"%c32_tcre_ctrl%"),sum(land, pcm_land(j,land)),j) - p32_aff_bgp(j,ac_bph) = f32_aff_bgp(j,"%c32_aff_bgp%")/p32_tcre_glo(j)/card(ac_bph) + p32_tcre_glo(j2) = m_weightedmean(f32_tcre(j,"%c32_tcre_ctrl%"),sum(land, pcm_land(j,land)),j); + p32_aff_bgp(j,ac_bph) = f32_aff_bgp(j,"%c32_aff_bgp%")/p32_tcre_glo(j)/card(ac_bph); ); -** Calculate plantation contribution scaled to Growing stock in plantations -** Initialize with low values -p32_plantation_contribution(t_ext,i) = 0.001; -** Fill parameter with input file based on scenario settings -p32_plantation_contribution(t_ext,i)$(f32_gs_relativetarget(i)>0) = f32_plantation_contribution(t_ext,i,"%c32_dev_scen%","%c32_incr_rate%"); - -************************************************************************** -******************************************************************************* -** Calibrate plantations yields -******************************************************************************* -** Initialize with 1 m3 per ha - to avoid dvision by 0 -p32_observed_gs_reg(i) = 1; -** Wherever FAO reports >0 growing stock, we calculate how much growing stock MAGPIE -** sees even before optimization starts -p32_observed_gs_reg(i)$(f32_gs_relativetarget(i)>0 AND sum((cell(i,j),ac),p32_land_start_ac(j,"plant",ac))>0) = (sum((cell(i,j),ac),(pm_timber_yield_initial(j,ac,"forestry") / sm_wood_density) * p32_land_start_ac(j,"plant",ac))/ sum((cell(i,j),ac),p32_land_start_ac(j,"plant",ac))); - -** Initialze calibration factor for growing stocks as 1 -** we dont set it to 0 as we don't want to modify carbon densities by multiplication with 0 later -p32_gs_scaling_reg(i) = 1; -** Calculate the ratio between target growing stock (reported by FAO) and observed growing stock (value at initialization in MAgPIE) -p32_gs_scaling_reg(i)$(f32_gs_relativetarget(i)>0 AND f32_plantedforest(i)>0) = f32_gs_relativetarget(i) / p32_observed_gs_reg(i); -** Calibration factors lower than 1 are set to 1 -p32_gs_scaling_reg(i)$(p32_gs_scaling_reg(i) < 1) = 1; - -** Save pm_carbon_density_ac_forestry in a parameter before upscaling to FAO growing stocks. -** This allows to use plantation growth curves for CO2 price driven afforestation. -p32_c_density_ac_fast_forestry(t_all,j,ac) = pm_carbon_density_ac_forestry(t_all,j,ac,"vegc"); - -** Update c-density for timber plantations based on calibration factor to match FAO growing stocks -pm_carbon_density_ac_forestry(t_all,j,ac,"vegc") = pm_carbon_density_ac_forestry(t_all,j,ac,"vegc") * sum(cell(i,j),p32_gs_scaling_reg(i)); -** keep c-density for timber plantations constant after rotation length to avoid unrealistic carbon sequestration in unharvested timber plantations -pm_carbon_density_ac_forestry(t_all,j,ac,"vegc")$(ac.off >= p32_rotation_cellular_harvesting(t_all,j)) = sum(ac2$(ac2.off = p32_rotation_cellular_harvesting(t_all,j)), pm_carbon_density_ac_forestry(t_all,j,ac2,"vegc")); - ** set bii coefficients p32_bii_coeff(type32,bii_class_secd,potnatveg) = 0; if(s32_aff_bii_coeff = 0, diff --git a/modules/32_forestry/dynamic_feb21/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms similarity index 83% rename from modules/32_forestry/dynamic_feb21/presolve.gms rename to modules/32_forestry/dynamic_may24/presolve.gms index 819189ae54..354e033617 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -21,7 +21,7 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; p32_aff_pol_timestep("y1995",j) = 0; p32_aff_pol_timestep(t,j)$(ord(t)>1) = p32_aff_pol(t,j) - p32_aff_pol(t-1,j); * Suitable area (`p32_aff_pot`) for NPI/NDC afforestation - p32_aff_pot(t,j) = (vm_land.l(j,"crop") - vm_land.lo(j,"crop")) + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore"); + p32_aff_pot(t,j) = sum((kcr,w),vm_area.l(j,kcr,w) - vm_area.lo(j,kcr,w)) + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore"); * suitable area `p32_aff_pot` can be negative, if land restoration is switched on (level smaller than lower bound), therefore set negative values to 0 p32_aff_pot(t,j)$(p32_aff_pot(t,j) < 0) = 0; * Limit prescribed NPI/NDC afforestation in `p32_aff_pol_timestep` if not enough suitable area (`p32_aff_pot`) for afforestation is available @@ -36,7 +36,7 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; if(s32_aff_plantation = 0, p32_carbon_density_ac(t,j,"aff",ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); elseif s32_aff_plantation = 1, - p32_carbon_density_ac(t,j,"aff",ac,ag_pools) = p32_c_density_ac_fast_forestry(t,j,ac); + p32_carbon_density_ac(t,j,"aff",ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,"vegc"); ); *' Timber plantations carbon densities: @@ -82,10 +82,6 @@ p32_land(t,j,type32,"acx") = p32_land(t,j,type32,"acx") + sum(ac$(ord(ac) > card p32_land(t,j,type32,ac_est) = 0; *' @stop - - - - ** Calculate v32_land.l v32_land.l(j,type32,ac) = p32_land(t,j,type32,ac); pc32_land(j,type32,ac) = v32_land.l(j,type32,ac); @@ -123,7 +119,7 @@ elseif s32_hvarea = 2, ** The offset is needed because the first element of ac is ac0, which is not included in p32_rotation_cellular_harvesting. v32_land.fx(j,"plant",ac)$(ac.off < p32_rotation_cellular_harvesting(t,j)) = pc32_land(j,"plant",ac); ** After the rotation period, plantations are free for harvesting - v32_land.up(j,"plant",ac)$(ac.off >= p32_rotation_cellular_harvesting(t,j)) = pc32_land(j,"plant",ac); + v32_land.fx(j,"plant",ac)$(ac.off >= p32_rotation_cellular_harvesting(t,j)) = 0; s32_establishment_static = 0; s32_establishment_dynamic = 1; ); @@ -160,19 +156,25 @@ else *' No afforestation is allowed if carbon density <= 20 tc/ha v32_land.fx(j,"aff",ac_est)$(fm_carbon_density(t,j,"forestry","vegc") <= 20) = 0; -m_boundfix(v32_land,(j,type32,ac_sub),up,10e-5); +m_boundfix(v32_land,(j,type32,ac_sub),up,1e-6); ** Calculate future yield based on rotation length -if((ord(t)=1), -pc32_yield_forestry_future(j) = sum(ac$(ord(ac) = p32_rotation_cellular_estb(t,j)-1), pm_timber_yield(t,j,ac,"forestry")); -pc32_area_rotation(j) = sum(ac$(ord(ac) = p32_rotation_cellular_estb(t,j)-1), p32_land(t,j,"plant",ac)); +pc32_yield_forestry_future(j) = sum(ac$(ac.off = p32_rotation_cellular_estb(t,j)), pm_timber_yield(t,j,ac,"forestry")); + +* Fader for plantation share in establishment decision +if(ord(t) = 1, + pc32_prod_forestry_ini(i) = sum(cell(i,j), sum(ac$(ac.off = p32_rotation_cellular_harvesting(t,j)), pm_timber_yield(t,j,ac,"forestry") * p32_land(t,j,"plant",ac))) / m_timestep_length_forestry; + pc32_plant_contr_ini(i) = pc32_prod_forestry_ini(i) / sum(kforestry, pm_demand_ext(t,i,kforestry)); + p32_plant_contr(t,i) = pc32_plant_contr_ini(i); +else + p32_plant_contr(t,i) = p32_plant_contr(t-1,i) * (1+i32_plant_contr_growth_fader(t))**m_timestep_length_forestry; ); -pc32_yield_forestry_future_reg(i) = m_weightedmean(pc32_yield_forestry_future(j),pc32_area_rotation(j),(cell(i,j))); -pc32_yield_forestry_future_reg(i)$(pc32_yield_forestry_future_reg(i) = 0) = smax(cell(i,j),pc32_yield_forestry_future(j)); +p32_plant_contr(t,i)$(p32_plant_contr(t,i) > s32_plant_contr_max) = s32_plant_contr_max; + +p32_forestry_product_dist(t,i,kforestry)$(pm_demand_forestry_future(t,i,kforestry) > 0) = pm_demand_forestry_future(t,i,kforestry) / sum(kforestry2, pm_demand_forestry_future(t,i,kforestry2)); +p32_forestry_product_dist(t,i,kforestry)$(pm_demand_forestry_future(t,i,kforestry) = 0) = 1/card(kforestry); -** Display -p32_updated_gs_reg(t,i) = 1; -p32_updated_gs_reg(t,i)$(sum((cell(i,j),ac_sub),p32_land(t,j,"plant",ac_sub))>0) = (sum((cell(i,j),ac_sub),(pm_timber_yield(t,j,ac_sub,"forestry") / sm_wood_density) * p32_land(t,j,"plant",ac_sub))/ sum((cell(i,j),ac_sub),p32_land(t,j,"plant",ac_sub))); +p32_future_to_current_demand_ratio(t,i) = sum(kforestry, pm_demand_forestry_future(t,i,kforestry)) / sum(kforestry, pm_demand_ext(t,i,kforestry)); * Avoid conflict between afforestation for carbon uptake on land and secdforest restoration pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") > sum(ac, p32_land(t,j,"ndc",ac) + v32_land.lo(j,"plant",ac) + p32_land(t,j,"aff",ac))+ p32_aff_pol_timestep(t,j)) diff --git a/modules/32_forestry/dynamic_feb21/realization.gms b/modules/32_forestry/dynamic_may24/realization.gms similarity index 94% rename from modules/32_forestry/dynamic_feb21/realization.gms rename to modules/32_forestry/dynamic_may24/realization.gms index 6e839fd3e8..233c1f8ee4 100644 --- a/modules/32_forestry/dynamic_feb21/realization.gms +++ b/modules/32_forestry/dynamic_may24/realization.gms @@ -34,12 +34,12 @@ *' @limitations Rotation lengths for timber plantations are not endogenous. *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/32_forestry/dynamic_feb21/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/32_forestry/dynamic_feb21/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/32_forestry/dynamic_feb21/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/32_forestry/dynamic_feb21/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/32_forestry/dynamic_feb21/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/32_forestry/dynamic_feb21/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/32_forestry/dynamic_feb21/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/32_forestry/dynamic_feb21/postsolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/32_forestry/dynamic_may24/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/32_forestry/dynamic_may24/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/32_forestry/dynamic_may24/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/32_forestry/dynamic_may24/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/32_forestry/dynamic_may24/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/32_forestry/dynamic_may24/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/32_forestry/dynamic_may24/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/32_forestry/dynamic_may24/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/32_forestry/dynamic_feb21/scaling.gms b/modules/32_forestry/dynamic_may24/scaling.gms similarity index 100% rename from modules/32_forestry/dynamic_feb21/scaling.gms rename to modules/32_forestry/dynamic_may24/scaling.gms diff --git a/modules/32_forestry/dynamic_feb21/sets.gms b/modules/32_forestry/dynamic_may24/sets.gms similarity index 100% rename from modules/32_forestry/dynamic_feb21/sets.gms rename to modules/32_forestry/dynamic_may24/sets.gms diff --git a/modules/32_forestry/input/files b/modules/32_forestry/input/files index 97cfd1ed3d..64bb96e008 100644 --- a/modules/32_forestry/input/files +++ b/modules/32_forestry/input/files @@ -7,8 +7,5 @@ f32_plant_prod_share.csv f32_bph_effect_noTCRE.cs3 f32_localTCRE.cs3 f32_ac_dist.csv -f32_gs_relativetarget.cs4 -f32_plantation_contribution.cs3 f32_plantedforest.cs4 -f32_estb_calib.cs4 f32_forest_shock.csv diff --git a/modules/32_forestry/module.gms b/modules/32_forestry/module.gms index 61a7880e7b..54f13c6e06 100644 --- a/modules/32_forestry/module.gms +++ b/modules/32_forestry/module.gms @@ -22,5 +22,5 @@ *' @authors Florian Humpenöder, Abhijeet Mishra *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%forestry%" == "dynamic_feb21" $include "./modules/32_forestry/dynamic_feb21/realization.gms" +$Ifi "%forestry%" == "dynamic_may24" $include "./modules/32_forestry/dynamic_may24/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/73_timber/default/declarations.gms b/modules/73_timber/default/declarations.gms index fc431387df..9ad6a0ba9f 100644 --- a/modules/73_timber/default/declarations.gms +++ b/modules/73_timber/default/declarations.gms @@ -8,7 +8,7 @@ parameters p73_timber_demand_gdp_pop(t_all,i,kforestry) Timber demand based on lauri et al 2019 (mio. m3 per yr) p73_forestry_demand_prod_specific(t_all,iso,total_wood_products) End product specific timber demand (mio. m3 per yr) -pm_demand_forestry_future(i,kforestry) Future forestry demand in current time step (tDM per yr) +pm_demand_forestry_future(t,i,kforestry) Future forestry demand in current time step (tDM per yr) pm_demand_ext(t_ext,i,kforestry) Extended demand for timber beyound simulation (mio. tDM per yr) p73_demand_calib(t_all,i,kforestry) Additive calibration for timber demand (mio. m3 per yr) p73_glo_wood(t_all,kforestry) Global wood demand (mio. tDM per yr) @@ -16,6 +16,7 @@ p73_demand_modifier(t_all) Simp p73_fraction(t_all) Fraction over which construction wood demand is spread out (1) p73_demand_constr_wood(t_all,i) Demand for construction wood (mio. tDM per yr) p73_fraction_sm_fix Modifier fraction at sm_fix_SSP2 time step (1) +im_timber_prod_cost(kforestry) Cost for producing one unit of wood and woodfuel (USD per tDM) ; positive variables diff --git a/modules/73_timber/default/preloop.gms b/modules/73_timber/default/preloop.gms index 1d1af6183c..bdd76ca93d 100644 --- a/modules/73_timber/default/preloop.gms +++ b/modules/73_timber/default/preloop.gms @@ -90,3 +90,11 @@ pm_demand_ext(t_all,i,"wood") = pm_demand_ext(t_all,i,"wood") + p73_demand_const pm_demand_ext(t_all,i,kforestry)$(m_year(t_all)>2100) = pm_demand_ext("y2100",i,kforestry); ** Calculate global demand p73_glo_wood(t_all,kforestry) = sum(i,pm_demand_ext(t_all,i,kforestry)); + +vm_prod_forestry.l(j,"wood") = 0; +vm_prod.l(j,"wood") = 0; + +im_timber_prod_cost("wood") = s73_timber_prod_cost_wood; +im_timber_prod_cost("woodfuel") = s73_timber_prod_cost_woodfuel; + +pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry) * 1.2; diff --git a/modules/73_timber/default/presolve.gms b/modules/73_timber/default/presolve.gms index 0637bd7719..8c78d44eec 100644 --- a/modules/73_timber/default/presolve.gms +++ b/modules/73_timber/default/presolve.gms @@ -9,13 +9,12 @@ ** s73_foresight=1 forward looking (establishment based on future demand), ** s73_foresight=0 myopic (establishment based on current demand) -if(m_year(t) <= sm_fix_SSP2, -* pm_demand_forestry_future(i,kforestry) = pm_demand_ext("y2010",i,kforestry)*1.5; - pm_demand_forestry_future(i,kforestry) = pm_demand_ext(t,i,kforestry); +if(s73_foresight=1, + if(m_year(t) <= sm_fix_SSP2, + pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry) * 1.2; + else + pm_demand_forestry_future(t,i,kforestry) = sum(t_ext$(t_ext.pos = t.pos + pm_representative_rotation(t,i)),pm_demand_ext(t_ext,i,kforestry)); + ); else - if(s73_foresight=1, - pm_demand_forestry_future(i,kforestry) = sum(t_ext$(t_ext.pos = t.pos + pm_representative_rotation(t,i)),pm_demand_ext(t_ext,i,kforestry)); - else - pm_demand_forestry_future(i,kforestry) = pm_demand_ext(t,i,kforestry); + pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry); ); -); From 95c0f43a9646664990fcfa8b102dc684e0cf2da8 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 9 May 2024 18:15:07 +0200 Subject: [PATCH 122/280] reverting back faders --- modules/15_food/anthro_iso_jun22/sets.gms | 46 +++---------------- .../15_food/anthropometrics_jan18/sets.gms | 46 +++---------------- modules/70_livestock/fbask_jan16/sets.gms | 45 ++---------------- scripts/start_functions.R | 20 -------- 4 files changed, 17 insertions(+), 140 deletions(-) diff --git a/modules/15_food/anthro_iso_jun22/sets.gms b/modules/15_food/anthro_iso_jun22/sets.gms index 99b6b94959..269ae4f7ad 100644 --- a/modules/15_food/anthro_iso_jun22/sets.gms +++ b/modules/15_food/anthro_iso_jun22/sets.gms @@ -5,46 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*############################################################################### -*######################## R SECTION START (SETS) ############################### -* THIS CODE IS CREATED AUTOMATICALLY, DO NOT MODIFY THESE LINES DIRECTLY -* ANY DIRECT MODIFICATION WILL BE LOST AFTER NEXT AUTOMATIC UPDATE! - -sets - - fadeoutscen15 Food substitution scenarios including functional forms with targets and transition periods - / constant, - lin_zero_10_50, - lin_50pc_10_50_extend90, - lin_75pc_10_50_extend90, - lin_zero_20_50, - lin_zero_20_30, - lin_zero_20_70, - lin_50pc_20_50, - lin_50pc_20_50_extend65, - lin_50pc_20_50_extend80, - lin_80pc_20_50, - lin_80pc_20_50_extend95, - lin_90pc_20_50_extend95, - lin_99-98-90pc_20_50-60-100, - lin_zero_25_50, - lin_zero_25_30, - lin_zero_25_70, - lin_zero_25_75, - lin_50pc_25_50, - lin_50pc_25_50_extend65, - lin_50pc_25_50_extend75, - sigmoid_20pc_20_50, - sigmoid_50pc_20_50, - sigmoid_80pc_20_50, - sigmoid_25pc_25_50, - sigmoid_50pc_25_50, - sigmoid_75pc_25_50 / - -; -*######################### R SECTION END (SETS) ################################ -*############################################################################### - sets iter15 iterations between food demand model and magpie @@ -195,6 +155,12 @@ sets kfo_rd(kfo) Ruminant meat and dairy food products / livst_rum,livst_milk / + fadeoutscen15 Food substitution scenarios including functional forms with targets and transition periods + / constant, + lin_zero_10_50, lin_zero_20_50, lin_zero_20_30, lin_zero_20_70, lin_50pc_20_50, lin_50pc_20_50_extend65, lin_50pc_20_50_extend80, + lin_50pc_10_50_extend90, lin_75pc_10_50_extend90, lin_80pc_20_50, lin_80pc_20_50_extend95, lin_90pc_20_50_extend95, + lin_99-98-90pc_20_50-60-100, sigmoid_20pc_20_50, sigmoid_50pc_20_50, sigmoid_80pc_20_50 / + t_scen15(t_all) Target years for transition to exogenous scenario diets / y2010, y2030, y2050 / diff --git a/modules/15_food/anthropometrics_jan18/sets.gms b/modules/15_food/anthropometrics_jan18/sets.gms index 2bee821a5e..86a7bbe4a9 100644 --- a/modules/15_food/anthropometrics_jan18/sets.gms +++ b/modules/15_food/anthropometrics_jan18/sets.gms @@ -5,46 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*############################################################################### -*######################## R SECTION START (SETS) ############################### -* THIS CODE IS CREATED AUTOMATICALLY, DO NOT MODIFY THESE LINES DIRECTLY -* ANY DIRECT MODIFICATION WILL BE LOST AFTER NEXT AUTOMATIC UPDATE! - -sets - - fadeoutscen15 Food substitution scenarios including functional forms with targets and transition periods - / constant, - lin_zero_10_50, - lin_50pc_10_50_extend90, - lin_75pc_10_50_extend90, - lin_zero_20_50, - lin_zero_20_30, - lin_zero_20_70, - lin_50pc_20_50, - lin_50pc_20_50_extend65, - lin_50pc_20_50_extend80, - lin_80pc_20_50, - lin_80pc_20_50_extend95, - lin_90pc_20_50_extend95, - lin_99-98-90pc_20_50-60-100, - lin_zero_25_50, - lin_zero_25_30, - lin_zero_25_70, - lin_zero_25_75, - lin_50pc_25_50, - lin_50pc_25_50_extend65, - lin_50pc_25_50_extend75, - sigmoid_20pc_20_50, - sigmoid_50pc_20_50, - sigmoid_80pc_20_50, - sigmoid_25pc_25_50, - sigmoid_50pc_25_50, - sigmoid_75pc_25_50 / - -; -*######################### R SECTION END (SETS) ################################ -*############################################################################### - sets iter15 iterations between food demand model and magpie @@ -189,6 +149,12 @@ sets kfo_rd(kfo) Ruminant meat and dairy food products / livst_rum,livst_milk / + fadeoutscen15 Food substitution scenarios including functional forms with targets and transition periods + / constant, + lin_zero_10_50, lin_zero_20_50, lin_zero_20_30, lin_zero_20_70, lin_50pc_20_50, lin_50pc_20_50_extend65, lin_50pc_20_50_extend80, + lin_50pc_10_50_extend90, lin_75pc_10_50_extend90, lin_80pc_20_50, lin_80pc_20_50_extend95, lin_90pc_20_50_extend95, + lin_99-98-90pc_20_50-60-100, sigmoid_20pc_20_50, sigmoid_50pc_20_50, sigmoid_80pc_20_50 / + t_scen15(t_all) Target years for transition to exogenous scenario diets / y2010, y2030, y2050 / diff --git a/modules/70_livestock/fbask_jan16/sets.gms b/modules/70_livestock/fbask_jan16/sets.gms index 3c219ab94b..2382b598f7 100644 --- a/modules/70_livestock/fbask_jan16/sets.gms +++ b/modules/70_livestock/fbask_jan16/sets.gms @@ -5,46 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*############################################################################### -*######################## R SECTION START (SETS) ############################### -* THIS CODE IS CREATED AUTOMATICALLY, DO NOT MODIFY THESE LINES DIRECTLY -* ANY DIRECT MODIFICATION WILL BE LOST AFTER NEXT AUTOMATIC UPDATE! - -sets - - fadeoutscen70 Feed substitution scenarios including functional forms with targets and transition periods - / constant, - lin_zero_10_50, - lin_50pc_10_50_extend90, - lin_75pc_10_50_extend90, - lin_zero_20_50, - lin_zero_20_30, - lin_zero_20_70, - lin_50pc_20_50, - lin_50pc_20_50_extend65, - lin_50pc_20_50_extend80, - lin_80pc_20_50, - lin_80pc_20_50_extend95, - lin_90pc_20_50_extend95, - lin_99-98-90pc_20_50-60-100, - lin_zero_25_50, - lin_zero_25_30, - lin_zero_25_70, - lin_zero_25_75, - lin_50pc_25_50, - lin_50pc_25_50_extend65, - lin_50pc_25_50_extend75, - sigmoid_20pc_20_50, - sigmoid_50pc_20_50, - sigmoid_80pc_20_50, - sigmoid_25pc_25_50, - sigmoid_50pc_25_50, - sigmoid_75pc_25_50 / - -; -*######################### R SECTION END (SETS) ################################ -*############################################################################### - sets cost_regr Cost regression parameters @@ -78,4 +38,9 @@ sets kcer70(kall) Cereals / tece, maiz, trce, rice_pro / + fadeoutscen70 Feed substitution scenarios including functional forms with targets and transition periods + / constant, + lin_zero_10_50, lin_zero_20_50, lin_zero_20_30, lin_zero_20_70, lin_50pc_20_50, lin_50pc_20_50_extend65, lin_50pc_20_50_extend80, + lin_50pc_10_50_extend90, lin_75pc_10_50_extend90, lin_80pc_20_50, lin_80pc_20_50_extend95, lin_90pc_20_50_extend95, + lin_99-98-90pc_20_50-60-100, sigmoid_20pc_20_50, sigmoid_50pc_20_50, sigmoid_80pc_20_50 / ; diff --git a/scripts/start_functions.R b/scripts/start_functions.R index 871544aeab..4074b48c69 100644 --- a/scripts/start_functions.R +++ b/scripts/start_functions.R @@ -73,16 +73,6 @@ .update_sets_modules <- function() { require(gms) - ### 15_food - fadeoutscen15 <- magclass::read.magpie("modules/15_food/input/f15_food_substitution_fader.csv") - fadeoutscen15 <- magclass::getNames(fadeoutscen15,dim=1) - - sets <- list(list(name = "fadeoutscen15", - desc = "Food substitution scenarios including functional forms with targets and transition periods", - items = fadeoutscen15)) - - gms::writeSets(sets , "modules/15_food/anthropometrics_jan18/sets.gms") - gms::writeSets(sets , "modules/15_food/anthro_iso_jun22/sets.gms") ### 56_ghg_policy ghgscen56 <- magclass::read.magpie("modules/56_ghg_policy/input/f56_pollutant_prices.cs3") @@ -109,16 +99,6 @@ items = scen2nd60)) gms::writeSets(sets , "modules/60_bioenergy/1stgen_priced_dec18/sets.gms") - - ### 70_livestock - fadeoutscen70 <- magclass::read.magpie("modules/70_livestock/fbask_jan16/input/f70_feed_substitution_fader.csv") - fadeoutscen70 <- magclass::getNames(fadeoutscen70,dim=1) - - sets <- list(list(name = "fadeoutscen70", - desc = "Feed substitution scenarios including functional forms with targets and transition periods", - items = fadeoutscen70)) - - gms::writeSets(sets , "modules/70_livestock/fbask_jan16/sets.gms") } # Function to extract information from info.txt From 466cc4134a5b7d90083f7d1a3a44c5c23261b938 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 9 May 2024 18:22:52 +0200 Subject: [PATCH 123/280] bugfix --- modules/32_forestry/dynamic_may24/presolve.gms | 6 ++++-- modules/35_natveg/dynamic_feb21/input.gms | 2 +- modules/73_timber/default/input.gms | 2 +- modules/73_timber/default/preloop.gms | 4 +--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 354e033617..6e86299c3f 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -164,7 +164,8 @@ pc32_yield_forestry_future(j) = sum(ac$(ac.off = p32_rotation_cellular_estb(t,j) * Fader for plantation share in establishment decision if(ord(t) = 1, pc32_prod_forestry_ini(i) = sum(cell(i,j), sum(ac$(ac.off = p32_rotation_cellular_harvesting(t,j)), pm_timber_yield(t,j,ac,"forestry") * p32_land(t,j,"plant",ac))) / m_timestep_length_forestry; - pc32_plant_contr_ini(i) = pc32_prod_forestry_ini(i) / sum(kforestry, pm_demand_ext(t,i,kforestry)); + pc32_plant_contr_ini(i)$(sum(kforestry, pm_demand_ext(t,i,kforestry)) > 0) = pc32_prod_forestry_ini(i) / sum(kforestry, pm_demand_ext(t,i,kforestry)); + pc32_plant_contr_ini(i)$(sum(kforestry, pm_demand_ext(t,i,kforestry)) = 0) = 0; p32_plant_contr(t,i) = pc32_plant_contr_ini(i); else p32_plant_contr(t,i) = p32_plant_contr(t-1,i) * (1+i32_plant_contr_growth_fader(t))**m_timestep_length_forestry; @@ -174,7 +175,8 @@ p32_plant_contr(t,i)$(p32_plant_contr(t,i) > s32_plant_contr_max) = s32_plant_co p32_forestry_product_dist(t,i,kforestry)$(pm_demand_forestry_future(t,i,kforestry) > 0) = pm_demand_forestry_future(t,i,kforestry) / sum(kforestry2, pm_demand_forestry_future(t,i,kforestry2)); p32_forestry_product_dist(t,i,kforestry)$(pm_demand_forestry_future(t,i,kforestry) = 0) = 1/card(kforestry); -p32_future_to_current_demand_ratio(t,i) = sum(kforestry, pm_demand_forestry_future(t,i,kforestry)) / sum(kforestry, pm_demand_ext(t,i,kforestry)); +p32_future_to_current_demand_ratio(t,i)$(sum(kforestry, pm_demand_ext(t,i,kforestry)) > 0) = sum(kforestry, pm_demand_forestry_future(t,i,kforestry)) / sum(kforestry, pm_demand_ext(t,i,kforestry)); +p32_future_to_current_demand_ratio(t,i)$(sum(kforestry, pm_demand_ext(t,i,kforestry)) = 0) = 0; * Avoid conflict between afforestation for carbon uptake on land and secdforest restoration pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") > sum(ac, p32_land(t,j,"ndc",ac) + v32_land.lo(j,"plant",ac) + p32_land(t,j,"aff",ac))+ p32_aff_pol_timestep(t,j)) diff --git a/modules/35_natveg/dynamic_feb21/input.gms b/modules/35_natveg/dynamic_feb21/input.gms index 89828c827e..cfe1752b0c 100644 --- a/modules/35_natveg/dynamic_feb21/input.gms +++ b/modules/35_natveg/dynamic_feb21/input.gms @@ -10,7 +10,7 @@ $setglobal c35_aolc_policy npi $setglobal c35_shock_scenario none scalars -s35_hvarea Flag for harvested area (0=zero 1=exognous 2=endogneous) / 0 / +s35_hvarea Flag for harvested area (0=zero 1=exognous 2=endogneous) / 2 / s35_hvarea_secdforest annual secdforest harvest rate for s35_hvarea equals 1 (percent per year) / 0 / s35_hvarea_primforest annual primforest harvest rate for s35_hvarea equals 1 (percent per year) / 0 / s35_hvarea_other annual other land harvest rate for s35_hvarea equals 1 (percent per year) / 0 / diff --git a/modules/73_timber/default/input.gms b/modules/73_timber/default/input.gms index c046fdfa64..797d4bbbba 100644 --- a/modules/73_timber/default/input.gms +++ b/modules/73_timber/default/input.gms @@ -19,7 +19,7 @@ scalars s73_timber_prod_cost_woodfuel Cost for prodcing one unit of woodfuel (USD per tDM) / 60 / s73_free_prod_cost Very high cost for settling demand without production (USD per tDM) /20000/ s73_timber_demand_switch Logical switch to turn on or off timber demand 1=on 0=off (1) / 0 / - s73_foresight Boolean switch for establishment demand assumption 1=forward looking 0=myopic (1) / 0 / + s73_foresight Boolean switch for establishment demand assumption 1=forward looking 0=myopic (1) / 1 / s73_increase_ceiling Limiter for not allowing a demand jump between time steps beyond a certain limit (1) /1.025/ s73_residue_ratio Proportion of overall industrial roundwood production which ends up as residue during harvest (1) / 0.15/ sm_wood_density Representative wood density based on IPCC (tDM per m3) /0.6/ diff --git a/modules/73_timber/default/preloop.gms b/modules/73_timber/default/preloop.gms index bdd76ca93d..f871c7cede 100644 --- a/modules/73_timber/default/preloop.gms +++ b/modules/73_timber/default/preloop.gms @@ -91,10 +91,8 @@ pm_demand_ext(t_all,i,kforestry)$(m_year(t_all)>2100) = pm_demand_ext("y2100",i, ** Calculate global demand p73_glo_wood(t_all,kforestry) = sum(i,pm_demand_ext(t_all,i,kforestry)); -vm_prod_forestry.l(j,"wood") = 0; -vm_prod.l(j,"wood") = 0; - im_timber_prod_cost("wood") = s73_timber_prod_cost_wood; im_timber_prod_cost("woodfuel") = s73_timber_prod_cost_woodfuel; +* initialize values for presolve of other modules pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry) * 1.2; From 893cbfdd6f3854aa011996cd5b70116c9c3f30db Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 9 May 2024 20:10:05 +0200 Subject: [PATCH 124/280] bugfix --- config/default.cfg | 2 +- modules/15_food/anthro_iso_jun22/sets.gms | 2 +- modules/15_food/anthropometrics_jan18/sets.gms | 2 +- modules/30_croparea/detail_apr24/input.gms | 2 +- modules/30_croparea/simple_apr24/input.gms | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 1062936334..4ee81e75b5 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -772,7 +772,7 @@ cfg$gms$s30_betr_scenario_start <- 2020 # def = 2020 # * Target year (year when full implementation is reached): cfg$gms$s30_betr_scenario_target <- 2050 # def = 2050 # * Penalty for violation of fallow target (USD05MER per ha) -cfg$gms$s30_betr_penalty <- 500 # def = 500 +cfg$gms$s30_betr_penalty <- 2000 # def = 2000 # *** Options only available for `simple_apr24` realization *** diff --git a/modules/15_food/anthro_iso_jun22/sets.gms b/modules/15_food/anthro_iso_jun22/sets.gms index 269ae4f7ad..18aa119f71 100644 --- a/modules/15_food/anthro_iso_jun22/sets.gms +++ b/modules/15_food/anthro_iso_jun22/sets.gms @@ -159,7 +159,7 @@ sets / constant, lin_zero_10_50, lin_zero_20_50, lin_zero_20_30, lin_zero_20_70, lin_50pc_20_50, lin_50pc_20_50_extend65, lin_50pc_20_50_extend80, lin_50pc_10_50_extend90, lin_75pc_10_50_extend90, lin_80pc_20_50, lin_80pc_20_50_extend95, lin_90pc_20_50_extend95, - lin_99-98-90pc_20_50-60-100, sigmoid_20pc_20_50, sigmoid_50pc_20_50, sigmoid_80pc_20_50 / + lin_99-98-90pc_20_50-60-100, sigmoid_20pc_20_50, sigmoid_50pc_20_50, sigmoid_80pc_20_50, sigmoid_75pc_25_50, sigmoid_50pc_25_50, sigmoid_25pc_25_50 / t_scen15(t_all) Target years for transition to exogenous scenario diets / y2010, y2030, y2050 / diff --git a/modules/15_food/anthropometrics_jan18/sets.gms b/modules/15_food/anthropometrics_jan18/sets.gms index 86a7bbe4a9..cb2b471dcd 100644 --- a/modules/15_food/anthropometrics_jan18/sets.gms +++ b/modules/15_food/anthropometrics_jan18/sets.gms @@ -153,7 +153,7 @@ sets / constant, lin_zero_10_50, lin_zero_20_50, lin_zero_20_30, lin_zero_20_70, lin_50pc_20_50, lin_50pc_20_50_extend65, lin_50pc_20_50_extend80, lin_50pc_10_50_extend90, lin_75pc_10_50_extend90, lin_80pc_20_50, lin_80pc_20_50_extend95, lin_90pc_20_50_extend95, - lin_99-98-90pc_20_50-60-100, sigmoid_20pc_20_50, sigmoid_50pc_20_50, sigmoid_80pc_20_50 / + lin_99-98-90pc_20_50-60-100, sigmoid_20pc_20_50, sigmoid_50pc_20_50, sigmoid_80pc_20_50, sigmoid_75pc_25_50, sigmoid_50pc_25_50, sigmoid_25pc_25_50 / t_scen15(t_all) Target years for transition to exogenous scenario diets / y2010, y2030, y2050 / diff --git a/modules/30_croparea/detail_apr24/input.gms b/modules/30_croparea/detail_apr24/input.gms index 72ca248086..4923074708 100644 --- a/modules/30_croparea/detail_apr24/input.gms +++ b/modules/30_croparea/detail_apr24/input.gms @@ -26,7 +26,7 @@ scalars s30_betr_scenario_start Bioenergy land scenario start year / 2020 / s30_betr_scenario_target Bioenergy land scenario target year / 2050 / s30_betr_target Target share of bioenergy land on total cropland (1) / 0 / - s30_betr_penalty Penalty for violation of betr target (USD05MER per ha) / 500 / + s30_betr_penalty Penalty for violation of betr target (USD05MER per ha) / 2000 / ; diff --git a/modules/30_croparea/simple_apr24/input.gms b/modules/30_croparea/simple_apr24/input.gms index e8f919c20f..ac6585c0ca 100644 --- a/modules/30_croparea/simple_apr24/input.gms +++ b/modules/30_croparea/simple_apr24/input.gms @@ -20,7 +20,7 @@ scalars s30_betr_scenario_start Bioenergy land scenario start year / 2020 / s30_betr_scenario_target Bioenergy land scenario target year / 2050 / s30_betr_target Target share of bioenergy land on total cropland (1) / 0 / - s30_betr_penalty Penalty for violation of betr target (USD05MER per ha) / 500 / + s30_betr_penalty Penalty for violation of betr target (USD05MER per ha) / 2000 / ; $ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes; From 8bf84920afccee57edb190e07ec759195e1a697c Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 9 May 2024 21:51:25 +0200 Subject: [PATCH 125/280] update --- config/scenario_config.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/scenario_config.csv b/config/scenario_config.csv index 4c1657a7d8..96f7b9d7c7 100755 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -74,7 +74,7 @@ gms$c42_watdem_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;; gms$c43_watavail_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;; gms$c52_carbon_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;; gms$c59_som_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;; -gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;4;4;0;;;;;;;;;;;; +gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;;;;; gms$s32_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;1;0;;;;;;;;;;;; gms$s35_secdf_distribution;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0;0;0;;;;;0;0;0;;;;;;;;;;;; gms$s35_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;;; From 1942a8f10b033f5dbea9e3a561cd21594fd6a1ce Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Fri, 10 May 2024 00:14:11 +0200 Subject: [PATCH 126/280] reworked forest recovery equations --- core/sets.gms | 15 ++++++++----- modules/10_land/landmatrix_dec18/presolve.gms | 3 --- .../pot_forest_may24/declarations.gms | 13 ++++++++--- .../35_natveg/pot_forest_may24/equations.gms | 22 ++++++++++++++++--- modules/35_natveg/pot_forest_may24/input.gms | 4 ++-- .../35_natveg/pot_forest_may24/postsolve.gms | 16 ++++++++++++++ .../35_natveg/pot_forest_may24/presolve.gms | 6 ----- modules/80_optimization/nlp_apr17/solve.gms | 5 ++++- 8 files changed, 60 insertions(+), 24 deletions(-) diff --git a/core/sets.gms b/core/sets.gms index 5ee0ef2fe4..407cc57255 100644 --- a/core/sets.gms +++ b/core/sets.gms @@ -245,19 +245,22 @@ sets / crop, past, forestry, primforest, secdforest, urban, other / land_ag(land) Agricultural land pools - / crop, past / - - land_timber(land) land from which timber can be taken away - / forestry, primforest, secdforest, other / + / crop, past / land_forest(land) Forested land pools - / forestry, primforest, secdforest / + / forestry, primforest, secdforest / + + land_noforest(land) Non-forest land pools + / crop, past, urban, other / + + land_timber(land) land from which timber can be taken away + / forestry, primforest, secdforest, other / land_natveg(land_timber) Natural vegetation land pools / primforest, secdforest, other / forest_type forest type - / plantations, natveg / + / plantations, natveg / ***Forestry** ac Age classes / ac0,ac5,ac10,ac15,ac20,ac25,ac30,ac35,ac40,ac45,ac50, diff --git a/modules/10_land/landmatrix_dec18/presolve.gms b/modules/10_land/landmatrix_dec18/presolve.gms index b3bd374f4c..edee5163dc 100644 --- a/modules/10_land/landmatrix_dec18/presolve.gms +++ b/modules/10_land/landmatrix_dec18/presolve.gms @@ -20,9 +20,6 @@ vm_lu_transitions.fx(j,"secdforest","other") = 0; vm_lu_transitions.fx(j,land_from,"primforest") = 0; vm_lu_transitions.up(j,"primforest","primforest") = Inf; -*' Forestry can only be converted into secdforest but not other -vm_lu_transitions.fx(j,"forestry","other") = 0; - *' @stop m_boundfix(vm_land,(j,land),up,10e-5); diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index 5e08255b8e..b027d86da0 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -20,7 +20,6 @@ parameters p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_damage_fader(t_all) Fader for forest damage (1) p35_max_forest_recovery(j) Forest recovery potential (mio. ha) - p35_forest_recovery_shr(j) Forest share in the regeneration of natural vegetation (1) p35_carbon_density_secdforest(t,j,ac,ag_pools) Carbon density secdforest (tC per ha) p35_carbon_density_other(t,j,ac,ag_pools) Carbon density other land (tC per ha) p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) @@ -46,9 +45,10 @@ equations q35_landdiff Difference in natveg land (mio. ha) q35_other_expansion(j) Other land expansion (mio. ha) q35_other_reduction(j,ac) Other land reduction (mio. ha) - q35_secdforest_expansion(j) Secdforest reduction (mio. ha) + q35_secdforest_expansion(j) Secdforest expansion (mio. ha) q35_secdforest_reduction(j,ac) Secdforest reduction (mio. ha) q35_primforest_reduction(j) Primforest reduction (mio. ha) + q35_secdforest_recovery_area(j) Forest recovery constraint after land abandonment (mio. ha) q35_secdforest_regeneration(j) Secondary forest regeneration (mio. ha) q35_max_forest_expansion(j) Maximum forestry regeneration based on potential forest area (mio. ha) q35_other_regeneration(j) Other land regeneration (mio. ha) @@ -65,6 +65,8 @@ equations q35_bv_secdforest(j,potnatveg) Biodiversity value of secondary forest (mio. ha) q35_bv_other(j,potnatveg) Biodiversity value of other land (mio. ha) q35_natveg_conservation(j) Total natural vegetation conservation constraint (mio. ha) + q35_secdforest_restoration(j) Secondary forest restoration constraint (mio. ha) + q35_other_restoration(j) Other land restoration constraint (mio. ha) ; positive variables @@ -76,6 +78,7 @@ positive variables v35_secdforest_expansion(j) Secdforest reduction compared to previous timestep (mio. ha) v35_secdforest_reduction(j,ac) Secdforest reduction compared to previous timestep (mio. ha) v35_primforest_reduction(j) Primforest reduction compared to previous timestep (mio. ha) + v35_secdforest_recovery_area(j) Forest recovery area after land abandonment (mio. ha) v35_hvarea_secdforest(j,ac) Harvested area from secondary forest (mio. ha) v35_hvarea_other(j,ac) Harvested area from other land (mio. ha) v35_hvarea_primforest(j) Harvested area from primary forest (mio. ha) @@ -94,6 +97,7 @@ parameters ov35_secdforest_expansion(t,j,type) Secdforest reduction compared to previous timestep (mio. ha) ov35_secdforest_reduction(t,j,ac,type) Secdforest reduction compared to previous timestep (mio. ha) ov35_primforest_reduction(t,j,type) Primforest reduction compared to previous timestep (mio. ha) + ov35_secdforest_recovery_area(t,j,type) Forest recovery area after land abandonment (mio. ha) ov35_hvarea_secdforest(t,j,ac,type) Harvested area from secondary forest (mio. ha) ov35_hvarea_other(t,j,ac,type) Harvested area from other land (mio. ha) ov35_hvarea_primforest(t,j,type) Harvested area from primary forest (mio. ha) @@ -109,9 +113,10 @@ parameters oq35_landdiff(t,type) Difference in natveg land (mio. ha) oq35_other_expansion(t,j,type) Other land expansion (mio. ha) oq35_other_reduction(t,j,ac,type) Other land reduction (mio. ha) - oq35_secdforest_expansion(t,j,type) Secdforest reduction (mio. ha) + oq35_secdforest_expansion(t,j,type) Secdforest expansion (mio. ha) oq35_secdforest_reduction(t,j,ac,type) Secdforest reduction (mio. ha) oq35_primforest_reduction(t,j,type) Primforest reduction (mio. ha) + oq35_secdforest_recovery_area(t,j,type) Forest recovery constraint after land abandonment (mio. ha) oq35_secdforest_regeneration(t,j,type) Secondary forest regeneration (mio. ha) oq35_max_forest_expansion(t,j,type) Maximum forestry regeneration based on potential forest area (mio. ha) oq35_other_regeneration(t,j,type) Other land regeneration (mio. ha) @@ -128,5 +133,7 @@ parameters oq35_bv_secdforest(t,j,potnatveg,type) Biodiversity value of secondary forest (mio. ha) oq35_bv_other(t,j,potnatveg,type) Biodiversity value of other land (mio. ha) oq35_natveg_conservation(t,j,type) Total natural vegetation conservation constraint (mio. ha) + oq35_secdforest_restoration(t,j,type) Secondary forest restoration constraint (mio. ha) + oq35_other_restoration(t,j,type) Other land restoration constraint (mio. ha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 6657d8e7f9..815ccdad9b 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -21,6 +21,17 @@ =g= sum((ct,land_natveg,consv_type), pm_land_conservation(ct,j2,land_natveg,consv_type)); + q35_secdforest_restoration(j2) .. + sum(land_ag, vm_lu_transitions(j2,land_ag,"secdforest")) + + vm_lu_transitions(j2,"forestry","secdforest") + =g= + p35_land_restoration(j2,"secdforest"); + + q35_other_restoration(j2) .. + sum(land_ag, vm_lu_transitions(j2,land_ag,"other")) + =g= + p35_land_restoration(j2,"other"); + *' Carbon stocks for primary forest, secondary forest or other natural land are calculated *' as the product of respective area and carbon density. *' Carbon stocks decline if the area decreases @@ -181,10 +192,16 @@ q35_secdforest_regeneration(j2).. sum(ac_sub,v35_hvarea_secdforest(j2,ac_sub)) + v35_hvarea_primforest(j2) + p35_land_restoration(j2,"secdforest") - + sum(land_ag, vm_lu_transitions(j2,land_ag,"other")) * p35_forest_recovery_shr(j2) - + vm_lu_transitions(j2,"forestry","secdforest") + + v35_secdforest_recovery_area(j2) ; +q35_secdforest_recovery_area(j2).. + v35_secdforest_recovery_area(j2) + =e= + + (p35_max_forest_recovery(j2) - p35_land_restoration(j2,"secdforest")) + * (sum(land_noforest,vm_landreduction(j2,land_noforest))/(sum(land_noforest,vm_land(j2,land_noforest))+1e-10)) + + vm_landreduction(j2,"forestry"); + *' The constraint for forest establishment is given by the *' remaining potential forest area, which was calculated based *' on the potential natural forest area in each cluster. @@ -201,7 +218,6 @@ q35_other_regeneration(j2).. sum(ac_est, v35_other(j2,ac_est)) =g= sum(ac_sub,v35_hvarea_other(j2,ac_sub)) - + sum(land_ag, vm_lu_transitions(j2,land_ag,"other")) * (1 - p35_forest_recovery_shr(j2)) ; *' The following two constraints distribute additions to secdforest and other land diff --git a/modules/35_natveg/pot_forest_may24/input.gms b/modules/35_natveg/pot_forest_may24/input.gms index de5bef3564..276c47c2f8 100644 --- a/modules/35_natveg/pot_forest_may24/input.gms +++ b/modules/35_natveg/pot_forest_may24/input.gms @@ -5,8 +5,8 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -$setglobal c35_ad_policy npi -$setglobal c35_aolc_policy npi +$setglobal c35_ad_policy ndc +$setglobal c35_aolc_policy ndc $setglobal c35_shock_scenario none scalars diff --git a/modules/35_natveg/pot_forest_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms index 859c858748..656abd9d7e 100644 --- a/modules/35_natveg/pot_forest_may24/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -20,6 +20,7 @@ p35_other(t,j,ac) = v35_other.l(j,ac); ov35_secdforest_expansion(t,j,"marginal") = v35_secdforest_expansion.m(j); ov35_secdforest_reduction(t,j,ac,"marginal") = v35_secdforest_reduction.m(j,ac); ov35_primforest_reduction(t,j,"marginal") = v35_primforest_reduction.m(j); + ov35_secdforest_recovery_area(t,j,"marginal") = v35_secdforest_recovery_area.m(j); ov35_hvarea_secdforest(t,j,ac,"marginal") = v35_hvarea_secdforest.m(j,ac); ov35_hvarea_other(t,j,ac,"marginal") = v35_hvarea_other.m(j,ac); ov35_hvarea_primforest(t,j,"marginal") = v35_hvarea_primforest.m(j); @@ -38,6 +39,7 @@ p35_other(t,j,ac) = v35_other.l(j,ac); oq35_secdforest_expansion(t,j,"marginal") = q35_secdforest_expansion.m(j); oq35_secdforest_reduction(t,j,ac,"marginal") = q35_secdforest_reduction.m(j,ac); oq35_primforest_reduction(t,j,"marginal") = q35_primforest_reduction.m(j); + oq35_secdforest_recovery_area(t,j,"marginal") = q35_secdforest_recovery_area.m(j); oq35_secdforest_regeneration(t,j,"marginal") = q35_secdforest_regeneration.m(j); oq35_max_forest_expansion(t,j,"marginal") = q35_max_forest_expansion.m(j); oq35_other_regeneration(t,j,"marginal") = q35_other_regeneration.m(j); @@ -54,6 +56,8 @@ p35_other(t,j,ac) = v35_other.l(j,ac); oq35_bv_secdforest(t,j,potnatveg,"marginal") = q35_bv_secdforest.m(j,potnatveg); oq35_bv_other(t,j,potnatveg,"marginal") = q35_bv_other.m(j,potnatveg); oq35_natveg_conservation(t,j,"marginal") = q35_natveg_conservation.m(j); + oq35_secdforest_restoration(t,j,"marginal") = q35_secdforest_restoration.m(j); + oq35_other_restoration(t,j,"marginal") = q35_other_restoration.m(j); ov35_secdforest(t,j,ac,"level") = v35_secdforest.l(j,ac); ov35_other(t,j,ac,"level") = v35_other.l(j,ac); ov_landdiff_natveg(t,"level") = vm_landdiff_natveg.l; @@ -62,6 +66,7 @@ p35_other(t,j,ac) = v35_other.l(j,ac); ov35_secdforest_expansion(t,j,"level") = v35_secdforest_expansion.l(j); ov35_secdforest_reduction(t,j,ac,"level") = v35_secdforest_reduction.l(j,ac); ov35_primforest_reduction(t,j,"level") = v35_primforest_reduction.l(j); + ov35_secdforest_recovery_area(t,j,"level") = v35_secdforest_recovery_area.l(j); ov35_hvarea_secdforest(t,j,ac,"level") = v35_hvarea_secdforest.l(j,ac); ov35_hvarea_other(t,j,ac,"level") = v35_hvarea_other.l(j,ac); ov35_hvarea_primforest(t,j,"level") = v35_hvarea_primforest.l(j); @@ -80,6 +85,7 @@ p35_other(t,j,ac) = v35_other.l(j,ac); oq35_secdforest_expansion(t,j,"level") = q35_secdforest_expansion.l(j); oq35_secdforest_reduction(t,j,ac,"level") = q35_secdforest_reduction.l(j,ac); oq35_primforest_reduction(t,j,"level") = q35_primforest_reduction.l(j); + oq35_secdforest_recovery_area(t,j,"level") = q35_secdforest_recovery_area.l(j); oq35_secdforest_regeneration(t,j,"level") = q35_secdforest_regeneration.l(j); oq35_max_forest_expansion(t,j,"level") = q35_max_forest_expansion.l(j); oq35_other_regeneration(t,j,"level") = q35_other_regeneration.l(j); @@ -96,6 +102,8 @@ p35_other(t,j,ac) = v35_other.l(j,ac); oq35_bv_secdforest(t,j,potnatveg,"level") = q35_bv_secdforest.l(j,potnatveg); oq35_bv_other(t,j,potnatveg,"level") = q35_bv_other.l(j,potnatveg); oq35_natveg_conservation(t,j,"level") = q35_natveg_conservation.l(j); + oq35_secdforest_restoration(t,j,"level") = q35_secdforest_restoration.l(j); + oq35_other_restoration(t,j,"level") = q35_other_restoration.l(j); ov35_secdforest(t,j,ac,"upper") = v35_secdforest.up(j,ac); ov35_other(t,j,ac,"upper") = v35_other.up(j,ac); ov_landdiff_natveg(t,"upper") = vm_landdiff_natveg.up; @@ -104,6 +112,7 @@ p35_other(t,j,ac) = v35_other.l(j,ac); ov35_secdforest_expansion(t,j,"upper") = v35_secdforest_expansion.up(j); ov35_secdforest_reduction(t,j,ac,"upper") = v35_secdforest_reduction.up(j,ac); ov35_primforest_reduction(t,j,"upper") = v35_primforest_reduction.up(j); + ov35_secdforest_recovery_area(t,j,"upper") = v35_secdforest_recovery_area.up(j); ov35_hvarea_secdforest(t,j,ac,"upper") = v35_hvarea_secdforest.up(j,ac); ov35_hvarea_other(t,j,ac,"upper") = v35_hvarea_other.up(j,ac); ov35_hvarea_primforest(t,j,"upper") = v35_hvarea_primforest.up(j); @@ -122,6 +131,7 @@ p35_other(t,j,ac) = v35_other.l(j,ac); oq35_secdforest_expansion(t,j,"upper") = q35_secdforest_expansion.up(j); oq35_secdforest_reduction(t,j,ac,"upper") = q35_secdforest_reduction.up(j,ac); oq35_primforest_reduction(t,j,"upper") = q35_primforest_reduction.up(j); + oq35_secdforest_recovery_area(t,j,"upper") = q35_secdforest_recovery_area.up(j); oq35_secdforest_regeneration(t,j,"upper") = q35_secdforest_regeneration.up(j); oq35_max_forest_expansion(t,j,"upper") = q35_max_forest_expansion.up(j); oq35_other_regeneration(t,j,"upper") = q35_other_regeneration.up(j); @@ -138,6 +148,8 @@ p35_other(t,j,ac) = v35_other.l(j,ac); oq35_bv_secdforest(t,j,potnatveg,"upper") = q35_bv_secdforest.up(j,potnatveg); oq35_bv_other(t,j,potnatveg,"upper") = q35_bv_other.up(j,potnatveg); oq35_natveg_conservation(t,j,"upper") = q35_natveg_conservation.up(j); + oq35_secdforest_restoration(t,j,"upper") = q35_secdforest_restoration.up(j); + oq35_other_restoration(t,j,"upper") = q35_other_restoration.up(j); ov35_secdforest(t,j,ac,"lower") = v35_secdforest.lo(j,ac); ov35_other(t,j,ac,"lower") = v35_other.lo(j,ac); ov_landdiff_natveg(t,"lower") = vm_landdiff_natveg.lo; @@ -146,6 +158,7 @@ p35_other(t,j,ac) = v35_other.l(j,ac); ov35_secdforest_expansion(t,j,"lower") = v35_secdforest_expansion.lo(j); ov35_secdforest_reduction(t,j,ac,"lower") = v35_secdforest_reduction.lo(j,ac); ov35_primforest_reduction(t,j,"lower") = v35_primforest_reduction.lo(j); + ov35_secdforest_recovery_area(t,j,"lower") = v35_secdforest_recovery_area.lo(j); ov35_hvarea_secdforest(t,j,ac,"lower") = v35_hvarea_secdforest.lo(j,ac); ov35_hvarea_other(t,j,ac,"lower") = v35_hvarea_other.lo(j,ac); ov35_hvarea_primforest(t,j,"lower") = v35_hvarea_primforest.lo(j); @@ -164,6 +177,7 @@ p35_other(t,j,ac) = v35_other.l(j,ac); oq35_secdforest_expansion(t,j,"lower") = q35_secdforest_expansion.lo(j); oq35_secdforest_reduction(t,j,ac,"lower") = q35_secdforest_reduction.lo(j,ac); oq35_primforest_reduction(t,j,"lower") = q35_primforest_reduction.lo(j); + oq35_secdforest_recovery_area(t,j,"lower") = q35_secdforest_recovery_area.lo(j); oq35_secdforest_regeneration(t,j,"lower") = q35_secdforest_regeneration.lo(j); oq35_max_forest_expansion(t,j,"lower") = q35_max_forest_expansion.lo(j); oq35_other_regeneration(t,j,"lower") = q35_other_regeneration.lo(j); @@ -180,4 +194,6 @@ p35_other(t,j,ac) = v35_other.l(j,ac); oq35_bv_secdforest(t,j,potnatveg,"lower") = q35_bv_secdforest.lo(j,potnatveg); oq35_bv_other(t,j,potnatveg,"lower") = q35_bv_other.lo(j,potnatveg); oq35_natveg_conservation(t,j,"lower") = q35_natveg_conservation.lo(j); + oq35_secdforest_restoration(t,j,"lower") = q35_secdforest_restoration.lo(j); + oq35_other_restoration(t,j,"lower") = q35_other_restoration.lo(j); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 5346fb9187..ce39680935 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -83,11 +83,6 @@ pcm_land(j,"other") = sum(ac, pc35_other(j,ac)); p35_max_forest_recovery(j) = fm_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); p35_max_forest_recovery(j)$(p35_max_forest_recovery(j) < 0) = 0; -* The forest recovery share is given by the relation between the forest recovery potential -* and the agricultural land area of the previous time step. -p35_forest_recovery_shr(j) = p35_max_forest_recovery(j) / sum(land_ag, pcm_land(j,land_ag)); -p35_forest_recovery_shr(j)$(p35_forest_recovery_shr(j) > 1) = 1; - * ------------------------------------- * Set bounds based on land conservation * ------------------------------------- @@ -139,7 +134,6 @@ p35_land_restoration(j,"secdforest") = pm_land_conservation(t,j,"secdforest","re * land area meets the total natural land conservation target p35_land_restoration(j,"secdforest")$(sum(land_natveg, pcm_land(j,land_natveg)) >= sum((land_natveg, consv_type), pm_land_conservation(t,j,land_natveg,consv_type))) = 0; - * Since forest restoration cannot be bigger than the maximum area for forest recovery, * any remaining restoration area is substracted and shifted to other land restoration. p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - p35_max_forest_recovery(j); diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index bae758fec1..f06dfcb779 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -30,7 +30,7 @@ Flg_Prep = FALSE $offecho *' @code -*' Solve statement is put twice for improved model results, +*' Solve statement is put twice for improved model results, *' in particular for matching LHS and RHS of equations. solve magpie USING nlp MINIMIZING vm_cost_glo; solve magpie USING nlp MINIMIZING vm_cost_glo; @@ -40,6 +40,9 @@ display "vm_cost_glo.l"; display vm_cost_glo.l; display magpie.modelstat; +* set modelstat to 13 in case of NA for continuation +magpie.modelStat$(magpie.modelStat=NA) = 13; + * in case of problems try different solvers and optfile settings if (magpie.modelstat > 2, repeat( From 42ff0ba95f77fb1f6ebec8c12fef2e1e71663898 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 10 May 2024 09:40:48 +0200 Subject: [PATCH 127/280] defaults --- config/scenario_config.csv | 2 +- modules/32_forestry/dynamic_may24/input.gms | 2 +- modules/32_forestry/dynamic_may24/preloop.gms | 63 ++++++++++++++++++- modules/73_timber/default/input.gms | 2 +- 4 files changed, 65 insertions(+), 4 deletions(-) mode change 100755 => 100644 config/scenario_config.csv diff --git a/config/scenario_config.csv b/config/scenario_config.csv old mode 100755 new mode 100644 index 96f7b9d7c7..4c1657a7d8 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -74,7 +74,7 @@ gms$c42_watdem_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;; gms$c43_watavail_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;; gms$c52_carbon_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;; gms$c59_som_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;; -gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;;;;; +gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;4;4;0;;;;;;;;;;;; gms$s32_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;1;0;;;;;;;;;;;; gms$s35_secdf_distribution;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0;0;0;;;;;0;0;0;;;;;;;;;;;; gms$s35_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;;; diff --git a/modules/32_forestry/dynamic_may24/input.gms b/modules/32_forestry/dynamic_may24/input.gms index d072426e61..89ac88ac42 100644 --- a/modules/32_forestry/dynamic_may24/input.gms +++ b/modules/32_forestry/dynamic_may24/input.gms @@ -36,7 +36,7 @@ scalars s32_planing_horizon Afforestation planing horizon (years) / 50 / s32_rotation_extension Rotation extension factor 1=original rotations 2=100 percent increase in rotations etc (1) / 1 / s32_faustmann_rotation Switch to activate faustmann rotations (1=on 0=off) / 0 / - s32_initial_distribution Switch to Activate ageclass distribution in plantations 1=equal distribution (1) / 1 / + s32_initial_distribution Switch to Activate ageclass distribution in plantations 0=off 1=equal distribution 2=FAO distribution 3=Poulter distribution 4=Manual distribution (1) / 0 / s32_price Price for timber (USD) / 45 / s32_free_land_cost Penalty for technial area balance term (USD per ha) / 1e+06 / s32_max_aff_area Maximum total global afforestation (mio. ha) / Inf / diff --git a/modules/32_forestry/dynamic_may24/preloop.gms b/modules/32_forestry/dynamic_may24/preloop.gms index 4d4ede2052..2f944fb313 100644 --- a/modules/32_forestry/dynamic_may24/preloop.gms +++ b/modules/32_forestry/dynamic_may24/preloop.gms @@ -146,12 +146,73 @@ ini32(j,ac) = no; ini32(j,ac) = yes$(ord(ac) >= 1 AND ac.off < p32_rotation_cellular_harvesting("y1995",j)); ** divide initial forestry area by number of age classes within ini32 -if(s32_initial_distribution = 1, +** divide initial forestry area by number of age classes within ini32 +if(s32_initial_distribution = 0, +** Initialize with highest age class + p32_land_start_ac(j,"plant","acx") = pcm_land(j,"forestry") * sum(cell(i,j),f32_plantedforest(i)); + p32_land_start_ac(j,"ndc","acx") = pcm_land(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i)); + +elseif s32_initial_distribution = 1, ** Initialize with equal distribution among rotation age classes ** Plantated forest area is divided into ndcs (other planted forest) and plantations p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = p32_plant_ini_ac(j); p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1- f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); + +elseif s32_initial_distribution = 2, +** Initialize with distribution based on FAO data (but this distribution is applied to all cells globally) +** Plantated forest area is divided into ndcs (other planted forest) and plantations + p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i)); + p32_land_start_ac(j,"plant",ac) = p32_plant_ini_ac(j) * f32_ac_dist(ac); + p32_land_start_ac(j,"ndc",ac) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i)) * f32_ac_dist(ac); + +elseif s32_initial_distribution = 3, +** Initialize with Poulter distribution among rotation age classes +** Plantated forest area is divided into ndcs (other planted forest) and plantations + p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i)); + p32_rotation_dist(j,ac) = (im_plantedclass_ac(j,ac)$(ini32(j,ac))/sum(ac2,im_plantedclass_ac(j,ac2)$(ini32(j,ac2))))$(sum(ac2,im_plantedclass_ac(j,ac2)$(ini32(j,ac2)))); + p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = p32_plant_ini_ac(j) * p32_rotation_dist(j,ac); + p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i)) * p32_rotation_dist(j,ac); + +*use residual approach to avoid distributional errors i.e., poulter set with no plantations but luh reporting plantations in a cell + loop (j, + if(sum(ac,p32_land_start_ac(j,"plant",ac)$(ini32(j,ac))) = 0, + p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); + p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); + ); + ); + +elseif s32_initial_distribution = 4, +** Initialize with Manual distribution among rotation age classes +** Plantated forest area is divided into ndcs (other planted forest) and plantations + loop(j, +** Set all acs to 0 + p32_ac_dist_flag(j,ac) = 0; +** Calculate reverse of age-classes, if rotation is 11acs, then ac0 should get a value of 11, 11th ac should get value of 1 + p32_ac_dist_flag(j,ac) = (10*p32_rotation_cellular_harvesting("y1995",j)-((ord(ac)-1))*5)$(ord(ac) <= p32_rotation_cellular_harvesting("y1995",j)); +** Calculate the weights, youngest age-class will have highest weight + p32_ac_dist(j,ac) = (p32_ac_dist_flag(j,ac) / (sum(ac2,p32_ac_dist_flag(j,ac2)) + ord(ac)))$(ord(ac) <= p32_rotation_cellular_harvesting("y1995",j)); +** there can be isntances where this distribution is not summing up to 1, in that case we take the excess and remove it evenly from all age-classes +** In case the sum of distribution is > 1 : Remove the excess from ac0 + p32_ac_dist(j,"ac0")$(sum(ac2, p32_ac_dist(j,ac2))>1) = p32_ac_dist(j,"ac0") - (sum(ac2, p32_ac_dist(j,ac2))-1); +** In case the sum of distribution is < 1 : Add the shortage to ac0 + p32_ac_dist(j,"ac0")$(sum(ac2, p32_ac_dist(j,ac2))<1) = p32_ac_dist(j,"ac0") + (1-sum(ac2, p32_ac_dist(j,ac2))); + ); +** Isolate plantations from planted forest (forestry) + p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i)); +** Divide plantations according to distribution + p32_land_start_ac(j,"plant",ac) = p32_plant_ini_ac(j) * p32_ac_dist(j,ac); +** Divide NDCs according to same distribution + p32_land_start_ac(j,"ndc",ac) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i)) * p32_ac_dist(j,ac); + +*use residual approach to avoid distributional errors i.e., poulter set with no plantations but luh reporting plantations in a cell + loop (j, + if(sum(ac,p32_land_start_ac(j,"plant",ac)$(ini32(j,ac))) = 0, + p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); + p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); + ); + ); + ); ** Redistribute to youngest age class in case the distribution to plantations and diff --git a/modules/73_timber/default/input.gms b/modules/73_timber/default/input.gms index 797d4bbbba..c046fdfa64 100644 --- a/modules/73_timber/default/input.gms +++ b/modules/73_timber/default/input.gms @@ -19,7 +19,7 @@ scalars s73_timber_prod_cost_woodfuel Cost for prodcing one unit of woodfuel (USD per tDM) / 60 / s73_free_prod_cost Very high cost for settling demand without production (USD per tDM) /20000/ s73_timber_demand_switch Logical switch to turn on or off timber demand 1=on 0=off (1) / 0 / - s73_foresight Boolean switch for establishment demand assumption 1=forward looking 0=myopic (1) / 1 / + s73_foresight Boolean switch for establishment demand assumption 1=forward looking 0=myopic (1) / 0 / s73_increase_ceiling Limiter for not allowing a demand jump between time steps beyond a certain limit (1) /1.025/ s73_residue_ratio Proportion of overall industrial roundwood production which ends up as residue during harvest (1) / 0.15/ sm_wood_density Representative wood density based on IPCC (tDM per m3) /0.6/ From d1ca47d691dc7c75afc37e2357401cb2264823eb Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 10 May 2024 11:53:17 +0200 Subject: [PATCH 128/280] start script peatlandTax --- scripts/start/projects/paper_peatlandTax.R | 148 +++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 scripts/start/projects/paper_peatlandTax.R diff --git a/scripts/start/projects/paper_peatlandTax.R b/scripts/start/projects/paper_peatlandTax.R new file mode 100644 index 0000000000..c81b4ac47b --- /dev/null +++ b/scripts/start/projects/paper_peatlandTax.R @@ -0,0 +1,148 @@ +# | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +# ---------------------------------------------------------- +# description: paper peatlandTax +# position: 5 +# ---------------------------------------------------------- + +## Load lucode2 and gms to use setScenario later +library(lucode2) +library(gms) +library(gdx) +library(magpie4) + +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") + +# Source default cfg. This loads the object "cfg" in R environment +source("config/default.cfg") + +# create additional information to describe the runs +cfg$info$flag <- "V14LRc500" + +cfg$results_folder <- "output/:title:" +cfg$results_folder_highres <- "output" +cfg$force_replace <- TRUE +cfg$qos <- "priority_maxMem" +#cfg$qos <- "standby_maxMem_dayMax" + +# support function to create standardized title +.title <- function(cfg, ...) return(paste(cfg$info$flag, sep="_",...)) + + +# EUR <- "ALB,AUT,BEL,BGR,CYP,CZE,DEU,DNK,ESP,EST,FIN,FRA,FRO, +# GBR,GGY,GIB,GRC,HRV,HUN,IMN,IRL,ITA,JEY,LTU,LUX,LVA,MLT, +# NLD,POL,PRT,ROU,SVK,SVN,SWE" + +ssp <- "SSP2" +#cfg$input['calibration'] <- "calibration_H12c400_16Apr24.tgz" +cfg$input['calibration'] <- "calibration_H12c500_15Apr24.tgz" +cfg$gms$c_timesteps <- "5year" + +limitAff <- function(cfg,gdx) { + #download input files with high resolution + download_and_update(cfg) + + # #get tau from low resolution run + # ov_tau <- readGDX(gdx, "ov_tau",select=list(type="level")) + # write.magpie(ov_tau,"modules/13_tc/input/f13_tau_scenario.csv") + # cfg$gms$tc <- "exo" + + #get regional afforestation patterns from low resolution run with c200 + aff <- dimSums(landForestry(gdx)[,,c("aff","ndc")],dim=3) + #Take away initial NDC area for consistency with global afforestation limit + aff <- aff-setYears(aff[,1,],NULL) + #calculate maximum regional afforestation over time + aff_max <- setYears(aff[,1,],NULL) + for (r in getRegions(aff)) { + aff_max[r,,] <- max(aff[r,,]) + } + aff_max[aff_max < 0] <- 0 + write.magpie(aff_max,"modules/32_forestry/input/f32_max_aff_area.cs4") + cfg$gms$s32_max_aff_area_glo <- 0 + #check + if(cfg$gms$s32_max_aff_area < Inf) { + indicator <- abs(sum(aff_max)-cfg$gms$s32_max_aff_area) + if(indicator > 1e-06) warning(paste("Global and regional afforestation limit differ by",indicator,"Mha")) + } + return(cfg) +} + + +cfg$output <- c("rds_report") +cfg$sequential <- TRUE +cfg$title <- .title(cfg, paste(ssp,"1p5deg","PricePeatOff","AffEndo",sep="-")) +cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9","ForestryEndo")) +#cfg$input['cellular'] <- "rev4.104_h12_6aa915b6_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" +cfg$input['cellular'] <- "rev4.104_h12_4c83b5e5_cellularmagpie_c500_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" +cfg$gms$c56_mute_ghgprices_until <- "y2030" +cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") +cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") +cfg$gms$c56_emis_policy <- "reddnatveg_nosoil_nopeat" +start_run(cfg, codeCheck = FALSE) +cfg$sequential <- FALSE + +PricePeatOff <- .title(cfg, paste(ssp,"1p5deg","PricePeatOff","AffEndo",sep="-")) + +#limitAff runs +cfg$output <- c("extra/highres", "extra/disaggregation", "rds_report", "rds_report_iso") + +cfg$title <- .title(cfg, paste(ssp,"NDC",sep="-")) +cfg <- setScenario(cfg,c(ssp,"NDC","rcp4p5","ForestryEndo")) +#cfg$input['cellular'] <- "rev4.104_h12_3d941455_cellularmagpie_c400_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz" +cfg$input['cellular'] <- "rev4.104_h12_9ab12c13_cellularmagpie_c500_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz" +cfg <- limitAff(cfg,file.path("output",PricePeatOff,"fulldata.gdx")) +cfg$gms$c56_mute_ghgprices_until <- "y2150" +cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-NDC") +cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-NDC") +cfg$gms$c56_emis_policy <- "reddnatveg_nosoil_nopeat" +start_run(cfg, codeCheck = FALSE) + +cfg$title <- .title(cfg, paste(ssp,"1p5deg","PricePeatOff",sep="-")) +cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9","ForestryEndo")) +#cfg$input['cellular'] <- "rev4.104_h12_6aa915b6_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" +cfg$input['cellular'] <- "rev4.104_h12_4c83b5e5_cellularmagpie_c500_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" +cfg <- limitAff(cfg,file.path("output",PricePeatOff,"fulldata.gdx")) +cfg$gms$c56_mute_ghgprices_until <- "y2030" +cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") +cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") +cfg$gms$c56_emis_policy <- "reddnatveg_nosoil_nopeat" +start_run(cfg, codeCheck = FALSE) + +cfg$title <- .title(cfg, paste(ssp,"1p5deg","PricePeatCO2",sep="-")) +cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9","ForestryEndo")) +#cfg$input['cellular'] <- "rev4.104_h12_6aa915b6_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" +cfg$input['cellular'] <- "rev4.104_h12_4c83b5e5_cellularmagpie_c500_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" +cfg <- limitAff(cfg,file.path("output",PricePeatOff,"fulldata.gdx")) +cfg$gms$c56_mute_ghgprices_until <- "y2030" +cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") +cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") +cfg$gms$c56_emis_policy <- "reddnatveg_nosoil_peatCO2only" +start_run(cfg, codeCheck = FALSE) + +cfg$title <- .title(cfg, paste(ssp,"1p5deg","PricePeatGHG",sep="-")) +cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9","ForestryEndo")) +#cfg$input['cellular'] <- "rev4.104_h12_6aa915b6_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" +cfg$input['cellular'] <- "rev4.104_h12_4c83b5e5_cellularmagpie_c500_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" +cfg <- limitAff(cfg,file.path("output",PricePeatOff,"fulldata.gdx")) +cfg$gms$c56_mute_ghgprices_until <- "y2030" +cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") +cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") +cfg$gms$c56_emis_policy <- "reddnatveg_nosoil" +start_run(cfg, codeCheck = FALSE) + +cfg$title <- .title(cfg, paste(ssp,"1p5deg","PricePeatGHG_CH4GWP20",sep="-")) +cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9","ForestryEndo")) +#cfg$input['cellular'] <- "rev4.104_h12_6aa915b6_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" +cfg$input['cellular'] <- "rev4.104_h12_4c83b5e5_cellularmagpie_c500_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" +cfg <- limitAff(cfg,file.path("output",PricePeatOff,"fulldata.gdx")) +cfg$gms$c56_mute_ghgprices_until <- "y2030" +cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") +cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") +cfg$gms$c56_emis_policy <- "reddnatveg_nosoil_CH4GWP20" +start_run(cfg, codeCheck = FALSE) From 1af10978c85503a279dc8a418e23d6fb894bbd45 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 10 May 2024 15:28:03 +0200 Subject: [PATCH 129/280] update --- modules/73_timber/default/input.gms | 5 +++-- modules/73_timber/default/preloop.gms | 2 +- modules/73_timber/default/presolve.gms | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/73_timber/default/input.gms b/modules/73_timber/default/input.gms index c046fdfa64..b975c80f8a 100644 --- a/modules/73_timber/default/input.gms +++ b/modules/73_timber/default/input.gms @@ -18,8 +18,9 @@ scalars s73_timber_prod_cost_wood Cost for producing one unit of wood (USD per tDM) / 120 / s73_timber_prod_cost_woodfuel Cost for prodcing one unit of woodfuel (USD per tDM) / 60 / s73_free_prod_cost Very high cost for settling demand without production (USD per tDM) /20000/ - s73_timber_demand_switch Logical switch to turn on or off timber demand 1=on 0=off (1) / 0 / - s73_foresight Boolean switch for establishment demand assumption 1=forward looking 0=myopic (1) / 0 / + s73_timber_demand_switch Logical switch to turn on or off timber demand 1=on 0=off (1) / 1 / + s73_foresight Boolean switch for establishment demand assumption 1=forward looking 0=myopic (1) / 1 / + s73_demand_multiplier_hist Multiplier used in historic period to obtain the same future demand in all scenarios / 1.2 / s73_increase_ceiling Limiter for not allowing a demand jump between time steps beyond a certain limit (1) /1.025/ s73_residue_ratio Proportion of overall industrial roundwood production which ends up as residue during harvest (1) / 0.15/ sm_wood_density Representative wood density based on IPCC (tDM per m3) /0.6/ diff --git a/modules/73_timber/default/preloop.gms b/modules/73_timber/default/preloop.gms index f871c7cede..4b1e5b8157 100644 --- a/modules/73_timber/default/preloop.gms +++ b/modules/73_timber/default/preloop.gms @@ -95,4 +95,4 @@ im_timber_prod_cost("wood") = s73_timber_prod_cost_wood; im_timber_prod_cost("woodfuel") = s73_timber_prod_cost_woodfuel; * initialize values for presolve of other modules -pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry) * 1.2; +pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry) * s73_foresight_multiplier_hist; diff --git a/modules/73_timber/default/presolve.gms b/modules/73_timber/default/presolve.gms index 8c78d44eec..c5709043ea 100644 --- a/modules/73_timber/default/presolve.gms +++ b/modules/73_timber/default/presolve.gms @@ -11,7 +11,7 @@ if(s73_foresight=1, if(m_year(t) <= sm_fix_SSP2, - pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry) * 1.2; + pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry) * s73_foresight_multiplier_hist; else pm_demand_forestry_future(t,i,kforestry) = sum(t_ext$(t_ext.pos = t.pos + pm_representative_rotation(t,i)),pm_demand_ext(t_ext,i,kforestry)); ); From 7eb17fe9534a0284adf8161fa56f42ecc10b26d2 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Fri, 10 May 2024 16:06:07 +0200 Subject: [PATCH 130/280] added combination of non-food mitigation mesaures scenario --- scripts/start/projects/project_EAT2p0_DeepDive.R | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index 13c3a25c51..4a4a749201 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -242,6 +242,19 @@ cfg <- bau(cfg = cfg) cfg <- priceNonCO2(cfg = cfg) start_run(cfg, codeCheck = FALSE) + +# BAU_MIT # +# All production-side land-based mitigation measures +cfg$title <- "BAU_MIT" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_lessSus")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation (CO2, non-CO2, bioenergy) +cfg <- miti(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + + # MITI_Diet (mitigation - PHD) # # All production-side land-based mitigation measures, but no demand-side mitigation (diet change) cfg$title <- "MITI_Diet" From 2c61aa6003c876ad6d6dad70363dc45d20a8ca74 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 11 May 2024 19:39:40 +0200 Subject: [PATCH 131/280] update --- modules/60_bioenergy/1stgen_priced_dec18/preloop.gms | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/60_bioenergy/1stgen_priced_dec18/preloop.gms b/modules/60_bioenergy/1stgen_priced_dec18/preloop.gms index 0a914aae3f..f92a9a2590 100644 --- a/modules/60_bioenergy/1stgen_priced_dec18/preloop.gms +++ b/modules/60_bioenergy/1stgen_priced_dec18/preloop.gms @@ -22,6 +22,10 @@ $elseif "%c60_2ndgen_biodem%" == "emulator" i60_bioenergy_dem(t,i) = f60_bioenergy_dem_emulator(t)/card(i); $elseif "%c60_2ndgen_biodem%" == "none" i60_bioenergy_dem(t,i) = 0; +** Harmonize till 2020 if not coupled or emulator +loop(t$(m_year(t) <= sm_fix_SSP2), + i60_bioenergy_dem(t,i) = f60_bioenergy_dem(t,i,"R32M46-SSP2EU-NPi"); +); $else i60_bioenergy_dem(t,i) = f60_bioenergy_dem(t,i,"%c60_2ndgen_biodem%") * p60_region_BE_shr(t,i) + f60_bioenergy_dem(t,i,"%c60_2ndgen_biodem_noselect%") * (1-p60_region_BE_shr(t,i)); From 02af343236f5811d0e582707016f432656de258a Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 13 May 2024 10:27:13 +0200 Subject: [PATCH 132/280] adde s30_betr_start --- config/default.cfg | 32 ++++++++++--------- modules/29_cropland/detail_apr24/input.gms | 4 +-- modules/30_croparea/detail_apr24/input.gms | 3 +- modules/30_croparea/detail_apr24/presolve.gms | 3 +- modules/30_croparea/simple_apr24/input.gms | 3 +- modules/30_croparea/simple_apr24/presolve.gms | 3 +- 6 files changed, 27 insertions(+), 21 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 4ee81e75b5..8ec6a06f71 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -717,17 +717,17 @@ cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, f # *** Options only available for `detail_apr24` realization *** -# * Minimum cluster share of treecover on total cropland area (including croparea, fallow land and tree cover). -# * s29_treecover_target is faded in linearly between s29_treecover_scenario_start and s29_treecover_scenario_target. +# * Sigmoid fader for minimum area share of treecover on total cropland at cluster level +# * Minimum area share of treecover on total cropland in target year cfg$gms$s29_treecover_target <- 0 # def = 0 # * Avoid loss of existing treecover (1=yes 0=no). # * If set to 1, `s29_treecover_target` will be adjusted based existing treecover area. cfg$gms$s29_treecover_keep <- 1 # def = 1 # * Maximum share of treecover on total cropland (1) cfg$gms$s29_treecover_max <- 0.4 # def = 0.4 -# * Start year of tree cover share fade-in: +# * Start year of fader cfg$gms$s29_treecover_scenario_start <- 2020 # def = 2020 -# * Target year (year when full implementation is reached): +# * Target year of fader (year when full implementation is reached) cfg$gms$s29_treecover_scenario_target <- 2050 # def = 2050 # * Penalty for violation of treecover target before scenario start (USD05MER per ha) cfg$gms$s29_treecover_penalty_before <- 2000 # def = 2000 @@ -738,16 +738,16 @@ cfg$gms$s29_cost_treecover_est <- 2000 # def = 2000 # * Tree cover recurring cost (USD05MER per ha) cfg$gms$s29_cost_treecover_recur <- 500 # def = 500 -# * Minimum cluster share of fallow land on total cropland area (including croparea, fallow land and tree cover). -# * s29_fallow_target is faded in linearly between s29_fallow_scenario_start and s29_fallow_scenario_target. +# * Sigmoid fader for minimum area share of fallow land on total cropland at cluster level +# * Minimum area share of fallow land on total cropland in target year cfg$gms$s29_fallow_target <- 0 # def = 0 -# * Maximum share of fallow land on total cropland (1) +# * Maximum share of fallow land on total cropland cfg$gms$s29_fallow_max <- 0.4 # def = 0.4 -# * Start year of tree cover share fade-in: +# * Start year of fader cfg$gms$s29_fallow_scenario_start <- 2020 # def = 2020 -# * Target year (year when full implementation is reached): +# * Target year of fader (year when full implementation is reached) cfg$gms$s29_fallow_scenario_target <- 2050 # def = 2050 -# * Penalty for violation of fallow target (USD05MER per ha) +# * Penalty for violation of fallow land target (USD05MER per ha) cfg$gms$s29_fallow_penalty <- 500 # def = 500 # ***--------------------- 30_croparea --------------------------------------- @@ -764,14 +764,16 @@ cfg$gms$c30_bioen_type <- "all" # def = "all" # * (c30_bioen_water): switch for irrigation of bioenergy crops; options: rainfed, irrigated, all cfg$gms$c30_bioen_water <- "rainfed" # def = "rainfed" -# * Minimum cluster share of bioenergy trees (betr) on total cropland area -# * s30_betr_target is faded in linearly between s30_betr_scenario_start and s30_betr_scenario_target. +# * Sigmoid fader for minimum area share of bioenergy trees (betr) on total cropland at cluster level +# * Minimum area share of bioenergy trees on total cropland in start year +cfg$gms$s30_betr_start <- 0 # def = 0 +# * Minimum area share of bioenergy trees on total cropland in target year cfg$gms$s30_betr_target <- 0 # def = 0 -# * Start year of tree cover share fade-in: +# * Start year of fader cfg$gms$s30_betr_scenario_start <- 2020 # def = 2020 -# * Target year (year when full implementation is reached): +# * Target year of fader (year when full implementation is reached) cfg$gms$s30_betr_scenario_target <- 2050 # def = 2050 -# * Penalty for violation of fallow target (USD05MER per ha) +# * Penalty for violation of the target (USD05MER per ha) cfg$gms$s30_betr_penalty <- 2000 # def = 2000 # *** Options only available for `simple_apr24` realization *** diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms index ad9fa127b3..50b306a32c 100644 --- a/modules/29_cropland/detail_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -21,14 +21,14 @@ scalars s29_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 / s29_treecover_scenario_start Cropland treecover scenario start year / 2020 / s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / - s29_treecover_target Target share of treecover on total cropland (1) / 0 / + s29_treecover_target Minimum share of treecover on total cropland in target year (1) / 0 / s29_treecover_keep Avoid loss of existing treecover (1=yes 0=no) / 1 / s29_treecover_max Maximum share of treecover on total cropland (1) / 0.4 / s29_treecover_penalty_before Penalty for violation of treecover target before scenario start (USD05MER per ha) / 2000 / s29_treecover_penalty Penalty for violation of treecover target after sceanrio start (USD05MER per ha) / 2000 / s29_fallow_scenario_start Fallow land scenario start year / 2020 / s29_fallow_scenario_target Fallow land scenario target year / 2050 / - s29_fallow_target Target share of fallow land on total cropland (1) / 0 / + s29_fallow_target Minimum share of fallow land on total cropland in target year (1) / 0 / s29_fallow_max Maximum share of fallow land on total cropland (1) / 0.4 / s29_fallow_penalty Penalty for violation of fallow target (USD05MER per ha) / 500 / ; diff --git a/modules/30_croparea/detail_apr24/input.gms b/modules/30_croparea/detail_apr24/input.gms index 4923074708..193e36dd93 100644 --- a/modules/30_croparea/detail_apr24/input.gms +++ b/modules/30_croparea/detail_apr24/input.gms @@ -25,7 +25,8 @@ scalars s30_implementation Switch for rule-based (1) or penalty-based (0) implementation of rotation scenarios / 1 / s30_betr_scenario_start Bioenergy land scenario start year / 2020 / s30_betr_scenario_target Bioenergy land scenario target year / 2050 / - s30_betr_target Target share of bioenergy land on total cropland (1) / 0 / + s30_betr_start Share of bioenergy land on total cropland in start year (1) / 0 / + s30_betr_target Share of bioenergy land on total cropland in target year (1) / 0 / s30_betr_penalty Penalty for violation of betr target (USD05MER per ha) / 2000 / ; diff --git a/modules/30_croparea/detail_apr24/presolve.gms b/modules/30_croparea/detail_apr24/presolve.gms index 4a028ffad2..a5f6187a7d 100644 --- a/modules/30_croparea/detail_apr24/presolve.gms +++ b/modules/30_croparea/detail_apr24/presolve.gms @@ -31,7 +31,8 @@ else ); * create betr target and penalty scenario -i30_betr_target(t) = s30_betr_target * i30_betr_scenario_fader(t); +i30_betr_target(t) = s30_betr_start * (1-i30_betr_scenario_fader(t)) + + s30_betr_target * i30_betr_scenario_fader(t); if (m_year(t) <= s30_betr_scenario_start, i30_betr_penalty(t) = 0; diff --git a/modules/30_croparea/simple_apr24/input.gms b/modules/30_croparea/simple_apr24/input.gms index ac6585c0ca..e8b9768473 100644 --- a/modules/30_croparea/simple_apr24/input.gms +++ b/modules/30_croparea/simple_apr24/input.gms @@ -19,7 +19,8 @@ scalars s30_rotation_scenario_target Rotation scenario target year / 2050 / s30_betr_scenario_start Bioenergy land scenario start year / 2020 / s30_betr_scenario_target Bioenergy land scenario target year / 2050 / - s30_betr_target Target share of bioenergy land on total cropland (1) / 0 / + s30_betr_start Share of bioenergy land on total cropland in start year (1) / 0 / + s30_betr_target Share of bioenergy land on total cropland in target year (1) / 0 / s30_betr_penalty Penalty for violation of betr target (USD05MER per ha) / 2000 / ; diff --git a/modules/30_croparea/simple_apr24/presolve.gms b/modules/30_croparea/simple_apr24/presolve.gms index fb57b1d9f4..23c3194651 100644 --- a/modules/30_croparea/simple_apr24/presolve.gms +++ b/modules/30_croparea/simple_apr24/presolve.gms @@ -24,7 +24,8 @@ crpmax30(crp30) = yes$(f30_rotation_max_shr(crp30) < 1); crpmin30(crp30) = yes$(f30_rotation_min_shr(crp30) > 0); * create betr target and penalty scenario -i30_betr_target(t) = s30_betr_target * i30_betr_scenario_fader(t); +i30_betr_target(t) = s30_betr_start * (1-i30_betr_scenario_fader(t)) + + s30_betr_target * i30_betr_scenario_fader(t); if (m_year(t) <= s30_betr_scenario_start, i30_betr_penalty(t) = 0; From 79d9e72c60564667e0e39d3f85ead0aba2365cc9 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Mon, 13 May 2024 17:32:14 +0200 Subject: [PATCH 133/280] separated forest establishment and secondary forest recovery equations --- core/sets.gms | 3 -- .../pot_forest_may24/declarations.gms | 3 +- .../35_natveg/pot_forest_may24/equations.gms | 35 ++++++++++--------- .../35_natveg/pot_forest_may24/presolve.gms | 22 ++++++++---- modules/35_natveg/pot_forest_may24/sets.gms | 2 ++ 5 files changed, 37 insertions(+), 28 deletions(-) diff --git a/core/sets.gms b/core/sets.gms index 407cc57255..9646116aa8 100644 --- a/core/sets.gms +++ b/core/sets.gms @@ -250,9 +250,6 @@ sets land_forest(land) Forested land pools / forestry, primforest, secdforest / - land_noforest(land) Non-forest land pools - / crop, past, urban, other / - land_timber(land) land from which timber can be taken away / forestry, primforest, secdforest, other / diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index b027d86da0..5660c08646 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -19,7 +19,8 @@ parameters p35_min_forest(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_damage_fader(t_all) Fader for forest damage (1) - p35_max_forest_recovery(j) Forest recovery potential (mio. ha) + p35_max_secdforest_recovery(j) Secondary forest recovery potential (mio. ha) + p35_max_forest_establishment(j) Overall forest establishment potential (mio. ha) p35_carbon_density_secdforest(t,j,ac,ag_pools) Carbon density secdforest (tC per ha) p35_carbon_density_other(t,j,ac,ag_pools) Carbon density other land (tC per ha) p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 815ccdad9b..4206ec790d 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -181,11 +181,29 @@ q35_hvarea_other(j2,ac_sub).. v35_other_reduction(j2,ac_sub); +*' The constraint for overall forest establishment is given by the +*' remaining potential forest area, which is derived from +*' the potential natural forest area in each cluster. + +q35_max_forest_expansion(j2).. + sum(land_forest, vm_landexpansion(j2,land_forest)) + =l= + p35_max_forest_establishment(j2) + ; + *' Harvested secondary forest is still considered secondary forests due to *' restrictive NPI definitions. Also primary forest harvested will be considered *' to be secondary forest i.e., harvested primary forest gets reclassified as *' secondary forest and ends up in the youngest age-class (and follows regrowth) +q35_secdforest_recovery_area(j2).. + v35_secdforest_recovery_area(j2) + =e= + + p35_max_secdforest_recovery(j2) + * (sum(land_recovery35,vm_landreduction(j2,land_recovery35))/ + (sum(land_recovery35,pcm_land(j2,land_recovery35))+1e-10)) + ; + q35_secdforest_regeneration(j2).. sum(ac_est, v35_secdforest(j2,ac_est)) =e= @@ -195,23 +213,6 @@ q35_secdforest_regeneration(j2).. + v35_secdforest_recovery_area(j2) ; -q35_secdforest_recovery_area(j2).. - v35_secdforest_recovery_area(j2) - =e= - + (p35_max_forest_recovery(j2) - p35_land_restoration(j2,"secdforest")) - * (sum(land_noforest,vm_landreduction(j2,land_noforest))/(sum(land_noforest,vm_land(j2,land_noforest))+1e-10)) - + vm_landreduction(j2,"forestry"); - -*' The constraint for forest establishment is given by the -*' remaining potential forest area, which was calculated based -*' on the potential natural forest area in each cluster. - -q35_max_forest_expansion(j2).. - sum(land_forest, vm_landexpansion(j2,land_forest)) - =l= - p35_max_forest_recovery(j2) - ; - *' Harvested other land is still considered other land q35_other_regeneration(j2).. diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index ce39680935..e3fc9c3c4d 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -74,14 +74,19 @@ vm_land.l(j,"other") = sum(ac, pc35_other(j,ac)); pcm_land(j,"other") = sum(ac, pc35_other(j,ac)); * -------------------------------------- -* Secondary forest recovery bound +* Secondary forest establishment bound * -------------------------------------- -* Forest recovery is constrained by the potential forest area in each cluster. -* Hence, the potential area for forest recovery is given by the potential forest +* Overall forest establishment is constrained by the potential forest area in each cluster. +* Hence, the potential area for any forest expansion is given by the potential forest * area minus all forest areas in the previous time step. -p35_max_forest_recovery(j) = fm_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); -p35_max_forest_recovery(j)$(p35_max_forest_recovery(j) < 0) = 0; +p35_max_forest_establishment(j) = fm_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); +p35_max_forest_establishment(j)$(p35_max_forest_establishment(j) < 0) = 0; + +* The secondary forest recovery potential also includes forestry areas. +* Therefore they are not substracted. +p35_max_secdforest_recovery(j) = fm_pot_forest_area(j)-pcm_land(j,"primforest")-pcm_land(j,"secdforest"); +p35_max_secdforest_recovery(j)$(p35_max_secdforest_recovery(j) < 0) = 0; * ------------------------------------- * Set bounds based on land conservation @@ -134,12 +139,15 @@ p35_land_restoration(j,"secdforest") = pm_land_conservation(t,j,"secdforest","re * land area meets the total natural land conservation target p35_land_restoration(j,"secdforest")$(sum(land_natveg, pcm_land(j,land_natveg)) >= sum((land_natveg, consv_type), pm_land_conservation(t,j,land_natveg,consv_type))) = 0; -* Since forest restoration cannot be bigger than the maximum area for forest recovery, +* Since forest restoration cannot be bigger than the potential area for secdforest recovery, * any remaining restoration area is substracted and shifted to other land restoration. -p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - p35_max_forest_recovery(j); +p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - p35_max_secdforest_recovery(j); p35_restoration_shift(j)$(p35_restoration_shift(j) < 0) = 0; p35_land_restoration(j,"secdforest") = p35_land_restoration(j,"secdforest") - p35_restoration_shift(j); pm_land_conservation(t,j,"other","restore") = pm_land_conservation(t,j,"other","restore") + p35_restoration_shift(j); +* Substract forest restoration area from secondary forest recovery potential +p35_max_secdforest_recovery(j) = p35_max_secdforest_recovery(j) - p35_land_restoration(j,"secdforest"); + * set conservation bound vm_land.lo(j,"secdforest") = pm_land_conservation(t,j,"secdforest","protect") + p35_land_restoration(j,"secdforest"); diff --git a/modules/35_natveg/pot_forest_may24/sets.gms b/modules/35_natveg/pot_forest_may24/sets.gms index 0ad78e215c..45ae03f81d 100644 --- a/modules/35_natveg/pot_forest_may24/sets.gms +++ b/modules/35_natveg/pot_forest_may24/sets.gms @@ -20,6 +20,8 @@ sets pol_stock35 Land types for land protection policies / forest, other / + land_recovery35(land) Natveg recovery land + / crop, past, forestry, urban / shock_scen Scenario name of forest carbon shock / none, 002lin2030,004lin2030,008lin2030,016lin2030 From d69aa50751ded369996080809c78ae8455282132 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Mon, 13 May 2024 17:50:47 +0200 Subject: [PATCH 134/280] minor adjustment --- modules/35_natveg/pot_forest_may24/equations.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 4206ec790d..273be6fce4 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -200,7 +200,7 @@ q35_secdforest_recovery_area(j2).. v35_secdforest_recovery_area(j2) =e= + p35_max_secdforest_recovery(j2) - * (sum(land_recovery35,vm_landreduction(j2,land_recovery35))/ + * (sum((land_recovery35,land_natveg),vm_lu_transitions(j2,land_recovery35,land_natveg))/ (sum(land_recovery35,pcm_land(j2,land_recovery35))+1e-10)) ; From 0eeddcb79552c81a9799fd08ce5572d288b27a51 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Mon, 13 May 2024 18:21:01 +0200 Subject: [PATCH 135/280] further adjustments --- modules/35_natveg/pot_forest_may24/equations.gms | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 273be6fce4..069cb8b0bb 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -200,8 +200,9 @@ q35_secdforest_recovery_area(j2).. v35_secdforest_recovery_area(j2) =e= + p35_max_secdforest_recovery(j2) - * (sum((land_recovery35,land_natveg),vm_lu_transitions(j2,land_recovery35,land_natveg))/ - (sum(land_recovery35,pcm_land(j2,land_recovery35))+1e-10)) + * (sum(land_natveg,vm_landexpansion(j2,land_natveg)) + -sum(land_natveg,p35_land_restoration(j2,land_natveg)))/ + (sum(land_recovery35,pcm_land(j2,land_recovery35))+1e-10) ; q35_secdforest_regeneration(j2).. From 391fd8537596f0d719960092793fe56e6fe5aeb6 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 14 May 2024 15:26:21 +0200 Subject: [PATCH 136/280] corrected typo --- modules/37_labor_prod/exo/sets.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/37_labor_prod/exo/sets.gms b/modules/37_labor_prod/exo/sets.gms index c289793d1a..1a76082620 100644 --- a/modules/37_labor_prod/exo/sets.gms +++ b/modules/37_labor_prod/exo/sets.gms @@ -6,7 +6,7 @@ *** | Contact: magpie@pik-potsdam.de sets - rcp37 climate change impact sceanrios + rcp37 climate change impact scenarios / rcp119, rcp585 / metric37 labor productivity impact metric From acef64e912a71a31967e3e230daf4f3dbcb76255 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 14 May 2024 15:26:45 +0200 Subject: [PATCH 137/280] updated Deep Dive scenarios: additional stacked decomposition scenarios --- config/scenario_config.csv | 2 +- .../start/projects/project_EAT2p0_DeepDive.R | 305 +++++++++++++----- 2 files changed, 221 insertions(+), 86 deletions(-) diff --git a/config/scenario_config.csv b/config/scenario_config.csv index 25d7930f35..f19bc99231 100755 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -87,4 +87,4 @@ gms$c52_land_carbon_sink_rcp;;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c57_macc_version;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PBL_2022;PBL_2022;PBL_2022;PBL_2022;;;;;;;;;;;;;;; gms$c57_macc_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Default;Optimistic;Default;Optimistic;;;;;;;;;;;;;;; gms$s58_rewetting_switch;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0;1;0;1;;;;;;;;;;;;;;; -magicc_emis_scen;;;;;;;;;;;;;;;;;;;;;;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif;;;;;;;;;;;;;;;;;;;;;;;; +magicc_emis_scen;;;;;;;;;;;;;;;;;;;;;;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index 4a4a749201..2766a21253 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -44,7 +44,7 @@ cfg$output <- c( ####################### # SCENARIO DEFINITION # ####################### -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) # To Do: Choose whether EL2_default or EL2_lessSus should be used! +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) # Note: The climate change impacts setting differs from the global AgMIP model comparision set-up. # We do not include climate change impacts in the coupled REMIND-MAgPIE runs for the PB Deep Dive # because we focus exclusively on the mitigation aspect without climate change impacts. @@ -61,11 +61,11 @@ cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) # To Do: C bau <- function(cfg) { ### Components for Decomposition ### # Diets: exogenous EATLancet diet - cfg$gms$s15_exo_diet <- 0 # default + cfg$gms$s15_exo_diet <- 0 # default cfg$gms$c15_kcal_scen <- "healthy_BMI" # default (but not active b/c of s15_exo_diet = 0) - cfg$gms$c15_EAT_scen <- "FLX" # default (but not active b/c of s15_exo_diet = 0) + cfg$gms$c15_EAT_scen <- "FLX" # default (but not active b/c of s15_exo_diet = 0) # Waste: half food waste - cfg$gms$s15_exo_waste <- 0 # default + cfg$gms$s15_exo_waste <- 0 # default cfg$gms$s15_waste_scen <- 1.2 # default (but not active b/c of s15_exo_waste = 0) # Default interest rate (for default productivity) cfg$gms$s12_interest_lic <- 0.1 # default @@ -73,20 +73,14 @@ bau <- function(cfg) { # Default livestock productivity cfg$gms$c70_feed_scen <- "ssp2" # default # Mitigation: no mitigation beyond NPi - cfg$gms$c56_emis_policy <- "none" - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-Npi_nonSus-rem-5/REMIND_generic_C_SSP2EU-Npi_nonSus-rem-5.mif" + cfg$gms$c56_emis_policy <- "none" + cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-Npi-rem-5/REMIND_generic_C_SSP2EU-Npi-rem-5.mif" cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-Npi_nonSus-rem-5/REMIND_generic_C_SSP2EU-Npi_nonSus-rem-5.mif" - cfg$gms$c60_2ndgen_biodem <- "coupling" - - ### Deactivate certain sustainability standard settings - # bioenergy plantations can be irrigated - cfg$gms$c30_bioen_water <- "all" - # forest plantations allowed for afforestation under ghg price - cfg$gms$s32_aff_plantation <- 1 + cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-Npi-rem-5/REMIND_generic_C_SSP2EU-Npi-rem-5.mif" + cfg$gms$c60_2ndgen_biodem <- "coupling" # Setting REMIND scenario for blackmagicc - cfg$magicc_emis_scen <- "SSP2EU-DSPkB650-DS_betax" + cfg$magicc_emis_scen <- "REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" return(cfg) } @@ -128,9 +122,9 @@ waste <- function(cfg) { # starting from 2020 and diet shift. miti <- function(cfg) { # Mitigation: consistent with 1.5C considering Diet change - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif" + cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif" + cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" cfg$gms$c60_2ndgen_biodem <- "coupling" # ecoSysProtAll: (Above ground CO2 emis from LUC in forest, forestry, natveg; All types of emis from peatland; All CH4 and N2O emis), cfg$gms$c56_emis_policy <- "ecoSysProtAll" @@ -141,7 +135,7 @@ miti <- function(cfg) { # Bioenergy demand only. No carbon price on land included. bioenergy <- function(cfg) { # Mitigation: only Bioenergy demand from coupled REMIND-MAgPIE run where 1.5 is reached with ghg prices on land and considering diet shift - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif" + cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" cfg$gms$c60_2ndgen_biodem <- "coupling" return(cfg) @@ -151,7 +145,7 @@ bioenergy <- function(cfg) { priceCO2 <- function(cfg) { # Mitigation: only price land CO2 cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif" + cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" #### double-check Florian return(cfg) @@ -161,7 +155,7 @@ priceCO2 <- function(cfg) { priceNonCO2 <- function(cfg) { # Mitigation: only CH4 and N2O price cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_nonSus-rem-5.mif" + cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" cfg$gms$c56_emis_policy <- "ecoSysProtOff" ### double-check Florian return(cfg) @@ -172,111 +166,137 @@ priceNonCO2 <- function(cfg) { # SCENARIO RUNS # ################# # BAU # -# Business as usual scenario based on SSP2 +# Business as usual scenario based on SSP2 (NPis) cfg$title <- "BAU_NPi" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) start_run(cfg, codeCheck = FALSE) +### Composition ### +# Mitigation components: +# (1a) Nationally Determined Contributions (NDCs) cfg$title <- "BAU_NDC" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_lessSus")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) cfg <- bau(cfg = cfg) # set path to bioenergy and prices to NDC run -cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NDC_nonSus-rem-5/REMIND_generic_C_SSP2EU-NDC_nonSus-rem-5.mif" +cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NDC-rem-5/REMIND_generic_C_SSP2EU-NDC-rem-5.mif" cfg$gms$c56_pollutant_prices <- "coupling" -cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NDC_nonSus-rem-5/REMIND_generic_C_SSP2EU-NDC_nonSus-rem-5.mif" +cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NDC-rem-5/REMIND_generic_C_SSP2EU-NDC-rem-5.mif" cfg$gms$c60_2ndgen_biodem <- "coupling" start_run(cfg, codeCheck = FALSE) -# BAU + EL2-Diet # -# Decomposition scenario. -# Globally achieves EL2 (Diet+Waste+Prod) by 2050 -cfg$title <- "BAU_PHD" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) +# (1b) BAU + Bioenergy # +# Decomposition Scenario. Adds bioenergy demand from coupled run with land-use policies consistent with 1.5C by 2050 to BAU +cfg$title <- "BAU_Bioenergy" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) -cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) -cfg <- waste(cfg = cfg) +cfg <- bioenergy(cfg = cfg) start_run(cfg, codeCheck = FALSE) -cfg$title <- "BAU_Diet" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) +# (1c) BAU + NonCO2 pricing in land sector # +# Decomposition Scenario. Adds non-CO2 pricing with ghg price from coupled run with land-use policies consistent with 1.5C by 2050 to BAU +cfg$title <- "BAU_NonCO2" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) -cfg <- diet(cfg = cfg) +cfg <- priceNonCO2(cfg = cfg) start_run(cfg, codeCheck = FALSE) -cfg$title <- "BAU_Prod" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) +# (1d) BAU + pricing of CO2 in land sector # +# Decomposition Scenario. Adds CO2 pricing on land-use change emissions with ghg price from coupled run with land-use policies consistent with 1.5C by 2050 to BAU +cfg$title <- "BAU_CO2" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) -cfg <- prod(cfg = cfg) +cfg <- priceCO2(cfg = cfg) start_run(cfg, codeCheck = FALSE) -cfg$title <- "BAU_Waste" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) +# (1a,b,c,d) BAU_MIT # +# All production-side land-based mitigation measures +cfg$title <- "BAU_Miti" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings cfg <- bau(cfg = cfg) -cfg <- waste(cfg = cfg) +# Mitigation (CO2, non-CO2, bioenergy) +cfg <- miti(cfg = cfg) start_run(cfg, codeCheck = FALSE) +# BAU + EL2-Diet # +# PHD components: +# (1e) Productivity +cfg$title <- "BAU_Prod" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +cfg <- bau(cfg = cfg) +cfg <- prod(cfg = cfg) +start_run(cfg, codeCheck = FALSE) -# BAU + Bioenergy # -# Decomposition Scenario. Adds bioenergy demand from coupled run with land-use policies consistent with 1.5C by 2050 to BAU -cfg$title <- "BAU_Bioenergy" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) +# (1f) Waste +cfg$title <- "BAU_Waste" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) -cfg <- bioenergy(cfg = cfg) +cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# BAU + pricing of CO2 in land sector # -# Decomposition Scenario. Adds CO2 pricing on land-use change emissions with ghg price from coupled run with land-use policies consistent with 1.5C by 2050 to BAU -cfg$title <- "BAU_CO2" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) +# (1g) Diet change +cfg$title <- "BAU_Diet" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) -cfg <- priceCO2(cfg = cfg) +cfg <- diet(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# BAU + NonCO2 pricing in land sector # -# Decomposition Scenario. Adds non-CO2 pricing with ghg price from coupled run with land-use policies consistent with 1.5C by 2050 to BAU -cfg$title <- "BAU_NonCO2" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_lessSus")) +# (1e,f,g) All Globally achieves EL2 (Diet+Waste+Prod) by 2050 +cfg$title <- "BAU_PHD" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) -cfg <- priceNonCO2(cfg = cfg) +cfg <- diet(cfg = cfg) +cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# BAU_MIT # -# All production-side land-based mitigation measures -cfg$title <- "BAU_MIT" +### Single measure Decomposition ### +# (2a) MITI_NDC # +# All production-side land-based mitigation measures and demand-side mitigation (diet change), but no NDCs +cfg$title <- "MITI_NDC" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_lessSus")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation (CO2, non-CO2, bioenergy) cfg <- miti(cfg = cfg) +# PHD (diet, prod, waste) +cfg <- diet(cfg = cfg) +cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) - -# MITI_Diet (mitigation - PHD) # -# All production-side land-based mitigation measures, but no demand-side mitigation (diet change) -cfg$title <- "MITI_Diet" +# MITI_Bioenergy (mitigation - bioenergy) # +# (2b) CO2 and non-CO2 pricing and demand-side mitigation (diet change), but no bioenergy demand from REMIND +cfg$title <- "MITI_Bioenergy" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_lessSus")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation cfg <- miti(cfg = cfg) +cfg$gms$c60_2ndgen_biodem <- "coupling" +cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-Npi-rem-5/REMIND_generic_C_SSP2EU-Npi-rem-5.mif" +# PHD +cfg <- diet(cfg = cfg) +cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# MITI_Bioenergy (mitigation - bioenergy) # -# CO2 and non-CO2 pricing and demand-side mitigation (diet change), but no bioenergy demand from REMIND -cfg$title <- "MITI_Bioenergy" +# MITI_nonCO2 (mitigation - non-CO2) # +# (2c) CO2 pricing and bioenergy demand from REMIND and demand-side mitigation (diet change), but no non-CO2 pricing in land-system +cfg$title <- "MITI_nonCO2" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_lessSus")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation cfg <- miti(cfg = cfg) -cfg$gms$c60_2ndgen_biodem <- "coupling" -cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-Npi_nonSus-rem-5/REMIND_generic_C_SSP2EU-Npi_nonSus-rem-5.mif" +# ecoSysProtAll_agMgmtOff: (Above ground CO2 emis from LUC in forest, forestry, natveg; All types of emis from peatland; No further CH4/N2O/other emis related to ag. management) +cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" # PHD cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) @@ -284,10 +304,10 @@ cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) # MITI_CO2 (mitigation - CO2) # -# non-CO2 pricing and bioenergy demand from REMIND and demand-side mitigation (diet change), but no CO2 pricing in land-system +# (2d) non-CO2 pricing and bioenergy demand from REMIND and demand-side mitigation (diet change), but no CO2 pricing in land-system cfg$title <- "MITI_CO2" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_lessSus")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation @@ -300,28 +320,143 @@ cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# MITI_nonCO2 (mitigation - non-CO2) # -# CO2 pricing and bioenergy demand from REMIND and demand-side mitigation (diet change), but no non-CO2 pricing in land-system -cfg$title <- "MITI_nonCO2" +# MITI_MITI # +# (2a,b,c,d) All demand-side mitigation (PHD, but no other miti measures) +cfg$title <- "MITI_Miti" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_lessSus")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) # BAU settings cfg <- bau(cfg = cfg) -# Mitigation +# PHD (diet, prod, waste) +cfg <- diet(cfg = cfg) +cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + + +# MITI_Prod # +# (2e) All production-side land-based mitigation measures and demand-side mitigation without Prod +cfg$title <- "MITI_Prod" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation (CO2, non-CO2, bioenergy) cfg <- miti(cfg = cfg) -# ecoSysProtAll_agMgmtOff: (Above ground CO2 emis from LUC in forest, forestry, natveg; All types of emis from peatland; No further CH4/N2O/other emis related to ag. management) -cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" -# PHD +# PHD (diet, prod, waste) +cfg <- diet(cfg = cfg) +cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +# MITI_Waste # +# (2f) All production-side land-based mitigation measures and demand-side mitigation without Waste +cfg$title <- "MITI_Waste" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation (CO2, non-CO2, bioenergy) +cfg <- miti(cfg = cfg) +# PHD (diet, prod, waste) cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +# MITI_Diet # +# (2g) All production-side land-based mitigation measures and demand-side mitigation without Diet +cfg$title <- "MITI_Diet" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation (CO2, non-CO2, bioenergy) +cfg <- miti(cfg = cfg) +# PHD (diet, prod, waste) +cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# MITI_Full # +# MITI_PHD (mitigation - PHD) # +# (2e,f,g) All production-side land-based mitigation measures, but no demand-side mitigation (PHD) +cfg$title <- "MITI_PHD" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation +cfg <- miti(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +### Stacked Decomposition ### +# (3a) Stacked 0: BAU_NPi (see above) + +# (3b) Stacked 1: BAU_NDC (see above) + +# (3c) Stacked 2: BAU_NDC_Bioenergy +cfg$title <- "Stacked2" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation (bioenergy) +cfg <- bioenergy(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +# (3d) Stacked 3: BAU_NDC_Bioenergy_nCO2 +cfg$title <- "Stacked3" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation (non-CO2, bioenergy) +cfg <- bioenergy(cfg = cfg) +cfg <- priceNonCO2(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +# (3e) Stacked 4: BAU_NDC_Bioenergy_nCO2_CO2 +cfg$title <- "Stacked4" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation (CO2, non-CO2, bioenergy) +cfg <- miti(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +# (3f) Stacked 5: BAU_NDC_Bioenergy_nCO2_CO2_prod +cfg$title <- "Stacked5" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation (CO2, non-CO2, bioenergy) +cfg <- miti(cfg = cfg) +# PHD (diet, prod, waste) +cfg <- prod(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +# (3g) Stacked 6: BAU_NDC_Bioenergy_nCO2_CO2_prod_waste +cfg$title <- "Stacked6" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation (CO2, non-CO2, bioenergy) +cfg <- miti(cfg = cfg) +# PHD (diet, prod, waste) +cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) +start_run(cfg, codeCheck = FALSE) + +# (3h) Stacked 7: BAU_NDC_Bioenergy_nCO2_CO2_prod_waste_diet (same as MITI_All, see below) + +### All measures ### +# MITI_All # # All production-side land-based mitigation measures and demand-side mitigation (diet change) -cfg$title <- "MITI_Full" +cfg$title <- "MITI_All" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_lessSus")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation (CO2, non-CO2, bioenergy) From f37813281befd1fd13ca073cfdd85c0609803ed5 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 14 May 2024 16:11:45 +0200 Subject: [PATCH 138/280] corrected spelling mistake in path to NPi run --- scripts/start/projects/project_EAT2p0_DeepDive.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index 2766a21253..e3a99db043 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -74,9 +74,9 @@ bau <- function(cfg) { cfg$gms$c70_feed_scen <- "ssp2" # default # Mitigation: no mitigation beyond NPi cfg$gms$c56_emis_policy <- "none" - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-Npi-rem-5/REMIND_generic_C_SSP2EU-Npi-rem-5.mif" + cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-Npi-rem-5/REMIND_generic_C_SSP2EU-Npi-rem-5.mif" + cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" cfg$gms$c60_2ndgen_biodem <- "coupling" # Setting REMIND scenario for blackmagicc @@ -279,7 +279,7 @@ cfg <- bau(cfg = cfg) # Mitigation cfg <- miti(cfg = cfg) cfg$gms$c60_2ndgen_biodem <- "coupling" -cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-Npi-rem-5/REMIND_generic_C_SSP2EU-Npi-rem-5.mif" +cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" # PHD cfg <- diet(cfg = cfg) cfg <- prod(cfg = cfg) From cb53c56c6ec8b164a9fd5537ee0a0437b02bee91 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Wed, 15 May 2024 14:51:00 +0200 Subject: [PATCH 139/280] updated physical activity level in EL2 diet settings --- config/scenario_config.csv | 2 +- scripts/start/projects/project_EAT2p0.R | 5 ++++- scripts/start/projects/project_EAT2p0_DeepDive.R | 4 +++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config/scenario_config.csv b/config/scenario_config.csv index f19bc99231..ed59c7ac38 100755 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -1,7 +1,7 @@ ;cc;nocc;nocc_hist;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SDP;SDP-EI;SDP-RC;SDP-MC;BASE;NPI;NDC;coupling;emulator;input;Tland;eat_lancet_diet;EL2_Diet;EL2_default;EL2_lessSus;LAMA_Inequal;LAMA_Inequal-SustDemand;LAMA_Inequal-EnvirProt;LAMA_Inequal-GHGPrice;LAMA_Sustainability;NAVIGATE_AllOff;NAVIGATE_LandSup;NAVIGATE_LandDem;NAVIGATE_AllOn;ForestryEndo;ForestryExo;ForestryOff;frst_shock_none;frst_shock_002lin2030;frst_shock_004lin2030;frst_shock_008lin2030;frst_shock_016lin2030;rcp1p9;rcp2p6;rcp4p5;rcp6p0;rcp7p0;rcp8p5;NGFS_o_lowdem gms$c09_pop_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SSP1;SSP1;SSP1;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;; gms$c09_gdp_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SDP_EI;SDP_RC;SDP_MC;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;; -gms$c09_pal_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;; +gms$c09_pal_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;;SDP;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;; gms$s12_interest_lic;;;;;;;;;;;;;;;;;;;;;;0.06;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s12_interest_hic;;;;;;;;;;;;;;;;;;;;;;0.04;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c15_food_scenario;;;;SSP1;SSP2;SSP2;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;SSP2 diff --git a/scripts/start/projects/project_EAT2p0.R b/scripts/start/projects/project_EAT2p0.R index 434b8a0d85..a676bcc4c8 100644 --- a/scripts/start/projects/project_EAT2p0.R +++ b/scripts/start/projects/project_EAT2p0.R @@ -90,8 +90,11 @@ bau <- function(cfg) { ### Diet component ## # Globally achieves EL2 diet by 2050 diet <- function(cfg) { + # Transition towards EL2 food intake recommendations until 2050 cfg$gms$s15_exo_diet <- 3 - + # Physical inactivity levels are reduced to 0 from 2020 to 2050 + cfg$gms$c09_pal_scenario <- "SDP" + return(cfg) } diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index e3a99db043..8f7649b8c7 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -88,8 +88,10 @@ bau <- function(cfg) { ### Diet component ## # Globally achieves EL2 diet by 2050 diet <- function(cfg) { + # Transition towards EL2 food intake recommendations until 2050 cfg$gms$s15_exo_diet <- 3 - + # Physical inactivity levels are reduced to 0 from 2020 to 2050 + cfg$gms$c09_pal_scenario <- "SDP" return(cfg) } From be4d767a0f972cb11d3270e5d3e83b43d20b0857 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 16 May 2024 09:08:16 +0200 Subject: [PATCH 140/280] sync --- CHANGELOG.md | 1 + modules/80_optimization/lp_nlp_apr17/not_used.txt | 2 -- modules/80_optimization/nlp_apr17/not_used.txt | 1 - modules/80_optimization/nlp_par/declarations.gms | 1 - modules/80_optimization/nlp_par/solve.gms | 3 +-- 5 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 modules/80_optimization/lp_nlp_apr17/not_used.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index bd69fe994a..3cbf51ddf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **30_crop** the two realizations `penalty_apr22` and `rotation_apr22` have been merged into a single `30_croparea/detail_apr24` realization - **30_crop** the previous `30_crop/endo_apr21` realization has been moved to `30_croparea/simple_apr24` - **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE, CONOPT4 without preprocessing and CONOPT3. +- **scripts** start/test_runs.R added 2 more test runs from FSEC ### added - **29_cropland** new module `29_cropland` accounting for crop area, fallow cropland and tree cover on cropland with two realizations: `detail_apr24` and `simple_apr24` (default). diff --git a/modules/80_optimization/lp_nlp_apr17/not_used.txt b/modules/80_optimization/lp_nlp_apr17/not_used.txt deleted file mode 100644 index 4dd79412da..0000000000 --- a/modules/80_optimization/lp_nlp_apr17/not_used.txt +++ /dev/null @@ -1,2 +0,0 @@ -name,type,reason -sm_fix_SSP2,input,not needed diff --git a/modules/80_optimization/nlp_apr17/not_used.txt b/modules/80_optimization/nlp_apr17/not_used.txt index 7a59e90855..ea605f3b35 100644 --- a/modules/80_optimization/nlp_apr17/not_used.txt +++ b/modules/80_optimization/nlp_apr17/not_used.txt @@ -1,3 +1,2 @@ name,type,reason vm_landdiff,input,questionnaire -sm_fix_SSP2,input,not needed diff --git a/modules/80_optimization/nlp_par/declarations.gms b/modules/80_optimization/nlp_par/declarations.gms index 1734708bc8..f64f323589 100644 --- a/modules/80_optimization/nlp_par/declarations.gms +++ b/modules/80_optimization/nlp_par/declarations.gms @@ -16,6 +16,5 @@ parameters scalars s80_counter counter (1) - s80_objective objective function value (mio. USD05MER per yr) s80_resolve_option option for resolve (1) ; diff --git a/modules/80_optimization/nlp_par/solve.gms b/modules/80_optimization/nlp_par/solve.gms index 64beff7501..e4478be1e6 100644 --- a/modules/80_optimization/nlp_par/solve.gms +++ b/modules/80_optimization/nlp_par/solve.gms @@ -59,10 +59,9 @@ repeat loop(i2, j2(j)$cell(i2,j) = yes); display h2; s80_counter = sum(h2,p80_counter(h2)); - s80_objective = sum(i2,v11_cost_reg.l(i2)); display s80_counter; display magpie.modelStat; - display s80_objective; + display vm_cost_glo.l; magpie.modelStat$(magpie.modelStat=NA) = 13; p80_modelstat(t,h) = magpie.modelStat; From 7ff33c06a82041f80a4c9ea05dde9927dd013b43 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 16 May 2024 09:43:25 +0200 Subject: [PATCH 141/280] resovled merge conflicts --- .../pot_forest_may24/declarations.gms | 6 +- .../35_natveg/pot_forest_may24/equations.gms | 15 +---- .../35_natveg/pot_forest_may24/postsolve.gms | 1 + .../35_natveg/pot_forest_may24/preloop.gms | 2 + .../35_natveg/pot_forest_may24/presolve.gms | 63 +++++++++++++++---- modules/35_natveg/pot_forest_may24/sets.gms | 4 +- 6 files changed, 62 insertions(+), 29 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index 5660c08646..064dd19f39 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -11,10 +11,13 @@ scalars parameters i35_secdforest(j,ac) Initial secdforest (mio. ha) + i35_youngsecdf(t,j,ac) Initial secdforest (mio. ha) i35_other(j,ac) Initial other land (mio. ha) p35_secdforest(t,j,ac) Secdforest per age class (mio. ha) + p35_youngsecdf(t,j,ac) Young secdforest per age class (mio. ha) p35_other(t,j,ac) Other land per age class (mio. ha) pc35_secdforest(j,ac) Secdforest per age class in current time step (mio. ha) + pc35_youngsecdf(t,j,ac) Young secdforest per age class in current time step (mio. ha) pc35_other(j,ac) Other land per age class in current time step (mio. ha) p35_min_forest(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) @@ -49,7 +52,6 @@ equations q35_secdforest_expansion(j) Secdforest expansion (mio. ha) q35_secdforest_reduction(j,ac) Secdforest reduction (mio. ha) q35_primforest_reduction(j) Primforest reduction (mio. ha) - q35_secdforest_recovery_area(j) Forest recovery constraint after land abandonment (mio. ha) q35_secdforest_regeneration(j) Secondary forest regeneration (mio. ha) q35_max_forest_expansion(j) Maximum forestry regeneration based on potential forest area (mio. ha) q35_other_regeneration(j) Other land regeneration (mio. ha) @@ -72,6 +74,7 @@ equations positive variables v35_secdforest(j,ac) Detailed stock of secdforest (mio. ha) + v35_youngsecdf(j,ac) Detailed stock of young secdforest (<20 tC/ha) (mio. ha) v35_other(j,ac) Detailed stock of other land (mio. ha) vm_landdiff_natveg Aggregated difference in natveg land compared to previous timestep (mio. ha) v35_other_expansion(j) Other land expansion compared to previous timestep (mio. ha) @@ -79,7 +82,6 @@ positive variables v35_secdforest_expansion(j) Secdforest reduction compared to previous timestep (mio. ha) v35_secdforest_reduction(j,ac) Secdforest reduction compared to previous timestep (mio. ha) v35_primforest_reduction(j) Primforest reduction compared to previous timestep (mio. ha) - v35_secdforest_recovery_area(j) Forest recovery area after land abandonment (mio. ha) v35_hvarea_secdforest(j,ac) Harvested area from secondary forest (mio. ha) v35_hvarea_other(j,ac) Harvested area from other land (mio. ha) v35_hvarea_primforest(j) Harvested area from primary forest (mio. ha) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 069cb8b0bb..801e0ad9f4 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -10,7 +10,7 @@ q35_land_secdforest(j2) .. vm_land(j2,"secdforest") =e= sum(ac, v35_secdforest(j2,ac)); - q35_land_other(j2) .. vm_land(j2,"other") =e= sum(ac, v35_other(j2,ac)); + q35_land_other(j2) .. vm_land(j2,"other") =e= sum(ac, v35_other(j2,ac)) + sum(ac, v35_youngsecdf(j2,ac)); *' The total natural land area cannot be smaller than the total natural land conservation target. *' Area requirements for natural land conservation are derived from WDPA and formulated based on @@ -49,7 +49,8 @@ q35_carbon_other(j2,ag_pools,stockType) .. vm_carbon_stock(j2,"other",ag_pools,stockType) =e= - m_carbon_stock_ac(v35_other,pm_carbon_density_ac,"ac","ac_sub"); + m_carbon_stock_ac(v35_other,pm_carbon_density_ac,"ac","ac_sub") + + m_carbon_stock_ac(v35_younsecdf,pm_carbon_density_ac,"ac","ac_sub") ; *' The biodiversity value (BV) of primary forest, secondary forest and other land is computed by multiplying their respective land area with bii coefficients, which depend on the age class and whether the potential natural vegetation forest or non-forest (luh2 side layers). @@ -196,22 +197,12 @@ q35_max_forest_expansion(j2).. *' to be secondary forest i.e., harvested primary forest gets reclassified as *' secondary forest and ends up in the youngest age-class (and follows regrowth) -q35_secdforest_recovery_area(j2).. - v35_secdforest_recovery_area(j2) - =e= - + p35_max_secdforest_recovery(j2) - * (sum(land_natveg,vm_landexpansion(j2,land_natveg)) - -sum(land_natveg,p35_land_restoration(j2,land_natveg)))/ - (sum(land_recovery35,pcm_land(j2,land_recovery35))+1e-10) - ; - q35_secdforest_regeneration(j2).. sum(ac_est, v35_secdforest(j2,ac_est)) =e= sum(ac_sub,v35_hvarea_secdforest(j2,ac_sub)) + v35_hvarea_primforest(j2) + p35_land_restoration(j2,"secdforest") - + v35_secdforest_recovery_area(j2) ; *' Harvested other land is still considered other land diff --git a/modules/35_natveg/pot_forest_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms index 656abd9d7e..07a03ba7df 100644 --- a/modules/35_natveg/pot_forest_may24/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -10,6 +10,7 @@ p35_secdforest(t,j,ac) = v35_secdforest.l(j,ac); *other land age class calculation p35_other(t,j,ac) = v35_other.l(j,ac); +p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); diff --git a/modules/35_natveg/pot_forest_may24/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms index 3d897377d7..4f85a2fe15 100644 --- a/modules/35_natveg/pot_forest_may24/preloop.gms +++ b/modules/35_natveg/pot_forest_may24/preloop.gms @@ -7,6 +7,7 @@ ** initialize other land i35_other(j,ac) = 0; +i35_youngsecdf(j,ac) = 0; i35_other(j,"acx") = pcm_land(j,"other"); ** initialize secdforest area depending on switch. @@ -34,6 +35,7 @@ i35_secdforest(j,"acx") = i35_secdforest(j,"acx") + (pcm_land(j,"secdforest") - *initialize parameter p35_other(t,j,ac) = 0; +p35_youngsecdf(t,j,ac) = 0; p35_secdforest(t,j,ac) = 0; * initialize forest disturbance losses diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index e3fc9c3c4d..cba882dfc3 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -7,9 +7,11 @@ if((ord(t) = 1), pc35_secdforest(j,ac) = i35_secdforest(j,ac); + pc35_youngsecdf(j,ac) = i35_youngsecdf(j,ac); pc35_other(j,ac) = i35_other(j,ac); else pc35_secdforest(j,ac) = p35_secdforest(t-1,j,ac); + pc35_youngsecdf(j,ac) = p35_youngsecdf(j,ac); pc35_other(j,ac) = p35_other(t-1,j,ac); ); @@ -47,6 +49,38 @@ pc35_secdforest(j,ac_sub) = pc35_secdforest(j,ac_sub) - p35_disturbance_loss_sec pcm_land(j,"primforest") = pcm_land(j,"primforest") - p35_disturbance_loss_primf(t,j); vm_land.l(j,"primforest") = pcm_land(j,"primforest"); + +* -------------------------------------- +* Secondary forest recovery bound +* -------------------------------------- + +* Forest recovery is constrained by the potential forest area in each cluster. +* Hence, the potential area for forest recovery is given by the potential forest +* area minus all forest areas in the previous time step. +p35_max_forest_recovery(j) = fm_pot_forest_area(j) + - sum(land_forest, pcm_land(j,land_forest)) + - sum(ac, pc35_youngsecdf(j,ac)); +p35_max_forest_recovery(j)$(p35_max_forest_recovery(j) < 0) = 0; + +p35_forest_recovery_shr(j) = p35_max_forest_recovery(j) / sum(land_ag, pcm_land(j,land_ag)); +p35_forest_recovery_shr(j)$(p35_forest_recovery_shr(j) > 1) = 1; + +* -------------------------------------- +* Secondary forest regeneration +* -------------------------------------- + +*' @code +*' Forest recovery is distributed proportionally based on the remaining +*' potential forest share in each cluster. +p35_recovered_forest(t,j,ac_est) = pc35_other(t,j,ac_est) * p35_forest_recovery_shr(j); +p35_recovered_forest(t,j,ac_est)$(p35_recovered_forest(t,j,ac_est) > p35_max_forest_recovery(j)) = p35_max_forest_recovery(j); +pc35_other(t,j,ac_est) = pc35_other(t,j,ac_est) - pc35_recovered_forest(t,j,ac_est); +pc35_secdforest(t,j,ac_est) = pc35_secdforest(t,j,ac_est) + pc35_recovered_forest(t,j,ac_est); + +*' Substract recovered forest area from the forest recovery potential. +p35_max_forest_recovery(j) = p35_max_forest_recovery(j) - p35_recovered_forest(t,j,ac_est); +*' @stop + * Regrowth of natural vegetation (natural succession) is modelled by shifting age-classes according to time step length. s35_shift = m_timestep_length_forestry/5; * example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) @@ -73,20 +107,20 @@ v35_other.l(j,ac) = pc35_other(j,ac); vm_land.l(j,"other") = sum(ac, pc35_other(j,ac)); pcm_land(j,"other") = sum(ac, pc35_other(j,ac)); -* -------------------------------------- -* Secondary forest establishment bound -* -------------------------------------- +* * -------------------------------------- +* * Secondary forest establishment bound +* * -------------------------------------- -* Overall forest establishment is constrained by the potential forest area in each cluster. -* Hence, the potential area for any forest expansion is given by the potential forest -* area minus all forest areas in the previous time step. -p35_max_forest_establishment(j) = fm_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); -p35_max_forest_establishment(j)$(p35_max_forest_establishment(j) < 0) = 0; +* * Overall forest establishment is constrained by the potential forest area in each cluster. +* * Hence, the potential area for any forest expansion is given by the potential forest +* * area minus all forest areas in the previous time step. +* p35_max_forest_establishment(j) = fm_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); +* p35_max_forest_establishment(j)$(p35_max_forest_establishment(j) < 0) = 0; -* The secondary forest recovery potential also includes forestry areas. -* Therefore they are not substracted. -p35_max_secdforest_recovery(j) = fm_pot_forest_area(j)-pcm_land(j,"primforest")-pcm_land(j,"secdforest"); -p35_max_secdforest_recovery(j)$(p35_max_secdforest_recovery(j) < 0) = 0; +* * The secondary forest recovery potential also includes forestry areas. +* * Therefore they are not substracted. +* p35_max_secdforest_recovery(j) = fm_pot_forest_area(j)-pcm_land(j,"primforest")-pcm_land(j,"secdforest"); +* p35_max_secdforest_recovery(j)$(p35_max_secdforest_recovery(j) < 0) = 0; * ------------------------------------- * Set bounds based on land conservation @@ -153,12 +187,15 @@ p35_max_secdforest_recovery(j) = p35_max_secdforest_recovery(j) - p35_land_resto vm_land.lo(j,"secdforest") = pm_land_conservation(t,j,"secdforest","protect") + p35_land_restoration(j,"secdforest"); ** Other land +***************** vm_lu_transitions.l(j,"forestry","other") *reset bounds v35_other.lo(j,ac) = 0; v35_other.up(j,ac) = Inf; *set upper bound -v35_other.up(j,ac_sub) = pc35_other(j,ac_sub); +v35_other.up(j,ac_sub) = pc35_other(j,ac_sub) +v35_youngsecdf.up(j,ac_sub) = pc35_youngsecdf.up(j,ac_sub); +v35_youngsecdf.fx(j,ac_est) = 0; m_boundfix(v35_other,(j,ac_sub),l,10e-5); * Other land conservation diff --git a/modules/35_natveg/pot_forest_may24/sets.gms b/modules/35_natveg/pot_forest_may24/sets.gms index 45ae03f81d..560dba40cd 100644 --- a/modules/35_natveg/pot_forest_may24/sets.gms +++ b/modules/35_natveg/pot_forest_may24/sets.gms @@ -20,8 +20,8 @@ sets pol_stock35 Land types for land protection policies / forest, other / - land_recovery35(land) Natveg recovery land - / crop, past, forestry, urban / + land_recov35(land) Natveg recovery land + / crop, past, other, urban / shock_scen Scenario name of forest carbon shock / none, 002lin2030,004lin2030,008lin2030,016lin2030 From 1e79ca8cfe4fc1b8191d26823d69ffc8274d021b Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 16 May 2024 12:25:35 +0200 Subject: [PATCH 142/280] reworked 35_natveg presolve regarding potential forest area --- config/default.cfg | 2 +- core/macros.gms | 4 +- .../pot_forest_may24/declarations.gms | 19 ++-- .../35_natveg/pot_forest_may24/equations.gms | 6 +- .../35_natveg/pot_forest_may24/postsolve.gms | 20 ++-- .../35_natveg/pot_forest_may24/presolve.gms | 103 ++++++++++-------- modules/35_natveg/pot_forest_may24/sets.gms | 3 - .../1st2ndgen_priced_feb24/sets.gms | 22 +++- 8 files changed, 102 insertions(+), 77 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 4e1e4027c8..d950d52a27 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -25,7 +25,7 @@ cfg$model <- "main.gms" #def = "main.gms" cfg$input <- c(regional = "rev4.105_h12_magpie.tgz", cellular = "rev4.105_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", validation = "rev4.105_h12_validation.tgz", - additional = "additional_data_rev4.48.tgz", + additional = "additional_data_rev4.50.tgz", calibration = "calibration_H12_26Mar24.tgz") # NOTE: It is recommended to recalibrate the model when changing cellular input data diff --git a/core/macros.gms b/core/macros.gms index 0103e94c73..2fb013af99 100644 --- a/core/macros.gms +++ b/core/macros.gms @@ -97,12 +97,12 @@ $macro m_linear_cell_data_interpol(output,x,input_x1,input_x2,input_y1,input_y2) * macro for simple carbon stocks $macro m_carbon_stock(land,carbon_density,item) \ (land(j2,item) * sum(ct,carbon_density(ct,j2,item,ag_pools)))$(sameas(stockType,"actual")) + \ - (land(j2,item) * sum(ct,carbon_density(ct,j2,item,ag_pools)))$(sameas(stockType,"actualNoAcEst")); + (land(j2,item) * sum(ct,carbon_density(ct,j2,item,ag_pools)))$(sameas(stockType,"actualNoAcEst")) * macro for carbon stocks with age classes $macro m_carbon_stock_ac(land,carbon_density,sets,sets_sub) \ sum((&&sets), land(j2,&&sets) * sum(ct, carbon_density(ct,j2,&&sets,ag_pools)))$(sameas(stockType,"actual")) + \ - sum((&&sets_sub), land(j2,&&sets_sub) * sum(ct, carbon_density(ct,j2,&&sets_sub,ag_pools)))$(sameas(stockType,"actualNoAcEst")); + sum((&&sets_sub), land(j2,&&sets_sub) * sum(ct, carbon_density(ct,j2,&&sets_sub,ag_pools)))$(sameas(stockType,"actualNoAcEst")) * macros for peatland module $macro m58_LandMerge(land,landForestry,set) \ diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index 064dd19f39..fe4433f782 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -11,19 +11,21 @@ scalars parameters i35_secdforest(j,ac) Initial secdforest (mio. ha) - i35_youngsecdf(t,j,ac) Initial secdforest (mio. ha) + i35_youngsecdf(j,ac) Initial young secdforest (mio. ha) i35_other(j,ac) Initial other land (mio. ha) p35_secdforest(t,j,ac) Secdforest per age class (mio. ha) p35_youngsecdf(t,j,ac) Young secdforest per age class (mio. ha) p35_other(t,j,ac) Other land per age class (mio. ha) pc35_secdforest(j,ac) Secdforest per age class in current time step (mio. ha) - pc35_youngsecdf(t,j,ac) Young secdforest per age class in current time step (mio. ha) + pc35_youngsecdf(j,ac) Young secdforest per age class in current time step (mio. ha) pc35_other(j,ac) Other land per age class in current time step (mio. ha) p35_min_forest(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_damage_fader(t_all) Fader for forest damage (1) - p35_max_secdforest_recovery(j) Secondary forest recovery potential (mio. ha) - p35_max_forest_establishment(j) Overall forest establishment potential (mio. ha) + p35_forest_recovery_shr(j) Forest share in natveg recovery (1) + p35_recovered_forest(t,j,ac) Recovered forest (mio. ha) + p35_maturesecdf(t,j,ac) Matured secondary forest (mio. ha) + p35_max_forest_est(j) Overall forest establishment potential (mio. ha) p35_carbon_density_secdforest(t,j,ac,ag_pools) Carbon density secdforest (tC per ha) p35_carbon_density_other(t,j,ac,ag_pools) Carbon density other land (tC per ha) p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) @@ -53,7 +55,7 @@ equations q35_secdforest_reduction(j,ac) Secdforest reduction (mio. ha) q35_primforest_reduction(j) Primforest reduction (mio. ha) q35_secdforest_regeneration(j) Secondary forest regeneration (mio. ha) - q35_max_forest_expansion(j) Maximum forestry regeneration based on potential forest area (mio. ha) + q35_max_forest_establishment(j) Maximum forestry regeneration based on potential forest area (mio. ha) q35_other_regeneration(j) Other land regeneration (mio. ha) q35_other_est(j,ac) Distribution of other land additions over ac_est (mio. ha) q35_secdforest_est(j,ac) Distribution of secdforest additions over ac_est (mio. ha) @@ -74,7 +76,7 @@ equations positive variables v35_secdforest(j,ac) Detailed stock of secdforest (mio. ha) - v35_youngsecdf(j,ac) Detailed stock of young secdforest (<20 tC/ha) (mio. ha) + v35_youngsecdf(j,ac) Detailed stock of young secdforest (mio. ha) v35_other(j,ac) Detailed stock of other land (mio. ha) vm_landdiff_natveg Aggregated difference in natveg land compared to previous timestep (mio. ha) v35_other_expansion(j) Other land expansion compared to previous timestep (mio. ha) @@ -93,6 +95,7 @@ positive variables *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov35_secdforest(t,j,ac,type) Detailed stock of secdforest (mio. ha) + ov35_youngsecdf(t,j,ac,type) Detailed stock of young secdforest (mio. ha) ov35_other(t,j,ac,type) Detailed stock of other land (mio. ha) ov_landdiff_natveg(t,type) Aggregated difference in natveg land compared to previous timestep (mio. ha) ov35_other_expansion(t,j,type) Other land expansion compared to previous timestep (mio. ha) @@ -100,7 +103,6 @@ parameters ov35_secdforest_expansion(t,j,type) Secdforest reduction compared to previous timestep (mio. ha) ov35_secdforest_reduction(t,j,ac,type) Secdforest reduction compared to previous timestep (mio. ha) ov35_primforest_reduction(t,j,type) Primforest reduction compared to previous timestep (mio. ha) - ov35_secdforest_recovery_area(t,j,type) Forest recovery area after land abandonment (mio. ha) ov35_hvarea_secdforest(t,j,ac,type) Harvested area from secondary forest (mio. ha) ov35_hvarea_other(t,j,ac,type) Harvested area from other land (mio. ha) ov35_hvarea_primforest(t,j,type) Harvested area from primary forest (mio. ha) @@ -119,9 +121,8 @@ parameters oq35_secdforest_expansion(t,j,type) Secdforest expansion (mio. ha) oq35_secdforest_reduction(t,j,ac,type) Secdforest reduction (mio. ha) oq35_primforest_reduction(t,j,type) Primforest reduction (mio. ha) - oq35_secdforest_recovery_area(t,j,type) Forest recovery constraint after land abandonment (mio. ha) oq35_secdforest_regeneration(t,j,type) Secondary forest regeneration (mio. ha) - oq35_max_forest_expansion(t,j,type) Maximum forestry regeneration based on potential forest area (mio. ha) + oq35_max_forest_establishment(t,j,type) Maximum forestry regeneration based on potential forest area (mio. ha) oq35_other_regeneration(t,j,type) Other land regeneration (mio. ha) oq35_other_est(t,j,ac,type) Distribution of other land additions over ac_est (mio. ha) oq35_secdforest_est(t,j,ac,type) Distribution of secdforest additions over ac_est (mio. ha) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 801e0ad9f4..f6acc90adb 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -50,7 +50,7 @@ q35_carbon_other(j2,ag_pools,stockType) .. vm_carbon_stock(j2,"other",ag_pools,stockType) =e= m_carbon_stock_ac(v35_other,pm_carbon_density_ac,"ac","ac_sub") - + m_carbon_stock_ac(v35_younsecdf,pm_carbon_density_ac,"ac","ac_sub") ; + + m_carbon_stock_ac(v35_youngsecdf,pm_carbon_density_ac,"ac","ac_sub"); *' The biodiversity value (BV) of primary forest, secondary forest and other land is computed by multiplying their respective land area with bii coefficients, which depend on the age class and whether the potential natural vegetation forest or non-forest (luh2 side layers). @@ -186,10 +186,10 @@ q35_hvarea_other(j2,ac_sub).. *' remaining potential forest area, which is derived from *' the potential natural forest area in each cluster. -q35_max_forest_expansion(j2).. +q35_max_forest_establishment(j2).. sum(land_forest, vm_landexpansion(j2,land_forest)) =l= - p35_max_forest_establishment(j2) + p35_max_forest_est(j2) ; *' Harvested secondary forest is still considered secondary forests due to diff --git a/modules/35_natveg/pot_forest_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms index 07a03ba7df..ebe6ddce81 100644 --- a/modules/35_natveg/pot_forest_may24/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -14,6 +14,7 @@ p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); + ov35_youngsecdf(t,j,ac,"marginal") = v35_youngsecdf.m(j,ac); ov35_other(t,j,ac,"marginal") = v35_other.m(j,ac); ov_landdiff_natveg(t,"marginal") = vm_landdiff_natveg.m; ov35_other_expansion(t,j,"marginal") = v35_other_expansion.m(j); @@ -21,7 +22,6 @@ p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); ov35_secdforest_expansion(t,j,"marginal") = v35_secdforest_expansion.m(j); ov35_secdforest_reduction(t,j,ac,"marginal") = v35_secdforest_reduction.m(j,ac); ov35_primforest_reduction(t,j,"marginal") = v35_primforest_reduction.m(j); - ov35_secdforest_recovery_area(t,j,"marginal") = v35_secdforest_recovery_area.m(j); ov35_hvarea_secdforest(t,j,ac,"marginal") = v35_hvarea_secdforest.m(j,ac); ov35_hvarea_other(t,j,ac,"marginal") = v35_hvarea_other.m(j,ac); ov35_hvarea_primforest(t,j,"marginal") = v35_hvarea_primforest.m(j); @@ -40,9 +40,8 @@ p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); oq35_secdforest_expansion(t,j,"marginal") = q35_secdforest_expansion.m(j); oq35_secdforest_reduction(t,j,ac,"marginal") = q35_secdforest_reduction.m(j,ac); oq35_primforest_reduction(t,j,"marginal") = q35_primforest_reduction.m(j); - oq35_secdforest_recovery_area(t,j,"marginal") = q35_secdforest_recovery_area.m(j); oq35_secdforest_regeneration(t,j,"marginal") = q35_secdforest_regeneration.m(j); - oq35_max_forest_expansion(t,j,"marginal") = q35_max_forest_expansion.m(j); + oq35_max_forest_establishment(t,j,"marginal") = q35_max_forest_establishment.m(j); oq35_other_regeneration(t,j,"marginal") = q35_other_regeneration.m(j); oq35_other_est(t,j,ac,"marginal") = q35_other_est.m(j,ac); oq35_secdforest_est(t,j,ac,"marginal") = q35_secdforest_est.m(j,ac); @@ -60,6 +59,7 @@ p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); oq35_secdforest_restoration(t,j,"marginal") = q35_secdforest_restoration.m(j); oq35_other_restoration(t,j,"marginal") = q35_other_restoration.m(j); ov35_secdforest(t,j,ac,"level") = v35_secdforest.l(j,ac); + ov35_youngsecdf(t,j,ac,"level") = v35_youngsecdf.l(j,ac); ov35_other(t,j,ac,"level") = v35_other.l(j,ac); ov_landdiff_natveg(t,"level") = vm_landdiff_natveg.l; ov35_other_expansion(t,j,"level") = v35_other_expansion.l(j); @@ -67,7 +67,6 @@ p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); ov35_secdforest_expansion(t,j,"level") = v35_secdforest_expansion.l(j); ov35_secdforest_reduction(t,j,ac,"level") = v35_secdforest_reduction.l(j,ac); ov35_primforest_reduction(t,j,"level") = v35_primforest_reduction.l(j); - ov35_secdforest_recovery_area(t,j,"level") = v35_secdforest_recovery_area.l(j); ov35_hvarea_secdforest(t,j,ac,"level") = v35_hvarea_secdforest.l(j,ac); ov35_hvarea_other(t,j,ac,"level") = v35_hvarea_other.l(j,ac); ov35_hvarea_primforest(t,j,"level") = v35_hvarea_primforest.l(j); @@ -86,9 +85,8 @@ p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); oq35_secdforest_expansion(t,j,"level") = q35_secdforest_expansion.l(j); oq35_secdforest_reduction(t,j,ac,"level") = q35_secdforest_reduction.l(j,ac); oq35_primforest_reduction(t,j,"level") = q35_primforest_reduction.l(j); - oq35_secdforest_recovery_area(t,j,"level") = q35_secdforest_recovery_area.l(j); oq35_secdforest_regeneration(t,j,"level") = q35_secdforest_regeneration.l(j); - oq35_max_forest_expansion(t,j,"level") = q35_max_forest_expansion.l(j); + oq35_max_forest_establishment(t,j,"level") = q35_max_forest_establishment.l(j); oq35_other_regeneration(t,j,"level") = q35_other_regeneration.l(j); oq35_other_est(t,j,ac,"level") = q35_other_est.l(j,ac); oq35_secdforest_est(t,j,ac,"level") = q35_secdforest_est.l(j,ac); @@ -106,6 +104,7 @@ p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); oq35_secdforest_restoration(t,j,"level") = q35_secdforest_restoration.l(j); oq35_other_restoration(t,j,"level") = q35_other_restoration.l(j); ov35_secdforest(t,j,ac,"upper") = v35_secdforest.up(j,ac); + ov35_youngsecdf(t,j,ac,"upper") = v35_youngsecdf.up(j,ac); ov35_other(t,j,ac,"upper") = v35_other.up(j,ac); ov_landdiff_natveg(t,"upper") = vm_landdiff_natveg.up; ov35_other_expansion(t,j,"upper") = v35_other_expansion.up(j); @@ -113,7 +112,6 @@ p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); ov35_secdforest_expansion(t,j,"upper") = v35_secdforest_expansion.up(j); ov35_secdforest_reduction(t,j,ac,"upper") = v35_secdforest_reduction.up(j,ac); ov35_primforest_reduction(t,j,"upper") = v35_primforest_reduction.up(j); - ov35_secdforest_recovery_area(t,j,"upper") = v35_secdforest_recovery_area.up(j); ov35_hvarea_secdforest(t,j,ac,"upper") = v35_hvarea_secdforest.up(j,ac); ov35_hvarea_other(t,j,ac,"upper") = v35_hvarea_other.up(j,ac); ov35_hvarea_primforest(t,j,"upper") = v35_hvarea_primforest.up(j); @@ -132,9 +130,8 @@ p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); oq35_secdforest_expansion(t,j,"upper") = q35_secdforest_expansion.up(j); oq35_secdforest_reduction(t,j,ac,"upper") = q35_secdforest_reduction.up(j,ac); oq35_primforest_reduction(t,j,"upper") = q35_primforest_reduction.up(j); - oq35_secdforest_recovery_area(t,j,"upper") = q35_secdforest_recovery_area.up(j); oq35_secdforest_regeneration(t,j,"upper") = q35_secdforest_regeneration.up(j); - oq35_max_forest_expansion(t,j,"upper") = q35_max_forest_expansion.up(j); + oq35_max_forest_establishment(t,j,"upper") = q35_max_forest_establishment.up(j); oq35_other_regeneration(t,j,"upper") = q35_other_regeneration.up(j); oq35_other_est(t,j,ac,"upper") = q35_other_est.up(j,ac); oq35_secdforest_est(t,j,ac,"upper") = q35_secdforest_est.up(j,ac); @@ -152,6 +149,7 @@ p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); oq35_secdforest_restoration(t,j,"upper") = q35_secdforest_restoration.up(j); oq35_other_restoration(t,j,"upper") = q35_other_restoration.up(j); ov35_secdforest(t,j,ac,"lower") = v35_secdforest.lo(j,ac); + ov35_youngsecdf(t,j,ac,"lower") = v35_youngsecdf.lo(j,ac); ov35_other(t,j,ac,"lower") = v35_other.lo(j,ac); ov_landdiff_natveg(t,"lower") = vm_landdiff_natveg.lo; ov35_other_expansion(t,j,"lower") = v35_other_expansion.lo(j); @@ -159,7 +157,6 @@ p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); ov35_secdforest_expansion(t,j,"lower") = v35_secdforest_expansion.lo(j); ov35_secdforest_reduction(t,j,ac,"lower") = v35_secdforest_reduction.lo(j,ac); ov35_primforest_reduction(t,j,"lower") = v35_primforest_reduction.lo(j); - ov35_secdforest_recovery_area(t,j,"lower") = v35_secdforest_recovery_area.lo(j); ov35_hvarea_secdforest(t,j,ac,"lower") = v35_hvarea_secdforest.lo(j,ac); ov35_hvarea_other(t,j,ac,"lower") = v35_hvarea_other.lo(j,ac); ov35_hvarea_primforest(t,j,"lower") = v35_hvarea_primforest.lo(j); @@ -178,9 +175,8 @@ p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); oq35_secdforest_expansion(t,j,"lower") = q35_secdforest_expansion.lo(j); oq35_secdforest_reduction(t,j,ac,"lower") = q35_secdforest_reduction.lo(j,ac); oq35_primforest_reduction(t,j,"lower") = q35_primforest_reduction.lo(j); - oq35_secdforest_recovery_area(t,j,"lower") = q35_secdforest_recovery_area.lo(j); oq35_secdforest_regeneration(t,j,"lower") = q35_secdforest_regeneration.lo(j); - oq35_max_forest_expansion(t,j,"lower") = q35_max_forest_expansion.lo(j); + oq35_max_forest_establishment(t,j,"lower") = q35_max_forest_establishment.lo(j); oq35_other_regeneration(t,j,"lower") = q35_other_regeneration.lo(j); oq35_other_est(t,j,ac,"lower") = q35_other_est.lo(j,ac); oq35_secdforest_est(t,j,ac,"lower") = q35_secdforest_est.lo(j,ac); diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index cba882dfc3..db7069b2a9 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -11,7 +11,7 @@ if((ord(t) = 1), pc35_other(j,ac) = i35_other(j,ac); else pc35_secdforest(j,ac) = p35_secdforest(t-1,j,ac); - pc35_youngsecdf(j,ac) = p35_youngsecdf(j,ac); + pc35_youngsecdf(j,ac) = p35_youngsecdf(t-1,j,ac); pc35_other(j,ac) = p35_other(t-1,j,ac); ); @@ -51,35 +51,42 @@ vm_land.l(j,"primforest") = pcm_land(j,"primforest"); * -------------------------------------- -* Secondary forest recovery bound +* Forest establishment bound * -------------------------------------- -* Forest recovery is constrained by the potential forest area in each cluster. -* Hence, the potential area for forest recovery is given by the potential forest +* Forest establishment is constrained by the potential forest area in each cluster. +* Hence, the area for potential forest establishments is given by the potential forest * area minus all forest areas in the previous time step. -p35_max_forest_recovery(j) = fm_pot_forest_area(j) - - sum(land_forest, pcm_land(j,land_forest)) - - sum(ac, pc35_youngsecdf(j,ac)); -p35_max_forest_recovery(j)$(p35_max_forest_recovery(j) < 0) = 0; - -p35_forest_recovery_shr(j) = p35_max_forest_recovery(j) / sum(land_ag, pcm_land(j,land_ag)); -p35_forest_recovery_shr(j)$(p35_forest_recovery_shr(j) > 1) = 1; +p35_max_forest_est(j) = fm_pot_forest_area(j) + - sum(land_forest, pcm_land(j,land_forest)) + - sum(ac_sub, pc35_youngsecdf(j,ac_sub)); +p35_max_forest_est(j)$(p35_max_forest_est(j) < 0) = 0; * -------------------------------------- -* Secondary forest regeneration +* Secondary forest recovery * -------------------------------------- -*' @code -*' Forest recovery is distributed proportionally based on the remaining -*' potential forest share in each cluster. -p35_recovered_forest(t,j,ac_est) = pc35_other(t,j,ac_est) * p35_forest_recovery_shr(j); -p35_recovered_forest(t,j,ac_est)$(p35_recovered_forest(t,j,ac_est) > p35_max_forest_recovery(j)) = p35_max_forest_recovery(j); -pc35_other(t,j,ac_est) = pc35_other(t,j,ac_est) - pc35_recovered_forest(t,j,ac_est); -pc35_secdforest(t,j,ac_est) = pc35_secdforest(t,j,ac_est) + pc35_recovered_forest(t,j,ac_est); - -*' Substract recovered forest area from the forest recovery potential. -p35_max_forest_recovery(j) = p35_max_forest_recovery(j) - p35_recovered_forest(t,j,ac_est); -*' @stop +* Distribute forestry abandonement +pc35_youngsecdf(j,ac_est) = vm_lu_transitions.l(j,"forestry","other")/card(ac_est2); +pc35_youngsecdf(j,ac_est)$(p35_max_forest_est(j) 1) = 1; +* Abandoned land pc35_other(j,ac_est) is then distributed propotionally using the forest recovery share. +p35_recovered_forest(t,j,ac_est) = pc35_other(j,ac_est) * p35_forest_recovery_shr(j); +p35_recovered_forest(t,j,ac_est)$(sum(ac_est2,p35_recovered_forest(t,j,ac_est)) > p35_max_forest_est(j)) = p35_max_forest_est(j)/card(ac_est2); +pc35_other(j,ac_est) = pc35_other(j,ac_est) - p35_recovered_forest(t,j,ac_est); +pc35_youngsecdf(j,ac_est) = pc35_youngsecdf(j,ac_est) + p35_recovered_forest(t,j,ac_est); + +* Substract the actual recovered forest area from the forest recovery potential. +p35_max_forest_est(j) = p35_max_forest_est(j) - sum(ac_est,p35_recovered_forest(t,j,ac_est)); + +* ------------------------------------------------ +* Natural vegetation growth (age-class shift) +* ------------------------------------------------ * Regrowth of natural vegetation (natural succession) is modelled by shifting age-classes according to time step length. s35_shift = m_timestep_length_forestry/5; @@ -89,6 +96,12 @@ s35_shift = m_timestep_length_forestry/5; p35_other(t,j,"acx") = p35_other(t,j,"acx") + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_other(j,ac)); +* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) + p35_youngsecdf(t,j,ac)$(ord(ac) > s35_shift) = pc35_youngsecdf(j,ac-s35_shift); +* account for cases at the end of the age class set (s35_shift > 1) which are not shifted by the above calculation + p35_youngsecdf(t,j,"acx") = p35_youngsecdf(t,j,"acx") + + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_youngsecdf(j,ac)); + * Usual shift * example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) p35_secdforest(t,j,ac)$(ord(ac) > s35_shift) = pc35_secdforest(j,ac-s35_shift); @@ -97,6 +110,20 @@ s35_shift = m_timestep_length_forestry/5; + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_secdforest(j,ac)); +* ------------------------------------------------------- +* Carbon threshold for secondary forest maturation +* ------------------------------------------------------- + +*' @code +*' If the vegetation carbon density in a simulation unit due to regrowth +*' exceeds a threshold of 20 tC/ha the respective area is shifted from young secondary +*' forest, which is still considered other land, to secondary forest land. +p35_maturesecdf(t,j,ac)$(not sameas(ac,"acx")) = + p35_youngsecdf(t,j,ac)$(pm_carbon_density_ac(t,j,ac,"vegc") > 20); +p35_youngsecdf(t,j,ac) = p35_youngsecdf(t,j,ac) - p35_maturesecdf(t,j,ac); +p35_secdforest(t,j,ac) = p35_secdforest(t,j,ac) + p35_maturesecdf(t,j,ac); +*' @stop + pc35_secdforest(j,ac) = p35_secdforest(t,j,ac); v35_secdforest.l(j,ac) = pc35_secdforest(j,ac); vm_land.l(j,"secdforest") = sum(ac, pc35_secdforest(j,ac)); @@ -104,23 +131,10 @@ pcm_land(j,"secdforest") = sum(ac, pc35_secdforest(j,ac)); pc35_other(j,ac) = p35_other(t,j,ac); v35_other.l(j,ac) = pc35_other(j,ac); -vm_land.l(j,"other") = sum(ac, pc35_other(j,ac)); -pcm_land(j,"other") = sum(ac, pc35_other(j,ac)); - -* * -------------------------------------- -* * Secondary forest establishment bound -* * -------------------------------------- - -* * Overall forest establishment is constrained by the potential forest area in each cluster. -* * Hence, the potential area for any forest expansion is given by the potential forest -* * area minus all forest areas in the previous time step. -* p35_max_forest_establishment(j) = fm_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); -* p35_max_forest_establishment(j)$(p35_max_forest_establishment(j) < 0) = 0; - -* * The secondary forest recovery potential also includes forestry areas. -* * Therefore they are not substracted. -* p35_max_secdforest_recovery(j) = fm_pot_forest_area(j)-pcm_land(j,"primforest")-pcm_land(j,"secdforest"); -* p35_max_secdforest_recovery(j)$(p35_max_secdforest_recovery(j) < 0) = 0; +pc35_youngsecdf(j,ac) = p35_youngsecdf(t,j,ac); +v35_youngsecdf.l(j,ac) = pc35_youngsecdf(j,ac); +vm_land.l(j,"other") = sum(ac, pc35_other(j,ac)) + sum(ac, pc35_youngsecdf(j,ac)); +pcm_land(j,"other") = sum(ac, pc35_other(j,ac)) + sum(ac, pc35_youngsecdf(j,ac)); * ------------------------------------- * Set bounds based on land conservation @@ -175,26 +189,25 @@ p35_land_restoration(j,"secdforest")$(sum(land_natveg, pcm_land(j,land_natveg)) * Since forest restoration cannot be bigger than the potential area for secdforest recovery, * any remaining restoration area is substracted and shifted to other land restoration. -p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - p35_max_secdforest_recovery(j); +p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - p35_max_forest_est(j); p35_restoration_shift(j)$(p35_restoration_shift(j) < 0) = 0; p35_land_restoration(j,"secdforest") = p35_land_restoration(j,"secdforest") - p35_restoration_shift(j); pm_land_conservation(t,j,"other","restore") = pm_land_conservation(t,j,"other","restore") + p35_restoration_shift(j); * Substract forest restoration area from secondary forest recovery potential -p35_max_secdforest_recovery(j) = p35_max_secdforest_recovery(j) - p35_land_restoration(j,"secdforest"); +p35_max_forest_est(j) = p35_max_forest_est(j) - p35_land_restoration(j,"secdforest"); * set conservation bound vm_land.lo(j,"secdforest") = pm_land_conservation(t,j,"secdforest","protect") + p35_land_restoration(j,"secdforest"); ** Other land -***************** vm_lu_transitions.l(j,"forestry","other") *reset bounds v35_other.lo(j,ac) = 0; v35_other.up(j,ac) = Inf; *set upper bound -v35_other.up(j,ac_sub) = pc35_other(j,ac_sub) -v35_youngsecdf.up(j,ac_sub) = pc35_youngsecdf.up(j,ac_sub); +v35_other.up(j,ac_sub) = pc35_other(j,ac_sub); +v35_youngsecdf.up(j,ac_sub) = pc35_youngsecdf(j,ac_sub); v35_youngsecdf.fx(j,ac_est) = 0; m_boundfix(v35_other,(j,ac_sub),l,10e-5); diff --git a/modules/35_natveg/pot_forest_may24/sets.gms b/modules/35_natveg/pot_forest_may24/sets.gms index 560dba40cd..c2c49b83d8 100644 --- a/modules/35_natveg/pot_forest_may24/sets.gms +++ b/modules/35_natveg/pot_forest_may24/sets.gms @@ -20,9 +20,6 @@ sets pol_stock35 Land types for land protection policies / forest, other / - land_recov35(land) Natveg recovery land - / crop, past, other, urban / - shock_scen Scenario name of forest carbon shock / none, 002lin2030,004lin2030,008lin2030,016lin2030 / diff --git a/modules/60_bioenergy/1st2ndgen_priced_feb24/sets.gms b/modules/60_bioenergy/1st2ndgen_priced_feb24/sets.gms index 82080a2dba..5a2d265a28 100644 --- a/modules/60_bioenergy/1st2ndgen_priced_feb24/sets.gms +++ b/modules/60_bioenergy/1st2ndgen_priced_feb24/sets.gms @@ -20,18 +20,22 @@ sets PIK_LIN, PIK_NPI, PIK_OPT, + R21M42-SDP-NDC, R21M42-SDP-NPi, R21M42-SDP-PkBudg1000, R21M42-SDP-PkBudg1100, R21M42-SDP-PkBudg900, + R21M42-SSP1-NDC, R21M42-SSP1-NPi, R21M42-SSP1-PkBudg1100, R21M42-SSP1-PkBudg1300, R21M42-SSP1-PkBudg900, + R21M42-SSP2-NDC, R21M42-SSP2-NPi, R21M42-SSP2-PkBudg1100, R21M42-SSP2-PkBudg1300, R21M42-SSP2-PkBudg900, + R21M42-SSP5-NDC, R21M42-SSP5-NPi, R21M42-SSP5-PkBudg1100, R21M42-SSP5-PkBudg1300, @@ -41,6 +45,21 @@ sets R2M41-SSP2-Budg950, R2M41-SSP2-NDC, R2M41-SSP2-NPi, + R32M46-SDP_MC-NDC, + R32M46-SDP_MC-NPi, + R32M46-SDP_MC-PkBudg650, + R32M46-SSP1-NDC, + R32M46-SSP1-NPi, + R32M46-SSP1-PkBudg1050, + R32M46-SSP1-PkBudg650, + R32M46-SSP2EU-NDC, + R32M46-SSP2EU-NPi, + R32M46-SSP2EU-PkBudg1050, + R32M46-SSP2EU-PkBudg650, + R32M46-SSP5-NDC, + R32M46-SSP5-NPi, + R32M46-SSP5-PkBudg1050, + R32M46-SSP5-PkBudg650, SSPDB-SSP1-19-IMAGE, SSPDB-SSP1-19-REMIND-MAGPIE, SSPDB-SSP1-26-IMAGE, @@ -62,8 +81,7 @@ sets SSPDB-SSP5-34-REMIND-MAGPIE, SSPDB-SSP5-45-REMIND-MAGPIE, SSPDB-SSP5-60-REMIND-MAGPIE, - SSPDB-SSP5-Ref-REMIND-MAGPIE, - R21M42-SSP2-Npi-PhaseOut20 / + SSPDB-SSP5-Ref-REMIND-MAGPIE / ; *######################### R SECTION END (SETS) ################################ From 6913e0f86daadd26a4fa0f0474dd5a87df6d7291 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 16 May 2024 14:28:35 +0200 Subject: [PATCH 143/280] separate carbon densities for forest and other land --- core/sets.gms | 7 +++--- .../managementcalib_aug19/preloop.gms | 25 +++++++++++++------ .../managementcalib_aug19/presolve.gms | 19 ++++++++++---- modules/32_forestry/dynamic_feb21/preloop.gms | 12 ++++----- .../32_forestry/dynamic_feb21/presolve.gms | 6 ++--- .../35_natveg/pot_forest_may24/equations.gms | 6 ++--- .../35_natveg/pot_forest_may24/presolve.gms | 10 +------- .../52_carbon/normal_dec17/declarations.gms | 5 ++-- modules/52_carbon/normal_dec17/start.gms | 23 ++++++++++++----- 9 files changed, 69 insertions(+), 44 deletions(-) diff --git a/core/sets.gms b/core/sets.gms index 667a888604..8279e27607 100644 --- a/core/sets.gms +++ b/core/sets.gms @@ -248,15 +248,16 @@ sets land_ag(land) Agricultural land pools / crop, past / - land_forest(land) Forested land pools - / forestry, primforest, secdforest / - land_timber(land) land from which timber can be taken away / forestry, primforest, secdforest, other / + land_forest(land_timber) Forested land pools + / forestry, primforest, secdforest / + land_natveg(land_timber) Natural vegetation land pools / primforest, secdforest, other / + forest_type forest type / plantations, natveg / diff --git a/modules/14_yields/managementcalib_aug19/preloop.gms b/modules/14_yields/managementcalib_aug19/preloop.gms index a23737fd6e..ced0a92e8a 100644 --- a/modules/14_yields/managementcalib_aug19/preloop.gms +++ b/modules/14_yields/managementcalib_aug19/preloop.gms @@ -146,11 +146,11 @@ if ((s14_calib_ir2rf = 1), *' @code *' Calibrated yields can additionally be adjusted by calibration factors 'f14_yld_calib' *' determined in a calibration run. As MAgPIE optimizes yield patterns and FAO regional -*' yields are outlier corrected, historical production and croparea can in some cases +*' yields are outlier corrected, historical production and croparea can in some cases *' be better represented with this additional correction: -* set yield calib factors to 1 in case of no use of yield calibration factors (s14_use_yield_calib = 0) -* or missing input file +* set yield calib factors to 1 in case of no use of yield calibration factors (s14_use_yield_calib = 0) +* or missing input file if(s14_use_yield_calib = 0 OR sum((i,ltype14),f14_yld_calib(i,ltype14)) = 0, f14_yld_calib(i,ltype14) = 1; ); @@ -189,23 +189,34 @@ if ((s14_degradation = 1), **** **** **** + p14_growing_stock_initial(j,ac,"forestry","plantations") = ( - pm_carbon_density_ac_forestry("y1995",j,ac,"vegc") + pm_carbon_density_ac_plantation("y1995",j,ac,"vegc") / s14_carbon_fraction * f14_aboveground_fraction("forestry") / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"plantations")) ) ; -p14_growing_stock_initial(j,ac,land_natveg,"natveg") = +p14_growing_stock_initial(j,ac,land_forest,"natveg") = + ( + pm_carbon_density_secdforest_ac("y1995",j,ac,"vegc") + / s14_carbon_fraction + * f14_aboveground_fraction(land_forest) + / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"natveg")) + ) + ; + +p14_growing_stock_initial(j,ac,"other","natveg") = ( - pm_carbon_density_ac("y1995",j,ac,"vegc") + pm_carbon_density_other_ac("y1995",j,ac,"vegc") / s14_carbon_fraction - * f14_aboveground_fraction(land_natveg) + * f14_aboveground_fraction("other") / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"natveg")) ) ; + **** Hard constraint to always have a positive number in p14_growing_stock p14_growing_stock_initial(j,ac,land_natveg,"natveg") = p14_growing_stock_initial(j,ac,land_natveg,"natveg")$(p14_growing_stock_initial(j,ac,land_natveg,"natveg")>0)+0.0001$(p14_growing_stock_initial(j,ac,land_natveg,"natveg")=0); p14_growing_stock_initial(j,ac,"forestry","plantations") = p14_growing_stock_initial(j,ac,"forestry","plantations")$(p14_growing_stock_initial(j,ac,"forestry","plantations")>0)+0.0001$(p14_growing_stock_initial(j,ac,"forestry","plantations")=0); diff --git a/modules/14_yields/managementcalib_aug19/presolve.gms b/modules/14_yields/managementcalib_aug19/presolve.gms index e9b652f06c..a564085171 100644 --- a/modules/14_yields/managementcalib_aug19/presolve.gms +++ b/modules/14_yields/managementcalib_aug19/presolve.gms @@ -11,7 +11,7 @@ *** YIELDS -*` `pm_carbon_density_ac_forestry` for vegetation Carbon is above- and belowground +*` `pm_carbon_density_ac_plantation` for vegetation Carbon is above- and belowground *' carbon density. We convert Carbon density in tC/ha to tDM/ha by using carbon *' fraction of `s14_carbon_fraction` in tC/tDM. For assessing wood harvesting *' we need only aboveground biomass information, therefore we multiply with @@ -22,18 +22,27 @@ *` @code p14_growing_stock(t,j,ac,"forestry","plantations") = ( - pm_carbon_density_ac_forestry(t,j,ac,"vegc") + pm_carbon_density_ac_plantation(t,j,ac,"vegc") / s14_carbon_fraction * f14_aboveground_fraction("forestry") / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"plantations")) ) ; -p14_growing_stock(t,j,ac,land_natveg,"natveg") = +p14_growing_stock(t,j,ac,land_forest,"natveg") = ( - pm_carbon_density_ac(t,j,ac,"vegc") + pm_carbon_density_secdforest_ac(t,j,ac,"vegc") / s14_carbon_fraction - * f14_aboveground_fraction(land_natveg) + * f14_aboveground_fraction(land_forest) + / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"natveg")) + ) + ; + +p14_growing_stock(t,j,ac,"other","natveg") = + ( + pm_carbon_density_other_ac(t,j,ac,"vegc") + / s14_carbon_fraction + * f14_aboveground_fraction("other") / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"natveg")) ) ; diff --git a/modules/32_forestry/dynamic_feb21/preloop.gms b/modules/32_forestry/dynamic_feb21/preloop.gms index fae349543f..f0be43077a 100644 --- a/modules/32_forestry/dynamic_feb21/preloop.gms +++ b/modules/32_forestry/dynamic_feb21/preloop.gms @@ -6,7 +6,7 @@ *** | Contact: magpie@pik-potsdam.de ** Calculation of Single rotation model rotation lengths ** Using forestry carbon densitiy here via carbon density data exchange from carbon module. -p32_carbon_density_ac_forestry(t_all,j,ac) = pm_carbon_density_ac_forestry(t_all,j,ac,"vegc"); +p32_carbon_density_ac_forestry(t_all,j,ac) = pm_carbon_density_ac_plantation(t_all,j,ac,"vegc"); ** Calculating the marginal of carbon density i.e. change in carbon density over two time steps ** The carbon densities are tC/ha/year so we don't have to divide by timestep length. @@ -44,7 +44,7 @@ $ifthen "%c32_rot_calc_type%" == "current_annual_increment" $endif $ifthen "%c32_rot_calc_type%" == "mean_annual_increment" - p32_avg_increment(t_all,j,ac) = pm_carbon_density_ac_forestry(t_all,j,ac,"vegc") / ((ord(ac)+1)*5); + p32_avg_increment(t_all,j,ac) = pm_carbon_density_ac_plantation(t_all,j,ac,"vegc") / ((ord(ac)+1)*5); p32_rot_flg(t_all,j,ac) = 1$(p32_carbon_density_ac_marg(t_all,j,ac) - p32_avg_increment(t_all,j,ac) > 0) + 0$(p32_carbon_density_ac_marg(t_all,j,ac) - p32_avg_increment(t_all,j,ac) <= 0); display "Rotation lengths are calculated based on maximizing mean annual increment in this run."; @@ -280,14 +280,14 @@ p32_gs_scaling_reg(i)$(f32_gs_relativetarget(i)>0 AND f32_plantedforest(i)>0) = ** Calibration factors lower than 1 are set to 1 p32_gs_scaling_reg(i)$(p32_gs_scaling_reg(i) < 1) = 1; -** Save pm_carbon_density_ac_forestry in a parameter before upscaling to FAO growing stocks. +** Save pm_carbon_density_ac_plantation in a parameter before upscaling to FAO growing stocks. ** This allows to use plantation growth curves for CO2 price driven afforestation. -p32_c_density_ac_fast_forestry(t_all,j,ac) = pm_carbon_density_ac_forestry(t_all,j,ac,"vegc"); +p32_c_density_ac_fast_forestry(t_all,j,ac) = pm_carbon_density_ac_plantation(t_all,j,ac,"vegc"); ** Update c-density for timber plantations based on calibration factor to match FAO growing stocks -pm_carbon_density_ac_forestry(t_all,j,ac,"vegc") = pm_carbon_density_ac_forestry(t_all,j,ac,"vegc") * sum(cell(i,j),p32_gs_scaling_reg(i)); +pm_carbon_density_ac_plantation(t_all,j,ac,"vegc") = pm_carbon_density_ac_plantation(t_all,j,ac,"vegc") * sum(cell(i,j),p32_gs_scaling_reg(i)); ** keep c-density for timber plantations constant after rotation length to avoid unrealistic carbon sequestration in unharvested timber plantations -pm_carbon_density_ac_forestry(t_all,j,ac,"vegc")$(ac.off >= p32_rotation_cellular_harvesting(t_all,j)) = sum(ac2$(ac2.off = p32_rotation_cellular_harvesting(t_all,j)), pm_carbon_density_ac_forestry(t_all,j,ac2,"vegc")); +pm_carbon_density_ac_plantation(t_all,j,ac,"vegc")$(ac.off >= p32_rotation_cellular_harvesting(t_all,j)) = sum(ac2$(ac2.off = p32_rotation_cellular_harvesting(t_all,j)), pm_carbon_density_ac_plantation(t_all,j,ac2,"vegc")); ** set bii coefficients p32_bii_coeff(type32,bii_class_secd,potnatveg) = 0; diff --git a/modules/32_forestry/dynamic_feb21/presolve.gms b/modules/32_forestry/dynamic_feb21/presolve.gms index 36d4f68049..95eb43a470 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_feb21/presolve.gms @@ -38,16 +38,16 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; *' 0 = Use natveg growth curve towards LPJmL natural vegetation *' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation if(s32_aff_plantation = 0, - p32_carbon_density_ac(t,j,"aff",ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); + p32_carbon_density_ac(t,j,"aff",ac,ag_pools) = pm_carbon_density_secdforest_ac(t,j,ac,ag_pools); elseif s32_aff_plantation = 1, p32_carbon_density_ac(t,j,"aff",ac,ag_pools) = p32_c_density_ac_fast_forestry(t,j,ac); ); *' Timber plantations carbon densities: -p32_carbon_density_ac(t,j,"plant",ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools); +p32_carbon_density_ac(t,j,"plant",ac,ag_pools) = pm_carbon_density_ac_plantation(t,j,ac,ag_pools); *' NDC carbon densities are natveg carbon densities. -p32_carbon_density_ac(t,j,"ndc",ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); +p32_carbon_density_ac(t,j,"ndc",ac,ag_pools) = pm_carbon_density_secdforest_ac(t,j,ac,ag_pools); *' CDR from afforestation for each age-class, depending on planning horizon. p32_cdr_ac(t,j,ac)$(ord(ac) > 1 AND (ord(ac)-1) <= s32_planing_horizon/5) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index f6acc90adb..85b04e3ae2 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -45,12 +45,12 @@ q35_carbon_secdforest(j2,ag_pools,stockType) .. vm_carbon_stock(j2,"secdforest",ag_pools,stockType) =e= - m_carbon_stock_ac(v35_secdforest,pm_carbon_density_ac,"ac","ac_sub"); + m_carbon_stock_ac(v35_secdforest,pm_carbon_density_secdforest_ac,"ac","ac_sub"); q35_carbon_other(j2,ag_pools,stockType) .. vm_carbon_stock(j2,"other",ag_pools,stockType) =e= - m_carbon_stock_ac(v35_other,pm_carbon_density_ac,"ac","ac_sub") - + m_carbon_stock_ac(v35_youngsecdf,pm_carbon_density_ac,"ac","ac_sub"); + m_carbon_stock_ac(v35_other,pm_carbon_density_other_ac,"ac","ac_sub") + + m_carbon_stock_ac(v35_youngsecdf,pm_carbon_density_secdforest_ac,"ac","ac_sub"); *' The biodiversity value (BV) of primary forest, secondary forest and other land is computed by multiplying their respective land area with bii coefficients, which depend on the age class and whether the potential natural vegetation forest or non-forest (luh2 side layers). diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index db7069b2a9..1241264a18 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -119,7 +119,7 @@ s35_shift = m_timestep_length_forestry/5; *' exceeds a threshold of 20 tC/ha the respective area is shifted from young secondary *' forest, which is still considered other land, to secondary forest land. p35_maturesecdf(t,j,ac)$(not sameas(ac,"acx")) = - p35_youngsecdf(t,j,ac)$(pm_carbon_density_ac(t,j,ac,"vegc") > 20); + p35_youngsecdf(t,j,ac)$(pm_carbon_density_secdforest_ac(t,j,ac,"vegc") > 20); p35_youngsecdf(t,j,ac) = p35_youngsecdf(t,j,ac) - p35_maturesecdf(t,j,ac); p35_secdforest(t,j,ac) = p35_secdforest(t,j,ac) + p35_maturesecdf(t,j,ac); *' @stop @@ -222,14 +222,6 @@ p35_land_restoration(j,"other")$(sum(land_natveg, pcm_land(j,land_natveg)) >= su * set conservation bound vm_land.lo(j,"other") = pm_land_conservation(t,j,"other","protect") + p35_land_restoration(j,"other"); -* ------------------------------ -* Calculate carbon density -* ------------------------------ - -* highest carbon density 1st time step to account for reshuffling -p35_carbon_density_secdforest(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); -p35_carbon_density_other(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); - * ------------------ * NPI/NDC policy * ------------------ diff --git a/modules/52_carbon/normal_dec17/declarations.gms b/modules/52_carbon/normal_dec17/declarations.gms index f102773491..706f9a49e3 100644 --- a/modules/52_carbon/normal_dec17/declarations.gms +++ b/modules/52_carbon/normal_dec17/declarations.gms @@ -6,8 +6,9 @@ *** | Contact: magpie@pik-potsdam.de parameters - pm_carbon_density_ac(t_all,j,ac,ag_pools) Above ground natveg carbon density for age classes and carbon pools (tC per ha) - pm_carbon_density_ac_forestry(t_all,j,ac,ag_pools) Above ground plantation carbon density for age classes and carbon pools (tC per ha) + pm_carbon_density_secdforest_ac(t_all,j,ac,ag_pools) Above ground secondary forest carbon density for age classes and carbon pools (tC per ha) + pm_carbon_density_other_ac(t_all,j,ac,ag_pools) Above ground other land carbon density for age classes and carbon pools (tC per ha) + pm_carbon_density_ac_plantation(t_all,j,ac,ag_pools) Above ground plantation carbon density for age classes and carbon pools (tC per ha) pc52_carbon_density_start(t_all,j,ag_pools) Above ground carbon density for new land in other land pool (tC per ha) i52_land_carbon_sink(t_all,i) Land carbon sink adjustment factors from Grassi et al 2021 (GtCO2 per year) ; diff --git a/modules/52_carbon/normal_dec17/start.gms b/modules/52_carbon/normal_dec17/start.gms index 1668e36251..f724c19d47 100644 --- a/modules/52_carbon/normal_dec17/start.gms +++ b/modules/52_carbon/normal_dec17/start.gms @@ -9,19 +9,30 @@ pc52_carbon_density_start(t_all,j,"vegc") = 0; pc52_carbon_density_start(t_all,j,"litc") = fm_carbon_density(t_all,j,"past","litc"); -*** Forestry +* ---------------------------- +* Forestry +* ---------------------------- *calculate vegetation age-class carbon density in current time step with chapman richards equation -pm_carbon_density_ac_forestry(t_all,j,ac,"vegc") = m_growth_vegc(pc52_carbon_density_start(t_all,j,"vegc"),fm_carbon_density(t_all,j,"other","vegc"),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"k","plantations")),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"m","plantations")),(ord(ac)-1)); +pm_carbon_density_ac_plantation(t_all,j,ac,"vegc") = m_growth_vegc(pc52_carbon_density_start(t_all,j,"vegc"),fm_carbon_density(t_all,j,"secdforest","vegc"),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"k","plantations")),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"m","plantations")),(ord(ac)-1)); *calculate litter carbon density based on linear growth funktion: carbon_density(ac) = intercept + slope*ac (20 year time horizon taken from IPCC) -pm_carbon_density_ac_forestry(t_all,j,ac,"litc") = m_growth_litc_soilc(pc52_carbon_density_start(t_all,j,"litc"),fm_carbon_density(t_all,j,"other","litc"),(ord(ac)-1)); +pm_carbon_density_ac_plantation(t_all,j,ac,"litc") = m_growth_litc_soilc(pc52_carbon_density_start(t_all,j,"litc"),fm_carbon_density(t_all,j,"secdforest","litc"),(ord(ac)-1)); +* ----------------------------- +* Natveg +* ----------------------------- -*** Natveg +*** Secondary forest +*calculate vegetation age-class carbon density in current time step with chapman richards equation +pm_carbon_density_secdforest_ac(t_all,j,ac,"vegc") = m_growth_vegc(pc52_carbon_density_start(t_all,j,"vegc"),fm_carbon_density(t_all,j,"secdforest","vegc"),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"k","natveg")),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"m","natveg")),(ord(ac)-1)); + +*calculate litter carbon density based on linear growth funktion: carbon_density(ac) = intercept + slope*ac (20 year time horizon taken from IPCC) +pm_carbon_density_secdforest_ac(t_all,j,ac,"litc") = m_growth_litc_soilc(pc52_carbon_density_start(t_all,j,"litc"),fm_carbon_density(t_all,j,"secdforest","litc"),(ord(ac)-1)); +*** Other land *calculate vegetation age-class carbon density in current time step with chapman richards equation -pm_carbon_density_ac(t_all,j,ac,"vegc") = m_growth_vegc(pc52_carbon_density_start(t_all,j,"vegc"),fm_carbon_density(t_all,j,"other","vegc"),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"k","natveg")),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"m","natveg")),(ord(ac)-1)); +pm_carbon_density_other_ac(t_all,j,ac,"vegc") = m_growth_vegc(pc52_carbon_density_start(t_all,j,"vegc"),fm_carbon_density(t_all,j,"other","vegc"),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"k","natveg")),sum(clcl,pm_climate_class(j,clcl)*f52_growth_par(clcl,"m","natveg")),(ord(ac)-1)); *calculate litter carbon density based on linear growth funktion: carbon_density(ac) = intercept + slope*ac (20 year time horizon taken from IPCC) -pm_carbon_density_ac(t_all,j,ac,"litc") = m_growth_litc_soilc(pc52_carbon_density_start(t_all,j,"litc"),fm_carbon_density(t_all,j,"other","litc"),(ord(ac)-1)); +pm_carbon_density_other_ac(t_all,j,ac,"litc") = m_growth_litc_soilc(pc52_carbon_density_start(t_all,j,"litc"),fm_carbon_density(t_all,j,"other","litc"),(ord(ac)-1)); From a11c5ea14884b530eefd93bfb690adf3901973c7 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 16 May 2024 14:56:50 +0200 Subject: [PATCH 144/280] bugfix --- config/scenario_config.csv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/scenario_config.csv b/config/scenario_config.csv index d2916722bb..0d3eb7168d 100755 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -31,9 +31,9 @@ gms$c21_trade_liberalization;;;;l908080r807070;l909090r808080;l909090r808080;l90 gms$c22_protect_scenario;;;;none;none;none;none;none;none;BH;none;BH_IFL;BH;;;;;;;BH;;;;;BH_IFL;BH_IFL;BH_IFL;BH_IFL;BH_IFL;;;;;;;;;;;;;;;;;;;; gms$c22_protect_scenario_noselect;;;;;;;;;;;;;;;;;;;;;;;;;none;none;BH_IFL;none;BH_IFL;;;;;;;;;;;;;;;;;;;; gms$c30_bioen_water;;;;rainfed;rainfed;rainfed;rainfed;rainfed;rainfed;rainfed;all;rainfed;rainfed;;;;;;;rainfed;;;rainfed;all;;;;;;;;;;;;;;;;;;;;;;;;; -gms$s30_snv_shr;;;;0;0;0;0;0;0;0;0;0;0.2;;;;;;;0;;;;;0.2;0.2;0.2;0.2;0.2;;;;;;;;;;;;;;;;;;;; -gms$s30_snv_shr_noselect;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0.2;0;0.2;;;;;;;;;;;;;;;;;;;; -gms$s30_snv_scenario_target;;;;;;;;;;;;;2030;;;;;;;;;;;;2030;2030;2030;2030;2030;;;;;;;;;;;;;;;;;;;; +gms$s29_snv_shr;;;;0;0;0;0;0;0;0;0;0;0.2;;;;;;;0;;;;;0.2;0.2;0.2;0.2;0.2;;;;;;;;;;;;;;;;;;;; +gms$s29_snv_shr_noselect;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0.2;0;0.2;;;;;;;;;;;;;;;;;;;; +gms$s29_snv_scenario_target;;;;;;;;;;;;;2030;;;;;;;;;;;;2030;2030;2030;2030;2030;;;;;;;;;;;;;;;;;;;; gms$c31_grassl_yld_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s32_aff_plantation;;;;0;0;0;0;0;0;0;1;0;0;;;;;;;0;;;0;1;;;;;;;;;;;;;;;;;;;;;;;;; gms$s32_aff_bii_coeff;;;;0;0;0;0;0;0;0;1;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;; From 0bce4fbd8c7abd29f3eba0a1313651154b8b4b6a Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 17 May 2024 13:09:55 +0200 Subject: [PATCH 145/280] Forestry Endo default for MAgPIE --- config/default.cfg | 28 ++++----- config/scenario_config.csv | 4 +- main.gms | 2 +- .../dynamic_may24/declarations.gms | 10 ---- modules/32_forestry/dynamic_may24/input.gms | 7 --- modules/32_forestry/dynamic_may24/preloop.gms | 57 +------------------ .../32_forestry/dynamic_may24/presolve.gms | 2 +- modules/32_forestry/input/files | 1 - modules/73_timber/default/preloop.gms | 2 +- modules/73_timber/default/presolve.gms | 2 +- 10 files changed, 19 insertions(+), 96 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index f4ec0404f4..0dd4b9ba3e 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -784,8 +784,8 @@ cfg$gms$c31_grassl_yld_scenario <- "cc" # def = "cc" cfg$gms$s31_limit_calib <- 1 # def = 1 # ***--------------------- 32_forestry ----------------------------------- -# * (dynamic_feb21): Dynamic forestry sector including afforestation with detailed age-classes -cfg$gms$forestry <- "dynamic_feb21" # def = dynamic_feb21 +# * (dynamic_may24): Dynamic forestry sector including afforestation with detailed age-classes +cfg$gms$forestry <- "dynamic_may24" # def = dynamic_may24 # * afforestation planing horizon (years) cfg$gms$s32_planing_horizon <- 50 # def = 50 @@ -866,16 +866,9 @@ cfg$gms$c32_tcre_ctrl <- "ann_TCREmean" # In addition, timber plantations are fixed to 1995 levels in the "off" case. # In other cases, age-classes in timber plantations are initialized based on # rotation length and can change dynamically over time. -# Note that this switch has no effect in the "static_sep16" realization, -# in which forestry area is assumed static. # * 0= off -# * 1= Equal distribution -# * 2= FAO distribution based on planted forest estimates 2006 -# * 3= Poulter distribution -# * 4= Manual distribution - Similar to equal distribution but higher weight on -# * younger age-classes as plantation areas increase strongly -# * in recent history (ca. >1990). -cfg$gms$s32_initial_distribution <- 0 # def = 0 +# * 1= Area is distributed equally to all age-classes within the rotation period +cfg$gms$s32_initial_distribution <- 1 # def = 1 # Switch fore regional or global interest rate for rotation length calculations. # Using the global setting would mean that the timber plantation decisions are @@ -915,7 +908,7 @@ cfg$gms$c32_incr_rate <- "h5s2l1" # def = "h5s2l1" # * such that the total plantation area remains constant. # * 2 = "Endogenous" scenario. Harvest from plantations including age-class shifting # * All plantations are harvested at rotation age. Plantation establishment is endogenous. -cfg$gms$s32_hvarea = 0 # def = 0 +cfg$gms$s32_hvarea = 2 # def = 2 # Type of rotation length selection criteria # * ("mean_annual_increment") = Harvesting when the average annual increment is maximum @@ -963,7 +956,7 @@ cfg$gms$c35_aolc_policy <- "npi" # def = "npi" # * (0): All secondary forest belongs to highest age class # * (1): Equal distribution of secondary forest in all age-classes # * (2): Distribution of secondary forest according to Poulter et al 2018 based on MODIS satellite data -cfg$gms$s35_secdf_distribution <- 0 # def = 0 +cfg$gms$s35_secdf_distribution <- 2 # def = 2 # Damages in natural forests # * (0): No damage simulated @@ -978,7 +971,7 @@ cfg$gms$s35_forest_damage_end <- 2050 #def = 2050 # * 0 = No timber production from natveg, no age-class shifting # * 1 = No timber production from natveg but with age-class shifting # * 2 = Timber production from natveg including age-class shifting -cfg$gms$s35_hvarea <- 0 # def = 0 +cfg$gms$s35_hvarea <- 2 # def = 2 # Generic forest shock scenarios. Disturbance sets percentage of all age classes back to 0 # * ("none") No disturbance applied @@ -1872,7 +1865,7 @@ cfg$gms$timber <- "default" # def = default # (implicitly assuming the same rate for plantation harvest and establishment). # * 1=on # * 0=off -cfg$gms$s73_timber_demand_switch <- 0 # def = 0 +cfg$gms$s73_timber_demand_switch <- 1 # def = 1 # Setting to define if the model should be forward looking or not in terms of # seeing the future demand for current timestep establishment of new plantations @@ -1882,7 +1875,10 @@ cfg$gms$s73_timber_demand_switch <- 0 # def = 0 # timber demand for establishment decisions. # * 1 = forward looking. Model sees future demand for establishment in current step # * 0 = myopic. Model sees current demand for establishment in current step -cfg$gms$s73_foresight <- 0 # def = 0 +cfg$gms$s73_foresight <- 1 # def = 1 + +# * Multiplier for timber demand used in historic period to obtain the same future demand in all scenarios +cfg$gms$s73_demand_multiplier_hist <- 1.2 # def = 1.2 # harvesting cost per ton of dry matter produced (USD/tDM) s73_timber_prod_cost <- 2000 # def = 2000 diff --git a/config/scenario_config.csv b/config/scenario_config.csv index 8f86e20357..985d29edef 100644 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -80,9 +80,9 @@ gms$c42_watdem_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;; gms$c43_watavail_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; gms$c52_carbon_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; gms$c59_som_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; -gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;4;4;0;;;;;;;;;;;;; +gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;;;;;; gms$s32_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;1;0;;;;;;;;;;;;; -gms$s35_secdf_distribution;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0;0;0;;;;;0;0;0;;;;;;;;;;;;; +gms$s35_secdf_distribution;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;;;; gms$s35_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;;;; gms$s73_timber_demand_switch;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;;;;;; gms$s35_forest_damage;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;;;; diff --git a/main.gms b/main.gms index e4c5470725..bc8150e6bb 100644 --- a/main.gms +++ b/main.gms @@ -252,7 +252,7 @@ $setglobal ageclass feb21 $setglobal crop endo_apr21 $setglobal past endo_jun13 -$setglobal forestry dynamic_feb21 +$setglobal forestry dynamic_may24 $setglobal urban exo_nov21 $setglobal natveg dynamic_feb21 diff --git a/modules/32_forestry/dynamic_may24/declarations.gms b/modules/32_forestry/dynamic_may24/declarations.gms index be974ad32d..27cdb53d6d 100644 --- a/modules/32_forestry/dynamic_may24/declarations.gms +++ b/modules/32_forestry/dynamic_may24/declarations.gms @@ -20,12 +20,9 @@ parameters p32_carbon_density_ac(t,j,type32,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) p32_carbon_density_ac_forestry(t_all,j,ac) Above ground carbon density for age classes and carbon pools (tC per ha) p32_carbon_density_ac_marg(t_all,j,ac) Marginal above ground carbon density for age classes and carbon pools (tC per ha) - pc32_area_rotation(j) Forestry area at rotation length end used as weight for regional aggregation (mio. ha) p32_land(t,j,type32,ac) Forestry land for each cell wood type and age class before and after optimization (mio. ha) pc32_land(j,type32,ac) Forestry land per forestry land type initialization of the optimization (mio. ha) pc32_yield_forestry_future(j) Cellular timber yield expected in the future (m3 per ha per year) - pc32_yield_forestry_future_reg(i) Regional timber yield expected in the future (m3 per ha per year) - p32_plant_ini_ac(j) Initialization of plantation area (mio. ha) p32_IGR(t_all,j,ac) Instantaneous growth rate or periodic annual increment of forest growth (1) p32_rot_flg(t_all,j,ac) Identifier flag when calculating rotation length (1) p32_rotation_regional(t_all,i) Regional average rotation length of plantations translated to age class equivalent for future (1) @@ -48,13 +45,6 @@ parameters pm_representative_rotation(t_all,i) Representative regional rotation (1) p32_aff_bgp(j,ac) Biophysical impact of afforestation (tCeq per ha) p32_tcre_glo(j) Global mean Transient Climate Response to cumulative Emissions (degree C per tC per ha) - p32_observed_gs_reg(i) Observed growing stock (m3 per ha) - p32_gs_scaling_reg(i) Calibration factor for scaling up the relative growing stock (1) - p32_rotation_dist(j,ac) Poulter distribution within celular rotation lengths (1) - p32_updated_gs_reg(t,i) Updated growing stock information after calibration (m3 per ha) - p32_plantation_contribution(t_ext,i) Share of roundwood production coming from timber plantations (percent) - p32_ac_dist_flag(j,ac) Distribution flag with inverse weights according to age-classes (1) - p32_ac_dist(j,ac) Actual share of age-class distribution (1) p32_avg_increment(t_all,j,ac) Mean annual increment (tC per ha per year) p32_bii_coeff(type32,bii_class_secd,potnatveg) bii coeff (1) p32_disturbance_loss_ftype32(t,j,type32,ac) Loss due to disturbances in all plantation type forests (mio. ha) diff --git a/modules/32_forestry/dynamic_may24/input.gms b/modules/32_forestry/dynamic_may24/input.gms index 89ac88ac42..bce4187eb0 100644 --- a/modules/32_forestry/dynamic_may24/input.gms +++ b/modules/32_forestry/dynamic_may24/input.gms @@ -90,13 +90,6 @@ $include "./modules/32_forestry/input/f32_localTCRE.cs3" $ondelim ; -parameter f32_ac_dist(ac) Age class distribution share (1) -/ -$ondelim -$include "./modules/32_forestry/input/f32_ac_dist.csv" -$offdelim -/; - parameter f32_gs_relativetarget(i) Relative growing stock target in each region (m3 per ha) / $ondelim diff --git a/modules/32_forestry/dynamic_may24/preloop.gms b/modules/32_forestry/dynamic_may24/preloop.gms index 2f944fb313..db516cf8af 100644 --- a/modules/32_forestry/dynamic_may24/preloop.gms +++ b/modules/32_forestry/dynamic_may24/preloop.gms @@ -155,64 +155,9 @@ if(s32_initial_distribution = 0, elseif s32_initial_distribution = 1, ** Initialize with equal distribution among rotation age classes ** Plantated forest area is divided into ndcs (other planted forest) and plantations - p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = p32_plant_ini_ac(j); + p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1- f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); -elseif s32_initial_distribution = 2, -** Initialize with distribution based on FAO data (but this distribution is applied to all cells globally) -** Plantated forest area is divided into ndcs (other planted forest) and plantations - p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i)); - p32_land_start_ac(j,"plant",ac) = p32_plant_ini_ac(j) * f32_ac_dist(ac); - p32_land_start_ac(j,"ndc",ac) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i)) * f32_ac_dist(ac); - -elseif s32_initial_distribution = 3, -** Initialize with Poulter distribution among rotation age classes -** Plantated forest area is divided into ndcs (other planted forest) and plantations - p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i)); - p32_rotation_dist(j,ac) = (im_plantedclass_ac(j,ac)$(ini32(j,ac))/sum(ac2,im_plantedclass_ac(j,ac2)$(ini32(j,ac2))))$(sum(ac2,im_plantedclass_ac(j,ac2)$(ini32(j,ac2)))); - p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = p32_plant_ini_ac(j) * p32_rotation_dist(j,ac); - p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i)) * p32_rotation_dist(j,ac); - -*use residual approach to avoid distributional errors i.e., poulter set with no plantations but luh reporting plantations in a cell - loop (j, - if(sum(ac,p32_land_start_ac(j,"plant",ac)$(ini32(j,ac))) = 0, - p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - ); - ); - -elseif s32_initial_distribution = 4, -** Initialize with Manual distribution among rotation age classes -** Plantated forest area is divided into ndcs (other planted forest) and plantations - loop(j, -** Set all acs to 0 - p32_ac_dist_flag(j,ac) = 0; -** Calculate reverse of age-classes, if rotation is 11acs, then ac0 should get a value of 11, 11th ac should get value of 1 - p32_ac_dist_flag(j,ac) = (10*p32_rotation_cellular_harvesting("y1995",j)-((ord(ac)-1))*5)$(ord(ac) <= p32_rotation_cellular_harvesting("y1995",j)); -** Calculate the weights, youngest age-class will have highest weight - p32_ac_dist(j,ac) = (p32_ac_dist_flag(j,ac) / (sum(ac2,p32_ac_dist_flag(j,ac2)) + ord(ac)))$(ord(ac) <= p32_rotation_cellular_harvesting("y1995",j)); -** there can be isntances where this distribution is not summing up to 1, in that case we take the excess and remove it evenly from all age-classes -** In case the sum of distribution is > 1 : Remove the excess from ac0 - p32_ac_dist(j,"ac0")$(sum(ac2, p32_ac_dist(j,ac2))>1) = p32_ac_dist(j,"ac0") - (sum(ac2, p32_ac_dist(j,ac2))-1); -** In case the sum of distribution is < 1 : Add the shortage to ac0 - p32_ac_dist(j,"ac0")$(sum(ac2, p32_ac_dist(j,ac2))<1) = p32_ac_dist(j,"ac0") + (1-sum(ac2, p32_ac_dist(j,ac2))); - ); -** Isolate plantations from planted forest (forestry) - p32_plant_ini_ac(j) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i)); -** Divide plantations according to distribution - p32_land_start_ac(j,"plant",ac) = p32_plant_ini_ac(j) * p32_ac_dist(j,ac); -** Divide NDCs according to same distribution - p32_land_start_ac(j,"ndc",ac) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i)) * p32_ac_dist(j,ac); - -*use residual approach to avoid distributional errors i.e., poulter set with no plantations but luh reporting plantations in a cell - loop (j, - if(sum(ac,p32_land_start_ac(j,"plant",ac)$(ini32(j,ac))) = 0, - p32_land_start_ac(j,"plant",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - p32_land_start_ac(j,"ndc",ac)$(ini32(j,ac)) = pm_land_start(j,"forestry") * sum(cell(i,j),1-f32_plantedforest(i))/p32_rotation_cellular_harvesting("y1995",j); - ); - ); - ); ** Redistribute to youngest age class in case the distribution to plantations and diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 4e650e90ac..d7a92d6327 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -118,7 +118,7 @@ elseif s32_hvarea = 2, ** Fix timber plantations until the end of the rotation. "ac.off" identical to "ord(ac)-1". ** The offset is needed because the first element of ac is ac0, which is not included in p32_rotation_cellular_harvesting. v32_land.fx(j,"plant",ac)$(ac.off < p32_rotation_cellular_harvesting(t,j)) = pc32_land(j,"plant",ac); -** After the rotation period, plantations are free for harvesting +** After the rotation period, all plantations are harvested. v32_land.fx(j,"plant",ac)$(ac.off >= p32_rotation_cellular_harvesting(t,j)) = 0; s32_establishment_static = 0; s32_establishment_dynamic = 1; diff --git a/modules/32_forestry/input/files b/modules/32_forestry/input/files index 64bb96e008..1a0959d8ae 100644 --- a/modules/32_forestry/input/files +++ b/modules/32_forestry/input/files @@ -6,6 +6,5 @@ npi_ndc_aff_pol.cs3 f32_plant_prod_share.csv f32_bph_effect_noTCRE.cs3 f32_localTCRE.cs3 -f32_ac_dist.csv f32_plantedforest.cs4 f32_forest_shock.csv diff --git a/modules/73_timber/default/preloop.gms b/modules/73_timber/default/preloop.gms index 4b1e5b8157..f9d5c41e16 100644 --- a/modules/73_timber/default/preloop.gms +++ b/modules/73_timber/default/preloop.gms @@ -95,4 +95,4 @@ im_timber_prod_cost("wood") = s73_timber_prod_cost_wood; im_timber_prod_cost("woodfuel") = s73_timber_prod_cost_woodfuel; * initialize values for presolve of other modules -pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry) * s73_foresight_multiplier_hist; +pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry) * s73_demand_multiplier_hist; diff --git a/modules/73_timber/default/presolve.gms b/modules/73_timber/default/presolve.gms index c5709043ea..4cca5213d3 100644 --- a/modules/73_timber/default/presolve.gms +++ b/modules/73_timber/default/presolve.gms @@ -11,7 +11,7 @@ if(s73_foresight=1, if(m_year(t) <= sm_fix_SSP2, - pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry) * s73_foresight_multiplier_hist; + pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry) * s73_demand_multiplier_hist; else pm_demand_forestry_future(t,i,kforestry) = sum(t_ext$(t_ext.pos = t.pos + pm_representative_rotation(t,i)),pm_demand_ext(t_ext,i,kforestry)); ); From 700e2d3c2922bd2b38523a053f1e06a9554b3ea7 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Fri, 17 May 2024 13:26:20 +0200 Subject: [PATCH 146/280] sorted the scenario_config by module number once again --- config/scenario_config.csv | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/config/scenario_config.csv b/config/scenario_config.csv index 8f86e20357..b55fd5ab04 100755 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -1,9 +1,11 @@ ;cc;nocc;nocc_hist;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SDP;SDP-EI;SDP-RC;SDP-MC;BASE;NPI;NDC;coupling;emulator;input;Tland;eat_lancet_diet;EL2_Diet;EL2_default;EL2_lessSus;LAMA_Inequal;LAMA_Inequal-SustDemand;LAMA_Inequal-EnvirProt;LAMA_Inequal-GHGPrice;LAMA_Sustainability;NAVIGATE_AllOff;NAVIGATE_LandSup;NAVIGATE_LandDem;NAVIGATE_AllOn;ForestryEndo;ForestryExo;ForestryOff;frst_shock_none;frst_shock_002lin2030;frst_shock_004lin2030;frst_shock_008lin2030;frst_shock_016lin2030;rcp1p9;rcp2p6;rcp4p5;rcp6p0;rcp7p0;rcp8p5;NGFS_o_lowdem;GENIE_SCP gms$c09_pop_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SSP1;SSP1;SSP1;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;; gms$c09_gdp_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SDP_EI;SDP_RC;SDP_MC;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;; -gms$c09_pal_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;; +gms$c09_pal_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;;SDP;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;; gms$s12_interest_lic;;;;;;;;;;;;;;;;;;;;;;0.06;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s12_interest_hic;;;;;;;;;;;;;;;;;;;;;;0.04;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c13_tccost;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;high +gms$food;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;anthropometrics_jan18 gms$c15_food_scenario;;;;SSP1;SSP2;SSP2;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;SSP2; gms$c15_food_scenario_noselect;;;;;;;;;;;;;;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;SSP2; gms$s15_elastic_demand;;;;0;0;0;0;0;0;0;0;0;0;;;;;;;0;0;0;;;0;0;0;0;0;;;;;;;;;;;;;;;;;;;; @@ -33,6 +35,7 @@ gms$s15_exo_brans;;;;;;;;;;1;0;1;1;;;;;;;1;1;0;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; gms$s15_exo_scp;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; gms$s15_exo_alcohol;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; gms$s15_alc_scen;0.014;;;;;;;;;;;;;;;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c20_scp_type;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;hydrogen gms$c21_trade_liberalization;;;;l908080r807070;l909090r808080;l909090r808080;l909595r809090;l908080r807070;l908080r807070;l908080r807070;l908080r807070;l909595r809090;l908080r807070;;;;;;;;;;;;l908080r807070;l908080r807070;l908080r807070;l908080r807070;l908080r807070;;;;;;;;;;;;;;;;;;;; gms$c22_protect_scenario;;;;none;none;none;none;none;none;BH;none;BH_IFL;BH;;;;;;;BH;;;;;BH_IFL;BH_IFL;BH_IFL;BH_IFL;BH_IFL;;;;;;;;;;;;;;;;;;;; gms$c22_protect_scenario_noselect;;;;;;;;;;;;;;;;;;;;;;;;;none;none;BH_IFL;none;BH_IFL;;;;;;;;;;;;;;;;;;;; @@ -40,7 +43,11 @@ gms$c30_bioen_water;;;;rainfed;rainfed;rainfed;rainfed;rainfed;rainfed;rainfed;a gms$s30_snv_shr;;;;0;0;0;0;0;0;0;0;0;0.2;;;;;;;0;;;;;0.2;0.2;0.2;0.2;0.2;;;;;;;;;;;;;;;;;;;; gms$s30_snv_shr_noselect;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0.2;0;0.2;;;;;;;;;;;;;;;;;;;; gms$s30_snv_scenario_target;;;;;;;;;;;;;2030;;;;;;;;;;;;2030;2030;2030;2030;2030;;;;;;;;;;;;;;;;;;;; +gms$s30_annual_max_growth;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0.02 gms$c31_grassl_yld_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c32_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;; +gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;4;4;0;;;;;;;;;;;;; +gms$s32_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;1;0;;;;;;;;;;;;; gms$s32_aff_plantation;;;;0;0;0;0;0;0;0;1;0;0;;;;;;;0;;;0;1;;;;;;;;;;;;;;;;;;;;;;;;; gms$s32_aff_bii_coeff;;;;0;0;0;0;0;0;0;1;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s32_max_aff_area;;;;Inf;Inf;Inf;Inf;Inf;Inf;500;350;0;700;;;;;;;500;;;;;Inf;Inf;Inf;500;500;;;;;;;;;;;;;;;;;;;; @@ -51,11 +58,17 @@ gms$s32_planing_horizon;;;;50;50;50;50;50;50;50;30;50;50;;;;;;;50;;;;;;;;;;;;;;; gms$c35_ad_policy;;;;;;;;;;;;;;none;npi;ndc;;;;;;;;;ndc;ndc;ndc;ndc;ndc;;;;;;;;;;;;;;;;;;;; gms$c35_aolc_policy;;;;;;;;;;;;;;none;npi;ndc;;;;;;;;;ndc;ndc;ndc;ndc;ndc;;;;;;;;;;;;;;;;;;;; gms$s35_forest_damage_end;;;;2030;2050;2050;2050;2050;2030;2030;2030;2030;2030;;;;;;;2030;;;;;2030;2030;2030;2030;2030;;;;;;;;;;;;;;;;;;;; +gms$s35_secdf_distribution;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0;0;0;;;;;0;0;0;;;;;;;;;;;;; +gms$s35_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;;;; +gms$c35_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;; +gms$s35_forest_damage;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;;;; +gms$factor_costs;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sticky_feb18 gms$s42_watdem_nonagr_scenario;;;;1;2;2;3;2;1;1;1;3;1;;;;;;;;;;;;2;1;2;2;1;;;;;;;;;;;;;;;;;;;; gms$s42_irrig_eff_scenario;;;;2;2;2;2;2;2;3;3;3;3;;;;;;;3;;;;;3;3;3;3;3;;;;;;;;;;;;;;;;;;;; gms$c42_env_flow_policy;;;;on;off;off;off;mixed;on;on;on;on;on;;;;;;;on;;;;;on;on;on;on;on;;;;;;;;;;;;;;;;;;;; gms$s42_efp_targetyear;;;;2040;2040;2040;2040;2040;2040;2040;2050;2070;2050;;;;;;;2040;;;;;2040;2040;2040;2040;2040;;;;;;;;;;;;;;;;;;;; gms$s44_target_price;;;;0;0;0;0;0;0;0;0;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s44_cost_bii_missing;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10000000 gms$c50_scen_neff;;;;baseeff_add3_add10_add20_max75;baseeff_add3_add5_add10_max65;baseeff_add3_add5_add10_max65;baseeff_add3_add0_add0_max55;baseeff_add3_add10_add15_max75;baseeff_add3_add5_add15_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max65;baseeff_add3_add15_add25_max75;;;;;;;baseeff_add3_add15_add25_max75;;;;;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;;;;;;;;;;;;;;;;;;;; gms$c50_scen_neff_noselect;;;;baseeff_add3_add10_add20_max75;baseeff_add3_add5_add10_max65;baseeff_add3_add5_add10_max65;baseeff_add3_add0_add0_max55;baseeff_add3_add10_add15_max75;baseeff_add3_add5_add15_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max65;baseeff_add3_add15_add25_max75;;;;;;;baseeff_add3_add15_add25_max75;;;;;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;;;;;;;;;;;;;;;;;;;; gms$c55_scen_conf;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;ssp1;ssp1;ssp1;ssp1;;;;;;;ssp1;;;;;ssp1;ssp1;ssp1;ssp1;ssp1;;;;;;;;;;;;;;;;;;;; @@ -67,6 +80,7 @@ gms$s56_buffer_aff;;;;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.2;0.3;;;;;;;0.5;;;;;;;;; gms$c56_emis_policy;;;;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;redd_nosoil;all_nosoil;;;;;;;reddnatveg_nosoil;;;none;none;;;;;;;;;;;;;;;;;;;;;;;;; gms$s56_minimum_cprice;;;;;;;;;;;;;;0;0;18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$maccs;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$bioenergy;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1st2ndgen_priced_feb24 gms$c60_2ndgen_biodem;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;none;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi gms$c60_2ndgen_biodem_noselect;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;none;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi gms$c60_1stgen_biodem;;;;phaseout2020;const2020;const2020;const2030;const2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;;;;;;;phaseout2020;;;;;phaseout2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;;;;;;;;;;;;;;;;;;;;phaseout2020 @@ -79,26 +93,12 @@ gms$c14_yields_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;; gms$c42_watdem_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; gms$c43_watavail_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; gms$c52_carbon_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; -gms$c59_som_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; -gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;4;4;0;;;;;;;;;;;;; -gms$s32_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;1;0;;;;;;;;;;;;; -gms$s35_secdf_distribution;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0;0;0;;;;;0;0;0;;;;;;;;;;;;; -gms$s35_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;;;; -gms$s73_timber_demand_switch;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;;;;;; -gms$s35_forest_damage;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;;;; -gms$c32_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;; -gms$c35_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;; -input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.105_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.105_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.105_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.105_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.105_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.105_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;; gms$c52_land_carbon_sink_rcp;;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;RCP19;RCP26;RCP45;RCP60;RCPBU;RCPBU;; +gms$c56_mute_ghgprices_until;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;y2020 gms$c57_macc_version;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PBL_2022;PBL_2022;PBL_2022;PBL_2022;;;;;;;;;;;;;;;; gms$c57_macc_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Default;Optimistic;Default;Optimistic;;;;;;;;;;;;;;;; gms$s58_rewetting_switch;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0;1;0;1;;;;;;;;;;;;;;;; -magicc_emis_scen;;;;;;;;;;;;;;;;;;;;;;SSP2EU-DSPkB500-DS_betax.mif;SSP2EU-DSPkB500-DS_betax.mif;SSP2EU-DSPkB500-DS_betax.mif;;;;;;;;;;;;;;;;;;;;;;;;; -gms$c13_tccost;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;high -gms$food;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;anthropometrics_jan18 -gms$c20_scp_type;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;hydrogen -gms$s30_annual_max_growth;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0.02 -gms$s44_cost_bii_missing;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10000000 -gms$c56_mute_ghgprices_until;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;y2020 -gms$bioenergy;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1st2ndgen_priced_feb24 -gms$factor_costs;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sticky_feb18 +gms$c59_som_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; +gms$s73_timber_demand_switch;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;;;;;; +input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.105_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.105_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.105_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.105_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.105_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.105_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;; +magicc_emis_scen;;;;;;;;;;;;;;;;;;;;;;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;;;;;;;;;;;;;;;;;;;;;;;;; From e590de838ba26ec0491569909fb19a16a440759d Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Fri, 17 May 2024 13:55:36 +0200 Subject: [PATCH 147/280] reverted renaming of forestry and natveg module --- .../dynamic_feb21/declarations.gms | 2 +- .../32_forestry/dynamic_feb21/equations.gms | 22 +++++------ .../32_forestry/dynamic_feb21/presolve.gms | 16 ++++---- modules/35_natveg/pot_forest_may24/input.gms | 2 +- .../35_natveg/pot_forest_may24/presolve.gms | 38 ++++++++++--------- modules/52_carbon/normal_dec17/input.gms | 2 +- 6 files changed, 42 insertions(+), 40 deletions(-) diff --git a/modules/32_forestry/dynamic_feb21/declarations.gms b/modules/32_forestry/dynamic_feb21/declarations.gms index 199e78df99..4b70b2d3ce 100644 --- a/modules/32_forestry/dynamic_feb21/declarations.gms +++ b/modules/32_forestry/dynamic_feb21/declarations.gms @@ -14,7 +14,7 @@ parameters i32_max_aff_area_glo(t) Maximum global endogenous afforestation area (mio. ha) i32_max_aff_area_reg(t,i) Maximum regional endogenous afforestation area (mio. ha) p32_aff_pol(t,j) NDC forest stock (mio. ha) - p32_aff_pol_timestep(t,j) NDC afforestation per time step (mio. ha) + pm_aff_pol_timestep(t,j) NDC afforestation per time step (mio. ha) p32_aff_pot(t,j) Potential afforestation area (mio. ha) p32_aff_togo(t,i) Remaining exogenous afforestation wrt to the maximum exogenous target over time (mio. ha) p32_carbon_density_ac(t,j,type32,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) diff --git a/modules/32_forestry/dynamic_feb21/equations.gms b/modules/32_forestry/dynamic_feb21/equations.gms index 259fdc7206..3a1cbee0a6 100644 --- a/modules/32_forestry/dynamic_feb21/equations.gms +++ b/modules/32_forestry/dynamic_feb21/equations.gms @@ -68,19 +68,19 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( *' The constraint `q32_aff_pol` accounts for the exogenous afforestation prescribed by NPI/NDC policies. q32_aff_pol(j2) .. - sum(ac_est, v32_land(j2,"ndc",ac_est)) =e= sum(ct, p32_aff_pol_timestep(ct,j2)); + sum(ac_est, v32_land(j2,"ndc",ac_est)) =e= sum(ct, pm_aff_pol_timestep(ct,j2)); -*' The constraint `q32_max_aff` accounts for the allowed maximum global endogenous -*' afforestation defined in `i32_max_aff_area_glo`. -*' The constraint `q32_max_aff_reg` accounts for the allowed maximum regional endogenous -*' afforestation defined in `i32_max_aff_area_reg`. +*' The constraint `q32_max_aff` accounts for the allowed maximum global endogenous +*' afforestation defined in `i32_max_aff_area_glo`. +*' The constraint `q32_max_aff_reg` accounts for the allowed maximum regional endogenous +*' afforestation defined in `i32_max_aff_area_reg`. *' Only one of the two constraints is active, depending on `s32_max_aff_area_glo`. - q32_max_aff$(s32_max_aff_area_glo=1) .. + q32_max_aff$(s32_max_aff_area_glo=1) .. sum((j2,ac), v32_land(j2,"aff",ac)) =l= sum(ct, i32_max_aff_area_glo(ct)); - q32_max_aff_reg(i2)$(s32_max_aff_area_glo=0) .. + q32_max_aff_reg(i2)$(s32_max_aff_area_glo=0) .. sum((cell(i2,j2),ac), v32_land(j2,"aff",ac)) =l= sum(ct, i32_max_aff_area_reg(ct,i2)); @@ -100,7 +100,7 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( + sum(ac_sub, v32_land_reduction(j2,type32,ac_sub))); q32_land_expansion(j2,type32) .. - v32_land_expansion(j2,type32) =e= + v32_land_expansion(j2,type32) =e= sum(ac_est, v32_land(j2,type32,ac_est)); q32_land_reduction(j2,type32,ac_sub) .. @@ -112,17 +112,17 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( q32_bv_aff(j2,potnatveg) .. vm_bv(j2,"aff_co2p",potnatveg) =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v32_land(j2,"aff",ac)) * + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v32_land(j2,"aff",ac)) * p32_bii_coeff("aff",bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); q32_bv_ndc(j2,potnatveg) .. vm_bv(j2,"aff_ndc",potnatveg) =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v32_land(j2,"ndc",ac)) * + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v32_land(j2,"ndc",ac)) * p32_bii_coeff("ndc",bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); q32_bv_plant(j2,potnatveg) .. vm_bv(j2,"plant",potnatveg) =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v32_land(j2,"plant",ac)) * + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v32_land(j2,"plant",ac)) * p32_bii_coeff("plant",bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); diff --git a/modules/32_forestry/dynamic_feb21/presolve.gms b/modules/32_forestry/dynamic_feb21/presolve.gms index 95eb43a470..90442e4c4a 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_feb21/presolve.gms @@ -18,18 +18,16 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; ** START ndc ** * calc NPI/NDC afforestation per time step based on forest stock change - p32_aff_pol_timestep("y1995",j) = 0; - p32_aff_pol_timestep(t,j)$(ord(t)>1) = p32_aff_pol(t,j) - p32_aff_pol(t-1,j); + pm_aff_pol_timestep("y1995",j) = 0; + pm_aff_pol_timestep(t,j)$(ord(t)>1) = p32_aff_pol(t,j) - p32_aff_pol(t-1,j); * Suitable area (`p32_aff_pot`) for NPI/NDC afforestation p32_aff_pot(t,j) = (vm_land.l(j,"crop") - vm_land.lo(j,"crop")) + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore"); - p32_aff_pot(t,j)$(p32_aff_pot(t,j) > (fm_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)))) - = (fm_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest))); * suitable area `p32_aff_pot` can be negative, if land restoration is switched on (level smaller than lower bound), therefore set negative values to 0 p32_aff_pot(t,j)$(p32_aff_pot(t,j) < 0) = 0; -* Limit prescribed NPI/NDC afforestation in `p32_aff_pol_timestep` if not enough suitable area (`p32_aff_pot`) for afforestation is available - p32_aff_pol_timestep(t,j)$(p32_aff_pol_timestep(t,j) > p32_aff_pot(t,j)) = p32_aff_pot(t,j); +* Limit prescribed NPI/NDC afforestation in `pm_aff_pol_timestep` if not enough suitable area (`p32_aff_pot`) for afforestation is available + pm_aff_pol_timestep(t,j)$(pm_aff_pol_timestep(t,j) > p32_aff_pot(t,j)) = p32_aff_pot(t,j); ** END ndc ** *' @code @@ -180,8 +178,8 @@ p32_updated_gs_reg(t,i) = 1; p32_updated_gs_reg(t,i)$(sum((cell(i,j),ac_sub),p32_land(t,j,"plant",ac_sub))>0) = (sum((cell(i,j),ac_sub),(pm_timber_yield(t,j,ac_sub,"forestry") / sm_wood_density) * p32_land(t,j,"plant",ac_sub))/ sum((cell(i,j),ac_sub),p32_land(t,j,"plant",ac_sub))); * Avoid conflict between afforestation for carbon uptake on land and secdforest restoration -pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") > sum(ac, p32_land(t,j,"ndc",ac) + v32_land.lo(j,"plant",ac) + p32_land(t,j,"aff",ac))+ p32_aff_pol_timestep(t,j)) - = pm_land_conservation(t,j,"secdforest","restore") - (sum(ac, p32_land(t,j,"ndc",ac) + p32_land(t,j,"aff",ac) + v32_land.lo(j,"plant",ac)) + p32_aff_pol_timestep(t,j)); -pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") <= sum(ac, p32_land(t,j,"ndc",ac) + p32_land(t,j,"aff",ac) + v32_land.lo(j,"plant",ac)) + p32_aff_pol_timestep(t,j)) = 0; +pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") > sum(ac, p32_land(t,j,"ndc",ac) + v32_land.lo(j,"plant",ac) + p32_land(t,j,"aff",ac))+ pm_aff_pol_timestep(t,j)) + = pm_land_conservation(t,j,"secdforest","restore") - (sum(ac, p32_land(t,j,"ndc",ac) + p32_land(t,j,"aff",ac) + v32_land.lo(j,"plant",ac)) + pm_aff_pol_timestep(t,j)); +pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") <= sum(ac, p32_land(t,j,"ndc",ac) + p32_land(t,j,"aff",ac) + v32_land.lo(j,"plant",ac)) + pm_aff_pol_timestep(t,j)) = 0; *** EOF presolve.gms *** diff --git a/modules/35_natveg/pot_forest_may24/input.gms b/modules/35_natveg/pot_forest_may24/input.gms index 276c47c2f8..c87fba9da7 100644 --- a/modules/35_natveg/pot_forest_may24/input.gms +++ b/modules/35_natveg/pot_forest_may24/input.gms @@ -55,7 +55,7 @@ $include "./modules/35_natveg/input/f35_gs_relativetarget.cs4" $offdelim /; -parameter fm_pot_forest_area(j) Potential forest area (mio. ha) +parameter f35_pot_forest_area(j) Potential forest area (mio. ha) / $ondelim $include "./modules/35_natveg/input/pot_forest_area.cs3" diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 1241264a18..e842a6b944 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -57,27 +57,31 @@ vm_land.l(j,"primforest") = pcm_land(j,"primforest"); * Forest establishment is constrained by the potential forest area in each cluster. * Hence, the area for potential forest establishments is given by the potential forest * area minus all forest areas in the previous time step. -p35_max_forest_est(j) = fm_pot_forest_area(j) +p35_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)) - sum(ac_sub, pc35_youngsecdf(j,ac_sub)); p35_max_forest_est(j)$(p35_max_forest_est(j) < 0) = 0; -* -------------------------------------- -* Secondary forest recovery -* -------------------------------------- +* ------------------------------------------------- +* Calculate area of secondary forest recovery +* ------------------------------------------------- * Distribute forestry abandonement pc35_youngsecdf(j,ac_est) = vm_lu_transitions.l(j,"forestry","other")/card(ac_est2); -pc35_youngsecdf(j,ac_est)$(p35_max_forest_est(j) p35_max_forest_est(j)) = p35_max_forest_est(j)/card(ac_est2); p35_max_forest_est(j) = p35_max_forest_est(j) - sum(ac_est, pc35_youngsecdf(j,ac_est)); -* Forest recovery is distributed proportionally based on the remaining -* potential forest share in each cluster. -p35_forest_recovery_shr(j) = p35_max_forest_est(j) / (sum(land_ag, pcm_land(j,land_ag)) + pcm_land(j,"urban")); +* Consider NDC/NPI re/afforesation in current time step +pm_aff_pol_timestep(t,j)$(pm_aff_pol_timestep(t,j) > p35_max_forest_est(j)) = p35_max_forest_est(j); +p35_max_forest_est(j) = p35_max_forest_est(j) - pm_aff_pol_timestep(t,j); + +* The proportion of secondary forest recovery in total natveg recovery is derived +* from the remaining potential area for forest establishment +p35_forest_recovery_shr(j) = p35_max_forest_est(j) / (sum(land_ag, pcm_land(j,land_ag)) + pcm_land(j,"urban")+1e-10); p35_forest_recovery_shr(j)$(p35_forest_recovery_shr(j) > 1) = 1; * Abandoned land pc35_other(j,ac_est) is then distributed propotionally using the forest recovery share. p35_recovered_forest(t,j,ac_est) = pc35_other(j,ac_est) * p35_forest_recovery_shr(j); -p35_recovered_forest(t,j,ac_est)$(sum(ac_est2,p35_recovered_forest(t,j,ac_est)) > p35_max_forest_est(j)) = p35_max_forest_est(j)/card(ac_est2); +p35_recovered_forest(t,j,ac_est)$(sum(ac_est2,p35_recovered_forest(t,j,ac_est2)) > p35_max_forest_est(j)) = p35_max_forest_est(j)/card(ac_est2); pc35_other(j,ac_est) = pc35_other(j,ac_est) - p35_recovered_forest(t,j,ac_est); pc35_youngsecdf(j,ac_est) = pc35_youngsecdf(j,ac_est) + p35_recovered_forest(t,j,ac_est); @@ -176,11 +180,11 @@ v35_secdforest.lo(j,ac_sub) = max((1-s35_natveg_harvest_shr) * pc35_secdforest(j ); * upper bound v35_secdforest.up(j,ac_sub) = pc35_secdforest(j,ac_sub); -m_boundfix(v35_secdforest,(j,ac_sub),l,10e-5); +m_boundfix(v35_secdforest,(j,ac_sub),l,1e-6); * Secondary forest conservation * protection bound fix -pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_secdforest(j,ac_sub)); +pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 1e-6) = sum(ac_sub, pc35_secdforest(j,ac_sub)); * set restoration target p35_land_restoration(j,"secdforest") = pm_land_conservation(t,j,"secdforest","restore"); * Do not restore secdforest in areas where total natural @@ -196,7 +200,6 @@ pm_land_conservation(t,j,"other","restore") = pm_land_conservation(t,j,"other"," * Substract forest restoration area from secondary forest recovery potential p35_max_forest_est(j) = p35_max_forest_est(j) - p35_land_restoration(j,"secdforest"); - * set conservation bound vm_land.lo(j,"secdforest") = pm_land_conservation(t,j,"secdforest","protect") + p35_land_restoration(j,"secdforest"); @@ -207,13 +210,14 @@ v35_other.lo(j,ac) = 0; v35_other.up(j,ac) = Inf; *set upper bound v35_other.up(j,ac_sub) = pc35_other(j,ac_sub); +m_boundfix(v35_other,(j,ac_sub),l,1e-6); v35_youngsecdf.up(j,ac_sub) = pc35_youngsecdf(j,ac_sub); +m_boundfix(v35_youngsecdf,(j,ac_sub),l,1e-6); v35_youngsecdf.fx(j,ac_est) = 0; -m_boundfix(v35_other,(j,ac_sub),l,10e-5); * Other land conservation * protection bound fix -pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 10e-5) = sum(ac_sub, pc35_other(j,ac_sub)); +pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 1e-6) = sum(ac_sub, pc35_other(j,ac_sub)); * set restoration target p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); * Do not restore other land in areas where total natural @@ -222,9 +226,9 @@ p35_land_restoration(j,"other")$(sum(land_natveg, pcm_land(j,land_natveg)) >= su * set conservation bound vm_land.lo(j,"other") = pm_land_conservation(t,j,"other","protect") + p35_land_restoration(j,"other"); -* ------------------ -* NPI/NDC policy -* ------------------ +* ---------------------------- +* NPI/NDC protection policy +* ---------------------------- p35_min_forest(t,j)$(p35_min_forest(t,j) > pcm_land(j,"primforest") + pcm_land(j,"secdforest")) = pcm_land(j,"primforest") + pcm_land(j,"secdforest"); p35_min_other(t,j)$(p35_min_other(t,j) > pcm_land(j,"other")) = pcm_land(j,"other"); diff --git a/modules/52_carbon/normal_dec17/input.gms b/modules/52_carbon/normal_dec17/input.gms index 7aa7a75499..16cb94a19e 100644 --- a/modules/52_carbon/normal_dec17/input.gms +++ b/modules/52_carbon/normal_dec17/input.gms @@ -27,7 +27,7 @@ m_fillmissingyears(fm_carbon_density,"j,land,c_pools"); * forest area is zero, use the carbon density of other land instead. * This affects areas, where the land use intialisation reports some * forest, although the forest potential is zero. Forest expansion in -* these cells is constrained by fm_pot_forest_area. +* these cells is constrained by f35_pot_forest_area. fm_carbon_density(t_all,j,land_forest,c_pools)$(fm_carbon_density(t_all,j,land_forest,c_pools) = 0) = fm_carbon_density(t_all,j,"other",c_pools); * Fix urban area soilc to natural land soilc as long as preprocessed From c54730264a86e004478bc84312f9f26f2ac5047f Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 17 May 2024 13:58:11 +0200 Subject: [PATCH 148/280] clean-up --- CHANGELOG.md | 4 +++- .../managementcalib_aug19/declarations.gms | 1 - .../managementcalib_aug19/preloop.gms | 9 ------- modules/21_trade/exo/declarations.gms | 11 ++------- modules/21_trade/exo/equations.gms | 9 +------ modules/21_trade/exo/input.gms | 4 ---- modules/21_trade/exo/postsolve.gms | 24 +++++++------------ modules/21_trade/exo/preloop.gms | 7 +----- modules/21_trade/free_apr16/declarations.gms | 1 - modules/21_trade/free_apr16/preloop.gms | 5 ---- modules/21_trade/off/declarations.gms | 4 ---- modules/21_trade/off/preloop.gms | 4 ---- .../selfsuff_reduced/declarations.gms | 1 - modules/21_trade/selfsuff_reduced/preloop.gms | 5 ---- .../declarations.gms | 1 - .../selfsuff_reduced_bilateral22/preloop.gms | 5 ---- modules/73_timber/default/presolve.gms | 3 +++ 17 files changed, 18 insertions(+), 80 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dcc35db1a..4f9b236685 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### changed - **22_land_conservation and default.cfg** Added options for baseline protection - **15_food, default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying food substitution scenarios and exogeneous food intake scenarios -- **70_livestock, default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying feed substitution with SCP scenarios +- **70_livestock** default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying feed substitution with SCP scenarios - **default.cfg** update additional data to rev4.50 - **default.cfg** changed default realization for 44_biodiversity to new realization `bii_target_apr24` - **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE, CONOPT4 without preprocessing and CONOPT3. - **scripts** start/test_runs.R added 2 more test runs from FSEC +- **32_forestry** revision and simplification of forestry implementation, renamed realization from `dynamic_feb21` to `dynamic_may24` +- **default.cfg** ForestryEndo as default setting ### added - **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` diff --git a/modules/14_yields/managementcalib_aug19/declarations.gms b/modules/14_yields/managementcalib_aug19/declarations.gms index 68eaecbcaf..cb84ddfbbd 100644 --- a/modules/14_yields/managementcalib_aug19/declarations.gms +++ b/modules/14_yields/managementcalib_aug19/declarations.gms @@ -17,7 +17,6 @@ parameters p14_growing_stock(t,j,ac,forest_land,forest_type) Forest growing stock (tDM per ha per yr) pm_timber_yield(t,j,ac,forest_land) Forest growing stock (tDM per ha per yr) p14_growing_stock_initial(j,ac,forest_land,forest_type) Initial Forest growing stock (tDM per ha per yr) - pm_timber_yield_initial(j,ac,forest_land) Initial Forest yield (tDM per ha per yr) pm_yields_semi_calib(j,kve,w) Potential yields calibrated to FAO regional levels (tDM per ha per yr) i14_calib_yields_hist(i,w) Calibrated yields average over region and crop type at the historical reference year (tDM per ha per yr) i14_calib_yields_ratio(i) Irrigated to rainfed yield ratio for calibrated yields (1) diff --git a/modules/14_yields/managementcalib_aug19/preloop.gms b/modules/14_yields/managementcalib_aug19/preloop.gms index a23737fd6e..9cac1c64cf 100644 --- a/modules/14_yields/managementcalib_aug19/preloop.gms +++ b/modules/14_yields/managementcalib_aug19/preloop.gms @@ -209,12 +209,3 @@ p14_growing_stock_initial(j,ac,land_natveg,"natveg") = **** Hard constraint to always have a positive number in p14_growing_stock p14_growing_stock_initial(j,ac,land_natveg,"natveg") = p14_growing_stock_initial(j,ac,land_natveg,"natveg")$(p14_growing_stock_initial(j,ac,land_natveg,"natveg")>0)+0.0001$(p14_growing_stock_initial(j,ac,land_natveg,"natveg")=0); p14_growing_stock_initial(j,ac,"forestry","plantations") = p14_growing_stock_initial(j,ac,"forestry","plantations")$(p14_growing_stock_initial(j,ac,"forestry","plantations")>0)+0.0001$(p14_growing_stock_initial(j,ac,"forestry","plantations")=0); - -** Used in equations -*************************************************************** -** If the plantation yield switch is on, forestry yields are treated as plantation yields -pm_timber_yield_initial(j,ac,"forestry")$(s14_timber_plantation_yield = 1) = p14_growing_stock_initial(j,ac,"forestry","plantations") ; -** If the plantation yield switch is off, then the forestry yields are given the same values as secdforest yields, -pm_timber_yield_initial(j,ac,"forestry")$(s14_timber_plantation_yield = 0) = pm_timber_yield_initial(j,ac,"secdforest"); -** Natveg yields are unchanged and do not depend on plantation yield switch -pm_timber_yield_initial(j,ac,land_natveg) = p14_growing_stock_initial(j,ac,land_natveg,"natveg"); diff --git a/modules/21_trade/exo/declarations.gms b/modules/21_trade/exo/declarations.gms index 43eec6aa8c..67b0151950 100644 --- a/modules/21_trade/exo/declarations.gms +++ b/modules/21_trade/exo/declarations.gms @@ -5,24 +5,17 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -parameters -pm_selfsuff_ext(t_ext,h,kforestry) Self sufficiency for timber products in extended time frame (1) -; positive variables vm_cost_trade(i) Regional trade costs (mio. USD05MER per yr) - v21_manna_from_heaven(h,kall) Last resort resource for otherwise infeasible trade balance constraints (mio. tDM per yr) ; equations q21_notrade(h,kall) Superregional production constraint of non-tradable commodities (mio. tDM per yr) - q21_cost_trade(h) Superregional trade costs (mio. USD05MER per yr) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_cost_trade(t,i,type) Regional trade costs (mio. USD05MER per yr) - ov21_manna_from_heaven(t,h,kall,type) Last resort resource for otherwise infeasible trade balance constraints (mio. tDM per yr) - oq21_notrade(t,h,kall,type) Superregional production constraint of non-tradable commodities (mio. tDM per yr) - oq21_cost_trade(t,h,type) Superregional trade costs (mio. USD05MER per yr) + ov_cost_trade(t,i,type) Regional trade costs (mio. USD05MER per yr) + oq21_notrade(t,h,kall,type) Superregional production constraint of non-tradable commodities (mio. tDM per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/21_trade/exo/equations.gms b/modules/21_trade/exo/equations.gms index 22a59aeb61..c463ace64c 100644 --- a/modules/21_trade/exo/equations.gms +++ b/modules/21_trade/exo/equations.gms @@ -7,7 +7,7 @@ q21_notrade(h2,kall).. sum(supreg(h2,i2),vm_prod_reg(i2,kall)) =g= sum(supreg(h2,i2), vm_supply(i2,kall)) - + sum(ct,f21_trade_balance(ct,h2,kall)) - v21_manna_from_heaven(h2,kall); + + sum(ct,f21_trade_balance(ct,h2,kall)); *' The regional production must be bigger than the regional demand plus exports @@ -17,10 +17,3 @@ q21_notrade(h2,kall).. *' trade balance conditions `v21_manna_from_heaven` is introduced. It is an *' unlimited, but heavily expensive resource which can be used as last resort, *' if in any other case the model would become infeasible. - -q21_cost_trade(h2).. sum(supreg(h2,i2),vm_cost_trade(i2)) =e= - 10**6 * sum(kall,v21_manna_from_heaven(h2,kall)); - -*' After each run trade costs `vm_cost_trade` as well as `v21_manna_from_heaven` -*' should be checked for non-zero values as these will indicate inconsistencies -*' between model simulation and exogenously provided trade balances. diff --git a/modules/21_trade/exo/input.gms b/modules/21_trade/exo/input.gms index d79312c2cf..70be889924 100644 --- a/modules/21_trade/exo/input.gms +++ b/modules/21_trade/exo/input.gms @@ -5,10 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -scalars - s21_manna_from_heaven v21_manna_from_heaven fixed to zero (0) or available at high cost (1) (binary) / 0 / -; - table f21_trade_balance(t_all,h,kall) trade balance of positive exports and negative imports (mio. tDM per yr) $ondelim $include "./modules/21_trade/input/f21_trade_balance.cs3" diff --git a/modules/21_trade/exo/postsolve.gms b/modules/21_trade/exo/postsolve.gms index 38495b7f8e..78358260dc 100644 --- a/modules/21_trade/exo/postsolve.gms +++ b/modules/21_trade/exo/postsolve.gms @@ -7,20 +7,12 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_cost_trade(t,i,"marginal") = vm_cost_trade.m(i); - ov21_manna_from_heaven(t,h,kall,"marginal") = v21_manna_from_heaven.m(h,kall); - oq21_notrade(t,h,kall,"marginal") = q21_notrade.m(h,kall); - oq21_cost_trade(t,h,"marginal") = q21_cost_trade.m(h); - ov_cost_trade(t,i,"level") = vm_cost_trade.l(i); - ov21_manna_from_heaven(t,h,kall,"level") = v21_manna_from_heaven.l(h,kall); - oq21_notrade(t,h,kall,"level") = q21_notrade.l(h,kall); - oq21_cost_trade(t,h,"level") = q21_cost_trade.l(h); - ov_cost_trade(t,i,"upper") = vm_cost_trade.up(i); - ov21_manna_from_heaven(t,h,kall,"upper") = v21_manna_from_heaven.up(h,kall); - oq21_notrade(t,h,kall,"upper") = q21_notrade.up(h,kall); - oq21_cost_trade(t,h,"upper") = q21_cost_trade.up(h); - ov_cost_trade(t,i,"lower") = vm_cost_trade.lo(i); - ov21_manna_from_heaven(t,h,kall,"lower") = v21_manna_from_heaven.lo(h,kall); - oq21_notrade(t,h,kall,"lower") = q21_notrade.lo(h,kall); - oq21_cost_trade(t,h,"lower") = q21_cost_trade.lo(h); + ov_cost_trade(t,i,"marginal") = vm_cost_trade.m(i); + oq21_notrade(t,h,kall,"marginal") = q21_notrade.m(h,kall); + ov_cost_trade(t,i,"level") = vm_cost_trade.l(i); + oq21_notrade(t,h,kall,"level") = q21_notrade.l(h,kall); + ov_cost_trade(t,i,"upper") = vm_cost_trade.up(i); + oq21_notrade(t,h,kall,"upper") = q21_notrade.up(h,kall); + ov_cost_trade(t,i,"lower") = vm_cost_trade.lo(i); + oq21_notrade(t,h,kall,"lower") = q21_notrade.lo(h,kall); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/21_trade/exo/preloop.gms b/modules/21_trade/exo/preloop.gms index 81d5fcb68e..88e0dbf793 100644 --- a/modules/21_trade/exo/preloop.gms +++ b/modules/21_trade/exo/preloop.gms @@ -5,9 +5,4 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -** Save self sufficiency values as a interface parameter needed in forestry module -pm_selfsuff_ext(t_ext,h,kforestry) = f21_self_suff("y2150",h,kforestry); -pm_selfsuff_ext(t_all,h,kforestry) = f21_self_suff(t_all,h,kforestry); - -** fix to zero by default -v21_manna_from_heaven.fx(h,kall)$(s21_manna_from_heaven = 0) = 0; +vm_cost_trade.fx(i) = 0; diff --git a/modules/21_trade/free_apr16/declarations.gms b/modules/21_trade/free_apr16/declarations.gms index f93d7f3b8b..811b4f5676 100644 --- a/modules/21_trade/free_apr16/declarations.gms +++ b/modules/21_trade/free_apr16/declarations.gms @@ -9,7 +9,6 @@ parameters i21_trade_bal_reduction(t_all,k_trade) Trade balance reduction (1) i21_trade_margin(h,k_trade) Trade margins (USD05MER per tDM) i21_trade_tariff(h,k_trade) Trade tariffs (USD05MER per tDM) - pm_selfsuff_ext(t_ext,h,kforestry) Self sufficiency for timber products in extended time frame (1) ; positive variables diff --git a/modules/21_trade/free_apr16/preloop.gms b/modules/21_trade/free_apr16/preloop.gms index bfc429a3eb..11b775455d 100644 --- a/modules/21_trade/free_apr16/preloop.gms +++ b/modules/21_trade/free_apr16/preloop.gms @@ -5,10 +5,5 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de - - *set vm_cost_trade zero in order to avoid a free variable vm_cost_trade.fx(i) = 0; - -pm_selfsuff_ext(t_ext,h,kforestry) = f21_self_suff("y2150",h,kforestry); -pm_selfsuff_ext(t_all,h,kforestry) = f21_self_suff(t_all,h,kforestry); diff --git a/modules/21_trade/off/declarations.gms b/modules/21_trade/off/declarations.gms index f4eb5cb097..5488673ee2 100644 --- a/modules/21_trade/off/declarations.gms +++ b/modules/21_trade/off/declarations.gms @@ -5,10 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -parameters -pm_selfsuff_ext(t_ext,h,kforestry) Self sufficiency for timber products in extended time frame (1) -; - positive variables vm_cost_trade(i) Regional trade costs (mio. USD05MER per yr) ; diff --git a/modules/21_trade/off/preloop.gms b/modules/21_trade/off/preloop.gms index 0441d70f3d..11b775455d 100644 --- a/modules/21_trade/off/preloop.gms +++ b/modules/21_trade/off/preloop.gms @@ -5,9 +5,5 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -** Save self sufficiency values as a interface parameter needed in forestry module -pm_selfsuff_ext(t_ext,h,kforestry) = f21_self_suff("y2150",h,kforestry); -pm_selfsuff_ext(t_all,h,kforestry) = f21_self_suff(t_all,h,kforestry); - *set vm_cost_trade zero in order to avoid a free variable vm_cost_trade.fx(i) = 0; diff --git a/modules/21_trade/selfsuff_reduced/declarations.gms b/modules/21_trade/selfsuff_reduced/declarations.gms index f6ccffef43..59bc20b4d9 100644 --- a/modules/21_trade/selfsuff_reduced/declarations.gms +++ b/modules/21_trade/selfsuff_reduced/declarations.gms @@ -9,7 +9,6 @@ parameters i21_trade_bal_reduction(t_all,k_trade) Trade balance reduction (1) i21_trade_margin(h,k_trade) Trade margins (USD05MER per tDM) i21_trade_tariff(h,k_trade) Trade tariffs (USD05MER per tDM) - pm_selfsuff_ext(t_ext,h,kforestry) Self sufficiency for timber products in extended time frame (1) ; positive variables diff --git a/modules/21_trade/selfsuff_reduced/preloop.gms b/modules/21_trade/selfsuff_reduced/preloop.gms index ff5c35c5a2..7a04513e1b 100644 --- a/modules/21_trade/selfsuff_reduced/preloop.gms +++ b/modules/21_trade/selfsuff_reduced/preloop.gms @@ -19,11 +19,6 @@ elseif (s21_trade_tariff=0), i21_trade_margin(h,"wood")$(i21_trade_margin(h,"wood") < s21_min_trade_margin_forestry) = s21_min_trade_margin_forestry; i21_trade_margin(h,"woodfuel")$(i21_trade_margin(h,"woodfuel") < s21_min_trade_margin_forestry) = s21_min_trade_margin_forestry; -pm_selfsuff_ext(t_ext,h,kforestry) = f21_self_suff("y2150",h,kforestry); -pm_selfsuff_ext(t_all,h,kforestry) = f21_self_suff(t_all,h,kforestry); -*Implausible jumps in selfsuff for wood in some regions. -pm_selfsuff_ext(tstart21,h,kforestry) = f21_self_suff("y2010",h,kforestry); - v21_import_for_feasibility.fx(h,k_trade) = 0; v21_import_for_feasibility.lo(h,k_import21) = 0; v21_import_for_feasibility.up(h,k_import21) = Inf; diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/declarations.gms b/modules/21_trade/selfsuff_reduced_bilateral22/declarations.gms index 02c0278f0c..52bfeefb13 100644 --- a/modules/21_trade/selfsuff_reduced_bilateral22/declarations.gms +++ b/modules/21_trade/selfsuff_reduced_bilateral22/declarations.gms @@ -9,7 +9,6 @@ parameters i21_trade_bal_reduction(t_all,k_trade) Trade balance reduction (1) i21_trade_margin(i_ex,i_im,k_trade) Trade transport and admin costs (USD05MER per tDM) i21_trade_tariff(t_all, i_ex,i_im,k_trade) Trade tariffs (USD05MER per tDM) - pm_selfsuff_ext(t_ext,h,kforestry) Self sufficiency for timber products in extended time frame (1) ; positive variables diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms b/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms index 7a27f3c715..5d60440200 100644 --- a/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms +++ b/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms @@ -26,11 +26,6 @@ i21_trade_tariff(t_all,i_ex,i_im,k_trade)$(m_year(t_all) >= s21_trade_tariff_tar ); ); -pm_selfsuff_ext(t_ext,h,kforestry) = f21_self_suff("y2150",h,kforestry); -pm_selfsuff_ext(t_all,h,kforestry) = f21_self_suff(t_all,h,kforestry); -*Implausible jumps in selfsuff for wood in some regions. -pm_selfsuff_ext(tstart21,h,kforestry) = f21_self_suff("y2010",h,kforestry); - v21_import_for_feasibility.fx(h,k_trade) = 0; v21_import_for_feasibility.lo(h,k_import21) = 0; v21_import_for_feasibility.up(h,k_import21) = Inf; diff --git a/modules/73_timber/default/presolve.gms b/modules/73_timber/default/presolve.gms index 4cca5213d3..205a9693bd 100644 --- a/modules/73_timber/default/presolve.gms +++ b/modules/73_timber/default/presolve.gms @@ -18,3 +18,6 @@ if(s73_foresight=1, else pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry); ); + +* tbd: remove after successful testing? +v73_prod_heaven_timber.fx(j,kforestry) = 0; From 30654ebc195e99b4911ed941843730011561c291 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 17 May 2024 14:01:03 +0200 Subject: [PATCH 149/280] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f9b236685..878a6aef49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### removed - **scripts/output/extra** removed scripts disaggregation_cropsplit and disaggregation_transitions - **scripts** removed support for spam files in start_functions +- *14_yields* removed interface `pm_timber_yield_initial`, no longer needed +- *21_trade_* removed interface `pm_selfsuff_ext`, no longer needed ### fixed - **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs From 2e6cea0b44e878f52ee442ad22752233f2e9e450 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Fri, 17 May 2024 14:35:23 +0200 Subject: [PATCH 150/280] updated input vector and scenario_config --- config/default.cfg | 6 ++-- config/scenario_config.csv | 62 +++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 796a299b40..572be18f70 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -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.105_h12_magpie.tgz", - cellular = "rev4.105_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.105_h12_validation.tgz", +cfg$input <- c(regional = "WARNINGS66_rev4.107Mehta_h12_magpie.tgz", + cellular = "WARNINGS26_rev4.107Mehta_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "WARNINGS79_rev4.107Mehta_h12_validation.tgz", additional = "additional_data_rev4.50.tgz", calibration = "calibration_H12_26Mar24.tgz") diff --git a/config/scenario_config.csv b/config/scenario_config.csv index b55fd5ab04..3c90074de9 100755 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -1,45 +1,45 @@ -;cc;nocc;nocc_hist;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SDP;SDP-EI;SDP-RC;SDP-MC;BASE;NPI;NDC;coupling;emulator;input;Tland;eat_lancet_diet;EL2_Diet;EL2_default;EL2_lessSus;LAMA_Inequal;LAMA_Inequal-SustDemand;LAMA_Inequal-EnvirProt;LAMA_Inequal-GHGPrice;LAMA_Sustainability;NAVIGATE_AllOff;NAVIGATE_LandSup;NAVIGATE_LandDem;NAVIGATE_AllOn;ForestryEndo;ForestryExo;ForestryOff;frst_shock_none;frst_shock_002lin2030;frst_shock_004lin2030;frst_shock_008lin2030;frst_shock_016lin2030;rcp1p9;rcp2p6;rcp4p5;rcp6p0;rcp7p0;rcp8p5;NGFS_o_lowdem;GENIE_SCP +;cc;nocc;nocc_hist;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SDP;SDP-EI;SDP-RC;SDP-MC;BASE;NPI;NDC;coupling;emulator;input;Tland;eat_lancet_diet;EL2_PHD;EL2_Demand;EL2_default;LAMA_Inequal;LAMA_Inequal-SustDemand;LAMA_Inequal-EnvirProt;LAMA_Inequal-GHGPrice;LAMA_Sustainability;NAVIGATE_AllOff;NAVIGATE_LandSup;NAVIGATE_LandDem;NAVIGATE_AllOn;ForestryEndo;ForestryExo;ForestryOff;frst_shock_none;frst_shock_002lin2030;frst_shock_004lin2030;frst_shock_008lin2030;frst_shock_016lin2030;rcp1p9;rcp2p6;rcp4p5;rcp6p0;rcp7p0;rcp8p5;NGFS_o_lowdem;GENIE_SCP gms$c09_pop_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SSP1;SSP1;SSP1;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;; gms$c09_gdp_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SDP_EI;SDP_RC;SDP_MC;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;; -gms$c09_pal_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;;SDP;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;; +gms$c09_pal_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;;SDP;SDP;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;; gms$s12_interest_lic;;;;;;;;;;;;;;;;;;;;;;0.06;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s12_interest_hic;;;;;;;;;;;;;;;;;;;;;;0.04;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c13_tccost;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;high gms$food;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;anthropometrics_jan18 gms$c15_food_scenario;;;;SSP1;SSP2;SSP2;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;SSP2; gms$c15_food_scenario_noselect;;;;;;;;;;;;;;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;SSP2; -gms$s15_elastic_demand;;;;0;0;0;0;0;0;0;0;0;0;;;;;;;0;0;0;;;0;0;0;0;0;;;;;;;;;;;;;;;;;;;; +gms$s15_elastic_demand;;;;0;0;0;0;0;0;0;0;0;0;;;;;;;0;0;0;0;;0;0;0;0;0;;;;;;;;;;;;;;;;;;;; gms$s15_rumdairy_scp_substitution;;;;0;0;0;0;0;0;0;0.5;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s15_food_subst_functional_form;;;;;;;;;;;2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s15_food_substitution_start;;;;;;;;;;;2020;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s15_food_substitution_target;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$kfo_rd;;;;;;;;;;;livst_rum;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;livst_rum,livst_milk -gms$s15_exo_foodscen_convergence;;;;;;;;;;1;1;1;1;;;;;;;1;1;1;;;;1;;;1;;;;;;;;;;;;;;;;;;;1; -gms$s15_exo_foodscen_functional_form;;;;;;;;;;1;1;1;1;;;;;;;1;1;1;;;;1;;;1;;;;;;;;;;;;;;;;;;;1; -gms$s15_exo_foodscen_start;;;;;;;;;;2020;2020;2020;2020;;;;;;;2020;2020;2020;;;;2020;;;2020;;;;;;;;;;;;;;;;;;;2020; -gms$s15_exo_foodscen_target;;;;;;;;;;2050;2050;2050;2070;;;;;;;2050;2050;2050;;;;2050;;;2050;;;;;;;;;;;;;;;;;;;2050; -gms$s15_exo_waste;;;;0;0;0;0;0;0;1;1;1;1;;;;;;;1;0;1;;;0;1;0;0;1;0;0;1;1;;;;;;;;;;;;;;;1; -gms$s15_waste_scen;;;;;;;;;;1.2;1.3;1.2;1.25;;;;;;;1.2;1.2;1.2;;;;1.2;;;1.2;;;;;;;;;;;;;;;;;;;1.2; -gms$s15_exo_diet;;;;0;0;0;0;0;0;1;1;1;1;;;;;;;1;1;3;;;0;1;0;0;1;0;0;1;1;;;;;;;;;;;;;;;1; -gms$c15_kcal_scen;;;;;;;;;;healthy_BMI;no_underweight;healthy_BMI;healthy_BMI;;;;;;;healthy_BMI;healthy_BMI;healthy_BMI;;;;healthy_BMI;;;healthy_BMI;;;;;;;;;;;;;;;;;;;healthy_BMI; -gms$c15_EAT_scen;;;;;;;;;;FLX;;FLX;FLX;;;;;;;FLX;FLX;FLX;;;;FLX;;;FLX;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_monogastric;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_ruminant;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_fish;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_fruitvegnut;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_roots;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_pulses;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_sugar;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_oils;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_brans;;;;;;;;;;1;0;1;1;;;;;;;1;1;0;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_scp;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_exo_alcohol;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; -gms$s15_alc_scen;0.014;;;;;;;;;;;;;;;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_foodscen_convergence;;;;;;;;;;1;1;1;1;;;;;;;1;1;1;1;;;1;;;1;;;;;;;;;;;;;;;;;;;1; +gms$s15_exo_foodscen_functional_form;;;;;;;;;;1;1;1;1;;;;;;;1;1;1;1;;;1;;;1;;;;;;;;;;;;;;;;;;;1; +gms$s15_exo_foodscen_start;;;;;;;;;;2020;2020;2020;2020;;;;;;;2020;2020;2020;2020;;;2020;;;2020;;;;;;;;;;;;;;;;;;;2020; +gms$s15_exo_foodscen_target;;;;;;;;;;2050;2050;2050;2070;;;;;;;2050;2050;2050;2050;;;2050;;;2050;;;;;;;;;;;;;;;;;;;2050; +gms$s15_exo_waste;;;;0;0;0;0;0;0;1;1;1;1;;;;;;;1;0;1;1;;0;1;0;0;1;0;0;1;1;;;;;;;;;;;;;;;1; +gms$s15_waste_scen;;;;;;;;;;1.2;1.3;1.2;1.25;;;;;;;1.2;1.2;1.2;1.2;;;1.2;;;1.2;;;;;;;;;;;;;;;;;;;1.2; +gms$s15_exo_diet;;;;0;0;0;0;0;0;1;1;1;1;;;;;;;1;1;3;3;;0;1;0;0;1;0;0;1;1;;;;;;;;;;;;;;;1; +gms$c15_kcal_scen;;;;;;;;;;healthy_BMI;no_underweight;healthy_BMI;healthy_BMI;;;;;;;healthy_BMI;healthy_BMI;healthy_BMI;healthy_BMI;;;healthy_BMI;;;healthy_BMI;;;;;;;;;;;;;;;;;;;healthy_BMI; +gms$c15_EAT_scen;;;;;;;;;;FLX;;FLX;FLX;;;;;;;FLX;FLX;FLX;FLX;;;FLX;;;FLX;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_monogastric;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_ruminant;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_fish;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_fruitvegnut;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_roots;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_pulses;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_sugar;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_oils;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_brans;;;;;;;;;;1;0;1;1;;;;;;;1;1;0;0;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_scp;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_exo_alcohol;;;;;;;;;;1;0;1;1;;;;;;;1;1;1;1;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; +gms$s15_alc_scen;0.014;;;;;;;;;;;;;;;;;;;;;0;0;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c20_scp_type;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;hydrogen gms$c21_trade_liberalization;;;;l908080r807070;l909090r808080;l909090r808080;l909595r809090;l908080r807070;l908080r807070;l908080r807070;l908080r807070;l909595r809090;l908080r807070;;;;;;;;;;;;l908080r807070;l908080r807070;l908080r807070;l908080r807070;l908080r807070;;;;;;;;;;;;;;;;;;;; gms$c22_protect_scenario;;;;none;none;none;none;none;none;BH;none;BH_IFL;BH;;;;;;;BH;;;;;BH_IFL;BH_IFL;BH_IFL;BH_IFL;BH_IFL;;;;;;;;;;;;;;;;;;;; gms$c22_protect_scenario_noselect;;;;;;;;;;;;;;;;;;;;;;;;;none;none;BH_IFL;none;BH_IFL;;;;;;;;;;;;;;;;;;;; -gms$c30_bioen_water;;;;rainfed;rainfed;rainfed;rainfed;rainfed;rainfed;rainfed;all;rainfed;rainfed;;;;;;;rainfed;;;rainfed;all;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c30_bioen_water;;;;rainfed;rainfed;rainfed;rainfed;rainfed;rainfed;rainfed;all;rainfed;rainfed;;;;;;;rainfed;;;;rainfed;;;;;;;;;;;;;;;;;;;;;;;;; gms$s30_snv_shr;;;;0;0;0;0;0;0;0;0;0;0.2;;;;;;;0;;;;;0.2;0.2;0.2;0.2;0.2;;;;;;;;;;;;;;;;;;;; gms$s30_snv_shr_noselect;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0.2;0;0.2;;;;;;;;;;;;;;;;;;;; gms$s30_snv_scenario_target;;;;;;;;;;;;;2030;;;;;;;;;;;;2030;2030;2030;2030;2030;;;;;;;;;;;;;;;;;;;; @@ -48,7 +48,7 @@ gms$c31_grassl_yld_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c32_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;; gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;4;4;0;;;;;;;;;;;;; gms$s32_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;1;0;;;;;;;;;;;;; -gms$s32_aff_plantation;;;;0;0;0;0;0;0;0;1;0;0;;;;;;;0;;;0;1;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s32_aff_plantation;;;;0;0;0;0;0;0;0;1;0;0;;;;;;;0;;;;0;;;;;;;;;;;;;;;;;;;;;;;;; gms$s32_aff_bii_coeff;;;;0;0;0;0;0;0;0;1;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s32_max_aff_area;;;;Inf;Inf;Inf;Inf;Inf;Inf;500;350;0;700;;;;;;;500;;;;;Inf;Inf;Inf;500;500;;;;;;;;;;;;;;;;;;;; gms$c32_aff_mask;;;;noboreal;noboreal;noboreal;noboreal;noboreal;noboreal;onlytropical;onlytropical;onlytropical;onlytropical;;;;;;;onlytropical;;;;;noboreal;noboreal;noboreal;noboreal;noboreal;;;;;;;;;;;;;;;;;;;; @@ -73,16 +73,16 @@ gms$c50_scen_neff;;;;baseeff_add3_add10_add20_max75;baseeff_add3_add5_add10_max6 gms$c50_scen_neff_noselect;;;;baseeff_add3_add10_add20_max75;baseeff_add3_add5_add10_max65;baseeff_add3_add5_add10_max65;baseeff_add3_add0_add0_max55;baseeff_add3_add10_add15_max75;baseeff_add3_add5_add15_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max65;baseeff_add3_add15_add25_max75;;;;;;;baseeff_add3_add15_add25_max75;;;;;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;;;;;;;;;;;;;;;;;;;; gms$c55_scen_conf;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;ssp1;ssp1;ssp1;ssp1;;;;;;;ssp1;;;;;ssp1;ssp1;ssp1;ssp1;ssp1;;;;;;;;;;;;;;;;;;;; gms$c55_scen_conf_noselect;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;ssp1;ssp1;ssp1;ssp1;;;;;;;ssp1;;;;;ssp4;ssp4;ssp1;ssp4;ssp1;;;;;;;;;;;;;;;;;;;; -gms$c56_pollutant_prices;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;none;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi -gms$c56_pollutant_prices_noselect;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;none;none;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi +gms$c56_pollutant_prices;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi +gms$c56_pollutant_prices_noselect;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;;none;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-NPi;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi gms$s56_c_price_exp_aff;;;;50;50;50;50;50;50;50;30;50;50;;;;;;;50;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s56_buffer_aff;;;;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.2;0.3;;;;;;;0.5;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -gms$c56_emis_policy;;;;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;redd_nosoil;all_nosoil;;;;;;;reddnatveg_nosoil;;;none;none;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c56_emis_policy;;;;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;redd_nosoil;all_nosoil;;;;;;;reddnatveg_nosoil;;;;none;;;;;;;;;;;;;;;;;;;;;;;;; gms$s56_minimum_cprice;;;;;;;;;;;;;;0;0;18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$maccs;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$bioenergy;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1st2ndgen_priced_feb24 -gms$c60_2ndgen_biodem;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;none;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi -gms$c60_2ndgen_biodem_noselect;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;none;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi +gms$c60_2ndgen_biodem;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi +gms$c60_2ndgen_biodem_noselect;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi gms$c60_1stgen_biodem;;;;phaseout2020;const2020;const2020;const2030;const2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;;;;;;;phaseout2020;;;;;phaseout2020;phaseout2020;phaseout2020;phaseout2020;phaseout2020;;;;;;;;;;;;;;;;;;;;phaseout2020 gms$c60_biodem_level;;;;;;;;;;;;;;;;;1;0;;;;;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; gms$c60_bioenergy_subsidy;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; From 932b49b8f15a5fa7dd12578778850c0886bb56c8 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 17 May 2024 17:06:51 +0200 Subject: [PATCH 151/280] update --- modules/32_forestry/dynamic_may24/input.gms | 2 +- modules/32_forestry/dynamic_may24/scaling.gms | 6 +++--- modules/34_urban/exo_nov21/realization.gms | 1 + modules/34_urban/exo_nov21/scaling.gms | 8 ++++++++ modules/35_natveg/dynamic_feb21/input.gms | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 modules/34_urban/exo_nov21/scaling.gms diff --git a/modules/32_forestry/dynamic_may24/input.gms b/modules/32_forestry/dynamic_may24/input.gms index bce4187eb0..038b9b8b33 100644 --- a/modules/32_forestry/dynamic_may24/input.gms +++ b/modules/32_forestry/dynamic_may24/input.gms @@ -36,7 +36,7 @@ scalars s32_planing_horizon Afforestation planing horizon (years) / 50 / s32_rotation_extension Rotation extension factor 1=original rotations 2=100 percent increase in rotations etc (1) / 1 / s32_faustmann_rotation Switch to activate faustmann rotations (1=on 0=off) / 0 / - s32_initial_distribution Switch to Activate ageclass distribution in plantations 0=off 1=equal distribution 2=FAO distribution 3=Poulter distribution 4=Manual distribution (1) / 0 / + s32_initial_distribution Switch to Activate ageclass distribution in plantations 0=off 1=equal distribution / 1 / s32_price Price for timber (USD) / 45 / s32_free_land_cost Penalty for technial area balance term (USD per ha) / 1e+06 / s32_max_aff_area Maximum total global afforestation (mio. ha) / Inf / diff --git a/modules/32_forestry/dynamic_may24/scaling.gms b/modules/32_forestry/dynamic_may24/scaling.gms index 284349ec52..029d892a2e 100644 --- a/modules/32_forestry/dynamic_may24/scaling.gms +++ b/modules/32_forestry/dynamic_may24/scaling.gms @@ -5,8 +5,8 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -v32_cost_establishment.scale(i) = 10e3; +v32_cost_establishment.scale(i) = 10e4; v32_cost_recur.scale(i) = 10e4; -vm_cost_fore.scale(i) = 10e4; -v32_cost_hvarea.scale(i)$(s32_hvarea = 1 OR s32_hvarea = 2) = 10e3; +vm_cost_fore.scale(i) = 10e5; +v32_cost_hvarea.scale(i)$(s32_hvarea = 1 OR s32_hvarea = 2) = 10e4; vm_cdr_aff.scale(j,ac,aff_effect) = 10e-4; diff --git a/modules/34_urban/exo_nov21/realization.gms b/modules/34_urban/exo_nov21/realization.gms index a1e3dee0bd..bf154011f1 100644 --- a/modules/34_urban/exo_nov21/realization.gms +++ b/modules/34_urban/exo_nov21/realization.gms @@ -17,6 +17,7 @@ $Ifi "%phase%" == "sets" $include "./modules/34_urban/exo_nov21/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/34_urban/exo_nov21/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/34_urban/exo_nov21/input.gms" $Ifi "%phase%" == "equations" $include "./modules/34_urban/exo_nov21/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/34_urban/exo_nov21/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/34_urban/exo_nov21/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/34_urban/exo_nov21/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/34_urban/exo_nov21/postsolve.gms" diff --git a/modules/34_urban/exo_nov21/scaling.gms b/modules/34_urban/exo_nov21/scaling.gms new file mode 100644 index 0000000000..dec0009dd7 --- /dev/null +++ b/modules/34_urban/exo_nov21/scaling.gms @@ -0,0 +1,8 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +vm_cost_urban.scale(j) = 10e4; diff --git a/modules/35_natveg/dynamic_feb21/input.gms b/modules/35_natveg/dynamic_feb21/input.gms index cfe1752b0c..4704e30dd2 100644 --- a/modules/35_natveg/dynamic_feb21/input.gms +++ b/modules/35_natveg/dynamic_feb21/input.gms @@ -18,7 +18,7 @@ s35_timber_harvest_cost_secdforest Cost for harvesting from secondary forest ( s35_timber_harvest_cost_other Cost for harvesting from other land (USD per ha) / 1500 / s35_timber_harvest_cost_primforest Cost for harvesting from primary forest (USD per ha) / 3000/ s35_natveg_harvest_shr Constrains the allowed wood harvest from natural vegetation (1=unconstrained) (1) /1/ -s35_secdf_distribution Flag for secdf initialization (0=all secondary forest in highest age class 1=Equal distribution among all age classes 2=Poulter distribution from MODIS satellite data) (1) / 0 / +s35_secdf_distribution Flag for secdf initialization (0=all secondary forest in highest age class 1=Equal distribution among all age classes 2=Poulter distribution from MODIS satellite data) (1) / 2 / s35_forest_damage Damage simulation in forests (0=none 1=shifting agriculture 2= Damage from shifting agriculture is faded out by c35_forest_damage_end 4= f35_forest_shock scenario) / 2 / s35_forest_damage_end Year of forest damage end (1) / 2050 / ; From 6fbbb512456b9f1a48d857ad7544b690f5af66ce Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 17 May 2024 17:32:47 +0200 Subject: [PATCH 152/280] bugfixes --- config/default.cfg | 2 +- config/scenario_fsec.csv | 2 +- modules/56_ghg_policy/price_aug22/sets.gms | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 0dd4b9ba3e..ac84e0731c 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -25,7 +25,7 @@ cfg$model <- "main.gms" #def = "main.gms" cfg$input <- c(regional = "rev4.105_h12_magpie.tgz", cellular = "rev4.105_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", validation = "rev4.105_h12_validation.tgz", - additional = "additional_data_rev4.50.tgz", + additional = "additional_data_rev4.51.tgz", calibration = "calibration_H12_26Mar24.tgz") # NOTE: It is recommended to recalibrate the model when changing cellular input data diff --git a/config/scenario_fsec.csv b/config/scenario_fsec.csv index 1ef7d7cb66..40f85c1978 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -77,6 +77,6 @@ gms$c73_build_demand;;;;;;;;;;;;;;;;;;;;;;;;50pc;;;;;;;;;;;;;;;;;;;;;;;;;;; input['cellular'];rev4.105_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.105_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.105_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;; input['regional'];rev4.105_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['validation'];rev4.105_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['additional'];additional_data_rev4.48.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['additional'];additional_data_rev4.51.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['calibration'];calibration_FSEC_26Mar24.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; magicc_emis_scen;bjoernAR6_C_SSP2-NDC.mif;;;bjoernAR6_C_SSP2-PkBudg900.mif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bjoernAR6_C_SSP1-NDC.mif;;;;;;;;;;;;bjoernAR6_C_RemSDP-900-MagSSP1.mif;; diff --git a/modules/56_ghg_policy/price_aug22/sets.gms b/modules/56_ghg_policy/price_aug22/sets.gms index 7bb8f6bde9..014de3106f 100644 --- a/modules/56_ghg_policy/price_aug22/sets.gms +++ b/modules/56_ghg_policy/price_aug22/sets.gms @@ -102,15 +102,19 @@ sets all, all_nosoil, redd_nosoil, + redd_nosoil_CH4GWP20, redd_nosoil_nopeat, redd_nosoil_peatCO2only, reddnatveg_nosoil, + reddnatveg_nosoil_CH4GWP20, reddnatveg_nosoil_nopeat, reddnatveg_nosoil_peatCO2only, redd+_nosoil, + redd+_nosoil_CH4GWP20, redd+_nosoil_nopeat, redd+_nosoil_peatCO2only, redd+natveg_nosoil, + redd+natveg_nosoil_CH4GWP20, redd+natveg_nosoil_nopeat, redd+natveg_nosoil_peatCO2only, all_vegc, From 9b0df5f3595a323e5ffb16c1840cdff80a64b69f Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Fri, 17 May 2024 17:56:19 +0200 Subject: [PATCH 153/280] rework of forest establishment potential --- .../dynamic_feb21/declarations.gms | 2 +- .../32_forestry/dynamic_feb21/equations.gms | 2 +- .../32_forestry/dynamic_feb21/presolve.gms | 17 ++++++----- .../pot_forest_may24/declarations.gms | 3 +- .../35_natveg/pot_forest_may24/equations.gms | 6 ++-- .../35_natveg/pot_forest_may24/preloop.gms | 4 +++ .../35_natveg/pot_forest_may24/presolve.gms | 30 +++++++------------ 7 files changed, 31 insertions(+), 33 deletions(-) diff --git a/modules/32_forestry/dynamic_feb21/declarations.gms b/modules/32_forestry/dynamic_feb21/declarations.gms index 4b70b2d3ce..199e78df99 100644 --- a/modules/32_forestry/dynamic_feb21/declarations.gms +++ b/modules/32_forestry/dynamic_feb21/declarations.gms @@ -14,7 +14,7 @@ parameters i32_max_aff_area_glo(t) Maximum global endogenous afforestation area (mio. ha) i32_max_aff_area_reg(t,i) Maximum regional endogenous afforestation area (mio. ha) p32_aff_pol(t,j) NDC forest stock (mio. ha) - pm_aff_pol_timestep(t,j) NDC afforestation per time step (mio. ha) + p32_aff_pol_timestep(t,j) NDC afforestation per time step (mio. ha) p32_aff_pot(t,j) Potential afforestation area (mio. ha) p32_aff_togo(t,i) Remaining exogenous afforestation wrt to the maximum exogenous target over time (mio. ha) p32_carbon_density_ac(t,j,type32,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) diff --git a/modules/32_forestry/dynamic_feb21/equations.gms b/modules/32_forestry/dynamic_feb21/equations.gms index 3a1cbee0a6..84df7e8a6c 100644 --- a/modules/32_forestry/dynamic_feb21/equations.gms +++ b/modules/32_forestry/dynamic_feb21/equations.gms @@ -68,7 +68,7 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( *' The constraint `q32_aff_pol` accounts for the exogenous afforestation prescribed by NPI/NDC policies. q32_aff_pol(j2) .. - sum(ac_est, v32_land(j2,"ndc",ac_est)) =e= sum(ct, pm_aff_pol_timestep(ct,j2)); + sum(ac_est, v32_land(j2,"ndc",ac_est)) =e= sum(ct, p32_aff_pol_timestep(ct,j2)); *' The constraint `q32_max_aff` accounts for the allowed maximum global endogenous *' afforestation defined in `i32_max_aff_area_glo`. diff --git a/modules/32_forestry/dynamic_feb21/presolve.gms b/modules/32_forestry/dynamic_feb21/presolve.gms index 90442e4c4a..9b79285dd7 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_feb21/presolve.gms @@ -18,20 +18,21 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; ** START ndc ** * calc NPI/NDC afforestation per time step based on forest stock change - pm_aff_pol_timestep("y1995",j) = 0; - pm_aff_pol_timestep(t,j)$(ord(t)>1) = p32_aff_pol(t,j) - p32_aff_pol(t-1,j); + p32_aff_pol_timestep("y1995",j) = 0; + p32_aff_pol_timestep(t,j)$(ord(t)>1) = p32_aff_pol(t,j) - p32_aff_pol(t-1,j); * Suitable area (`p32_aff_pot`) for NPI/NDC afforestation p32_aff_pot(t,j) = (vm_land.l(j,"crop") - vm_land.lo(j,"crop")) + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore"); +*** NDC/NPI re/afforesation is further constrained by the remaining forest establishment potential + p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pm_max_forest_est(j)) = pm_max_forest_est(j); * suitable area `p32_aff_pot` can be negative, if land restoration is switched on (level smaller than lower bound), therefore set negative values to 0 p32_aff_pot(t,j)$(p32_aff_pot(t,j) < 0) = 0; -* Limit prescribed NPI/NDC afforestation in `pm_aff_pol_timestep` if not enough suitable area (`p32_aff_pot`) for afforestation is available - pm_aff_pol_timestep(t,j)$(pm_aff_pol_timestep(t,j) > p32_aff_pot(t,j)) = p32_aff_pot(t,j); +* Limit prescribed NPI/NDC afforestation in `p32_aff_pol_timestep` if not enough suitable area (`p32_aff_pot`) for afforestation is available + p32_aff_pol_timestep(t,j)$(p32_aff_pol_timestep(t,j) > p32_aff_pot(t,j)) = p32_aff_pot(t,j); ** END ndc ** *' @code - *' Afforestation switch: *' 0 = Use natveg growth curve towards LPJmL natural vegetation *' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation @@ -178,8 +179,8 @@ p32_updated_gs_reg(t,i) = 1; p32_updated_gs_reg(t,i)$(sum((cell(i,j),ac_sub),p32_land(t,j,"plant",ac_sub))>0) = (sum((cell(i,j),ac_sub),(pm_timber_yield(t,j,ac_sub,"forestry") / sm_wood_density) * p32_land(t,j,"plant",ac_sub))/ sum((cell(i,j),ac_sub),p32_land(t,j,"plant",ac_sub))); * Avoid conflict between afforestation for carbon uptake on land and secdforest restoration -pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") > sum(ac, p32_land(t,j,"ndc",ac) + v32_land.lo(j,"plant",ac) + p32_land(t,j,"aff",ac))+ pm_aff_pol_timestep(t,j)) - = pm_land_conservation(t,j,"secdforest","restore") - (sum(ac, p32_land(t,j,"ndc",ac) + p32_land(t,j,"aff",ac) + v32_land.lo(j,"plant",ac)) + pm_aff_pol_timestep(t,j)); -pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") <= sum(ac, p32_land(t,j,"ndc",ac) + p32_land(t,j,"aff",ac) + v32_land.lo(j,"plant",ac)) + pm_aff_pol_timestep(t,j)) = 0; +pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") > sum(ac, p32_land(t,j,"ndc",ac) + v32_land.lo(j,"plant",ac) + p32_land(t,j,"aff",ac))+ p32_aff_pol_timestep(t,j)) + = pm_land_conservation(t,j,"secdforest","restore") - (sum(ac, p32_land(t,j,"ndc",ac) + p32_land(t,j,"aff",ac) + v32_land.lo(j,"plant",ac)) + p32_aff_pol_timestep(t,j)); +pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") <= sum(ac, p32_land(t,j,"ndc",ac) + p32_land(t,j,"aff",ac) + v32_land.lo(j,"plant",ac)) + p32_aff_pol_timestep(t,j)) = 0; *** EOF presolve.gms *** diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index fe4433f782..8bb3c5b948 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -25,7 +25,8 @@ parameters p35_forest_recovery_shr(j) Forest share in natveg recovery (1) p35_recovered_forest(t,j,ac) Recovered forest (mio. ha) p35_maturesecdf(t,j,ac) Matured secondary forest (mio. ha) - p35_max_forest_est(j) Overall forest establishment potential (mio. ha) + pm_max_forest_est(j) Overall forest establishment potential (mio. ha) + p35_max_forest_recovery(j) Maximum forest recovery potential after land abandonement (mio. ha) p35_carbon_density_secdforest(t,j,ac,ag_pools) Carbon density secdforest (tC per ha) p35_carbon_density_other(t,j,ac,ag_pools) Carbon density other land (tC per ha) p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 85b04e3ae2..4cae033500 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -184,12 +184,14 @@ q35_hvarea_other(j2,ac_sub).. *' The constraint for overall forest establishment is given by the *' remaining potential forest area, which is derived from -*' the potential natural forest area in each cluster. +*' the potential natural forest area minus the recovering secondary +*' forest area. q35_max_forest_establishment(j2).. sum(land_forest, vm_landexpansion(j2,land_forest)) =l= - p35_max_forest_est(j2) + pm_max_forest_est(j2) + - sum(ac, v35_youngsecdf(j2,ac)) ; *' Harvested secondary forest is still considered secondary forests due to diff --git a/modules/35_natveg/pot_forest_may24/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms index 4f85a2fe15..0ad313bfbb 100644 --- a/modules/35_natveg/pot_forest_may24/preloop.gms +++ b/modules/35_natveg/pot_forest_may24/preloop.gms @@ -42,6 +42,10 @@ p35_secdforest(t,j,ac) = 0; p35_disturbance_loss_secdf(t,j,ac) = 0; p35_disturbance_loss_primf(t,j) = 0; +* initialize remaining potential forest establishment area +pm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); +pm_max_forest_est(j)$(pm_max_forest_est(j) < 0) = 0; + * ----------------------------------------- * Land conservation for climate mitigation * ----------------------------------------- diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index e842a6b944..67a41d9469 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -57,37 +57,28 @@ vm_land.l(j,"primforest") = pcm_land(j,"primforest"); * Forest establishment is constrained by the potential forest area in each cluster. * Hence, the area for potential forest establishments is given by the potential forest * area minus all forest areas in the previous time step. -p35_max_forest_est(j) = f35_pot_forest_area(j) - - sum(land_forest, pcm_land(j,land_forest)) - - sum(ac_sub, pc35_youngsecdf(j,ac_sub)); -p35_max_forest_est(j)$(p35_max_forest_est(j) < 0) = 0; +pm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); +pm_max_forest_est(j)$(pm_max_forest_est(j) < 0) = 0; * ------------------------------------------------- * Calculate area of secondary forest recovery * ------------------------------------------------- -* Distribute forestry abandonement +*** Distribute forestry abandonement pc35_youngsecdf(j,ac_est) = vm_lu_transitions.l(j,"forestry","other")/card(ac_est2); -pc35_youngsecdf(j,ac_est)$(sum(ac_est2,pc35_youngsecdf(j,ac_est2)) > p35_max_forest_est(j)) = p35_max_forest_est(j)/card(ac_est2); -p35_max_forest_est(j) = p35_max_forest_est(j) - sum(ac_est, pc35_youngsecdf(j,ac_est)); - -* Consider NDC/NPI re/afforesation in current time step -pm_aff_pol_timestep(t,j)$(pm_aff_pol_timestep(t,j) > p35_max_forest_est(j)) = p35_max_forest_est(j); -p35_max_forest_est(j) = p35_max_forest_est(j) - pm_aff_pol_timestep(t,j); +pc35_youngsecdf(j,ac_est)$(sum(ac_est2,pc35_youngsecdf(j,ac_est2)) > pm_max_forest_est(j)) = pm_max_forest_est(j)/card(ac_est2); * The proportion of secondary forest recovery in total natveg recovery is derived -* from the remaining potential area for forest establishment -p35_forest_recovery_shr(j) = p35_max_forest_est(j) / (sum(land_ag, pcm_land(j,land_ag)) + pcm_land(j,"urban")+1e-10); +* from the remaining forest recovery area +p35_max_forest_recovery(j) = pm_max_forest_est(j) - sum(ac pc35_youngsecdf(j,ac)); +p35_forest_recovery_shr(j) = p35_max_forest_recovery(j) / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")+1e-10); p35_forest_recovery_shr(j)$(p35_forest_recovery_shr(j) > 1) = 1; * Abandoned land pc35_other(j,ac_est) is then distributed propotionally using the forest recovery share. p35_recovered_forest(t,j,ac_est) = pc35_other(j,ac_est) * p35_forest_recovery_shr(j); -p35_recovered_forest(t,j,ac_est)$(sum(ac_est2,p35_recovered_forest(t,j,ac_est2)) > p35_max_forest_est(j)) = p35_max_forest_est(j)/card(ac_est2); +p35_recovered_forest(t,j,ac_est)$(sum(ac_est2,p35_recovered_forest(t,j,ac_est2)) > p35_max_forest_recovery(j)) = p35_max_forest_recovery(j)/card(ac_est2); pc35_other(j,ac_est) = pc35_other(j,ac_est) - p35_recovered_forest(t,j,ac_est); pc35_youngsecdf(j,ac_est) = pc35_youngsecdf(j,ac_est) + p35_recovered_forest(t,j,ac_est); -* Substract the actual recovered forest area from the forest recovery potential. -p35_max_forest_est(j) = p35_max_forest_est(j) - sum(ac_est,p35_recovered_forest(t,j,ac_est)); - * ------------------------------------------------ * Natural vegetation growth (age-class shift) * ------------------------------------------------ @@ -193,12 +184,10 @@ p35_land_restoration(j,"secdforest")$(sum(land_natveg, pcm_land(j,land_natveg)) * Since forest restoration cannot be bigger than the potential area for secdforest recovery, * any remaining restoration area is substracted and shifted to other land restoration. -p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - p35_max_forest_est(j); +p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - p35_max_forest_recovery(j); p35_restoration_shift(j)$(p35_restoration_shift(j) < 0) = 0; p35_land_restoration(j,"secdforest") = p35_land_restoration(j,"secdforest") - p35_restoration_shift(j); pm_land_conservation(t,j,"other","restore") = pm_land_conservation(t,j,"other","restore") + p35_restoration_shift(j); -* Substract forest restoration area from secondary forest recovery potential -p35_max_forest_est(j) = p35_max_forest_est(j) - p35_land_restoration(j,"secdforest"); * set conservation bound vm_land.lo(j,"secdforest") = pm_land_conservation(t,j,"secdforest","protect") + p35_land_restoration(j,"secdforest"); @@ -211,6 +200,7 @@ v35_other.up(j,ac) = Inf; *set upper bound v35_other.up(j,ac_sub) = pc35_other(j,ac_sub); m_boundfix(v35_other,(j,ac_sub),l,1e-6); +v35_youngsecdf.lo(j,ac_sub) = 0; v35_youngsecdf.up(j,ac_sub) = pc35_youngsecdf(j,ac_sub); m_boundfix(v35_youngsecdf,(j,ac_sub),l,1e-6); v35_youngsecdf.fx(j,ac_est) = 0; From 7395c9a5346359f1733fd61795f780b5bc3ce651 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Fri, 17 May 2024 18:08:52 +0200 Subject: [PATCH 154/280] bugfix --- modules/35_natveg/pot_forest_may24/presolve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 67a41d9469..5879055464 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -70,7 +70,7 @@ pc35_youngsecdf(j,ac_est)$(sum(ac_est2,pc35_youngsecdf(j,ac_est2)) > pm_max_fore * The proportion of secondary forest recovery in total natveg recovery is derived * from the remaining forest recovery area -p35_max_forest_recovery(j) = pm_max_forest_est(j) - sum(ac pc35_youngsecdf(j,ac)); +p35_max_forest_recovery(j) = pm_max_forest_est(j) - sum(ac, pc35_youngsecdf(j,ac)); p35_forest_recovery_shr(j) = p35_max_forest_recovery(j) / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")+1e-10); p35_forest_recovery_shr(j)$(p35_forest_recovery_shr(j) > 1) = 1; * Abandoned land pc35_other(j,ac_est) is then distributed propotionally using the forest recovery share. From 0c8311f692c2e4331e7c173384e6b3d137680371 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 17 May 2024 18:35:53 +0200 Subject: [PATCH 155/280] bugfix changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 878a6aef49..cc4959ce48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,8 +35,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### removed - **scripts/output/extra** removed scripts disaggregation_cropsplit and disaggregation_transitions - **scripts** removed support for spam files in start_functions -- *14_yields* removed interface `pm_timber_yield_initial`, no longer needed -- *21_trade_* removed interface `pm_selfsuff_ext`, no longer needed +- **14_yields** removed interface `pm_timber_yield_initial`, no longer needed +- **21_trade** removed interface `pm_selfsuff_ext`, no longer needed ### fixed - **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs From cae41c4e6b1ecaf5095e3e8df0fab107fa6b9bec Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 17 May 2024 20:21:15 +0200 Subject: [PATCH 156/280] defaults --- config/default.cfg | 2 +- config/scenario_fsec.csv | 2 +- modules/44_biodiversity/bii_target/input.gms | 2 +- modules/44_biodiversity/bii_target_apr24/input.gms | 2 +- modules/56_ghg_policy/price_aug22/sets.gms | 4 ---- modules/58_peatland/v2/input.gms | 2 +- modules/60_bioenergy/1st2ndgen_priced_feb24/input.gms | 6 +++--- 7 files changed, 8 insertions(+), 12 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index ac84e0731c..0dd4b9ba3e 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -25,7 +25,7 @@ cfg$model <- "main.gms" #def = "main.gms" cfg$input <- c(regional = "rev4.105_h12_magpie.tgz", cellular = "rev4.105_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", validation = "rev4.105_h12_validation.tgz", - additional = "additional_data_rev4.51.tgz", + additional = "additional_data_rev4.50.tgz", calibration = "calibration_H12_26Mar24.tgz") # NOTE: It is recommended to recalibrate the model when changing cellular input data diff --git a/config/scenario_fsec.csv b/config/scenario_fsec.csv index 40f85c1978..53c95b210c 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -77,6 +77,6 @@ gms$c73_build_demand;;;;;;;;;;;;;;;;;;;;;;;;50pc;;;;;;;;;;;;;;;;;;;;;;;;;;; input['cellular'];rev4.105_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.105_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.105_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;; input['regional'];rev4.105_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['validation'];rev4.105_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['additional'];additional_data_rev4.51.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['additional'];additional_data_rev4.50.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['calibration'];calibration_FSEC_26Mar24.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; magicc_emis_scen;bjoernAR6_C_SSP2-NDC.mif;;;bjoernAR6_C_SSP2-PkBudg900.mif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bjoernAR6_C_SSP1-NDC.mif;;;;;;;;;;;;bjoernAR6_C_RemSDP-900-MagSSP1.mif;; diff --git a/modules/44_biodiversity/bii_target/input.gms b/modules/44_biodiversity/bii_target/input.gms index 3840e6c4ed..26deafacfd 100644 --- a/modules/44_biodiversity/bii_target/input.gms +++ b/modules/44_biodiversity/bii_target/input.gms @@ -10,7 +10,7 @@ scalars c44_bii_decrease Implementation of lower bound for BII (binary) / 1 / s44_target_year Year in which the BII lower bound is reached (1) / 2100 / s44_start_year Start year for interpolation towards BII lower bound (1) / 2025 / - s44_cost_bii_missing Technical costs for missing BII increase (USD per unit of BII) / 1000000 / + s44_cost_bii_missing Technical costs for missing BII increase (USD per unit of BII) / 1e+06 / ; diff --git a/modules/44_biodiversity/bii_target_apr24/input.gms b/modules/44_biodiversity/bii_target_apr24/input.gms index fc6d28b687..f5d19800c5 100644 --- a/modules/44_biodiversity/bii_target_apr24/input.gms +++ b/modules/44_biodiversity/bii_target_apr24/input.gms @@ -10,7 +10,7 @@ scalars c44_bii_decrease Implementation of lower bound for BII (binary) / 1 / s44_target_year Year in which the BII lower bound is reached (1) / 2100 / s44_start_year Start year for interpolation towards BII lower bound (1) / 2025 / - s44_cost_bii_missing Technical costs for missing BII increase (USD per unit of BII) / 1000000 / + s44_cost_bii_missing Technical costs for missing BII increase (USD per unit of BII) / 1e+06 / ; diff --git a/modules/56_ghg_policy/price_aug22/sets.gms b/modules/56_ghg_policy/price_aug22/sets.gms index 014de3106f..7bb8f6bde9 100644 --- a/modules/56_ghg_policy/price_aug22/sets.gms +++ b/modules/56_ghg_policy/price_aug22/sets.gms @@ -102,19 +102,15 @@ sets all, all_nosoil, redd_nosoil, - redd_nosoil_CH4GWP20, redd_nosoil_nopeat, redd_nosoil_peatCO2only, reddnatveg_nosoil, - reddnatveg_nosoil_CH4GWP20, reddnatveg_nosoil_nopeat, reddnatveg_nosoil_peatCO2only, redd+_nosoil, - redd+_nosoil_CH4GWP20, redd+_nosoil_nopeat, redd+_nosoil_peatCO2only, redd+natveg_nosoil, - redd+natveg_nosoil_CH4GWP20, redd+natveg_nosoil_nopeat, redd+natveg_nosoil_peatCO2only, all_vegc, diff --git a/modules/58_peatland/v2/input.gms b/modules/58_peatland/v2/input.gms index 0508ea5c3f..12007a7e7c 100644 --- a/modules/58_peatland/v2/input.gms +++ b/modules/58_peatland/v2/input.gms @@ -13,7 +13,7 @@ scalars s58_cost_drain_rewet_onetime One-time costs for drainage of rewetted peatland (USD05MER per ha) / 0 / s58_rewetting_switch Peatland rewetting on (Inf) or off (0) / Inf / s58_fix_peatland Year indicating until when peatland area should be fixed (year) / 2020 / - s58_balance_penalty Penalty for technical peatland balance term (USD05MER) / 1000000 / + s58_balance_penalty Penalty for technical peatland balance term (USD05MER) / 1e+06 / ; *Peatland area based on Global Peatland Map 2.0 and Global Peatland Database diff --git a/modules/60_bioenergy/1st2ndgen_priced_feb24/input.gms b/modules/60_bioenergy/1st2ndgen_priced_feb24/input.gms index 5f8da47522..da938046e9 100644 --- a/modules/60_bioenergy/1st2ndgen_priced_feb24/input.gms +++ b/modules/60_bioenergy/1st2ndgen_priced_feb24/input.gms @@ -43,9 +43,9 @@ scalars s60_2ndgen_bioenergy_dem_min_post_fix Minimum dedicated 2nd generation bioenergy demand assumed in each region after SSP2-fix (mio. GJ per yr) / 1 / ; -$setglobal c60_price_implementation exp -$setglobal c60_2ndgen_biodem R21M42-SSP2-Npi-PhaseOut50 -$setglobal c60_2ndgen_biodem_noselect R21M42-SSP2-NPi +$setglobal c60_price_implementation lin +$setglobal c60_2ndgen_biodem R32M46-SSP2EU-NPi +$setglobal c60_2ndgen_biodem_noselect R32M46-SSP2EU-NPi $if "%c60_2ndgen_biodem%" == "coupling" table f60_bioenergy_dem_coupling(t_all,i) Bioenergy demand (regional) (mio. GJ per yr) From b7647f2998feb3baa0e3f3f1758c9b8cf3dc2ccb Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 17 May 2024 20:37:02 +0200 Subject: [PATCH 157/280] bugfix --- modules/32_forestry/dynamic_may24/input.gms | 7 ------- modules/32_forestry/input/files | 1 - 2 files changed, 8 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/input.gms b/modules/32_forestry/dynamic_may24/input.gms index 038b9b8b33..354a7eefe3 100644 --- a/modules/32_forestry/dynamic_may24/input.gms +++ b/modules/32_forestry/dynamic_may24/input.gms @@ -90,13 +90,6 @@ $include "./modules/32_forestry/input/f32_localTCRE.cs3" $ondelim ; -parameter f32_gs_relativetarget(i) Relative growing stock target in each region (m3 per ha) -/ -$ondelim -$include "./modules/32_forestry/input/f32_gs_relativetarget.cs4" -$offdelim -/; - parameter f32_plantedforest(i) Share of plantation forest in planted forest (1) / $ondelim diff --git a/modules/32_forestry/input/files b/modules/32_forestry/input/files index 1a0959d8ae..b4ae3f22af 100644 --- a/modules/32_forestry/input/files +++ b/modules/32_forestry/input/files @@ -3,7 +3,6 @@ aff_unrestricted.cs2 aff_noboreal.cs2 aff_onlytropical.cs2 npi_ndc_aff_pol.cs3 -f32_plant_prod_share.csv f32_bph_effect_noTCRE.cs3 f32_localTCRE.cs3 f32_plantedforest.cs4 From 9627d1c3982af0c9f9be73e4c46cc5da8d29e68b Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 17 May 2024 20:57:45 +0200 Subject: [PATCH 158/280] update highres --- scripts/output/extra/highres.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/output/extra/highres.R b/scripts/output/extra/highres.R index 3d250abb7a..809868fef6 100644 --- a/scripts/output/extra/highres.R +++ b/scripts/output/extra/highres.R @@ -100,9 +100,8 @@ highres <- function(cfg) { #copy gdx file for 1st time step from low resolution run for better starting point #note: using gdx files for more than the 1st time step sometimes pushes the model into corner solutions, which might result in infeasibilites. cfg$files2export$start <- c(cfg$files2export$start, - paste0(cfg$results_folder, "/", "magpie_y1995.gdx")) - cfg$gms$s_use_gdx <- 1 - cfg$gms$s80_optfile <- 1 + paste0(cfg$results_folder, "/", "magpie_y*.gdx")) + cfg$gms$s_use_gdx <- 2 #max resources for parallel runs cfg$qos <- "standby_maxMem_dayMax" From 41250ca450068abd52789149f0fb8e45b7140774 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Sat, 18 May 2024 00:32:27 +0200 Subject: [PATCH 159/280] forest establishment bound fix --- modules/35_natveg/pot_forest_may24/postsolve.gms | 4 ++++ modules/35_natveg/pot_forest_may24/preloop.gms | 8 +++++++- modules/35_natveg/pot_forest_may24/presolve.gms | 10 ---------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms index ebe6ddce81..404670eb0c 100644 --- a/modules/35_natveg/pot_forest_may24/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -12,6 +12,10 @@ p35_secdforest(t,j,ac) = v35_secdforest.l(j,ac); p35_other(t,j,ac) = v35_other.l(j,ac); p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); +* Forest establishment bound +pm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, vm_land.l(j,land_forest)); +pm_max_forest_est(j)$(pm_max_forest_est(j) < 0) = 0; + *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); ov35_youngsecdf(t,j,ac,"marginal") = v35_youngsecdf.m(j,ac); diff --git a/modules/35_natveg/pot_forest_may24/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms index 0ad313bfbb..4b1cba4f6c 100644 --- a/modules/35_natveg/pot_forest_may24/preloop.gms +++ b/modules/35_natveg/pot_forest_may24/preloop.gms @@ -42,7 +42,13 @@ p35_secdforest(t,j,ac) = 0; p35_disturbance_loss_secdf(t,j,ac) = 0; p35_disturbance_loss_primf(t,j) = 0; -* initialize remaining potential forest establishment area +* ------------------------------------------------------------- +* Initialize remaining potential forest establishment area +* ------------------------------------------------------------- + +* Forest establishment is constrained by the potential forest area in each cluster. +* Hence, the area for potential forest establishments is given by the potential forest +* area minus all forest areas in the previous time step. pm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); pm_max_forest_est(j)$(pm_max_forest_est(j) < 0) = 0; diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 5879055464..be45026c6b 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -50,16 +50,6 @@ pcm_land(j,"primforest") = pcm_land(j,"primforest") - p35_disturbance_loss_primf vm_land.l(j,"primforest") = pcm_land(j,"primforest"); -* -------------------------------------- -* Forest establishment bound -* -------------------------------------- - -* Forest establishment is constrained by the potential forest area in each cluster. -* Hence, the area for potential forest establishments is given by the potential forest -* area minus all forest areas in the previous time step. -pm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); -pm_max_forest_est(j)$(pm_max_forest_est(j) < 0) = 0; - * ------------------------------------------------- * Calculate area of secondary forest recovery * ------------------------------------------------- From aa8c9a9c6ab50a6976d94f3f5cd2b7ae42fe0810 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 18 May 2024 08:12:26 +0200 Subject: [PATCH 160/280] bugfix --- modules/21_trade/exo/input.gms | 5 ----- .../selfsuff_reduced_bilateral22/equations.gms | 5 +++-- scripts/output/extra/highres.R | 11 ++++++++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/modules/21_trade/exo/input.gms b/modules/21_trade/exo/input.gms index 70be889924..3ae07b84d6 100644 --- a/modules/21_trade/exo/input.gms +++ b/modules/21_trade/exo/input.gms @@ -9,8 +9,3 @@ table f21_trade_balance(t_all,h,kall) trade balance of positive exports and nega $ondelim $include "./modules/21_trade/input/f21_trade_balance.cs3" $offdelim; - -table f21_self_suff(t_all,h,kall) Superregional self-sufficiency rates (1) -$ondelim -$include "./modules/21_trade/input/f21_trade_self_suff.cs3" -$offdelim; diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/equations.gms b/modules/21_trade/selfsuff_reduced_bilateral22/equations.gms index 09bc08180c..4e25b7c5ce 100644 --- a/modules/21_trade/selfsuff_reduced_bilateral22/equations.gms +++ b/modules/21_trade/selfsuff_reduced_bilateral22/equations.gms @@ -37,8 +37,9 @@ q21_trade_bilat(h2,k_trade).. *sum(ct,i21_trade_bal_reduction(ct,k_trade))) $(sum(ct,f21_self_suff(ct,h2,k_trade) >= 1)) + (sum(supreg(h2,i2),vm_supply(i2,k_trade))*sum(ct,f21_self_suff(ct,h2,k_trade)) - *sum(ct,i21_trade_bal_reduction(ct,k_trade)) - v21_import_for_feasibility(h2,k_trade)) - $(sum(ct,f21_self_suff(ct,h2,k_trade) < 1)); + *sum(ct,i21_trade_bal_reduction(ct,k_trade))) + $(sum(ct,f21_self_suff(ct,h2,k_trade) < 1)) + - v21_import_for_feasibility(h2,k_trade); *' Upper bound for production. diff --git a/scripts/output/extra/highres.R b/scripts/output/extra/highres.R index 809868fef6..bde43b4419 100644 --- a/scripts/output/extra/highres.R +++ b/scripts/output/extra/highres.R @@ -128,10 +128,15 @@ highres <- function(cfg) { cfg$recalc_npi_ndc <- TRUE #get trade pattern from low resolution run with c200 - ov_prod_reg <- readGDX(gdx, "ov_prod_reg", select = list(type = "level")) - ov_supply <- readGDX(gdx, "ov_supply", select = list(type = "level")) + k_trade <- readGDX(gdx, "k_trade") + ov_prod_reg <- readGDX(gdx, "ov_prod_reg", select = list(type = "level"))[,,k_trade] + ov_supply <- readGDX(gdx, "ov_supply", select = list(type = "level"))[,,k_trade] + import_for_feasibility <- readGDX(gdx, "ov21_import_for_feasibility", select = list(type = "level"), react = "silent") + if(is.null(import_for_feasibility)) { + import_for_feasibility <- new.magpie(getCells(ov_supply),getYears(ov_supply),getNames(ov_supply),fill = 0) + } supreg <- readGDX(gdx, "supreg") - f21_trade_balance <- toolAggregate(ov_prod_reg - ov_supply, supreg) + f21_trade_balance <- toolAggregate(ov_prod_reg - (ov_supply + import_for_feasibility), supreg) write.magpie(f21_trade_balance, paste0("modules/21_trade/input/f21_trade_balance.cs3")) #get tau from low resolution run with c200 From 0e0e5276ece6f81cd8f8bfb6b24ca1e5840ca4f7 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 18 May 2024 09:35:37 +0200 Subject: [PATCH 161/280] reverting back --- modules/73_timber/default/presolve.gms | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/73_timber/default/presolve.gms b/modules/73_timber/default/presolve.gms index 205a9693bd..4cca5213d3 100644 --- a/modules/73_timber/default/presolve.gms +++ b/modules/73_timber/default/presolve.gms @@ -18,6 +18,3 @@ if(s73_foresight=1, else pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry); ); - -* tbd: remove after successful testing? -v73_prod_heaven_timber.fx(j,kforestry) = 0; From 2e28b4ad4aa5d6c4d009958696196d4ba95f3832 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Sat, 18 May 2024 10:06:38 +0200 Subject: [PATCH 162/280] slight renaming --- modules/35_natveg/pot_forest_may24/declarations.gms | 2 +- modules/35_natveg/pot_forest_may24/equations.gms | 2 +- modules/35_natveg/pot_forest_may24/postsolve.gms | 6 +++--- modules/35_natveg/pot_forest_may24/preloop.gms | 4 ++-- modules/35_natveg/pot_forest_may24/presolve.gms | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index 8bb3c5b948..28c382ce43 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -25,7 +25,7 @@ parameters p35_forest_recovery_shr(j) Forest share in natveg recovery (1) p35_recovered_forest(t,j,ac) Recovered forest (mio. ha) p35_maturesecdf(t,j,ac) Matured secondary forest (mio. ha) - pm_max_forest_est(j) Overall forest establishment potential (mio. ha) + pcm_max_forest_est(j) Overall forest establishment potential in current time step (mio. ha) p35_max_forest_recovery(j) Maximum forest recovery potential after land abandonement (mio. ha) p35_carbon_density_secdforest(t,j,ac,ag_pools) Carbon density secdforest (tC per ha) p35_carbon_density_other(t,j,ac,ag_pools) Carbon density other land (tC per ha) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 4cae033500..6175c5b31e 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -190,7 +190,7 @@ q35_hvarea_other(j2,ac_sub).. q35_max_forest_establishment(j2).. sum(land_forest, vm_landexpansion(j2,land_forest)) =l= - pm_max_forest_est(j2) + pcm_max_forest_est(j2) - sum(ac, v35_youngsecdf(j2,ac)) ; diff --git a/modules/35_natveg/pot_forest_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms index 404670eb0c..c503ff69ad 100644 --- a/modules/35_natveg/pot_forest_may24/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -12,9 +12,9 @@ p35_secdforest(t,j,ac) = v35_secdforest.l(j,ac); p35_other(t,j,ac) = v35_other.l(j,ac); p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); -* Forest establishment bound -pm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, vm_land.l(j,land_forest)); -pm_max_forest_est(j)$(pm_max_forest_est(j) < 0) = 0; +* Reset forest establishment bound +pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, vm_land.l(j,land_forest)); +pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); diff --git a/modules/35_natveg/pot_forest_may24/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms index 4b1cba4f6c..0f6ec6dd21 100644 --- a/modules/35_natveg/pot_forest_may24/preloop.gms +++ b/modules/35_natveg/pot_forest_may24/preloop.gms @@ -49,8 +49,8 @@ p35_disturbance_loss_primf(t,j) = 0; * Forest establishment is constrained by the potential forest area in each cluster. * Hence, the area for potential forest establishments is given by the potential forest * area minus all forest areas in the previous time step. -pm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); -pm_max_forest_est(j)$(pm_max_forest_est(j) < 0) = 0; +pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); +pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; * ----------------------------------------- * Land conservation for climate mitigation diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index be45026c6b..6a6e08fb29 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -56,11 +56,11 @@ vm_land.l(j,"primforest") = pcm_land(j,"primforest"); *** Distribute forestry abandonement pc35_youngsecdf(j,ac_est) = vm_lu_transitions.l(j,"forestry","other")/card(ac_est2); -pc35_youngsecdf(j,ac_est)$(sum(ac_est2,pc35_youngsecdf(j,ac_est2)) > pm_max_forest_est(j)) = pm_max_forest_est(j)/card(ac_est2); +pc35_youngsecdf(j,ac_est)$(sum(ac_est2,pc35_youngsecdf(j,ac_est2)) > pcm_max_forest_est(j)) = pcm_max_forest_est(j)/card(ac_est2); * The proportion of secondary forest recovery in total natveg recovery is derived * from the remaining forest recovery area -p35_max_forest_recovery(j) = pm_max_forest_est(j) - sum(ac, pc35_youngsecdf(j,ac)); +p35_max_forest_recovery(j) = pcm_max_forest_est(j) - sum(ac, pc35_youngsecdf(j,ac)); p35_forest_recovery_shr(j) = p35_max_forest_recovery(j) / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")+1e-10); p35_forest_recovery_shr(j)$(p35_forest_recovery_shr(j) > 1) = 1; * Abandoned land pc35_other(j,ac_est) is then distributed propotionally using the forest recovery share. From 26acf5acad0d430ead02abe5b319f80907b3856d Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Sat, 18 May 2024 10:08:18 +0200 Subject: [PATCH 163/280] slight renaming --- modules/32_forestry/dynamic_feb21/presolve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/32_forestry/dynamic_feb21/presolve.gms b/modules/32_forestry/dynamic_feb21/presolve.gms index 9b79285dd7..380d05d2f4 100644 --- a/modules/32_forestry/dynamic_feb21/presolve.gms +++ b/modules/32_forestry/dynamic_feb21/presolve.gms @@ -25,7 +25,7 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore"); *** NDC/NPI re/afforesation is further constrained by the remaining forest establishment potential - p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pm_max_forest_est(j)) = pm_max_forest_est(j); + p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pcm_max_forest_est(j)) = pcm_max_forest_est(j); * suitable area `p32_aff_pot` can be negative, if land restoration is switched on (level smaller than lower bound), therefore set negative values to 0 p32_aff_pot(t,j)$(p32_aff_pot(t,j) < 0) = 0; * Limit prescribed NPI/NDC afforestation in `p32_aff_pol_timestep` if not enough suitable area (`p32_aff_pot`) for afforestation is available From a2fe7f64ad8f5727962c9a3ed841047f3c1b8eba Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 19 May 2024 10:33:34 +0200 Subject: [PATCH 164/280] model run time --- scripts/output/extra/runtimePR.R | 128 +++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 scripts/output/extra/runtimePR.R diff --git a/scripts/output/extra/runtimePR.R b/scripts/output/extra/runtimePR.R new file mode 100644 index 0000000000..219d4a8c77 --- /dev/null +++ b/scripts/output/extra/runtimePR.R @@ -0,0 +1,128 @@ +# | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +# | authors, and contributors see CITATION.cff file. This file is part +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +# | AGPL-3.0, you are granted additional permissions described in the +# | MAgPIE License Exception, version 1.0 (see LICENSE file). +# | Contact: magpie@pik-potsdam.de + +# -------------------------------------------------------------- +# description: Compiles model run time for PR +# comparison script: TRUE +# --------------------------------------------------------------- + +############################# LOAD LIBRARIES ############################# +library(lucode2, quietly = TRUE, warn.conflicts =FALSE) + +if(!exists("source_include")) { + outputdir <- file.path("output",list.dirs("output", full.names = FALSE, recursive = FALSE)) + lucode2::readArgs("outputdir") +} + +runtime <- NULL +maindir <- getwd() + +# ---- Read runtime data ---- + +cat("\nReading runtime for", length(outputdir), "runs\n") +for (d in outputdir) { + splittedpath <- strsplit(d, "/")[[1]] + runfolder <- splittedpath[length(splittedpath)] + datafile <- paste0(d, "/runstatistics.rda") + + # try to read runtime data from runstatistics.rda + tmp <- NULL + start <- NULL + end <- NULL + timePrepareStart <- NULL + timePrepareEnd <- NULL + timeGAMSStart <- NULL + timeGAMSEnd <- NULL + timeOutputStart <- NULL + timeOutputEnd <- NULL + + if (!file.exists(datafile)) { + cat("No file found ", datafile, "\n") + } else if (file.info(datafile)$size == 0) { + cat("Empty file ", datafile, "\n") + } else { + # if file exists and it's file size is >0: load it + stats <- NULL + load(datafile) + # try to load detailed runtime information + if (!is.null(stats) && !is.null(stats$timePrepareStart)) { + timePrepareStart <- stats$timePrepareStart + timePrepareEnd <- stats$timePrepareEnd + timeGAMSStart <- stats$timeGAMSStart + timeGAMSEnd <- stats$timeGAMSEnd + timeOutputStart <- stats$timeOutputStart + timeOutputEnd <- stats$timeOutputEnd + } else if (!is.null(stats) && !is.null(stats$starttime)) { + # if no detailed information is available load the old one (it's only the gams runtime) + start <- stats$starttime + end <- stats$endtime + } + } + + # if no start and end was extractable from runstatistics.rda + # conclude it from timestamps of the files in the results folder + if (is.null(end) && is.null(timePrepareEnd) && is.null(timeGAMSEnd) && is.null(timeOutputEnd)) { + local_dir(d) + # find all files + info <- file.info(dir()) + # sort files in info by mtime + info <- info[order(info$mtime), ] + # save time of first file in the list (oldest) + start <- info[1, ]$mtime + # save time if last file in the list (newest) + + if ("report.rds" %in% rownames(info)) { + # if run has finished normally the report.rds file should exist. In this case take the newest file + cat("Using the newest file in", runfolder, "as end\n") + end <- tail(info$mtime, n = 1) + } else { + # if report.rds does not exist, this indicates that the run did not finish properly and the mif file has been + # generated manually later without also producing the report.rds + # In this case do not take the newest file (which is the manually and belated produced mif file) but take the + # full.lst which is the newest file before the mif file + cat("Using", runfolder, "full.lst as end\n") + end <- info["full.lst", ]$mtime + } + local_dir(maindir) + } + + # if (total) runtime data was found + if (all(c(!is.null(start), !is.null(end)))) { + # need to be transformed to NA otherwise rbind would not work if one of them is NULL + tmp <- end - start + units(tmp) <- "hours" + if (is.null(start)) start <- NA + if (is.null(end)) end <- NA + new <- data.frame(section = "total", run = runfolder, mins = round(tmp,1), stringsAsFactors = FALSE) + runtime <- rbind(runtime, new) + } + + # if detailed runtime data was found append it + if (!is.null(timePrepareEnd)) { + tmp <- timePrepareEnd - timePrepareStart + units(tmp) <- "mins" + new <- data.frame(section = "prep", run = runfolder, mins = round(tmp,1), stringsAsFactors = FALSE) + runtime <- rbind(runtime, new) + } + + if (!is.null(timeGAMSEnd)) { + tmp <- timeGAMSEnd - timeGAMSStart + units(tmp) <- "mins" + new <- data.frame(section = "GAMS", run = runfolder, mins = round(tmp,1), stringsAsFactors = FALSE) + runtime <- rbind(runtime, new) + } + + if (!is.null(timeOutputEnd)) { + tmp <- timeOutputEnd - timeOutputStart + units(tmp) <- "mins" + new <- data.frame(section = "output", run = runfolder, mins = round(tmp,1), stringsAsFactors = FALSE) + runtime <- rbind(runtime, new) + } +} + +runtime <- runtime[order(runtime$section,runtime$run),] +write.csv(runtime, file = "output/runtimePR.csv", quote = FALSE,row.names = FALSE) From cdd804bad3b53083f11248ea7411c25b4fc41123 Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 19 May 2024 12:45:18 +0200 Subject: [PATCH 165/280] update --- CHANGELOG.md | 2 +- modules/16_demand/sector_may15/equations.gms | 2 +- .../32_forestry/dynamic_may24/presolve.gms | 8 ++++---- .../exo_flexreg_apr16/declarations.gms | 8 +++++--- .../exo_flexreg_apr16/equations.gms | 18 +++++++++++------ .../exo_flexreg_apr16/postsolve.gms | 20 +++++++++++-------- .../62_material/exo_flexreg_apr16/sets.gms | 10 ++++++++++ modules/73_timber/default/declarations.gms | 2 +- modules/73_timber/default/preloop.gms | 16 +++++++-------- modules/73_timber/default/presolve.gms | 6 +++--- 10 files changed, 57 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc4959ce48..1495dad620 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,7 +46,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **start/projects/fsec.R** scenario settings - **80_optimization** fixed a bug in nlp_apr17; cycling through CONOPT4, CONOPT4 without preprocessing and CONOPT3 was not working - **58_peatland** Added balance variable to avoid random infeasibilites - +- **62_material/16_demand** Removed double structure for forestry products. `pm_demand_foresty` is now used in `62_material` ## [4.7.3] - 2024-04-12 diff --git a/modules/16_demand/sector_may15/equations.gms b/modules/16_demand/sector_may15/equations.gms index 7ae902205a..b5bab81189 100644 --- a/modules/16_demand/sector_may15/equations.gms +++ b/modules/16_demand/sector_may15/equations.gms @@ -84,5 +84,5 @@ q16_seed_demand(i2,kcr) .. q16_supply_forestry(i2,kforestry) .. vm_supply(i2,kforestry) =e= - sum(ct,pm_demand_ext(ct,i2,kforestry)) + vm_dem_material(i2,kforestry) ; diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index d7a92d6327..bcbb5c8b3a 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -165,8 +165,8 @@ pc32_yield_forestry_future(j) = sum(ac$(ac.off = p32_rotation_cellular_estb(t,j) * Fader for plantation share in establishment decision if(ord(t) = 1, pc32_prod_forestry_ini(i) = sum(cell(i,j), sum(ac$(ac.off = p32_rotation_cellular_harvesting(t,j)), pm_timber_yield(t,j,ac,"forestry") * p32_land(t,j,"plant",ac))) / m_timestep_length_forestry; - pc32_plant_contr_ini(i)$(sum(kforestry, pm_demand_ext(t,i,kforestry)) > 0) = pc32_prod_forestry_ini(i) / sum(kforestry, pm_demand_ext(t,i,kforestry)); - pc32_plant_contr_ini(i)$(sum(kforestry, pm_demand_ext(t,i,kforestry)) = 0) = 0; + pc32_plant_contr_ini(i)$(sum(kforestry, pm_demand_forestry(t,i,kforestry)) > 0) = pc32_prod_forestry_ini(i) / sum(kforestry, pm_demand_forestry(t,i,kforestry)); + pc32_plant_contr_ini(i)$(sum(kforestry, pm_demand_forestry(t,i,kforestry)) = 0) = 0; p32_plant_contr(t,i) = pc32_plant_contr_ini(i); else p32_plant_contr(t,i) = p32_plant_contr(t-1,i) * (1+i32_plant_contr_growth_fader(t))**m_timestep_length_forestry; @@ -176,8 +176,8 @@ p32_plant_contr(t,i)$(p32_plant_contr(t,i) > s32_plant_contr_max) = s32_plant_co p32_forestry_product_dist(t,i,kforestry)$(pm_demand_forestry_future(t,i,kforestry) > 0) = pm_demand_forestry_future(t,i,kforestry) / sum(kforestry2, pm_demand_forestry_future(t,i,kforestry2)); p32_forestry_product_dist(t,i,kforestry)$(pm_demand_forestry_future(t,i,kforestry) = 0) = 1/card(kforestry); -p32_future_to_current_demand_ratio(t,i)$(sum(kforestry, pm_demand_ext(t,i,kforestry)) > 0) = sum(kforestry, pm_demand_forestry_future(t,i,kforestry)) / sum(kforestry, pm_demand_ext(t,i,kforestry)); -p32_future_to_current_demand_ratio(t,i)$(sum(kforestry, pm_demand_ext(t,i,kforestry)) = 0) = 0; +p32_future_to_current_demand_ratio(t,i)$(sum(kforestry, pm_demand_forestry(t,i,kforestry)) > 0) = sum(kforestry, pm_demand_forestry_future(t,i,kforestry)) / sum(kforestry, pm_demand_forestry(t,i,kforestry)); +p32_future_to_current_demand_ratio(t,i)$(sum(kforestry, pm_demand_forestry(t,i,kforestry)) = 0) = 0; * Avoid conflict between afforestation for carbon uptake on land and secdforest restoration pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") > sum(ac, p32_land(t,j,"ndc",ac) + v32_land.lo(j,"plant",ac) + p32_land(t,j,"aff",ac))+ p32_aff_pol_timestep(t,j)) diff --git a/modules/62_material/exo_flexreg_apr16/declarations.gms b/modules/62_material/exo_flexreg_apr16/declarations.gms index f123033e91..ffb6234084 100644 --- a/modules/62_material/exo_flexreg_apr16/declarations.gms +++ b/modules/62_material/exo_flexreg_apr16/declarations.gms @@ -26,12 +26,14 @@ positive variables ; equations - q62_dem_material(i,kall) Estimating material demand (mio. tDM per yr) + q62_dem_material(i,kall_excl_kforestry) Estimating material demand (mio. tDM per yr) + q62_dem_material_forestry(i,kforestry) Demand for forestry products (mio. tDM per yr) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_dem_material(t,i,kall,type) Demand for material usage (mio. tDM per yr) - oq62_dem_material(t,i,kall,type) Estimating material demand (mio. tDM per yr) + ov_dem_material(t,i,kall,type) Demand for material usage (mio. tDM per yr) + oq62_dem_material(t,i,kall_excl_kforestry,type) Estimating material demand (mio. tDM per yr) + oq62_dem_material_forestry(t,i,kforestry,type) Demand for forestry products (mio. tDM per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/62_material/exo_flexreg_apr16/equations.gms b/modules/62_material/exo_flexreg_apr16/equations.gms index 1f6221a307..1d588cb992 100644 --- a/modules/62_material/exo_flexreg_apr16/equations.gms +++ b/modules/62_material/exo_flexreg_apr16/equations.gms @@ -19,14 +19,20 @@ *' For historic years it is assumed that this demand is already part of the *' general material demand, therefore the double-counted demand is subtracted. - q62_dem_material(i2,kall) .. - vm_dem_material(i2,kall) + q62_dem_material(i2,kall_excl_kforestry) .. + vm_dem_material(i2,kall_excl_kforestry) =e= - sum(ct,f62_dem_material(ct,i2,kall))*s62_historical + sum(ct,f62_dem_material(ct,i2,kall_excl_kforestry))*s62_historical + - (p62_dem_material_lastcalibyear(i2,kall) * p62_scaling_factor(i2)) - *(1-s62_historical) + sum(ct, p62_bioplastic_substrate(ct, i2, kall)) - - sum(ct, p62_bioplastic_substrate_double_counted(ct,i2,kall)) + (p62_dem_material_lastcalibyear(i2,kall_excl_kforestry) * p62_scaling_factor(i2)) + *(1-s62_historical) + sum(ct, p62_bioplastic_substrate(ct, i2, kall_excl_kforestry)) - + sum(ct, p62_bioplastic_substrate_double_counted(ct,i2,kall_excl_kforestry)) ; +*' Demand for forestry products (wood and woodfuel) is provided by the timber module. + q62_dem_material_forestry(i2,kforestry) .. + vm_dem_material(i2,kforestry) + =e= + sum(ct, pm_demand_forestry(ct,i2,kforestry)); + ; diff --git a/modules/62_material/exo_flexreg_apr16/postsolve.gms b/modules/62_material/exo_flexreg_apr16/postsolve.gms index 6151fa40de..979193f976 100644 --- a/modules/62_material/exo_flexreg_apr16/postsolve.gms +++ b/modules/62_material/exo_flexreg_apr16/postsolve.gms @@ -18,12 +18,16 @@ if (sum(sameas(t_past,t),1) = 1, *' @stop *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_dem_material(t,i,kall,"marginal") = vm_dem_material.m(i,kall); - oq62_dem_material(t,i,kall,"marginal") = q62_dem_material.m(i,kall); - ov_dem_material(t,i,kall,"level") = vm_dem_material.l(i,kall); - oq62_dem_material(t,i,kall,"level") = q62_dem_material.l(i,kall); - ov_dem_material(t,i,kall,"upper") = vm_dem_material.up(i,kall); - oq62_dem_material(t,i,kall,"upper") = q62_dem_material.up(i,kall); - ov_dem_material(t,i,kall,"lower") = vm_dem_material.lo(i,kall); - oq62_dem_material(t,i,kall,"lower") = q62_dem_material.lo(i,kall); + ov_dem_material(t,i,kall,"marginal") = vm_dem_material.m(i,kall); + oq62_dem_material(t,i,kall_excl_kforestry,"marginal") = q62_dem_material.m(i,kall_excl_kforestry); + oq62_dem_material_forestry(t,i,kforestry,"marginal") = q62_dem_material_forestry.m(i,kforestry); + ov_dem_material(t,i,kall,"level") = vm_dem_material.l(i,kall); + oq62_dem_material(t,i,kall_excl_kforestry,"level") = q62_dem_material.l(i,kall_excl_kforestry); + oq62_dem_material_forestry(t,i,kforestry,"level") = q62_dem_material_forestry.l(i,kforestry); + ov_dem_material(t,i,kall,"upper") = vm_dem_material.up(i,kall); + oq62_dem_material(t,i,kall_excl_kforestry,"upper") = q62_dem_material.up(i,kall_excl_kforestry); + oq62_dem_material_forestry(t,i,kforestry,"upper") = q62_dem_material_forestry.up(i,kforestry); + ov_dem_material(t,i,kall,"lower") = vm_dem_material.lo(i,kall); + oq62_dem_material(t,i,kall_excl_kforestry,"lower") = q62_dem_material.lo(i,kall_excl_kforestry); + oq62_dem_material_forestry(t,i,kforestry,"lower") = q62_dem_material_forestry.lo(i,kforestry); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/62_material/exo_flexreg_apr16/sets.gms b/modules/62_material/exo_flexreg_apr16/sets.gms index 253c23cbfd..e89607d1a0 100644 --- a/modules/62_material/exo_flexreg_apr16/sets.gms +++ b/modules/62_material/exo_flexreg_apr16/sets.gms @@ -13,4 +13,14 @@ sets a1,a2,b1,b2, history, SSP2_lowls,SSP2_lowcal / + + kall_excl_kforestry(kall) All products in the sectoral version excluding wood and woodfuel + / + tece,maiz,trce,rice_pro,soybean,rapeseed,groundnut,sunflower,oilpalm,puls_pro, + potato,cassav_sp,sugr_cane,sugr_beet,others,cottn_pro,foddr, pasture, begr, betr, + oils,oilcakes,sugar,molasses,alcohol,ethanol,distillers_grain,brans,scp,fibres, + livst_rum, livst_pig,livst_chick, livst_egg, livst_milk, fish, + res_cereals, res_fibrous, res_nonfibrous + / + ; diff --git a/modules/73_timber/default/declarations.gms b/modules/73_timber/default/declarations.gms index 9ad6a0ba9f..cc335849c3 100644 --- a/modules/73_timber/default/declarations.gms +++ b/modules/73_timber/default/declarations.gms @@ -9,7 +9,7 @@ parameters p73_timber_demand_gdp_pop(t_all,i,kforestry) Timber demand based on lauri et al 2019 (mio. m3 per yr) p73_forestry_demand_prod_specific(t_all,iso,total_wood_products) End product specific timber demand (mio. m3 per yr) pm_demand_forestry_future(t,i,kforestry) Future forestry demand in current time step (tDM per yr) -pm_demand_ext(t_ext,i,kforestry) Extended demand for timber beyound simulation (mio. tDM per yr) +pm_demand_forestry(t_ext,i,kforestry) Extended demand for timber beyound simulation (mio. tDM per yr) p73_demand_calib(t_all,i,kforestry) Additive calibration for timber demand (mio. m3 per yr) p73_glo_wood(t_all,kforestry) Global wood demand (mio. tDM per yr) p73_demand_modifier(t_all) Simple demand modifier for construction wood (mio. tDM per yr) diff --git a/modules/73_timber/default/preloop.gms b/modules/73_timber/default/preloop.gms index f9d5c41e16..e21e29a812 100644 --- a/modules/73_timber/default/preloop.gms +++ b/modules/73_timber/default/preloop.gms @@ -48,12 +48,12 @@ $endif ** Convert to tDM from mio m3 ** p73_timber_demand_gdp_pop is in mio m^3 -** pm_demand_ext in mio ton DM +** pm_demand_forestry in mio ton DM ** Hold constraint beyond 2150 - First every time step gets 2150 values **** Extend for Churkina et al 2020 demand scenarios -pm_demand_ext(t_ext,i,kforestry) = round(p73_timber_demand_gdp_pop("y2150",i,kforestry) * f73_volumetric_conversion(kforestry),3); +pm_demand_forestry(t_ext,i,kforestry) = round(p73_timber_demand_gdp_pop("y2150",i,kforestry) * f73_volumetric_conversion(kforestry),3); ** overwrite timesteps below 2150 with actual values -pm_demand_ext(t_all,i,kforestry) = round(p73_timber_demand_gdp_pop(t_all,i,kforestry) * f73_volumetric_conversion(kforestry),3); +pm_demand_forestry(t_all,i,kforestry) = round(p73_timber_demand_gdp_pop(t_all,i,kforestry) * f73_volumetric_conversion(kforestry),3); ** Initialize fraction p73_fraction(t_all) = s73_expansion/(m_year("y2100") - sm_fix_SSP2); @@ -81,18 +81,18 @@ if(s73_expansion = 0, ** In case using simple assumption for construction wood demand (based on industrial_roundwood demand) if(s73_expansion > 0, - p73_demand_constr_wood(t_all,i) = pm_demand_ext(t_all,i,"wood") * p73_fraction(t_all); + p73_demand_constr_wood(t_all,i) = pm_demand_forestry(t_all,i,"wood") * p73_fraction(t_all); ); ** Adjust industrial roundwood demand (construction wood demand is added on top) -pm_demand_ext(t_all,i,"wood") = pm_demand_ext(t_all,i,"wood") + p73_demand_constr_wood(t_all,i); +pm_demand_forestry(t_all,i,"wood") = pm_demand_forestry(t_all,i,"wood") + p73_demand_constr_wood(t_all,i); ** Keep demand after 2100 constant -pm_demand_ext(t_all,i,kforestry)$(m_year(t_all)>2100) = pm_demand_ext("y2100",i,kforestry); +pm_demand_forestry(t_all,i,kforestry)$(m_year(t_all)>2100) = pm_demand_forestry("y2100",i,kforestry); ** Calculate global demand -p73_glo_wood(t_all,kforestry) = sum(i,pm_demand_ext(t_all,i,kforestry)); +p73_glo_wood(t_all,kforestry) = sum(i,pm_demand_forestry(t_all,i,kforestry)); im_timber_prod_cost("wood") = s73_timber_prod_cost_wood; im_timber_prod_cost("woodfuel") = s73_timber_prod_cost_woodfuel; * initialize values for presolve of other modules -pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry) * s73_demand_multiplier_hist; +pm_demand_forestry_future(t,i,kforestry) = pm_demand_forestry(t,i,kforestry) * s73_demand_multiplier_hist; diff --git a/modules/73_timber/default/presolve.gms b/modules/73_timber/default/presolve.gms index 4cca5213d3..58453706f5 100644 --- a/modules/73_timber/default/presolve.gms +++ b/modules/73_timber/default/presolve.gms @@ -11,10 +11,10 @@ if(s73_foresight=1, if(m_year(t) <= sm_fix_SSP2, - pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry) * s73_demand_multiplier_hist; + pm_demand_forestry_future(t,i,kforestry) = pm_demand_forestry(t,i,kforestry) * s73_demand_multiplier_hist; else - pm_demand_forestry_future(t,i,kforestry) = sum(t_ext$(t_ext.pos = t.pos + pm_representative_rotation(t,i)),pm_demand_ext(t_ext,i,kforestry)); + pm_demand_forestry_future(t,i,kforestry) = sum(t_ext$(t_ext.pos = t.pos + pm_representative_rotation(t,i)),pm_demand_forestry(t_ext,i,kforestry)); ); else - pm_demand_forestry_future(t,i,kforestry) = pm_demand_ext(t,i,kforestry); + pm_demand_forestry_future(t,i,kforestry) = pm_demand_forestry(t,i,kforestry); ); From b4f172bee20433c61b9068927ebbb3c7e14632f2 Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 19 May 2024 12:59:42 +0200 Subject: [PATCH 166/280] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1495dad620..95bb367324 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **default.cfg** changed default realization for 44_biodiversity to new realization `bii_target_apr24` - **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE, CONOPT4 without preprocessing and CONOPT3. - **scripts** start/test_runs.R added 2 more test runs from FSEC -- **32_forestry** revision and simplification of forestry implementation, renamed realization from `dynamic_feb21` to `dynamic_may24` +- **32_forestry** revision and simplification of forestry implementation, renamed realization from `dynamic_feb21` to `dynamic_may24`. Renamed `pm_demand_ext` to `pm_demand_forestry` - **default.cfg** ForestryEndo as default setting ### added From d53c8f2e18e908714485fd913e20bb5f06e23641 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 20 May 2024 12:00:51 +0200 Subject: [PATCH 167/280] updates --- CHANGELOG.md | 3 ++ config/default.cfg | 35 +++---------------- .../dynamic_may24/declarations.gms | 2 +- .../32_forestry/dynamic_may24/equations.gms | 6 ++-- modules/32_forestry/dynamic_may24/input.gms | 1 + modules/32_forestry/dynamic_may24/preloop.gms | 2 -- .../32_forestry/dynamic_may24/presolve.gms | 19 ++++++++-- modules/73_timber/default/declarations.gms | 3 +- modules/73_timber/default/input.gms | 2 -- modules/73_timber/default/preloop.gms | 3 -- modules/73_timber/default/presolve.gms | 13 ------- 11 files changed, 30 insertions(+), 59 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95bb367324..3379648a17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE, CONOPT4 without preprocessing and CONOPT3. - **scripts** start/test_runs.R added 2 more test runs from FSEC - **32_forestry** revision and simplification of forestry implementation, renamed realization from `dynamic_feb21` to `dynamic_may24`. Renamed `pm_demand_ext` to `pm_demand_forestry` +- **32_forestry** renamed interface `pm_demand_ext` to `pm_demand_forestry` - **default.cfg** ForestryEndo as default setting ### added @@ -37,6 +38,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **scripts** removed support for spam files in start_functions - **14_yields** removed interface `pm_timber_yield_initial`, no longer needed - **21_trade** removed interface `pm_selfsuff_ext`, no longer needed +- **32_forestry** removed interface `pm_representative_rotation`, no longer needed +- **73_timber** removed interface `pm_demand_forestry_future`, no longer needed ### fixed - **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs diff --git a/config/default.cfg b/config/default.cfg index 0dd4b9ba3e..3d98bfe386 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -882,23 +882,11 @@ cfg$gms$c32_interest_rate <- "regional" # def = "regional" # Accepted values between 0 and 1. cfg$gms$s32_forestry_int_rate <- 0.05 # def = 0.05 -# Scenarios for using FAO scenarios of future proportion of production coming from -# Timber plantations used for deciding how much establishment should be made in -# simulation time step. This setting is only used when s32_hvarea is set to 2 ("Endogenous") -# * ("abare") = Global outlook for plantations. Australian Bureau of Agriculture and Resource Economics (ABARE) and Jaakko Pöyry Consulting 1999 -# * ("brown") = The global outlook for future wood supply from forest plantations. Working paper GFPOS/WP/03 prepared for the 1999 Global Forest Products Outlook Study 1999 -cfg$gms$c32_dev_scen <- "abare" # def = "abare" - -# Scenarios for future development of timber production contribution to roundwood demand -# based on the settings from c32_dev_scen. -# * ("constant") = Constant share over time (1995-2250) -# * ("h5s5l5") = In every time step 5% increase from 1995 till 2020, 5% increase from 2025 till 2050, 5% increase from 2055 till 2250 -# * ("h5s2l2") = In every time step 5% increase from 1995 till 2020, 2% increase from 2025 till 2050, 2% increase from 2055 till 2250 -# * ("h5s2l1") = In every time step 5% increase from 1995 till 2020, 2% increase from 2025 till 2050, 1% increase from 2055 till 2250 -# * ("h5s1l1") = In every time step 5% increase from 1995 till 2020, 1% increase from 2025 till 2050, 1% increase from 2055 till 2250 -# * ("h5s1l05") = In every time step 5% increase from 1995 till 2020, 1% increase from 2025 till 2050, 0.5% increase from 2055 till 2250 -# * ("h2s1l05") = In every time step 2% increase from 1995 till 2020, 1% increase from 2025 till 2050, 0.5% increase from 2055 till 2250 -cfg$gms$c32_incr_rate <- "h5s2l1" # def = "h5s2l1" +# Setting to define if the model should be forward looking or not in terms of +# seeing the future demand for current timestep establishment of new plantations. +# * 0 = static (establishment based on current demand) +# * 1 = forward looking (establishment based on future demand according to rotation length) +cfg$gms$s32_demand_establishment <- 1 # def = 1 # Harvesting switch for timber production # * 0 = No harvested area from plantations, no age-class shifting (area held constant at 1995 levels) @@ -1867,19 +1855,6 @@ cfg$gms$timber <- "default" # def = default # * 0=off cfg$gms$s73_timber_demand_switch <- 1 # def = 1 -# Setting to define if the model should be forward looking or not in terms of -# seeing the future demand for current timestep establishment of new plantations -# in the forward setting, the model sees only current demand for establishment -# decisions in the historical time period but then sees future demand for non -# historic time periods. In myopic setting, the model sees always the current -# timber demand for establishment decisions. -# * 1 = forward looking. Model sees future demand for establishment in current step -# * 0 = myopic. Model sees current demand for establishment in current step -cfg$gms$s73_foresight <- 1 # def = 1 - -# * Multiplier for timber demand used in historic period to obtain the same future demand in all scenarios -cfg$gms$s73_demand_multiplier_hist <- 1.2 # def = 1.2 - # harvesting cost per ton of dry matter produced (USD/tDM) s73_timber_prod_cost <- 2000 # def = 2000 diff --git a/modules/32_forestry/dynamic_may24/declarations.gms b/modules/32_forestry/dynamic_may24/declarations.gms index 27cdb53d6d..4dc31991dc 100644 --- a/modules/32_forestry/dynamic_may24/declarations.gms +++ b/modules/32_forestry/dynamic_may24/declarations.gms @@ -42,7 +42,6 @@ parameters p32_rot_flg_faustmann(t_all,j,ac) Identifier flag when calculating faustmann rotation length (1) p32_rot_length_faustmann(t_all,j) Cellular Faustmann rotation length of plantations translated to age class equivalent (1) p32_ncells(i) Number of cells in each region (1) - pm_representative_rotation(t_all,i) Representative regional rotation (1) p32_aff_bgp(j,ac) Biophysical impact of afforestation (tCeq per ha) p32_tcre_glo(j) Global mean Transient Climate Response to cumulative Emissions (degree C per tC per ha) p32_avg_increment(t_all,j,ac) Mean annual increment (tC per ha per year) @@ -55,6 +54,7 @@ parameters p32_plant_contr(t,i) Share of roundwood production coming from timber plantations (percent) p32_forestry_product_dist(t,i,kforestry) Distribution of wood products (1) p32_future_to_current_demand_ratio(t,i) Ratio of future and current timber demand (1) + p32_demand_forestry_future(t,i,kforestry) Future forestry demand in current time step (tDM per yr) ; positive variables diff --git a/modules/32_forestry/dynamic_may24/equations.gms b/modules/32_forestry/dynamic_may24/equations.gms index 5143936da3..b658162cef 100644 --- a/modules/32_forestry/dynamic_may24/equations.gms +++ b/modules/32_forestry/dynamic_may24/equations.gms @@ -146,7 +146,7 @@ q32_cost_establishment(i2).. (sum((cell(i2,j2),type32,ac_est), v32_land(j2,type32,ac_est) * s32_reESTBcost)) * sum(ct,pm_interest(ct,i2)/(1+pm_interest(ct,i2))) + sum((ct,kforestry), v32_prod_forestry_future(i2) * p32_forestry_product_dist(ct,i2,kforestry) * im_timber_prod_cost(kforestry)) - / ((1+sum(ct,pm_interest(ct,i2))**sum(ct, pm_representative_rotation(ct,i2)*5))); + / ((1+sum(ct,pm_interest(ct,i2))**sum(ct, p32_rotation_regional(ct,i2)*5))); *' Recurring costs are paid for plantations where the trees have to be regularly monitored @@ -161,7 +161,7 @@ q32_cost_recur(i2) .. v32_cost_recur(i2) =e= **** New establishment decision *------------------------------ *' New plantations are established in the optimization step based on a certain -*' percentage (`p32_plant_contr`) of expected future demand (`pm_demand_forestry_future`). +*' percentage (`p32_plant_contr`) of expected future demand (`p32_demand_forestry_future`). *' As plantation establishment decisions should *' also know some indication of expected future yields, we calculate how much yield *' newly established plantation can realize based on rotation lengths. This is defined as @@ -181,7 +181,7 @@ q32_prod_forestry_future(i2) .. q32_establishment_demand(i2)$s32_establishment_dynamic .. v32_prod_forestry_future(i2) =g= - sum((ct,kforestry), pm_demand_forestry_future(ct,i2,kforestry)) * sum(ct, p32_plant_contr(ct,i2)) + sum((ct,kforestry), p32_demand_forestry_future(ct,i2,kforestry)) * sum(ct, p32_plant_contr(ct,i2)) ; *' Harvested areas are fully re-established at cell level, unless the ratio of future and current demand drops below 1. diff --git a/modules/32_forestry/dynamic_may24/input.gms b/modules/32_forestry/dynamic_may24/input.gms index 354a7eefe3..2c6e29045a 100644 --- a/modules/32_forestry/dynamic_may24/input.gms +++ b/modules/32_forestry/dynamic_may24/input.gms @@ -52,6 +52,7 @@ scalars s32_plant_contr_growth_startvalue Start value for plantation contribution growth fader (percent per year) / 0.05 / s32_plant_contr_growth_endvalue End value for plantation contribution growth fader (percent per year) / 0 / s32_plant_contr_max Maximum plantation contribution for establishment decision (percent) / 0.5 / + s32_demand_establishment Boolean switch for establishment demand assumption 1=forward looking 0=static (1) / 1 / ; parameter f32_aff_mask(j) afforestation mask (binary) diff --git a/modules/32_forestry/dynamic_may24/preloop.gms b/modules/32_forestry/dynamic_may24/preloop.gms index db516cf8af..fceaa4d7b0 100644 --- a/modules/32_forestry/dynamic_may24/preloop.gms +++ b/modules/32_forestry/dynamic_may24/preloop.gms @@ -100,8 +100,6 @@ p32_ncells(i) = sum(cell(i,j),1); **** Representative regional rotation loop(t_all, p32_rotation_regional(t_all,i) = ceil(sum(cell(i,j), p32_rot_length_ac_eqivalent(t_all,j))/p32_ncells(i)); -* pm_representative_rotation(t_all,i) = ord(t_all) + ceil(sum(cell(i,j),p32_rot_length_ac_eqivalent(t_all,j))/p32_ncells(i)); - pm_representative_rotation(t_all,i) = ceil(sum(cell(i,j),p32_rot_length_ac_eqivalent(t_all,j))/p32_ncells(i)); ); ** Earlier we converted rotation lengths to absolute numbers, now we make the Conversion diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index bcbb5c8b3a..378f2ae164 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -173,10 +173,23 @@ else ); p32_plant_contr(t,i)$(p32_plant_contr(t,i) > s32_plant_contr_max) = s32_plant_contr_max; -p32_forestry_product_dist(t,i,kforestry)$(pm_demand_forestry_future(t,i,kforestry) > 0) = pm_demand_forestry_future(t,i,kforestry) / sum(kforestry2, pm_demand_forestry_future(t,i,kforestry2)); -p32_forestry_product_dist(t,i,kforestry)$(pm_demand_forestry_future(t,i,kforestry) = 0) = 1/card(kforestry); +** demand for establishment decision depends on s32_demand_establishment: +** s32_demand_establishment = 0 static (establishment based on current demand) +** s32_demand_establishment = 1 forward looking (establishment based on future demand according to rotation length) +if(s32_demand_establishment = 1, + if(m_year(t) <= sm_fix_SSP2, + p32_demand_forestry_future(t,i,kforestry) = sum(t2$(m_year(t2) = sm_fix_SSP2), pm_demand_forestry(t2,i,kforestry)); + else + p32_demand_forestry_future(t,i,kforestry) = sum(t_ext$(t_ext.pos = t.pos + p32_rotation_regional(t,i)),pm_demand_forestry(t_ext,i,kforestry)); + ); +else + p32_demand_forestry_future(t,i,kforestry) = pm_demand_forestry(t,i,kforestry); + ); + +p32_forestry_product_dist(t,i,kforestry)$(p32_demand_forestry_future(t,i,kforestry) > 0) = p32_demand_forestry_future(t,i,kforestry) / sum(kforestry2, p32_demand_forestry_future(t,i,kforestry2)); +p32_forestry_product_dist(t,i,kforestry)$(p32_demand_forestry_future(t,i,kforestry) = 0) = 1/card(kforestry); -p32_future_to_current_demand_ratio(t,i)$(sum(kforestry, pm_demand_forestry(t,i,kforestry)) > 0) = sum(kforestry, pm_demand_forestry_future(t,i,kforestry)) / sum(kforestry, pm_demand_forestry(t,i,kforestry)); +p32_future_to_current_demand_ratio(t,i)$(sum(kforestry, pm_demand_forestry(t,i,kforestry)) > 0) = sum(kforestry, p32_demand_forestry_future(t,i,kforestry)) / sum(kforestry, pm_demand_forestry(t,i,kforestry)); p32_future_to_current_demand_ratio(t,i)$(sum(kforestry, pm_demand_forestry(t,i,kforestry)) = 0) = 0; * Avoid conflict between afforestation for carbon uptake on land and secdforest restoration diff --git a/modules/73_timber/default/declarations.gms b/modules/73_timber/default/declarations.gms index cc335849c3..67ced42c84 100644 --- a/modules/73_timber/default/declarations.gms +++ b/modules/73_timber/default/declarations.gms @@ -8,8 +8,7 @@ parameters p73_timber_demand_gdp_pop(t_all,i,kforestry) Timber demand based on lauri et al 2019 (mio. m3 per yr) p73_forestry_demand_prod_specific(t_all,iso,total_wood_products) End product specific timber demand (mio. m3 per yr) -pm_demand_forestry_future(t,i,kforestry) Future forestry demand in current time step (tDM per yr) -pm_demand_forestry(t_ext,i,kforestry) Extended demand for timber beyound simulation (mio. tDM per yr) +pm_demand_forestry(t_ext,i,kforestry) Extended demand for timber beyound simulation (mio. tDM per yr) p73_demand_calib(t_all,i,kforestry) Additive calibration for timber demand (mio. m3 per yr) p73_glo_wood(t_all,kforestry) Global wood demand (mio. tDM per yr) p73_demand_modifier(t_all) Simple demand modifier for construction wood (mio. tDM per yr) diff --git a/modules/73_timber/default/input.gms b/modules/73_timber/default/input.gms index b975c80f8a..a6b2c54eef 100644 --- a/modules/73_timber/default/input.gms +++ b/modules/73_timber/default/input.gms @@ -19,8 +19,6 @@ scalars s73_timber_prod_cost_woodfuel Cost for prodcing one unit of woodfuel (USD per tDM) / 60 / s73_free_prod_cost Very high cost for settling demand without production (USD per tDM) /20000/ s73_timber_demand_switch Logical switch to turn on or off timber demand 1=on 0=off (1) / 1 / - s73_foresight Boolean switch for establishment demand assumption 1=forward looking 0=myopic (1) / 1 / - s73_demand_multiplier_hist Multiplier used in historic period to obtain the same future demand in all scenarios / 1.2 / s73_increase_ceiling Limiter for not allowing a demand jump between time steps beyond a certain limit (1) /1.025/ s73_residue_ratio Proportion of overall industrial roundwood production which ends up as residue during harvest (1) / 0.15/ sm_wood_density Representative wood density based on IPCC (tDM per m3) /0.6/ diff --git a/modules/73_timber/default/preloop.gms b/modules/73_timber/default/preloop.gms index e21e29a812..8eed23dbf4 100644 --- a/modules/73_timber/default/preloop.gms +++ b/modules/73_timber/default/preloop.gms @@ -93,6 +93,3 @@ p73_glo_wood(t_all,kforestry) = sum(i,pm_demand_forestry(t_all,i,kforestry)); im_timber_prod_cost("wood") = s73_timber_prod_cost_wood; im_timber_prod_cost("woodfuel") = s73_timber_prod_cost_woodfuel; - -* initialize values for presolve of other modules -pm_demand_forestry_future(t,i,kforestry) = pm_demand_forestry(t,i,kforestry) * s73_demand_multiplier_hist; diff --git a/modules/73_timber/default/presolve.gms b/modules/73_timber/default/presolve.gms index 58453706f5..f9600b871f 100644 --- a/modules/73_timber/default/presolve.gms +++ b/modules/73_timber/default/presolve.gms @@ -5,16 +5,3 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -** Current demand for establishment until 2020, after 2020 depending on s73_foresight -** s73_foresight=1 forward looking (establishment based on future demand), -** s73_foresight=0 myopic (establishment based on current demand) - -if(s73_foresight=1, - if(m_year(t) <= sm_fix_SSP2, - pm_demand_forestry_future(t,i,kforestry) = pm_demand_forestry(t,i,kforestry) * s73_demand_multiplier_hist; - else - pm_demand_forestry_future(t,i,kforestry) = sum(t_ext$(t_ext.pos = t.pos + pm_representative_rotation(t,i)),pm_demand_forestry(t_ext,i,kforestry)); - ); -else - pm_demand_forestry_future(t,i,kforestry) = pm_demand_forestry(t,i,kforestry); - ); From 927413a3e4bad5ac724abcb6b624b3b71dab20bf Mon Sep 17 00:00:00 2001 From: Felicitas Date: Mon, 20 May 2024 12:43:49 +0200 Subject: [PATCH 168/280] updated Deep Dive script (temporary version) --- .../start/projects/project_EAT2p0_DeepDive.R | 161 ++++++++---------- 1 file changed, 68 insertions(+), 93 deletions(-) diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index 8f7649b8c7..eac1f29d16 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -177,15 +177,16 @@ start_run(cfg, codeCheck = FALSE) ### Composition ### # Mitigation components: # (1a) Nationally Determined Contributions (NDCs) -cfg$title <- "BAU_NDC" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) -cfg <- bau(cfg = cfg) +#cfg$title <- "BAU_NDC" +#cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +#cfg <- bau(cfg = cfg) # set path to bioenergy and prices to NDC run -cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NDC-rem-5/REMIND_generic_C_SSP2EU-NDC-rem-5.mif" -cfg$gms$c56_pollutant_prices <- "coupling" -cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NDC-rem-5/REMIND_generic_C_SSP2EU-NDC-rem-5.mif" -cfg$gms$c60_2ndgen_biodem <- "coupling" -start_run(cfg, codeCheck = FALSE) +#cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NDC-rem-5/REMIND_generic_C_SSP2EU-NDC-rem-5.mif" +#cfg$gms$c56_pollutant_prices <- "coupling" +#cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NDC-rem-5/REMIND_generic_C_SSP2EU-NDC-rem-5.mif" +#cfg$gms$c60_2ndgen_biodem <- "coupling" +#start_run(cfg, codeCheck = FALSE) +# Note: Exclude NDC run for now. Starting point is NPi and we do not look at policies, but only mitigation measures (demand side vs. supply side) # (1b) BAU + Bioenergy # # Decomposition Scenario. Adds bioenergy demand from coupled run with land-use policies consistent with 1.5C by 2050 to BAU @@ -224,12 +225,12 @@ start_run(cfg, codeCheck = FALSE) # BAU + EL2-Diet # # PHD components: -# (1e) Productivity -cfg$title <- "BAU_Prod" -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) -cfg <- bau(cfg = cfg) -cfg <- prod(cfg = cfg) -start_run(cfg, codeCheck = FALSE) +# (1e) Productivity +#cfg$title <- "BAU_Prod" +#cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +#cfg <- bau(cfg = cfg) +#cfg <- prod(cfg = cfg) +#start_run(cfg, codeCheck = FALSE) # (1f) Waste cfg$title <- "BAU_Waste" @@ -245,12 +246,12 @@ cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# (1e,f,g) All Globally achieves EL2 (Diet+Waste+Prod) by 2050 -cfg$title <- "BAU_PHD" +# (1e,f,g) Demand-side options (Diet+Waste) by 2050 +cfg$title <- "BAU_Dem" cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) +#cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -258,18 +259,18 @@ start_run(cfg, codeCheck = FALSE) ### Single measure Decomposition ### # (2a) MITI_NDC # # All production-side land-based mitigation measures and demand-side mitigation (diet change), but no NDCs -cfg$title <- "MITI_NDC" +#cfg$title <- "MITI_NDC" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +#cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) # BAU settings -cfg <- bau(cfg = cfg) +#cfg <- bau(cfg = cfg) # Mitigation (CO2, non-CO2, bioenergy) -cfg <- miti(cfg = cfg) +#cfg <- miti(cfg = cfg) # PHD (diet, prod, waste) -cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) -cfg <- waste(cfg = cfg) -start_run(cfg, codeCheck = FALSE) +#cfg <- diet(cfg = cfg) +#cfg <- prod(cfg = cfg) +#cfg <- waste(cfg = cfg) +#start_run(cfg, codeCheck = FALSE) # MITI_Bioenergy (mitigation - bioenergy) # # (2b) CO2 and non-CO2 pricing and demand-side mitigation (diet change), but no bioenergy demand from REMIND @@ -284,7 +285,7 @@ cfg$gms$c60_2ndgen_biodem <- "coupling" cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" # PHD cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) +#cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -301,7 +302,7 @@ cfg <- miti(cfg = cfg) cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" # PHD cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) +#cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -318,7 +319,7 @@ cfg <- miti(cfg = cfg) cfg$gms$c56_emis_policy <- "ecoSysProtOff" # PHD cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) +#cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) @@ -331,25 +332,25 @@ cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) # PHD (diet, prod, waste) cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) +#cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) # MITI_Prod # # (2e) All production-side land-based mitigation measures and demand-side mitigation without Prod -cfg$title <- "MITI_Prod" +#cfg$title <- "MITI_Prod" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +#cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) # BAU settings -cfg <- bau(cfg = cfg) +#cfg <- bau(cfg = cfg) # Mitigation (CO2, non-CO2, bioenergy) -cfg <- miti(cfg = cfg) +#cfg <- miti(cfg = cfg) # PHD (diet, prod, waste) -cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) -cfg <- waste(cfg = cfg) -start_run(cfg, codeCheck = FALSE) +#cfg <- diet(cfg = cfg) +#cfg <- prod(cfg = cfg) +#cfg <- waste(cfg = cfg) +#start_run(cfg, codeCheck = FALSE) # MITI_Waste # # (2f) All production-side land-based mitigation measures and demand-side mitigation without Waste @@ -362,7 +363,7 @@ cfg <- bau(cfg = cfg) cfg <- miti(cfg = cfg) # PHD (diet, prod, waste) cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) +#cfg <- prod(cfg = cfg) start_run(cfg, codeCheck = FALSE) # MITI_Diet # @@ -375,13 +376,13 @@ cfg <- bau(cfg = cfg) # Mitigation (CO2, non-CO2, bioenergy) cfg <- miti(cfg = cfg) # PHD (diet, prod, waste) -cfg <- prod(cfg = cfg) +#cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) # MITI_PHD (mitigation - PHD) # -# (2e,f,g) All production-side land-based mitigation measures, but no demand-side mitigation (PHD) -cfg$title <- "MITI_PHD" +# (2e,f,g) All production-side land-based mitigation measures, but no demand-side mitigation +cfg$title <- "MITI_Dem" # standard setting, but with NDC for miti cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) # BAU settings @@ -390,69 +391,43 @@ cfg <- bau(cfg = cfg) cfg <- miti(cfg = cfg) start_run(cfg, codeCheck = FALSE) -### Stacked Decomposition ### -# (3a) Stacked 0: BAU_NPi (see above) - -# (3b) Stacked 1: BAU_NDC (see above) - -# (3c) Stacked 2: BAU_NDC_Bioenergy -cfg$title <- "Stacked2" -# standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) -# BAU settings +### Combining demand-side changes with single mitigation measures ### +# (3b) Demand-side change + Bioenergy # +# Decomposition Scenario with demand-side changes. Adds bioenergy demand from coupled run with land-use policies consistent with 1.5C by 2050 to BAU +cfg$title <- "DEM_Bioenergy" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) -# Mitigation (bioenergy) cfg <- bioenergy(cfg = cfg) +# Demand-side change (diet, waste) +cfg <- diet(cfg = cfg) +# cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# (3d) Stacked 3: BAU_NDC_Bioenergy_nCO2 -cfg$title <- "Stacked3" -# standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) -# BAU settings +# (3c) Demand-side + NonCO2 pricing in land sector # +# Decomposition Scenario with demand-side changes. Adds non-CO2 pricing with ghg price from coupled run with land-use policies consistent with 1.5C by 2050 to BAU +cfg$title <- "DEM_NonCO2" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) -# Mitigation (non-CO2, bioenergy) -cfg <- bioenergy(cfg = cfg) cfg <- priceNonCO2(cfg = cfg) +# Demand-side change (diet, waste) +cfg <- diet(cfg = cfg) +# cfg <- prod(cfg = cfg) +cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# (3e) Stacked 4: BAU_NDC_Bioenergy_nCO2_CO2 -cfg$title <- "Stacked4" -# standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) -# BAU settings -cfg <- bau(cfg = cfg) -# Mitigation (CO2, non-CO2, bioenergy) -cfg <- miti(cfg = cfg) -start_run(cfg, codeCheck = FALSE) - -# (3f) Stacked 5: BAU_NDC_Bioenergy_nCO2_CO2_prod -cfg$title <- "Stacked5" -# standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) -# BAU settings -cfg <- bau(cfg = cfg) -# Mitigation (CO2, non-CO2, bioenergy) -cfg <- miti(cfg = cfg) -# PHD (diet, prod, waste) -cfg <- prod(cfg = cfg) -start_run(cfg, codeCheck = FALSE) - -# (3g) Stacked 6: BAU_NDC_Bioenergy_nCO2_CO2_prod_waste -cfg$title <- "Stacked6" -# standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) -# BAU settings +# (3d) Demand-side + pricing of CO2 in land sector # +# Decomposition Scenario with demand-side changes. Adds CO2 pricing on land-use change emissions with ghg price from coupled run with land-use policies consistent with 1.5C by 2050 to BAU +cfg$title <- "DEM_CO2" +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) -# Mitigation (CO2, non-CO2, bioenergy) -cfg <- miti(cfg = cfg) -# PHD (diet, prod, waste) -cfg <- prod(cfg = cfg) +cfg <- priceCO2(cfg = cfg) +# Demand-side change (diet, waste) +cfg <- diet(cfg = cfg) +# cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) -# (3h) Stacked 7: BAU_NDC_Bioenergy_nCO2_CO2_prod_waste_diet (same as MITI_All, see below) - ### All measures ### # MITI_All # # All production-side land-based mitigation measures and demand-side mitigation (diet change) @@ -465,6 +440,6 @@ cfg <- bau(cfg = cfg) cfg <- miti(cfg = cfg) # PHD (diet, prod, waste) cfg <- diet(cfg = cfg) -cfg <- prod(cfg = cfg) +#cfg <- prod(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) From 03e7b255790884ae7e6bc568719b5f74c5fe7230 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 20 May 2024 18:28:34 +0200 Subject: [PATCH 169/280] update --- config/default.cfg | 9 +++++- .../managementcalib_aug19/declarations.gms | 2 -- .../14_yields/managementcalib_aug19/input.gms | 3 +- .../managementcalib_aug19/preloop.gms | 25 ---------------- .../managementcalib_aug19/presolve.gms | 30 +++++++------------ .../dynamic_may24/declarations.gms | 3 +- .../32_forestry/dynamic_may24/equations.gms | 6 ++-- modules/32_forestry/dynamic_may24/input.gms | 11 ++----- modules/32_forestry/dynamic_may24/preloop.gms | 4 +++ .../32_forestry/dynamic_may24/presolve.gms | 2 +- 10 files changed, 33 insertions(+), 62 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 3d98bfe386..68cb741fd5 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -332,7 +332,7 @@ cfg$gms$s14_use_yield_calib <- 0 # def = 0 # Include a minimum yield for wood harvest in secondary vegetation (tDM per ha per yr). # Age classes with wood yields below this threshold have a production of zero. -cfg$gms$s14_minimum_wood_yield <- 20 #def = 20 +cfg$gms$s14_minimum_wood_yield <- 10 #def = 10 # ***--------------------- 15_food --------------------------------------- # * (anthropometrics_jan18): estimates food using scenario dependent regression @@ -888,6 +888,13 @@ cfg$gms$s32_forestry_int_rate <- 0.05 # def = 0.05 # * 1 = forward looking (establishment based on future demand according to rotation length) cfg$gms$s32_demand_establishment <- 1 # def = 1 +# Establishment cost for plantations (USD per ha) +cfg$gms$s32_est_cost_plant <- 10000 # def = 10000 + +# Establishment cost for natural vegetation (USD per ha) +cfg$gms$s32_est_cost_natveg <- 2000 # def = 2000 + + # Harvesting switch for timber production # * 0 = No harvested area from plantations, no age-class shifting (area held constant at 1995 levels) # * This also means that no harvesting or establishment of new plantations takes place. diff --git a/modules/14_yields/managementcalib_aug19/declarations.gms b/modules/14_yields/managementcalib_aug19/declarations.gms index cb84ddfbbd..04d259f841 100644 --- a/modules/14_yields/managementcalib_aug19/declarations.gms +++ b/modules/14_yields/managementcalib_aug19/declarations.gms @@ -14,9 +14,7 @@ parameters i14_fao_yields_hist(t,i,kcr) FAO yields per region at the historical referende year (tDM per ha per yr) i14_lambda_yields(t,i,kcr) Scaling factor for non-linear management calibration (1) i14_managementcalib(t,j,kcr,w) Regional management calibration factor accounting for FAO yield levels (1) - p14_growing_stock(t,j,ac,forest_land,forest_type) Forest growing stock (tDM per ha per yr) pm_timber_yield(t,j,ac,forest_land) Forest growing stock (tDM per ha per yr) - p14_growing_stock_initial(j,ac,forest_land,forest_type) Initial Forest growing stock (tDM per ha per yr) pm_yields_semi_calib(j,kve,w) Potential yields calibrated to FAO regional levels (tDM per ha per yr) i14_calib_yields_hist(i,w) Calibrated yields average over region and crop type at the historical reference year (tDM per ha per yr) i14_calib_yields_ratio(i) Irrigated to rainfed yield ratio for calibrated yields (1) diff --git a/modules/14_yields/managementcalib_aug19/input.gms b/modules/14_yields/managementcalib_aug19/input.gms index 4677381139..8b3451220c 100644 --- a/modules/14_yields/managementcalib_aug19/input.gms +++ b/modules/14_yields/managementcalib_aug19/input.gms @@ -18,7 +18,7 @@ scalar s14_degradation Switch to include yield impacts of land degradation(0=n scalar s14_use_yield_calib Switch for using or not using yield calibration factors from the preprocessing (1=use facs 0=not use facs) / 0 /; -scalar s14_minimum_wood_yield Minimum wood yield for timber harvest in natural vegetation (tDM per ha per yr) / 20 /; +scalar s14_minimum_wood_yield Minimum wood yield for timber harvest in natural vegetation (tDM per ha per yr) / 10 /; scalars s14_yld_past_switch Spillover parameter for translating technological change in the crop sector into pasture yield increases (1) / 0.25 / @@ -26,7 +26,6 @@ scalars ; scalars - s14_timber_plantation_yield Plantation yield switch (0=natveg yields 1=plantation yields) (1) / 1 / s14_carbon_fraction Carbon fraction for conversion of biomass to dry matter (1) / 0.5/ ; diff --git a/modules/14_yields/managementcalib_aug19/preloop.gms b/modules/14_yields/managementcalib_aug19/preloop.gms index 9cac1c64cf..eaed90f248 100644 --- a/modules/14_yields/managementcalib_aug19/preloop.gms +++ b/modules/14_yields/managementcalib_aug19/preloop.gms @@ -184,28 +184,3 @@ if ((s14_degradation = 1), ); *' @stop - - -**** -**** -**** -p14_growing_stock_initial(j,ac,"forestry","plantations") = - ( - pm_carbon_density_ac_forestry("y1995",j,ac,"vegc") - / s14_carbon_fraction - * f14_aboveground_fraction("forestry") - / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"plantations")) - ) - ; - -p14_growing_stock_initial(j,ac,land_natveg,"natveg") = - ( - pm_carbon_density_ac("y1995",j,ac,"vegc") - / s14_carbon_fraction - * f14_aboveground_fraction(land_natveg) - / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"natveg")) - ) - ; -**** Hard constraint to always have a positive number in p14_growing_stock -p14_growing_stock_initial(j,ac,land_natveg,"natveg") = p14_growing_stock_initial(j,ac,land_natveg,"natveg")$(p14_growing_stock_initial(j,ac,land_natveg,"natveg")>0)+0.0001$(p14_growing_stock_initial(j,ac,land_natveg,"natveg")=0); -p14_growing_stock_initial(j,ac,"forestry","plantations") = p14_growing_stock_initial(j,ac,"forestry","plantations")$(p14_growing_stock_initial(j,ac,"forestry","plantations")>0)+0.0001$(p14_growing_stock_initial(j,ac,"forestry","plantations")=0); diff --git a/modules/14_yields/managementcalib_aug19/presolve.gms b/modules/14_yields/managementcalib_aug19/presolve.gms index e9b652f06c..e1b795fa46 100644 --- a/modules/14_yields/managementcalib_aug19/presolve.gms +++ b/modules/14_yields/managementcalib_aug19/presolve.gms @@ -20,16 +20,17 @@ *' biomass in tDM/ha. *` @code -p14_growing_stock(t,j,ac,"forestry","plantations") = + +pm_timber_yield(t,j,ac,"forestry") = ( - pm_carbon_density_ac_forestry(t,j,ac,"vegc") - / s14_carbon_fraction - * f14_aboveground_fraction("forestry") - / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"plantations")) - ) + pm_carbon_density_ac_forestry(t,j,ac,"vegc") + / s14_carbon_fraction + * f14_aboveground_fraction("forestry") + / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"plantations")) + ) ; -p14_growing_stock(t,j,ac,land_natveg,"natveg") = +pm_timber_yield(t,j,ac,land_natveg) = ( pm_carbon_density_ac(t,j,ac,"vegc") / s14_carbon_fraction @@ -37,19 +38,10 @@ p14_growing_stock(t,j,ac,land_natveg,"natveg") = / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"natveg")) ) ; -*` @stop -**** Hard constraint to always have a positive number in p14_growing_stock -p14_growing_stock(t,j,ac,land_natveg,"natveg") = p14_growing_stock(t,j,ac,land_natveg,"natveg")$(p14_growing_stock(t,j,ac,land_natveg,"natveg")>0)+0.0001$(p14_growing_stock(t,j,ac,land_natveg,"natveg")=0); -p14_growing_stock(t,j,ac,"forestry","plantations") = p14_growing_stock(t,j,ac,"forestry","plantations")$(p14_growing_stock(t,j,ac,"forestry","plantations")>0)+0.0001$(p14_growing_stock(t,j,ac,"forestry","plantations")=0); +*` @stop -** Used in equations -- Annual value hence division by timestep -*************************************************************** -** If the plantation yield switch is on, forestry yields are treated as plantation yields -pm_timber_yield(t,j,ac,"forestry")$(s14_timber_plantation_yield = 1) = p14_growing_stock(t,j,ac,"forestry","plantations") ; -** Natveg yields are unchanged and doesn't depend on plantation yield switch -pm_timber_yield(t,j,ac,land_natveg) = p14_growing_stock(t,j,ac,land_natveg,"natveg"); +** Hard constraint to always have a positive number in pm_timber_yield +pm_timber_yield(t,j,ac,forest_land) = pm_timber_yield(t,j,ac,forest_land)$(pm_timber_yield(t,j,ac,forest_land) > 0) + 0.0001$(pm_timber_yield(t,j,ac,forest_land) = 0); ** Put yields to 0 where they dont exceed a minimum yield for harvest pm_timber_yield(t,j,ac,land_natveg)$(pm_timber_yield(t,j,ac,land_natveg) < s14_minimum_wood_yield) = 0; -** If the plantation yield switch is off, then the forestry yields are given the same values as secdforest yields, -pm_timber_yield(t,j,ac,"forestry")$(s14_timber_plantation_yield = 0) = pm_timber_yield(t,j,ac,"secdforest"); diff --git a/modules/32_forestry/dynamic_may24/declarations.gms b/modules/32_forestry/dynamic_may24/declarations.gms index 4dc31991dc..6b679b0a4d 100644 --- a/modules/32_forestry/dynamic_may24/declarations.gms +++ b/modules/32_forestry/dynamic_may24/declarations.gms @@ -22,7 +22,7 @@ parameters p32_carbon_density_ac_marg(t_all,j,ac) Marginal above ground carbon density for age classes and carbon pools (tC per ha) p32_land(t,j,type32,ac) Forestry land for each cell wood type and age class before and after optimization (mio. ha) pc32_land(j,type32,ac) Forestry land per forestry land type initialization of the optimization (mio. ha) - pc32_yield_forestry_future(j) Cellular timber yield expected in the future (m3 per ha per year) + p32_yield_forestry_future(t,j) Cellular timber yield expected in the future (m3 per ha per year) p32_IGR(t_all,j,ac) Instantaneous growth rate or periodic annual increment of forest growth (1) p32_rot_flg(t_all,j,ac) Identifier flag when calculating rotation length (1) p32_rotation_regional(t_all,i) Regional average rotation length of plantations translated to age class equivalent for future (1) @@ -55,6 +55,7 @@ parameters p32_forestry_product_dist(t,i,kforestry) Distribution of wood products (1) p32_future_to_current_demand_ratio(t,i) Ratio of future and current timber demand (1) p32_demand_forestry_future(t,i,kforestry) Future forestry demand in current time step (tDM per yr) + p32_est_cost(type32) Establishment cost (USD per ha) ; positive variables diff --git a/modules/32_forestry/dynamic_may24/equations.gms b/modules/32_forestry/dynamic_may24/equations.gms index b658162cef..b3041e536a 100644 --- a/modules/32_forestry/dynamic_may24/equations.gms +++ b/modules/32_forestry/dynamic_may24/equations.gms @@ -143,7 +143,7 @@ q32_bv_plant(j2,potnatveg) .. vm_bv(j2,"plant",potnatveg) q32_cost_establishment(i2).. v32_cost_establishment(i2) =e= - (sum((cell(i2,j2),type32,ac_est), v32_land(j2,type32,ac_est) * s32_reESTBcost)) + (sum((cell(i2,j2),type32,ac_est), v32_land(j2,type32,ac_est) * p32_est_cost(type32))) * sum(ct,pm_interest(ct,i2)/(1+pm_interest(ct,i2))) + sum((ct,kforestry), v32_prod_forestry_future(i2) * p32_forestry_product_dist(ct,i2,kforestry) * im_timber_prod_cost(kforestry)) / ((1+sum(ct,pm_interest(ct,i2))**sum(ct, p32_rotation_regional(ct,i2)*5))); @@ -165,7 +165,7 @@ q32_cost_recur(i2) .. v32_cost_recur(i2) =e= *' As plantation establishment decisions should *' also know some indication of expected future yields, we calculate how much yield *' newly established plantation can realize based on rotation lengths. This is defined as -*' the expected future yield (`pc32_yield_forestry_future`) at harvest. +*' the expected future yield (`p32_yield_forestry_future`) at harvest. *' Future expected production is calculated for the establishment decision below and the costs above *' based on newly established areas and expected future yields. @@ -173,7 +173,7 @@ q32_cost_recur(i2) .. v32_cost_recur(i2) =e= q32_prod_forestry_future(i2) .. v32_prod_forestry_future(i2) =e= - sum(cell(i2,j2), (sum(ac_est, v32_land(j2,"plant",ac_est)) + v32_land_missing(j2)) * pc32_yield_forestry_future(j2)) / m_timestep_length_forestry + sum(cell(i2,j2), (sum(ac_est, v32_land(j2,"plant",ac_est)) + v32_land_missing(j2)) * sum(ct, p32_yield_forestry_future(ct,j2))) / m_timestep_length_forestry ; *' Future expected production has to be equal or larger than future demand multiplied with the plantation contribution factor. diff --git a/modules/32_forestry/dynamic_may24/input.gms b/modules/32_forestry/dynamic_may24/input.gms index 2c6e29045a..cf93880505 100644 --- a/modules/32_forestry/dynamic_may24/input.gms +++ b/modules/32_forestry/dynamic_may24/input.gms @@ -4,8 +4,6 @@ *** | AGPL-3.0, you are granted additional permissions described in the *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -$setglobal c32_timber_plantations plantations -* option: natveg, plantations $setglobal c32_aff_mask noboreal * options: unrestricted, noboreal, onlytropical $setglobal c32_aff_policy npi @@ -16,10 +14,6 @@ $setglobal c32_tcre_ctrl ann_TCREmean * options: ann_TCREmean, ann_TCREhigh, ann_TCRElow $setglobal c32_interest_rate regional * options regional, global -$setglobal c32_dev_scen abare -* options abare, brown -$setglobal c32_incr_rate h5s2l1 -* options constant,h5s5l5,h5s2l2,h5s2l1,h5s1l1,h5s1l05,h2s1l05 $setglobal c32_rot_calc_type current_annual_increment * option max_increment, max_npv $setglobal c32_rot_calc_type current_annual_increment @@ -30,9 +24,10 @@ $setglobal c32_shock_scenario none scalars s32_hvarea Flag for harvested area and establishemt (0=zero 1=exognous 2=endogneous) / 2 / - s32_reESTBcost Re establishment cost (USD per ha) / 2000 / + s32_est_cost_plant Establishment cost for plantations (USD per ha) / 10000 / + s32_est_cost_natveg Establishment cost for natural vegetation (USD per ha) / 2000 / s32_recurring_cost Recurring costs (USD per ha) / 500 / - s32_harvesting_cost Harvesting cost (USD per ha) / 1000 / + s32_harvesting_cost Harvesting cost (USD per ha) / 2000 / s32_planing_horizon Afforestation planing horizon (years) / 50 / s32_rotation_extension Rotation extension factor 1=original rotations 2=100 percent increase in rotations etc (1) / 1 / s32_faustmann_rotation Switch to activate faustmann rotations (1=on 0=off) / 0 / diff --git a/modules/32_forestry/dynamic_may24/preloop.gms b/modules/32_forestry/dynamic_may24/preloop.gms index fceaa4d7b0..0b08ad4822 100644 --- a/modules/32_forestry/dynamic_may24/preloop.gms +++ b/modules/32_forestry/dynamic_may24/preloop.gms @@ -8,6 +8,10 @@ *m_sigmoid_time_interpol(i32_plant_contr_fader,2020,2050,0.05,0); m_sigmoid_time_interpol(i32_plant_contr_growth_fader,s32_plant_contr_growth_startyear,s32_plant_contr_growth_endyear,s32_plant_contr_growth_startvalue,s32_plant_contr_growth_endvalue); +p32_est_cost("plant") = s32_est_cost_plant; +p32_est_cost("ndc") = s32_est_cost_natveg; +p32_est_cost("aff") = s32_est_cost_natveg$(s32_aff_plantation = 0) + s32_est_cost_plant$(s32_aff_plantation = 1); + ** Calculation of Single rotation model rotation lengths ** Using forestry carbon densitiy here via carbon density data exchange from carbon module. p32_carbon_density_ac_forestry(t_all,j,ac) = pm_carbon_density_ac_forestry(t_all,j,ac,"vegc"); diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 378f2ae164..b8585fe52f 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -160,7 +160,7 @@ v32_land.fx(j,"aff",ac_est)$(fm_carbon_density(t,j,"forestry","vegc") <= 20) = 0 m_boundfix(v32_land,(j,type32,ac_sub),up,1e-6); ** Calculate future yield based on rotation length -pc32_yield_forestry_future(j) = sum(ac$(ac.off = p32_rotation_cellular_estb(t,j)), pm_timber_yield(t,j,ac,"forestry")); +p32_yield_forestry_future(t,j) = sum(ac$(ac.off = p32_rotation_cellular_estb(t,j)), pm_timber_yield(t,j,ac,"forestry")); * Fader for plantation share in establishment decision if(ord(t) = 1, From ebb9bb4331ff9f59833583c6c470b7371eda1b34 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 20 May 2024 22:12:16 +0200 Subject: [PATCH 170/280] update --- CHANGELOG.md | 1 + config/default.cfg | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3379648a17..2bd2494082 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **32_forestry** revision and simplification of forestry implementation, renamed realization from `dynamic_feb21` to `dynamic_may24`. Renamed `pm_demand_ext` to `pm_demand_forestry` - **32_forestry** renamed interface `pm_demand_ext` to `pm_demand_forestry` - **default.cfg** ForestryEndo as default setting +- **14_yields** revised timber yield calculations ### added - **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` diff --git a/config/default.cfg b/config/default.cfg index 68cb741fd5..e0a187b8d4 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -894,7 +894,6 @@ cfg$gms$s32_est_cost_plant <- 10000 # def = 10000 # Establishment cost for natural vegetation (USD per ha) cfg$gms$s32_est_cost_natveg <- 2000 # def = 2000 - # Harvesting switch for timber production # * 0 = No harvested area from plantations, no age-class shifting (area held constant at 1995 levels) # * This also means that no harvesting or establishment of new plantations takes place. From 23866378797d25ad3fdec3d95f3059d38f57bae5 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 20 May 2024 22:23:19 +0200 Subject: [PATCH 171/280] updates --- CHANGELOG.md | 9 +++++---- config/default.cfg | 9 ++++----- modules/21_trade/exo/equations.gms | 12 +++--------- .../21_trade/selfsuff_reduced_bilateral22/input.gms | 1 + .../selfsuff_reduced_bilateral22/preloop.gms | 3 +++ 5 files changed, 16 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bd2494082..cc6220373a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,14 +33,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **scripts** added start scripts for the GENIE project - **scenario_config.csv** added preset for GENIE project - **default.cfg** cfg$gms$s80_secondsolve option for second solve statement with 0=off as default +- **21_trade** Minimum trade margin for forestry products `s21_min_trade_margin_forestry` ### removed - **scripts/output/extra** removed scripts disaggregation_cropsplit and disaggregation_transitions - **scripts** removed support for spam files in start_functions -- **14_yields** removed interface `pm_timber_yield_initial`, no longer needed -- **21_trade** removed interface `pm_selfsuff_ext`, no longer needed -- **32_forestry** removed interface `pm_representative_rotation`, no longer needed -- **73_timber** removed interface `pm_demand_forestry_future`, no longer needed +- **14_yields** removed interface `pm_timber_yield_initial` +- **21_trade** removed interface `pm_selfsuff_ext`, removed `v21_manna_from_heaven` +- **32_forestry** removed interface `pm_representative_rotation` +- **73_timber** removed interface `pm_demand_forestry_future` ### fixed - **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs diff --git a/config/default.cfg b/config/default.cfg index e0a187b8d4..750d8ba722 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -573,11 +573,6 @@ cfg$gms$c20_scp_type <- "sugar" # def = sugar # * (selfsuff_reduced_bilateral22): same as `selfsuff_reduced` but with bilateral trade flows cfg$gms$trade <- "selfsuff_reduced" # def = selfsuff_reduced -# * option for `exo` realization only: -# * fix `v21_manna_from_heaven` to zero (0) or not (1) -# Note: Without fixing to zero, v21_manna_from_heaven might be used unnecessarily in runs started with highres.R -cfg$gms$s21_manna_from_heaven <- 0 - # * options for `selfsuff_reduced` and `selfsuff_reduced_bilateral22` realizations: # * Commodities that can have additional imports to maintain feasibility cfg$gms$k_import21 <- "wood, woodfuel" @@ -615,6 +610,10 @@ cfg$gms$s21_trade_tariff_startyear <- 2020 # * end year of fadeout if s21_trade_tariff_fadeout = 1 # def = 2050 cfg$gms$s21_trade_tariff_targetyear <- 2050 +# * Minimum trade margin for forestry products (USD05MER per tDM) +cfg$gms$s21_min_trade_margin_forestry <- 50 # def = 50 + + # ***--------------------- 22_land_conservation -------------------------------------- # * (area_based_apr22): Area-based conservation (baseline and future) # * based on WDPA and conservation priority areas diff --git a/modules/21_trade/exo/equations.gms b/modules/21_trade/exo/equations.gms index c463ace64c..d84819634e 100644 --- a/modules/21_trade/exo/equations.gms +++ b/modules/21_trade/exo/equations.gms @@ -5,15 +5,9 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de +*' The regional production must be larger than the regional demand plus exports +*' from that region (or minus imports in case of a negative trade balance). + q21_notrade(h2,kall).. sum(supreg(h2,i2),vm_prod_reg(i2,kall)) =g= sum(supreg(h2,i2), vm_supply(i2,kall)) + sum(ct,f21_trade_balance(ct,h2,kall)); - - -*' The regional production must be bigger than the regional demand plus exports -*' from that region (or minus imports in case of a negative trade balance). As -*' the trade balance in this realization is exogenously defined there is the -*' imminent risk of infeasibilities. To get results even in case of infeasble -*' trade balance conditions `v21_manna_from_heaven` is introduced. It is an -*' unlimited, but heavily expensive resource which can be used as last resort, -*' if in any other case the model would become infeasible. diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/input.gms b/modules/21_trade/selfsuff_reduced_bilateral22/input.gms index 75dc72a26f..52055626c4 100644 --- a/modules/21_trade/selfsuff_reduced_bilateral22/input.gms +++ b/modules/21_trade/selfsuff_reduced_bilateral22/input.gms @@ -19,6 +19,7 @@ scalars s21_trade_tariff_startyear year to start fading out trade tariffs / 2020 / s21_trade_tariff_targetyear year to finish fading out trade tariffs / 2050 / s21_cost_import Cost for additional imports to maintain feasibility (USD05MER per tDM) / 10000 / + s21_min_trade_margin_forestry Minimum trade margin for forestry products (USD05MER per tDM) / 50 / ; table f21_trade_bal_reduction(t_all,trade_groups21,trade_regime21) Share of inelastic trade pool (1) diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms b/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms index 5d60440200..9f56067666 100644 --- a/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms +++ b/modules/21_trade/selfsuff_reduced_bilateral22/preloop.gms @@ -26,6 +26,9 @@ i21_trade_tariff(t_all,i_ex,i_im,k_trade)$(m_year(t_all) >= s21_trade_tariff_tar ); ); +i21_trade_margin(h,"wood")$(i21_trade_margin(h,"wood") < s21_min_trade_margin_forestry) = s21_min_trade_margin_forestry; +i21_trade_margin(h,"woodfuel")$(i21_trade_margin(h,"woodfuel") < s21_min_trade_margin_forestry) = s21_min_trade_margin_forestry; + v21_import_for_feasibility.fx(h,k_trade) = 0; v21_import_for_feasibility.lo(h,k_import21) = 0; v21_import_for_feasibility.up(h,k_import21) = Inf; From ddc4b9063cd8998e9d22d7e4af946bc33b0046ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Humpen=C3=B6der?= Date: Tue, 21 May 2024 09:15:54 +0200 Subject: [PATCH 172/280] Update CHANGELOG.md Co-authored-by: Jan Dietrich --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc6220373a..b8962e24a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **default.cfg** changed default realization for 44_biodiversity to new realization `bii_target_apr24` - **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE, CONOPT4 without preprocessing and CONOPT3. - **scripts** start/test_runs.R added 2 more test runs from FSEC -- **32_forestry** revision and simplification of forestry implementation, renamed realization from `dynamic_feb21` to `dynamic_may24`. Renamed `pm_demand_ext` to `pm_demand_forestry` +- **32_forestry** revision and simplification of forestry implementation, renamed realization from `dynamic_feb21` to `dynamic_may24`. - **32_forestry** renamed interface `pm_demand_ext` to `pm_demand_forestry` - **default.cfg** ForestryEndo as default setting - **14_yields** revised timber yield calculations From ee2ceac7ce36b808825c87761eebaeb0c15b9b50 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 21 May 2024 09:25:06 +0200 Subject: [PATCH 173/280] update changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8962e24a0..0e7a315cc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **scripts** start/test_runs.R added 2 more test runs from FSEC - **32_forestry** revision and simplification of forestry implementation, renamed realization from `dynamic_feb21` to `dynamic_may24`. - **32_forestry** renamed interface `pm_demand_ext` to `pm_demand_forestry` -- **default.cfg** ForestryEndo as default setting +- **default.cfg** Forestry sector included by default by using the `ForestryEndo` settings from `scenario_config.csv`: `s32_initial_distribution = 1`, `s32_demand_establishment = 1`, `s32_hvarea = 2`, `s35_secdf_distribution = 2`, `s35_hvarea = 2`, `s73_timber_demand_switch = 1` - **14_yields** revised timber yield calculations ### added @@ -42,6 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **21_trade** removed interface `pm_selfsuff_ext`, removed `v21_manna_from_heaven` - **32_forestry** removed interface `pm_representative_rotation` - **73_timber** removed interface `pm_demand_forestry_future` +- **62_material/16_demand** Removed double structure for forestry products. `pm_demand_foresty` is now used in `62_material` ### fixed - **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs @@ -51,7 +52,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **start/projects/fsec.R** scenario settings - **80_optimization** fixed a bug in nlp_apr17; cycling through CONOPT4, CONOPT4 without preprocessing and CONOPT3 was not working - **58_peatland** Added balance variable to avoid random infeasibilites -- **62_material/16_demand** Removed double structure for forestry products. `pm_demand_foresty` is now used in `62_material` ## [4.7.3] - 2024-04-12 From 2e4d1b19110546c1a5da751d61b2bf35b4c7b895 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 21 May 2024 10:14:34 +0200 Subject: [PATCH 174/280] doc and clean-up --- CHANGELOG.md | 3 ++- modules/21_trade/module.gms | 2 +- modules/32_forestry/dynamic_may24/equations.gms | 6 +++--- modules/32_forestry/dynamic_may24/realization.gms | 12 ++++++------ modules/35_natveg/dynamic_feb21/declarations.gms | 2 -- modules/35_natveg/dynamic_feb21/input.gms | 7 ------- modules/35_natveg/dynamic_feb21/presolve.gms | 8 -------- modules/35_natveg/input/files | 1 - modules/73_timber/default/equations.gms | 15 +++++++-------- modules/73_timber/default/input.gms | 7 +++---- modules/73_timber/default/presolve.gms | 7 ------- modules/73_timber/default/realization.gms | 11 ++++------- modules/73_timber/module.gms | 9 ++++----- 13 files changed, 30 insertions(+), 60 deletions(-) delete mode 100644 modules/73_timber/default/presolve.gms diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e7a315cc0..b96eaaa4c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **scenario_config.csv** added preset for GENIE project - **default.cfg** cfg$gms$s80_secondsolve option for second solve statement with 0=off as default - **21_trade** Minimum trade margin for forestry products `s21_min_trade_margin_forestry` +- **73_timber** added interface `im_timber_prod_cost` ### removed - **scripts/output/extra** removed scripts disaggregation_cropsplit and disaggregation_transitions @@ -41,7 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **14_yields** removed interface `pm_timber_yield_initial` - **21_trade** removed interface `pm_selfsuff_ext`, removed `v21_manna_from_heaven` - **32_forestry** removed interface `pm_representative_rotation` -- **73_timber** removed interface `pm_demand_forestry_future` +- **73_timber** removed interfaces `pm_demand_forestry_future` and `sm_wood_density` - **62_material/16_demand** Removed double structure for forestry products. `pm_demand_foresty` is now used in `62_material` ### fixed diff --git a/modules/21_trade/module.gms b/modules/21_trade/module.gms index f50e59d819..c38f8d8d64 100644 --- a/modules/21_trade/module.gms +++ b/modules/21_trade/module.gms @@ -7,7 +7,7 @@ *' @title Agricultural trade *' -*' @description This module represents agricutlural trade among world regions. +*' @description This module represents agricultural trade among world regions. *' It ensures that the regional demand is met by domestic production and imports from other regions. *' The global trade balance dictates that global production must be larger than or equal to global demand. *' For non-traded goods, the regional production must be larger than or equal to regional demand. diff --git a/modules/32_forestry/dynamic_may24/equations.gms b/modules/32_forestry/dynamic_may24/equations.gms index b3041e536a..e3ad87cf1a 100644 --- a/modules/32_forestry/dynamic_may24/equations.gms +++ b/modules/32_forestry/dynamic_may24/equations.gms @@ -150,15 +150,15 @@ q32_cost_establishment(i2).. *' Recurring costs are paid for plantations where the trees have to be regularly monitored -*' and maintained. These costs are only calculated becuase we see active human intervention +*' and maintained. These costs are only calculated because we see active human intervention *' in commercial plantations. These costs are paid for trees used for timber production or -*' trees established for afforestation purposes. +*' trees established for re/afforestation purposes. q32_cost_recur(i2) .. v32_cost_recur(i2) =e= sum((cell(i2,j2),type32,ac_sub), v32_land(j2,type32,ac_sub)) * s32_recurring_cost; -**** New establishment decision +**** Plantation establishment decision *------------------------------ *' New plantations are established in the optimization step based on a certain *' percentage (`p32_plant_contr`) of expected future demand (`p32_demand_forestry_future`). diff --git a/modules/32_forestry/dynamic_may24/realization.gms b/modules/32_forestry/dynamic_may24/realization.gms index 233c1f8ee4..dd607eee92 100644 --- a/modules/32_forestry/dynamic_may24/realization.gms +++ b/modules/32_forestry/dynamic_may24/realization.gms @@ -5,15 +5,15 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*' @description The main feature of the this realization is afforestation for CDR -*' and timber production. Afforestation can be modelled exogenously (prescribed +*' @description The main features of the this realization are re/afforestation for CDR +*' and timber production. Re/afforestation can be modelled exogenously (prescribed *' by NPI/NDC policies) and/or endogenously (incentivized by a reward for CDR). *' National policies implemented (NPI) and nationally determined contributions to -*' the Paris agreement (NDC) for afforestation are based on country reports. The +*' the Paris agreement (NDC) for re/afforestation are based on country reports. The *' interface `vm_cdr_aff` includes the expected CDR and local bph effects from -*' afforestation depending on the planning horizon `s32_planing_horizon`. The -*' reward for CDR and local bph effects from afforestation is calculated in the -*' [56_ghg_policy] module. In this realization, afforestation is modeled by default +*' re/afforestation depending on the planning horizon `s32_planing_horizon`. The +*' reward for CDR and local bph effects from re/afforestation is calculated in the +*' [56_ghg_policy] module. In this realization, re/afforestation is modeled by default *' as regrowth of natural vegetation (see @humpenoder_investigating_2014 for details on the implemenation). *' The regrowth of natural vegetation follows S-shaped growth curves, which are *' parametrized based on @braakhekke_modelling_2019. Additionally this module diff --git a/modules/35_natveg/dynamic_feb21/declarations.gms b/modules/35_natveg/dynamic_feb21/declarations.gms index e949a349a4..e56a8dde9a 100644 --- a/modules/35_natveg/dynamic_feb21/declarations.gms +++ b/modules/35_natveg/dynamic_feb21/declarations.gms @@ -26,8 +26,6 @@ parameters p35_disturbance_loss_primf(t,j) Loss due to disturbances in primary forest (mio. ha) i35_plantedclass_ac(j,ac) Area of age-classes in secondary forest (1) p35_poulter_dist(j,ac) Share of age-classes in secondary forest (1) - p35_land(t,j,land_natveg,ac) Natural vegetation area (mio. ha) - p35_updated_gs_natfor(t,i) Updated growing stock in natural forests after calibration (m3 per ha) p35_land_start_ac(j,ac,land_natveg) Initial Natural vegetation area (mio. ha) p35_protection_dist(j,ac) Distribution of secondary forest protection (1) p35_land_restoration(j,land_natveg) Actual secondary forest and other land restoration area (mio. ha) diff --git a/modules/35_natveg/dynamic_feb21/input.gms b/modules/35_natveg/dynamic_feb21/input.gms index 4704e30dd2..2e8ff828cc 100644 --- a/modules/35_natveg/dynamic_feb21/input.gms +++ b/modules/35_natveg/dynamic_feb21/input.gms @@ -47,10 +47,3 @@ $ondelim $include "./modules/35_natveg/input/f35_forest_disturbance_share.cs4" $offdelim /; - -parameter f35_gs_relativetarget(i) Relative growing stock target in each region (m3 per ha) -/ -$ondelim -$include "./modules/35_natveg/input/f35_gs_relativetarget.cs4" -$offdelim -/; diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/dynamic_feb21/presolve.gms index 97a6f33b35..dd9c94c7cc 100644 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ b/modules/35_natveg/dynamic_feb21/presolve.gms @@ -173,14 +173,6 @@ p35_carbon_density_other(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools p35_min_forest(t,j)$(p35_min_forest(t,j) > pcm_land(j,"primforest") + pcm_land(j,"secdforest")) = pcm_land(j,"primforest") + pcm_land(j,"secdforest"); p35_min_other(t,j)$(p35_min_other(t,j) > pcm_land(j,"other")) = pcm_land(j,"other"); -** Display -p35_land(t,j,land_natveg,ac) = 0; -p35_land(t,j,"primforest","acx") = pcm_land(j,"primforest"); -p35_land(t,j,"secdforest",ac) = p35_secdforest(t,j,ac); -*p35_land(t,j,"other",ac) = p35_other(t,j,ac): -p35_updated_gs_natfor(t,i) = 0; -p35_updated_gs_natfor(t,i)$(sum((cell(i,j),ac,land_natveg), p35_land(t,j,land_natveg,ac))>0) = (sum((cell(i,j),ac,land_natveg),(pm_timber_yield(t,j,ac,land_natveg) / sm_wood_density) * p35_land(t,j,land_natveg,ac))/ sum((cell(i,j),ac,land_natveg), p35_land(t,j,land_natveg,ac))); - ** Youngest age classes are not allowed to be harvested v35_hvarea_secdforest.fx(j,ac_est) = 0; v35_hvarea_other.fx(j,ac_est) = 0; diff --git a/modules/35_natveg/input/files b/modules/35_natveg/input/files index f1603f4a64..994bc46a69 100644 --- a/modules/35_natveg/input/files +++ b/modules/35_natveg/input/files @@ -2,5 +2,4 @@ npi_ndc_ad_aolc_pol.cs3 f35_forest_disturbance_share.cs4 f35_forest_lost_share.cs3 -f35_gs_relativetarget.cs4 f35_forest_shock.csv diff --git a/modules/73_timber/default/equations.gms b/modules/73_timber/default/equations.gms index d78bdb9177..0b062cc877 100644 --- a/modules/73_timber/default/equations.gms +++ b/modules/73_timber/default/equations.gms @@ -8,8 +8,8 @@ *' @equations *' Timber production cost include the cost for producing wood, woodfuel and residues, -*' as well as additional costs for harvesting (see below) and technical costs for -*' a slack variable ('v73_prod_heaven_timber'). The slack variable (high costs) +*' and technical costs for a slack variable ('v73_prod_heaven_timber'). +*' The slack variable (high costs) *' is only used as a last resort when there is no other way to meet the timber *' demand. The purpose of the slack variable is to assure technically feasibility *' of the model under all conditions and to indicate shortage of wood supply, if any. @@ -17,15 +17,14 @@ q73_cost_timber(i2).. vm_cost_timber(i2) =e= - sum(cell(i2,j2), vm_prod(j2,"wood")) * s73_timber_prod_cost_wood - + sum(cell(i2,j2), vm_prod(j2,"woodfuel")) * s73_timber_prod_cost_woodfuel - + sum(cell(i2,j2), v73_prod_residues(j2)) * s73_reisdue_removal_cost + sum((cell(i2,j2),kforestry), vm_prod(j2,kforestry) * im_timber_prod_cost(kforestry)) + + sum(cell(i2,j2), v73_prod_residues(j2)) * s73_reisdue_removal_cost + sum((cell(i2,j2),kforestry), v73_prod_heaven_timber(j2,kforestry) * s73_free_prod_cost) ; *' The following equations describes cellular level production (in dry matter) of -*' woody biomass `vm_prod_reg` as the sum of the cluster level production of -*' timber coming from 'v73_prod_forestry' and 'v73_prod_natveg'. When production +*' woody biomass `vm_prod` as the sum of the cluster level production of +*' timber coming from 'vm_prod_forestry' and 'vm_prod_natveg'. When production *' capabilities are exhausted, the model can produce roundwood without using any *' land resources but by paying a very high cost ('s73_free_prod_cost'). *' Timber production equation is split in two parts, one each for industrial roundwood @@ -57,7 +56,7 @@ q73_prod_woodfuel(j2).. *' of industrial roundwood production is assumed to be lost during harvesting processes. *' USDA reports that ca. 30% of roundwood harvested are residues (@oswalt2019forest). *' Not all of this residue is recoverwed from forest and we assume 50% of residue -*' removal based on @pokharel2017factors. These numebrs (residue levels and residude +*' removal based on @pokharel2017factors. These numbers (residue levels and residude *' removals vary strongly among different studies, the numbers used here are from *' a USDA report on state of forests in USA which has consistent reporting over years) diff --git a/modules/73_timber/default/input.gms b/modules/73_timber/default/input.gms index a6b2c54eef..91d789b5a2 100644 --- a/modules/73_timber/default/input.gms +++ b/modules/73_timber/default/input.gms @@ -17,11 +17,10 @@ scalars * https://unece.org/forests/prices s73_timber_prod_cost_wood Cost for producing one unit of wood (USD per tDM) / 120 / s73_timber_prod_cost_woodfuel Cost for prodcing one unit of woodfuel (USD per tDM) / 60 / - s73_free_prod_cost Very high cost for settling demand without production (USD per tDM) /20000/ + s73_free_prod_cost Very high cost for settling demand without production (USD per tDM) / 20000 / s73_timber_demand_switch Logical switch to turn on or off timber demand 1=on 0=off (1) / 1 / - s73_increase_ceiling Limiter for not allowing a demand jump between time steps beyond a certain limit (1) /1.025/ - s73_residue_ratio Proportion of overall industrial roundwood production which ends up as residue during harvest (1) / 0.15/ - sm_wood_density Representative wood density based on IPCC (tDM per m3) /0.6/ + s73_increase_ceiling Limiter for not allowing a demand jump between time steps beyond a certain limit (1) / 1.025 / + s73_residue_ratio Proportion of overall industrial roundwood production which ends up as residue during harvest (1) / 0.15 / s73_reisdue_removal_cost Cost of removing residues left after industrial roundwood harvest (USD per tDM) / 2 / s73_expansion Construction wood demand expansion factor by end of century based on industrial roundwood demand as base (1=100 percent increase) / 0 / ; diff --git a/modules/73_timber/default/presolve.gms b/modules/73_timber/default/presolve.gms deleted file mode 100644 index f9600b871f..0000000000 --- a/modules/73_timber/default/presolve.gms +++ /dev/null @@ -1,7 +0,0 @@ -*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) -*** | authors, and contributors see CITATION.cff file. This file is part -*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of -*** | AGPL-3.0, you are granted additional permissions described in the -*** | MAgPIE License Exception, version 1.0 (see LICENSE file). -*** | Contact: magpie@pik-potsdam.de - diff --git a/modules/73_timber/default/realization.gms b/modules/73_timber/default/realization.gms index 3e091e309d..571cb987fb 100644 --- a/modules/73_timber/default/realization.gms +++ b/modules/73_timber/default/realization.gms @@ -5,15 +5,13 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*' @description biomass_mar20 realization acts as a common tunnel for land related -*' decisions in forestry [32_forestry] and natveg [35_natveg] modules and corresponding -*' production of woody biomass realized. This realization harvests timber from -*' available plantations to meet a portion of overall timber demand. Rest of the timber -*' production comes by harvesting natural vegetation. Aggregated timber demand for -*' wood and woodfuel is calculated based on demand equation from @lauri_timber_demand +*' @description In this realization, aggregated timber demand for wood and woodfuel +*' `pm_demand_forestry` is calculated based on demand equation from @lauri_timber_demand *' and income elasticities from @morland2018supply. See @mishra_forestry_2021 for more details. *' This realization can also account for construction wood demand based on *' @churkina2020buildings which is added on top of industrial roundwood demand (see @mishra_timbercities_2022). +*' Timber can be produced from both timber plantations `vm_prod_forestry` provided by [32_forestry] +*' and natural vegetation `vm_prod_natveg` provided by [35_natveg]. *' @limitations Timber demand cannot be determined endogenously @@ -24,6 +22,5 @@ $Ifi "%phase%" == "input" $include "./modules/73_timber/default/input.gms" $Ifi "%phase%" == "equations" $include "./modules/73_timber/default/equations.gms" $Ifi "%phase%" == "scaling" $include "./modules/73_timber/default/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/73_timber/default/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/73_timber/default/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/73_timber/default/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/73_timber/module.gms b/modules/73_timber/module.gms index 6da09b4853..cbaad3d3fb 100644 --- a/modules/73_timber/module.gms +++ b/modules/73_timber/module.gms @@ -7,11 +7,10 @@ *' @title Timber *' -*' @description This module handles the production of timber using plantations [32_forestry] -*' and natural vegetation [35_natveg]. Timber can be produced from both commercial plantations -*' and natural forests. The module feeds `vm_prod` at cluster level to [17_production] and -*' [21_trade] modules. This module also calculates the "real" harvested area in natural -*' forests i.e. `v35_hvarea_primforest`,`v35_hvarea_secdforest` and `v73_hvarea_other`. +*' @description This module provides demand for forestry products via the interface `pm_demand_forestry` +*' to the modules [32_forestry] and [62_material], and merges production of timber from +*' different sources into the interface `vm_prod`, which is used in the [17_production] and +*' [21_trade] modules. *' *' @authors Abhijeet Mishra, Florian Humpenöder From 28d94ae43ad5495c5156d4e81e10d290fcd85e89 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 21 May 2024 10:17:14 +0200 Subject: [PATCH 175/280] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b96eaaa4c4..cbf3b8ac99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **32_forestry** removed interface `pm_representative_rotation` - **73_timber** removed interfaces `pm_demand_forestry_future` and `sm_wood_density` - **62_material/16_demand** Removed double structure for forestry products. `pm_demand_foresty` is now used in `62_material` +- **35_natveg** removed growing stock calculation and calibration, which is no longer needed. ### fixed - **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs From 27abd8f94c58312575d8dfbe51d37bf740e6ea56 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 21 May 2024 20:36:30 +0200 Subject: [PATCH 176/280] NPI update --- CHANGELOG.md | 1 + config/default.cfg | 2 +- modules/32_forestry/dynamic_may24/input.gms | 2 +- modules/35_natveg/dynamic_feb21/equations.gms | 2 +- modules/35_natveg/dynamic_feb21/presolve.gms | 3 ++- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbf3b8ac99..dd93377f55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **32_forestry** renamed interface `pm_demand_ext` to `pm_demand_forestry` - **default.cfg** Forestry sector included by default by using the `ForestryEndo` settings from `scenario_config.csv`: `s32_initial_distribution = 1`, `s32_demand_establishment = 1`, `s32_hvarea = 2`, `s35_secdf_distribution = 2`, `s35_hvarea = 2`, `s73_timber_demand_switch = 1` - **14_yields** revised timber yield calculations +- **35_natveg** `vm_land(j2,"forestry")` included in NPI/NDC constraint `q35_min_forest` ### added - **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` diff --git a/config/default.cfg b/config/default.cfg index 750d8ba722..b44c05755f 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -888,7 +888,7 @@ cfg$gms$s32_forestry_int_rate <- 0.05 # def = 0.05 cfg$gms$s32_demand_establishment <- 1 # def = 1 # Establishment cost for plantations (USD per ha) -cfg$gms$s32_est_cost_plant <- 10000 # def = 10000 +cfg$gms$s32_est_cost_plant <- 2000 # def = 2000 # Establishment cost for natural vegetation (USD per ha) cfg$gms$s32_est_cost_natveg <- 2000 # def = 2000 diff --git a/modules/32_forestry/dynamic_may24/input.gms b/modules/32_forestry/dynamic_may24/input.gms index cf93880505..4561adace6 100644 --- a/modules/32_forestry/dynamic_may24/input.gms +++ b/modules/32_forestry/dynamic_may24/input.gms @@ -24,7 +24,7 @@ $setglobal c32_shock_scenario none scalars s32_hvarea Flag for harvested area and establishemt (0=zero 1=exognous 2=endogneous) / 2 / - s32_est_cost_plant Establishment cost for plantations (USD per ha) / 10000 / + s32_est_cost_plant Establishment cost for plantations (USD per ha) / 2000 / s32_est_cost_natveg Establishment cost for natural vegetation (USD per ha) / 2000 / s32_recurring_cost Recurring costs (USD per ha) / 500 / s32_harvesting_cost Harvesting cost (USD per ha) / 2000 / diff --git a/modules/35_natveg/dynamic_feb21/equations.gms b/modules/35_natveg/dynamic_feb21/equations.gms index 9b3f100c5b..6a49b108c6 100644 --- a/modules/35_natveg/dynamic_feb21/equations.gms +++ b/modules/35_natveg/dynamic_feb21/equations.gms @@ -61,7 +61,7 @@ *' the natural land conservation constraint) and specifically formulated for forest and *' other land stocks. - q35_min_forest(j2) .. vm_land(j2,"primforest") + vm_land(j2,"secdforest") + q35_min_forest(j2) .. vm_land(j2,"primforest") + vm_land(j2,"secdforest") + vm_land(j2,"forestry") =g= sum(ct, p35_min_forest(ct,j2)); diff --git a/modules/35_natveg/dynamic_feb21/presolve.gms b/modules/35_natveg/dynamic_feb21/presolve.gms index dd9c94c7cc..f4c870b7e5 100644 --- a/modules/35_natveg/dynamic_feb21/presolve.gms +++ b/modules/35_natveg/dynamic_feb21/presolve.gms @@ -170,7 +170,8 @@ p35_carbon_density_other(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools * NPI/NDC policy * ------------------ -p35_min_forest(t,j)$(p35_min_forest(t,j) > pcm_land(j,"primforest") + pcm_land(j,"secdforest")) = pcm_land(j,"primforest") + pcm_land(j,"secdforest"); +p35_min_forest(t,j)$(p35_min_forest(t,j) > pcm_land(j,"primforest") + pcm_land(j,"secdforest") + pcm_land(j,"forestry")) + = pcm_land(j,"primforest") + pcm_land(j,"secdforest") + pcm_land(j,"forestry"); p35_min_other(t,j)$(p35_min_other(t,j) > pcm_land(j,"other")) = pcm_land(j,"other"); ** Youngest age classes are not allowed to be harvested From de0ce461e36ff4f48f18bfa98d18a3edfcb69d33 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Wed, 22 May 2024 14:27:30 +0200 Subject: [PATCH 177/280] small bugfix in output scripts call in start scripts --- scripts/start/projects/project_EAT2p0.R | 4 ++-- scripts/start/projects/project_EAT2p0_DeepDive.R | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/start/projects/project_EAT2p0.R b/scripts/start/projects/project_EAT2p0.R index a676bcc4c8..e941839731 100644 --- a/scripts/start/projects/project_EAT2p0.R +++ b/scripts/start/projects/project_EAT2p0.R @@ -35,7 +35,7 @@ cfg$output <- c("output_check", # "projects/FSEC_water", # do manually on last (high-res) magpie run # add output file: pb_report (magpie (special mif created by getReportPBindicators & remind mif (REMIND_generic_scenName.mif)) "rds_report", - "agmip_report") + "projects/agmip_report") ####################### # SCENARIO DEFINITION # @@ -83,7 +83,7 @@ bau <- function(cfg) { # Climate Change cfg$input['cellular'] <- "rev4.99_h12_c6a7458f_cellularmagpie_c200_IPSL-CM6A-LR-ssp370_lpjml-8e6c5eb1.tgz" - + return(cfg) } diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index eac1f29d16..979f7aad10 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -34,7 +34,7 @@ cfg$output <- c( "extra/disaggregation", "projects/FSEC_nitrogenPollution", "projects/FSEC_water", - "agmip_report", + "projects/agmip_report", "rds_report", "runBlackmagicc" # add output file: pb_report (magpie (special mif created by getReportPBindicators & remind mif (REMIND_generic_scenName.mif)) From 625a3692472a854953bf612f9f86199035bf7556 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Wed, 22 May 2024 15:00:53 +0200 Subject: [PATCH 178/280] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a51b3c1631..157d858538 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **default.cfg** Forestry sector included by default by using the `ForestryEndo` settings from `scenario_config.csv`: `s32_initial_distribution = 1`, `s32_demand_establishment = 1`, `s32_hvarea = 2`, `s35_secdf_distribution = 2`, `s35_hvarea = 2`, `s73_timber_demand_switch = 1` - **14_yields** revised timber yield calculations - **35_natveg** `vm_land(j2,"forestry")` included in NPI/NDC constraint `q35_min_forest` -- **35_natveg** replaced the realisation `dynamic_feb21` with realisation `pot_forest_may24`. The new realisation provides additional information on the potential forest area, which is now used to constrain forest and forestry expansion. The remaining area for forest establishment is provided to the forestry module via the new interface parameter `pcm_max_forest_est`. +- **35_natveg** replaced the realisation `dynamic_feb21` with realisation `pot_forest_may24`. The new realisation provides additional information on the potential forest area, which is now used to constrain forest and forestry expansion and recovery. The remaining area for forest establishment is provided to the forestry module via the new interface parameter `pcm_max_forest_est`. - **52_carbon** Separate carbon densities for forest and other land. Before there was only a single carbon density for natural vegetation land. ### added From f7efd460e1da2db1d1efb06aa099e584ec7275c2 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Wed, 22 May 2024 18:09:56 +0200 Subject: [PATCH 179/280] typos --- modules/35_natveg/pot_forest_may24/input.gms | 4 ++-- modules/35_natveg/pot_forest_may24/preloop.gms | 2 +- modules/35_natveg/pot_forest_may24/presolve.gms | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/input.gms b/modules/35_natveg/pot_forest_may24/input.gms index aecafd5342..659aa2c69b 100644 --- a/modules/35_natveg/pot_forest_may24/input.gms +++ b/modules/35_natveg/pot_forest_may24/input.gms @@ -5,8 +5,8 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -$setglobal c35_ad_policy ndc -$setglobal c35_aolc_policy ndc +$setglobal c35_ad_policy npi +$setglobal c35_aolc_policy npi $setglobal c35_shock_scenario none scalars diff --git a/modules/35_natveg/pot_forest_may24/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms index 0f6ec6dd21..a874eb3fff 100644 --- a/modules/35_natveg/pot_forest_may24/preloop.gms +++ b/modules/35_natveg/pot_forest_may24/preloop.gms @@ -47,7 +47,7 @@ p35_disturbance_loss_primf(t,j) = 0; * ------------------------------------------------------------- * Forest establishment is constrained by the potential forest area in each cluster. -* Hence, the area for potential forest establishments is given by the potential forest +* Hence, the area for forest establishments is given by the potential forest * area minus all forest areas in the previous time step. pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 260ab20bad..55e4e2eee0 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -65,7 +65,7 @@ pc35_youngsecdf(j,ac_est)$(sum(ac_est2,pc35_youngsecdf(j,ac_est2)) > pcm_max_for p35_max_forest_recovery(j) = pcm_max_forest_est(j) - sum(ac, pc35_youngsecdf(j,ac)); p35_forest_recovery_shr(j) = p35_max_forest_recovery(j) / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")+1e-10); p35_forest_recovery_shr(j)$(p35_forest_recovery_shr(j) > 1) = 1; -* Abandoned land pc35_other(j,ac_est) is then distributed propotionally using the forest recovery share. +* Abandoned land pc35_other(j,ac_est) is then distributed proportionally using the forest recovery share. p35_recovered_forest(t,j,ac_est) = pc35_other(j,ac_est) * p35_forest_recovery_shr(j); p35_recovered_forest(t,j,ac_est)$(sum(ac_est2,p35_recovered_forest(t,j,ac_est2)) > p35_max_forest_recovery(j)) = p35_max_forest_recovery(j)/card(ac_est2); pc35_other(j,ac_est) = pc35_other(j,ac_est) - p35_recovered_forest(t,j,ac_est); From c4677ad149aa21e39805c5c5187883b64d874ba1 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Thu, 23 May 2024 10:29:56 +0200 Subject: [PATCH 180/280] changed Deep Dive start script: all are based on NPI now --- .../start/projects/project_EAT2p0_DeepDive.R | 78 ++++++++++++------- 1 file changed, 51 insertions(+), 27 deletions(-) diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index 979f7aad10..a9a21192e9 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -148,7 +148,7 @@ priceCO2 <- function(cfg) { # Mitigation: only price land CO2 cfg$gms$c56_pollutant_prices <- "coupling" cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" - cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" #### double-check Florian + cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" #### double-check Florian or Leon return(cfg) } @@ -158,7 +158,7 @@ priceNonCO2 <- function(cfg) { # Mitigation: only CH4 and N2O price cfg$gms$c56_pollutant_prices <- "coupling" cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" - cfg$gms$c56_emis_policy <- "ecoSysProtOff" ### double-check Florian + cfg$gms$c56_emis_policy <- "ecoSysProtOff" ### double-check Florian or Leon return(cfg) } @@ -216,13 +216,53 @@ start_run(cfg, codeCheck = FALSE) # All production-side land-based mitigation measures cfg$title <- "BAU_Miti" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation (CO2, non-CO2, bioenergy) cfg <- miti(cfg = cfg) start_run(cfg, codeCheck = FALSE) +# BAU_MITI - bioenergy # +# (1e) CO2 and non-CO2 pricing, but no bioenergy demand from REMIND +cfg$title <- "BAUMITI_Bioenergy" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation +cfg <- miti(cfg = cfg) +cfg$gms$c60_2ndgen_biodem <- "coupling" +cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" +start_run(cfg, codeCheck = FALSE) + +# BAU_MITI - non-CO2 # +# (1f) CO2 pricing and bioenergy demand from REMIND, but no non-CO2 pricing in land-system +cfg$title <- "BAUMITI_nonCO2" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation +cfg <- miti(cfg = cfg) +# ecoSysProtAll_agMgmtOff: (Above ground CO2 emis from LUC in forest, forestry, natveg; All types of emis from peatland; No further CH4/N2O/other emis related to ag. management) +cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" +start_run(cfg, codeCheck = FALSE) + +# MITI_CO2 (mitigation - CO2) # +# (1g) non-CO2 pricing and bioenergy demand from REMIND, but no CO2 pricing in land-system +cfg$title <- "BAUMITI_CO2" +# standard setting, but with NDC for miti +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +# BAU settings +cfg <- bau(cfg = cfg) +# Mitigation +cfg <- miti(cfg = cfg) +# ecoSysProtOff: (All CH4 and N2O emis except peatland), +cfg$gms$c56_emis_policy <- "ecoSysProtOff" +start_run(cfg, codeCheck = FALSE) + + # BAU + EL2-Diet # # PHD components: # (1e) Productivity @@ -261,7 +301,7 @@ start_run(cfg, codeCheck = FALSE) # All production-side land-based mitigation measures and demand-side mitigation (diet change), but no NDCs #cfg$title <- "MITI_NDC" # standard setting, but with NDC for miti -#cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) +#cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) # BAU settings #cfg <- bau(cfg = cfg) # Mitigation (CO2, non-CO2, bioenergy) @@ -276,7 +316,7 @@ start_run(cfg, codeCheck = FALSE) # (2b) CO2 and non-CO2 pricing and demand-side mitigation (diet change), but no bioenergy demand from REMIND cfg$title <- "MITI_Bioenergy" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation @@ -293,7 +333,7 @@ start_run(cfg, codeCheck = FALSE) # (2c) CO2 pricing and bioenergy demand from REMIND and demand-side mitigation (diet change), but no non-CO2 pricing in land-system cfg$title <- "MITI_nonCO2" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation @@ -310,7 +350,7 @@ start_run(cfg, codeCheck = FALSE) # (2d) non-CO2 pricing and bioenergy demand from REMIND and demand-side mitigation (diet change), but no CO2 pricing in land-system cfg$title <- "MITI_CO2" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation @@ -336,27 +376,11 @@ cfg <- diet(cfg = cfg) cfg <- waste(cfg = cfg) start_run(cfg, codeCheck = FALSE) - -# MITI_Prod # -# (2e) All production-side land-based mitigation measures and demand-side mitigation without Prod -#cfg$title <- "MITI_Prod" -# standard setting, but with NDC for miti -#cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) -# BAU settings -#cfg <- bau(cfg = cfg) -# Mitigation (CO2, non-CO2, bioenergy) -#cfg <- miti(cfg = cfg) -# PHD (diet, prod, waste) -#cfg <- diet(cfg = cfg) -#cfg <- prod(cfg = cfg) -#cfg <- waste(cfg = cfg) -#start_run(cfg, codeCheck = FALSE) - # MITI_Waste # # (2f) All production-side land-based mitigation measures and demand-side mitigation without Waste cfg$title <- "MITI_Waste" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation (CO2, non-CO2, bioenergy) @@ -370,7 +394,7 @@ start_run(cfg, codeCheck = FALSE) # (2g) All production-side land-based mitigation measures and demand-side mitigation without Diet cfg$title <- "MITI_Diet" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation (CO2, non-CO2, bioenergy) @@ -384,7 +408,7 @@ start_run(cfg, codeCheck = FALSE) # (2e,f,g) All production-side land-based mitigation measures, but no demand-side mitigation cfg$title <- "MITI_Dem" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation @@ -433,7 +457,7 @@ start_run(cfg, codeCheck = FALSE) # All production-side land-based mitigation measures and demand-side mitigation (diet change) cfg$title <- "MITI_All" # standard setting, but with NDC for miti -cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) +cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) # BAU settings cfg <- bau(cfg = cfg) # Mitigation (CO2, non-CO2, bioenergy) From 5210068e6c67f8f3e26ed92db8a3c6258e2dc209 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 23 May 2024 10:36:49 +0200 Subject: [PATCH 181/280] addressed review comments --- modules/35_natveg/pot_forest_may24/equations.gms | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 5c6aa02224..14a7db4a1f 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -73,7 +73,7 @@ *' the natural land conservation constraint) and specifically formulated for forest and *' other land stocks. - q35_min_forest(j2) .. vm_land(j2,"primforest") + vm_land(j2,"secdforest") + vm_land(j2,"forestry") + q35_min_forest(j2) .. sum(land_forest, vm_land(j2,land_forest)) =g= sum(ct, p35_min_forest(ct,j2)); @@ -182,10 +182,9 @@ q35_hvarea_other(j2,ac_sub).. v35_other_reduction(j2,ac_sub); -*' The constraint for overall forest establishment is given by the -*' remaining potential forest area, which is derived from -*' the potential natural forest area minus the recovering secondary -*' forest area. +*' The constraint for overall forest establishment, including forestry, is given +*' by the remaining potential forest area, which is derived from the potential +*' natural forestarea minus the recovering secondary forest area. q35_max_forest_establishment(j2).. sum(land_forest, vm_landexpansion(j2,land_forest)) From ac813f0042a3401be867e0b303f6eac1abbedda9 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Thu, 23 May 2024 11:28:41 +0200 Subject: [PATCH 182/280] updated FSEC water script --- scripts/output/projects/FSEC_water.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/output/projects/FSEC_water.R b/scripts/output/projects/FSEC_water.R index 016ccd2868..564f89ba33 100644 --- a/scripts/output/projects/FSEC_water.R +++ b/scripts/output/projects/FSEC_water.R @@ -59,3 +59,7 @@ watStressViolations <- watStress # mark violations in different color watStressViolations[efvViolation == 1] <- 100 write.magpie(watStressViolations, file_name = file.path(outputdir, "watStressViolations.mz")) + +# Water EFV ratio (EFV to EFR) +watEFVratio <- waterEFVratio(gdx, level = "grid", dir = outputdir) +write.magpie(watEFVratio, file_name = file.path(outputdir, "watEFVratio.mz")) From 390afbd2a82d40299e3dd0ea087263aa14d6e46b Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 23 May 2024 11:55:20 +0200 Subject: [PATCH 183/280] minor streamlining of code --- config/default.cfg | 8 +-- config/scenario_config.csv | 2 +- config/scenario_fsec.csv | 6 +- main.gms | 60 +++++++++---------- modules/35_natveg/input/files | 2 +- modules/35_natveg/pot_forest_may24/input.gms | 2 +- .../35_natveg/pot_forest_may24/postsolve.gms | 6 +- .../35_natveg/pot_forest_may24/preloop.gms | 8 +++ .../35_natveg/pot_forest_may24/presolve.gms | 10 ---- 9 files changed, 51 insertions(+), 53 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 4318c70842..693b579897 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -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.105_h12_magpie.tgz", - cellular = "rev4.105_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.105_h12_validation.tgz", +cfg$input <- c(regional = "rev4.106_h12_magpie.tgz", + cellular = "rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.106_h12_validation.tgz", additional = "additional_data_rev4.50.tgz", calibration = "calibration_H12_26Mar24.tgz") @@ -882,7 +882,7 @@ cfg$gms$c32_interest_rate <- "regional" # def = "regional" cfg$gms$s32_forestry_int_rate <- 0.05 # def = 0.05 # Setting to define if the model should be forward looking or not in terms of -# seeing the future demand for current timestep establishment of new plantations. +# seeing the future demand for current timestep establishment of new plantations. # * 0 = static (establishment based on current demand) # * 1 = forward looking (establishment based on future demand according to rotation length) cfg$gms$s32_demand_establishment <- 1 # def = 1 diff --git a/config/scenario_config.csv b/config/scenario_config.csv index 985d29edef..fd673c0b0e 100644 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -88,7 +88,7 @@ gms$s73_timber_demand_switch;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;; gms$s35_forest_damage;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;;;; gms$c32_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;; gms$c35_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;; -input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.105_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.105_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.105_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.105_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.105_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.105_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;; +input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.106_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.106_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.106_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.106_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.106_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;; gms$c52_land_carbon_sink_rcp;;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;RCP19;RCP26;RCP45;RCP60;RCPBU;RCPBU;; gms$c57_macc_version;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PBL_2022;PBL_2022;PBL_2022;PBL_2022;;;;;;;;;;;;;;;; gms$c57_macc_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Default;Optimistic;Default;Optimistic;;;;;;;;;;;;;;;; diff --git a/config/scenario_fsec.csv b/config/scenario_fsec.csv index 53c95b210c..dfb83a5046 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -74,9 +74,9 @@ gms$s62_max_dem_bioplastic;0;;;;400;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c70_fac_req_regr;reg;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c70_feed_scen;;;;;;;;;;;;;;;;;;ssp1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c73_build_demand;;;;;;;;;;;;;;;;;;;;;;;;50pc;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['cellular'];rev4.105_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.105_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.105_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.105_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;; -input['regional'];rev4.105_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['validation'];rev4.105_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['cellular'];rev4.106_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.106_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.106_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.106_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.106_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.106_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.106_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;; +input['regional'];rev4.106_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['validation'];rev4.106_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['additional'];additional_data_rev4.50.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['calibration'];calibration_FSEC_26Mar24.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; magicc_emis_scen;bjoernAR6_C_SSP2-NDC.mif;;;bjoernAR6_C_SSP2-PkBudg900.mif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bjoernAR6_C_SSP1-NDC.mif;;;;;;;;;;;;bjoernAR6_C_RemSDP-900-MagSSP1.mif;; diff --git a/main.gms b/main.gms index e77c4cbc72..c1fd3720e4 100644 --- a/main.gms +++ b/main.gms @@ -147,44 +147,44 @@ $title magpie *' * Always try to access model outputs through the corresponding magpie package instead of accessing them directly with readGDX. It cannot be guaranteed that your script will work in the future if you do otherwise (as only the corresponding magpie package will be continuously adapted to changes in the GAMS code). *##################### R SECTION START (VERSION INFO) ########################## -* -* Used data set: rev4.104_h12_magpie.tgz -* md5sum: NA -* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* -* Used data set: rev4.104_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz -* md5sum: NA -* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* -* Used data set: rev4.104_h12_validation.tgz -* md5sum: NA -* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* -* Used data set: additional_data_rev4.48.tgz -* md5sum: NA -* Repository: scp://cluster.pik-potsdam.de/p/projects/landuse/data/input/archive -* +* +* Used data set: rev4.106_h12_magpie.tgz +* md5sum: e76c52a364c5028c8c8e9f427bbf788a +* Repository: /p/projects/rd3mod/inputdata/output +* +* Used data set: rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz +* md5sum: 21ae47f599f0526af325f43b2316978e +* Repository: /p/projects/rd3mod/inputdata/output +* +* Used data set: rev4.106_h12_validation.tgz +* md5sum: 9f7639ae2bef9f24fcae12d85300d4bd +* Repository: /p/projects/rd3mod/inputdata/output +* +* Used data set: additional_data_rev4.50.tgz +* md5sum: d29e253bd32fce7d3b9217642a5978d5 +* Repository: /p/projects/landuse/data/input/archive +* * Used data set: calibration_H12_26Mar24.tgz * md5sum: NA * Repository: https://rse.pik-potsdam.de/data/magpie/public -* +* * Low resolution: c200 * High resolution: 0.5 -* +* * Total number of cells: 200 -* +* * Number of cells per region: * CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA * 14 23 10 7 4 26 21 9 16 23 32 15 -* +* * Regionscode: 62eff8f7 -* -* Regions data revision: 4.104 -* +* +* Regions data revision: 4.106 +* * lpj2magpie settings: * * LPJmL data: MRI-ESM2-0:ssp370 -* * Revision: 4.104 -* +* * Revision: 4.106 +* * aggregation settings: * * Input resolution: 0.5 * * Output resolution: c200 @@ -193,10 +193,10 @@ $title magpie * CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA * 14 23 10 7 4 26 21 9 16 23 32 15 * * Call: withCallingHandlers(expr, message = messageHandler, warning = warningHandler, error = errorHandler) -* -* -* Last modification (input data): Wed May 8 14:54:42 2024 -* +* +* +* Last modification (input data): Thu May 23 11:16:51 2024 +* *###################### R SECTION END (VERSION INFO) ########################### $offupper diff --git a/modules/35_natveg/input/files b/modules/35_natveg/input/files index 372c96f03c..dc39074a1e 100644 --- a/modules/35_natveg/input/files +++ b/modules/35_natveg/input/files @@ -3,5 +3,5 @@ npi_ndc_ad_aolc_pol.cs3 f35_forest_disturbance_share.cs4 f35_forest_lost_share.cs3 f35_forest_shock.csv -pot_forest_area.cs3 +pot_forest_area.cs2 pot_forest_area_0.5.mz diff --git a/modules/35_natveg/pot_forest_may24/input.gms b/modules/35_natveg/pot_forest_may24/input.gms index 659aa2c69b..0ed373a22b 100644 --- a/modules/35_natveg/pot_forest_may24/input.gms +++ b/modules/35_natveg/pot_forest_may24/input.gms @@ -51,6 +51,6 @@ $offdelim parameter f35_pot_forest_area(j) Potential forest area (mio. ha) / $ondelim -$include "./modules/35_natveg/input/pot_forest_area.cs3" +$include "./modules/35_natveg/input/pot_forest_area.cs2" $offdelim /; diff --git a/modules/35_natveg/pot_forest_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms index c503ff69ad..d4be352bbe 100644 --- a/modules/35_natveg/pot_forest_may24/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -6,11 +6,11 @@ *** | Contact: magpie@pik-potsdam.de *secdforest age class calculation -p35_secdforest(t,j,ac) = v35_secdforest.l(j,ac); +pc35_secdforest(j,ac) = v35_secdforest.l(j,ac); *other land age class calculation -p35_other(t,j,ac) = v35_other.l(j,ac); -p35_youngsecdf(t,j,ac) = v35_youngsecdf.l(j,ac); +pc35_other(j,ac) = v35_other.l(j,ac); +pc35_youngsecdf(j,ac) = v35_youngsecdf.l(j,ac); * Reset forest establishment bound pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, vm_land.l(j,land_forest)); diff --git a/modules/35_natveg/pot_forest_may24/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms index a874eb3fff..cce3cf00ca 100644 --- a/modules/35_natveg/pot_forest_may24/preloop.gms +++ b/modules/35_natveg/pot_forest_may24/preloop.gms @@ -75,3 +75,11 @@ p35_land_start_ac(j,ac,"secdforest") = i35_secdforest(j,ac); * Set forest damage trajectory * ----------------------------- m_sigmoid_time_interpol(p35_damage_fader,sm_fix_SSP2,s35_forest_damage_end,0,1); + +* --------------------------------------- +* Initialise natveg in first time step +* --------------------------------------- + + pc35_secdforest(j,ac) = i35_secdforest(j,ac); + pc35_youngsecdf(j,ac) = i35_youngsecdf(j,ac); + pc35_other(j,ac) = i35_other(j,ac); diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 55e4e2eee0..b0eb4fdf77 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -5,16 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -if((ord(t) = 1), - pc35_secdforest(j,ac) = i35_secdforest(j,ac); - pc35_youngsecdf(j,ac) = i35_youngsecdf(j,ac); - pc35_other(j,ac) = i35_other(j,ac); -else - pc35_secdforest(j,ac) = p35_secdforest(t-1,j,ac); - pc35_youngsecdf(j,ac) = p35_youngsecdf(t-1,j,ac); - pc35_other(j,ac) = p35_other(t-1,j,ac); -); - * ---------------------------------------------------- * Shift ageclasses due to shifting agriculture fires * ---------------------------------------------------- From caa8ec0e7710f8da898610e5cca99870b80ce53b Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 23 May 2024 12:02:12 +0200 Subject: [PATCH 184/280] reverted main.gms download paths --- main.gms | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/main.gms b/main.gms index c1fd3720e4..5a585545d1 100644 --- a/main.gms +++ b/main.gms @@ -147,44 +147,44 @@ $title magpie *' * Always try to access model outputs through the corresponding magpie package instead of accessing them directly with readGDX. It cannot be guaranteed that your script will work in the future if you do otherwise (as only the corresponding magpie package will be continuously adapted to changes in the GAMS code). *##################### R SECTION START (VERSION INFO) ########################## -* +* * Used data set: rev4.106_h12_magpie.tgz -* md5sum: e76c52a364c5028c8c8e9f427bbf788a -* Repository: /p/projects/rd3mod/inputdata/output -* +* md5sum: NA +* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output +* * Used data set: rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz -* md5sum: 21ae47f599f0526af325f43b2316978e -* Repository: /p/projects/rd3mod/inputdata/output -* +* md5sum: NA +* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output +* * Used data set: rev4.106_h12_validation.tgz -* md5sum: 9f7639ae2bef9f24fcae12d85300d4bd -* Repository: /p/projects/rd3mod/inputdata/output -* +* md5sum: NA +* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output +* * Used data set: additional_data_rev4.50.tgz -* md5sum: d29e253bd32fce7d3b9217642a5978d5 -* Repository: /p/projects/landuse/data/input/archive -* +* md5sum: NA +* Repository: scp://cluster.pik-potsdam.de/p/projects/landuse/data/input/archive +* * Used data set: calibration_H12_26Mar24.tgz * md5sum: NA * Repository: https://rse.pik-potsdam.de/data/magpie/public -* +* * Low resolution: c200 * High resolution: 0.5 -* +* * Total number of cells: 200 -* +* * Number of cells per region: * CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA * 14 23 10 7 4 26 21 9 16 23 32 15 -* +* * Regionscode: 62eff8f7 -* +* * Regions data revision: 4.106 -* +* * lpj2magpie settings: * * LPJmL data: MRI-ESM2-0:ssp370 * * Revision: 4.106 -* +* * aggregation settings: * * Input resolution: 0.5 * * Output resolution: c200 @@ -193,10 +193,10 @@ $title magpie * CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA * 14 23 10 7 4 26 21 9 16 23 32 15 * * Call: withCallingHandlers(expr, message = messageHandler, warning = warningHandler, error = errorHandler) -* -* +* +* * Last modification (input data): Thu May 23 11:16:51 2024 -* +* *###################### R SECTION END (VERSION INFO) ########################### $offupper From cfbdf80161a92552645eae315df39777a78ffb9e Mon Sep 17 00:00:00 2001 From: Felicitas Date: Thu, 23 May 2024 13:51:55 +0200 Subject: [PATCH 185/280] update realization description of 41_AEI module --- .../41_area_equipped_for_irrigation/endo_apr13/realization.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/41_area_equipped_for_irrigation/endo_apr13/realization.gms b/modules/41_area_equipped_for_irrigation/endo_apr13/realization.gms index 07fb647508..f93521ee43 100644 --- a/modules/41_area_equipped_for_irrigation/endo_apr13/realization.gms +++ b/modules/41_area_equipped_for_irrigation/endo_apr13/realization.gms @@ -9,7 +9,7 @@ *' @description This realization allows the model to endogenously decide on investments to deploy additional *' irrigation infrastructure, i.e. to increase the area equipped for irrigation (AEI). *' Initial values for AEI are areas that are irrigated in the initial time step in LUH2v2. -*' Contraction of AEI is not possible. +*' Depreciation of AEI can be set via `s41_AEI_depreciation`. *' Irrigated crop production can only take place where irrigation infrastructure is present. *' *' Unit costs per hectare for AEI expansion are derived from a World Bank study (@worldbank_irrigation_1995) From b70d512f7490fe03c7567266a085e71fb23659b8 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Thu, 23 May 2024 13:53:53 +0200 Subject: [PATCH 186/280] update input data --- config/default.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 572be18f70..828289cad7 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -22,9 +22,9 @@ cfg$model <- "main.gms" #def = "main.gms" #### input settings #### # which input data sets should be used? -cfg$input <- c(regional = "WARNINGS66_rev4.107Mehta_h12_magpie.tgz", - cellular = "WARNINGS26_rev4.107Mehta_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "WARNINGS79_rev4.107Mehta_h12_validation.tgz", +cfg$input <- c(regional = "rev4.106_h12_magpie.tgz", + cellular = "rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.106_h12_validation.tgz", additional = "additional_data_rev4.50.tgz", calibration = "calibration_H12_26Mar24.tgz") From e2f3698080608782898a47a35ef46aa34553bb30 Mon Sep 17 00:00:00 2001 From: David Hoetten Date: Thu, 23 May 2024 15:10:45 +0200 Subject: [PATCH 187/280] fixed division by zero in preloop and updated changelog --- CHANGELOG.md | 1 + modules/14_yields/managementcalib_aug19/preloop.gms | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3b75a1cb3..8e50855c08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### changed +- **14_yields** fix division by zero in preloop of managementcalib_aug19 - **22_land_conservation and default.cfg** Added options for baseline protection - **15_food, default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying food substitution scenarios and exogeneous food intake scenarios - **70_livestock, default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying feed substitution with SCP scenarios diff --git a/modules/14_yields/managementcalib_aug19/preloop.gms b/modules/14_yields/managementcalib_aug19/preloop.gms index a23737fd6e..b513ffbd36 100644 --- a/modules/14_yields/managementcalib_aug19/preloop.gms +++ b/modules/14_yields/managementcalib_aug19/preloop.gms @@ -127,9 +127,9 @@ if ((s14_calib_ir2rf = 1), * Calibrate newly calibrated yields to FAO yields i14_modeled_yields_hist2(i,knbe14) = (sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14) * i14_yields_calib("y1995",j,knbe14,w)) / - sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14)))$(sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14))>0) + sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14)))$(sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14))>0.00001) + (sum((cell(i,j),w), i14_croparea_total("y1995",w,j) * f14_yields("y1995",j,knbe14,w)) / - sum((cell(i,j),w), i14_croparea_total("y1995",w,j)))$(sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14))=0); + sum((cell(i,j),w), i14_croparea_total("y1995",w,j)))$(sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14))<0.00001); i14_yields_calib(t,j,knbe14,w) = sum((cell(i,j)), i14_fao_yields_hist("y1995",i,knbe14) / i14_modeled_yields_hist2(i,knbe14)) * From 185fedceb3f7db6397239bc2275878036779cd53 Mon Sep 17 00:00:00 2001 From: David Hoetten Date: Thu, 23 May 2024 15:44:03 +0200 Subject: [PATCH 188/280] recovered original behaviour for <0 case --- modules/14_yields/managementcalib_aug19/preloop.gms | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/14_yields/managementcalib_aug19/preloop.gms b/modules/14_yields/managementcalib_aug19/preloop.gms index b513ffbd36..4a097775c5 100644 --- a/modules/14_yields/managementcalib_aug19/preloop.gms +++ b/modules/14_yields/managementcalib_aug19/preloop.gms @@ -129,7 +129,8 @@ if ((s14_calib_ir2rf = 1), = (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) + (sum((cell(i,j),w), i14_croparea_total("y1995",w,j) * f14_yields("y1995",j,knbe14,w)) / - sum((cell(i,j),w), i14_croparea_total("y1995",w,j)))$(sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14))<0.00001); + sum((cell(i,j),w), i14_croparea_total("y1995",w,j))) + $(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))>=0); i14_yields_calib(t,j,knbe14,w) = sum((cell(i,j)), i14_fao_yields_hist("y1995",i,knbe14) / i14_modeled_yields_hist2(i,knbe14)) * From 9e5ffd1f6dd55bf0173ace46e40042b4215912ce Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 23 May 2024 16:35:34 +0200 Subject: [PATCH 189/280] carbon density fix --- .../14_yields/managementcalib_aug19/presolve.gms | 13 +++++++++++-- modules/35_natveg/pot_forest_may24/presolve.gms | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/modules/14_yields/managementcalib_aug19/presolve.gms b/modules/14_yields/managementcalib_aug19/presolve.gms index 7d77d33032..ca1189f665 100644 --- a/modules/14_yields/managementcalib_aug19/presolve.gms +++ b/modules/14_yields/managementcalib_aug19/presolve.gms @@ -30,11 +30,20 @@ pm_timber_yield(t,j,ac,"forestry") = ) ; -pm_timber_yield(t,j,ac,land_forest) = +pm_timber_yield(t,j,ac,"primforest") = + ( + fm_carbon_density(t,j,"primforest","vegc") + / s14_carbon_fraction + * f14_aboveground_fraction("primforest") + / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"natveg")) + ) + ; + +pm_timber_yield(t,j,ac,"secdforest") = ( pm_carbon_density_secdforest_ac(t,j,ac,"vegc") / s14_carbon_fraction - * f14_aboveground_fraction(land_forest) + * f14_aboveground_fraction("secdforest") / sum(clcl, pm_climate_class(j,clcl) * f14_ipcc_bce(clcl,"natveg")) ) ; diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index b0eb4fdf77..be972d342c 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -119,7 +119,7 @@ pcm_land(j,"other") = sum(ac, pc35_other(j,ac)) + sum(ac, pc35_youngsecdf(j,ac)) * Within the optimization, primary forests can only decrease * (e.g. due to cropland expansion). -* In contrast, other natural land and secdforest can decrease and increase within the optimization. +* In contrast, other natural land can decrease and increase within the optimization. * For instance, other natural land increases if agricultural land is abandoned. * Correct land conservation for damage From b9c2b1824aafb293b99512f4672cfbbd19934082 Mon Sep 17 00:00:00 2001 From: DavidhoPIK <101278418+DavidhoPIK@users.noreply.github.com> Date: Thu, 23 May 2024 19:41:37 +0200 Subject: [PATCH 190/280] Move CHANGELOG entry to fixed --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e50855c08..0480675e4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### changed -- **14_yields** fix division by zero in preloop of managementcalib_aug19 - **22_land_conservation and default.cfg** Added options for baseline protection - **15_food, default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying food substitution scenarios and exogeneous food intake scenarios - **70_livestock, default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying feed substitution with SCP scenarios @@ -38,6 +37,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **scripts** removed support for spam files in start_functions ### fixed +- **14_yields** fix division by zero in preloop of managementcalib_aug19 - **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs - **44_biodiversity** avoid division by zero - **scenario_config.csv** same revision for input files as in default.cfg From 301a4b711afc6e0eeb8f3e4adff8f6c67f1da96f Mon Sep 17 00:00:00 2001 From: David Hoetten Date: Fri, 24 May 2024 11:00:09 +0200 Subject: [PATCH 191/280] removed >= 0 check for better readability, added analogous change for first modeled_yields_historical def --- modules/14_yields/managementcalib_aug19/preloop.gms | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/14_yields/managementcalib_aug19/preloop.gms b/modules/14_yields/managementcalib_aug19/preloop.gms index 4a097775c5..a495c24376 100644 --- a/modules/14_yields/managementcalib_aug19/preloop.gms +++ b/modules/14_yields/managementcalib_aug19/preloop.gms @@ -59,9 +59,9 @@ i14_croparea_total(t_all,w,j) = sum(kcr, fm_croparea(t_all,j,w,kcr)); i14_modeled_yields_hist(t_past,i,knbe14) = (sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14) * f14_yields(t_past,j,knbe14,w)) / - sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14)))$(sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14))>0) + sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14)))$(sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14))>0.00001) + (sum((cell(i,j),w), i14_croparea_total(t_past,w,j) * f14_yields(t_past,j,knbe14,w)) / - sum((cell(i,j),w), i14_croparea_total(t_past,w,j)))$(sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14))=0); + sum((cell(i,j),w), i14_croparea_total(t_past,w,j)))$(sum((cell(i,j),w), fm_croparea(t_past,j,w,knbe14))<0.00001); *' The factor `i14_lambda_yields` is calculated for the initial time step depending @@ -129,8 +129,7 @@ if ((s14_calib_ir2rf = 1), = (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) + (sum((cell(i,j),w), i14_croparea_total("y1995",w,j) * f14_yields("y1995",j,knbe14,w)) / - sum((cell(i,j),w), i14_croparea_total("y1995",w,j))) - $(sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14))<0.00001 and sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14))>=0); + sum((cell(i,j),w), i14_croparea_total("y1995",w,j)))$(sum((cell(i,j),w), fm_croparea("y1995",j,w,knbe14))<0.00001); i14_yields_calib(t,j,knbe14,w) = sum((cell(i,j)), i14_fao_yields_hist("y1995",i,knbe14) / i14_modeled_yields_hist2(i,knbe14)) * From 9580188a8d7f6183f296f2ae443ea7c379c9be02 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Fri, 24 May 2024 14:30:54 +0200 Subject: [PATCH 192/280] added interface vm_land_other to facilitate emissions calculations --- .../pot_forest_may24/declarations.gms | 154 +++++++++--------- .../35_natveg/pot_forest_may24/equations.gms | 101 ++++++------ .../35_natveg/pot_forest_may24/postsolve.gms | 63 ++++--- .../35_natveg/pot_forest_may24/preloop.gms | 11 +- .../35_natveg/pot_forest_may24/presolve.gms | 80 ++++----- modules/35_natveg/pot_forest_may24/sets.gms | 3 + modules/59_som/cellpool_aug16/equations.gms | 30 ++-- modules/59_som/cellpool_jan23/equations.gms | 30 ++-- modules/59_som/static_jan19/declarations.gms | 12 +- modules/59_som/static_jan19/equations.gms | 14 +- modules/59_som/static_jan19/postsolve.gms | 36 ++-- modules/59_som/static_jan19/sets.gms | 4 +- 12 files changed, 271 insertions(+), 267 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index 6345f0ade8..43532f0540 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -10,100 +10,94 @@ scalars ; parameters - i35_secdforest(j,ac) Initial secdforest (mio. ha) - i35_youngsecdf(j,ac) Initial young secdforest (mio. ha) - i35_other(j,ac) Initial other land (mio. ha) - p35_secdforest(t,j,ac) Secdforest per age class (mio. ha) - p35_youngsecdf(t,j,ac) Young secdforest per age class (mio. ha) - p35_other(t,j,ac) Other land per age class (mio. ha) - pc35_secdforest(j,ac) Secdforest per age class in current time step (mio. ha) - pc35_youngsecdf(j,ac) Young secdforest per age class in current time step (mio. ha) - pc35_other(j,ac) Other land per age class in current time step (mio. ha) - p35_min_forest(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) - p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) - p35_damage_fader(t_all) Fader for forest damage (1) - p35_forest_recovery_shr(j) Forest share in natveg recovery (1) - p35_recovered_forest(t,j,ac) Recovered forest (mio. ha) - p35_maturesecdf(t,j,ac) Matured secondary forest (mio. ha) - pcm_max_forest_est(j) Overall forest establishment potential in current time step (mio. ha) - p35_max_forest_recovery(j) Maximum forest recovery potential after land abandonement (mio. ha) - p35_carbon_density_secdforest(t,j,ac,ag_pools) Carbon density secdforest (tC per ha) - p35_carbon_density_other(t,j,ac,ag_pools) Carbon density other land (tC per ha) - p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) - p35_disturbance_loss_primf(t,j) Loss due to disturbances in primary forest (mio. ha) - i35_plantedclass_ac(j,ac) Area of age-classes in secondary forest (1) - p35_poulter_dist(j,ac) Share of age-classes in secondary forest (1) - p35_land_start_ac(j,ac,land_natveg) Initial Natural vegetation area (mio. ha) - p35_protection_dist(j,ac) Distribution of secondary forest protection (1) - p35_land_restoration(j,land_natveg) Actual secondary forest and other land restoration area (mio. ha) - p35_restoration_shift(j) Restoration of other land instead of secdforest (mio. ha) + i35_secdforest(j,ac) Initial secdforest (mio. ha) + i35_land_other(j,ac,othertype35) Initial other land (mio. ha) + p35_secdforest(t,j,ac) Secdforest per age class (mio. ha) + p35_land_other(t,j,ac,othertype35) Other land per age class (mio. ha) + pc35_secdforest(j,ac) Secdforest per age class in current time step (mio. ha) + pc35_land_other(j,ac,othertype35) Other land per age class in current time step (mio. ha) + p35_min_forest(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) + p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) + p35_damage_fader(t_all) Fader for forest damage (1) + p35_forest_recovery_shr(j) Forest share in natveg recovery (1) + p35_forest_recovery_area(t,j,ac) Recovered forest (mio. ha) + p35_maturesecdf(t,j,ac) Matured secondary forest (mio. ha) + pcm_max_forest_est(j) Overall forest establishment potential in current time step (mio. ha) + p35_max_forest_recovery(j) Maximum forest recovery potential after land abandonement (mio. ha) + p35_carbon_density_other(t,j,ac,othertype35,ag_pools) Carbon density other land (tC per ha) + p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) + p35_disturbance_loss_primf(t,j) Loss due to disturbances in primary forest (mio. ha) + i35_plantedclass_ac(j,ac) Area of age-classes in secondary forest (1) + p35_poulter_dist(j,ac) Share of age-classes in secondary forest (1) + p35_land_start_ac(j,ac,land_natveg) Initial Natural vegetation area (mio. ha) + p35_protection_dist(j,ac) Distribution of secondary forest protection (1) + p35_land_restoration(j,land_natveg) Actual secondary forest and other land restoration area (mio. ha) + p35_restoration_shift(j) Restoration of other land instead of secdforest (mio. ha) ; equations - q35_land_secdforest(j) Secdforest land pool calculation (mio. ha) - q35_land_other(j) Other land pool calculation (mio. ha) - q35_carbon_primforest(j,ag_pools,stockType) Primforest carbon stock calculation (mio tC) - q35_carbon_secdforest(j,ag_pools,stockType) Secdforest carbon stock calculation (mio tC) - q35_carbon_other(j,ag_pools,stockType) Other land carbon stock calculation (mio tC) - q35_min_forest(j) Minimum forest land constraint (mio. ha) - q35_min_other(j) Minimum other land constraint (mio. ha) - q35_landdiff Difference in natveg land (mio. ha) - q35_other_expansion(j) Other land expansion (mio. ha) - q35_other_reduction(j,ac) Other land reduction (mio. ha) - q35_secdforest_expansion(j) Secdforest expansion (mio. ha) - q35_secdforest_reduction(j,ac) Secdforest reduction (mio. ha) - q35_primforest_reduction(j) Primforest reduction (mio. ha) - q35_secdforest_regeneration(j) Secondary forest regeneration (mio. ha) - q35_max_forest_establishment(j) Maximum forestry regeneration based on potential forest area (mio. ha) - q35_other_regeneration(j) Other land regeneration (mio. ha) - q35_other_est(j,ac) Distribution of other land additions over ac_est (mio. ha) - q35_secdforest_est(j,ac) Distribution of secdforest additions over ac_est (mio. ha) - q35_hvarea_other(j,ac) Harvested area other land (mio. ha) - q35_hvarea_secdforest(j,ac) Harvested area secdforest (mio. ha) - q35_hvarea_primforest(j) Harvested area primforest (mio. ha) - q35_prod_secdforest(j) Production of woody biomass from secondary forests (mio. tDM per yr) - q35_prod_primforest(j) Production of woody biomass from primary forests (mio. tDM per yr) - q35_prod_other(j) Production of woody biomass from other land (mio. tDM per yr) - q35_cost_hvarea(i) Cost of harvesting natural vegetation (mio. USD) - q35_bv_primforest(j,potnatveg) Biodiversity value of primary forest (mio. ha) - q35_bv_secdforest(j,potnatveg) Biodiversity value of secondary forest (mio. ha) - q35_bv_other(j,potnatveg) Biodiversity value of other land (mio. ha) - q35_natveg_conservation(j) Total natural vegetation conservation constraint (mio. ha) - q35_secdforest_restoration(j) Secondary forest restoration constraint (mio. ha) - q35_other_restoration(j) Other land restoration constraint (mio. ha) + q35_land_secdforest(j) Secdforest land pool calculation (mio. ha) + q35_land_other(j) Other land pool calculation (mio. ha) + q35_carbon_primforest(j,ag_pools,stockType) Primforest carbon stock calculation (mio tC) + q35_carbon_secdforest(j,ag_pools,stockType) Secdforest carbon stock calculation (mio tC) + q35_carbon_other(j,ag_pools,stockType) Other land carbon stock calculation (mio tC) + q35_min_forest(j) Minimum forest land constraint (mio. ha) + q35_min_other(j) Minimum other land constraint (mio. ha) + q35_landdiff Difference in natveg land (mio. ha) + q35_other_expansion(j,othertype35) Other land expansion (mio. ha) + q35_other_reduction(j,ac,othertype35) Other land reduction (mio. ha) + q35_secdforest_expansion(j) Secdforest expansion (mio. ha) + q35_secdforest_reduction(j,ac) Secdforest reduction (mio. ha) + q35_primforest_reduction(j) Primforest reduction (mio. ha) + q35_secdforest_regeneration(j) Secondary forest regeneration (mio. ha) + q35_max_forest_establishment(j) Maximum forestry regeneration based on potential forest area (mio. ha) + q35_other_regeneration(j) Other land regeneration (mio. ha) + q35_other_est(j,ac) Distribution of other land additions over ac_est (mio. ha) + q35_secdforest_est(j,ac) Distribution of secdforest additions over ac_est (mio. ha) + q35_hvarea_other(j,ac,othertype35) Harvested area other land (mio. ha) + q35_hvarea_secdforest(j,ac) Harvested area secdforest (mio. ha) + q35_hvarea_primforest(j) Harvested area primforest (mio. ha) + q35_prod_secdforest(j) Production of woody biomass from secondary forests (mio. tDM per yr) + q35_prod_primforest(j) Production of woody biomass from primary forests (mio. tDM per yr) + q35_prod_other(j) Production of woody biomass from other land (mio. tDM per yr) + q35_cost_hvarea(i) Cost of harvesting natural vegetation (mio. USD) + q35_bv_primforest(j,potnatveg) Biodiversity value of primary forest (mio. ha) + q35_bv_secdforest(j,potnatveg) Biodiversity value of secondary forest (mio. ha) + q35_bv_other(j,potnatveg) Biodiversity value of other land (mio. ha) + q35_natveg_conservation(j) Total natural vegetation conservation constraint (mio. ha) + q35_secdforest_restoration(j) Secondary forest restoration constraint (mio. ha) + q35_other_restoration(j) Other land restoration constraint (mio. ha) ; positive variables - v35_secdforest(j,ac) Detailed stock of secdforest (mio. ha) - v35_youngsecdf(j,ac) Detailed stock of young secdforest (mio. ha) - v35_other(j,ac) Detailed stock of other land (mio. ha) - vm_landdiff_natveg Aggregated difference in natveg land compared to previous timestep (mio. ha) - v35_other_expansion(j) Other land expansion compared to previous timestep (mio. ha) - v35_other_reduction(j,ac) Other land reduction compared to previous timestep (mio. ha) - v35_secdforest_expansion(j) Secdforest reduction compared to previous timestep (mio. ha) - v35_secdforest_reduction(j,ac) Secdforest reduction compared to previous timestep (mio. ha) - v35_primforest_reduction(j) Primforest reduction compared to previous timestep (mio. ha) - v35_hvarea_secdforest(j,ac) Harvested area from secondary forest (mio. ha) - v35_hvarea_other(j,ac) Harvested area from other land (mio. ha) - v35_hvarea_primforest(j) Harvested area from primary forest (mio. ha) - vm_prod_natveg(j,land_natveg,kforestry) Production of woody biomass from natural vegetation (mio. tDM per yr) - vm_cost_hvarea_natveg(i) Cost of harvesting natural vegetation (mio. USD) + v35_secdforest(j,ac) Detailed stock of secdforest (mio. ha) + vm_land_other(j,ac,othertype35) Detailed stock of other land (mio. ha) + vm_landdiff_natveg Aggregated difference in natveg land compared to previous timestep (mio. ha) + v35_other_expansion(j,othertype35) Other land expansion compared to previous timestep (mio. ha) + v35_other_reduction(j,ac,othertype35) Other land reduction compared to previous timestep (mio. ha) + v35_secdforest_expansion(j) Secdforest reduction compared to previous timestep (mio. ha) + v35_secdforest_reduction(j,ac) Secdforest reduction compared to previous timestep (mio. ha) + v35_primforest_reduction(j) Primforest reduction compared to previous timestep (mio. ha) + v35_hvarea_secdforest(j,ac) Harvested area from secondary forest (mio. ha) + v35_hvarea_other(j,ac,othertype35) Harvested area from other land (mio. ha) + v35_hvarea_primforest(j) Harvested area from primary forest (mio. ha) + vm_prod_natveg(j,land_natveg,kforestry) Production of woody biomass from natural vegetation (mio. tDM per yr) + vm_cost_hvarea_natveg(i) Cost of harvesting natural vegetation (mio. USD) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov35_secdforest(t,j,ac,type) Detailed stock of secdforest (mio. ha) - ov35_youngsecdf(t,j,ac,type) Detailed stock of young secdforest (mio. ha) - ov35_other(t,j,ac,type) Detailed stock of other land (mio. ha) + ov_land_other(t,j,ac,othertype35,type) Detailed stock of other land (mio. ha) ov_landdiff_natveg(t,type) Aggregated difference in natveg land compared to previous timestep (mio. ha) - ov35_other_expansion(t,j,type) Other land expansion compared to previous timestep (mio. ha) - ov35_other_reduction(t,j,ac,type) Other land reduction compared to previous timestep (mio. ha) + ov35_other_expansion(t,j,othertype35,type) Other land expansion compared to previous timestep (mio. ha) + ov35_other_reduction(t,j,ac,othertype35,type) Other land reduction compared to previous timestep (mio. ha) ov35_secdforest_expansion(t,j,type) Secdforest reduction compared to previous timestep (mio. ha) ov35_secdforest_reduction(t,j,ac,type) Secdforest reduction compared to previous timestep (mio. ha) ov35_primforest_reduction(t,j,type) Primforest reduction compared to previous timestep (mio. ha) ov35_hvarea_secdforest(t,j,ac,type) Harvested area from secondary forest (mio. ha) - ov35_hvarea_other(t,j,ac,type) Harvested area from other land (mio. ha) + ov35_hvarea_other(t,j,ac,othertype35,type) Harvested area from other land (mio. ha) ov35_hvarea_primforest(t,j,type) Harvested area from primary forest (mio. ha) ov_prod_natveg(t,j,land_natveg,kforestry,type) Production of woody biomass from natural vegetation (mio. tDM per yr) ov_cost_hvarea_natveg(t,i,type) Cost of harvesting natural vegetation (mio. USD) @@ -115,8 +109,8 @@ parameters oq35_min_forest(t,j,type) Minimum forest land constraint (mio. ha) oq35_min_other(t,j,type) Minimum other land constraint (mio. ha) oq35_landdiff(t,type) Difference in natveg land (mio. ha) - oq35_other_expansion(t,j,type) Other land expansion (mio. ha) - oq35_other_reduction(t,j,ac,type) Other land reduction (mio. ha) + oq35_other_expansion(t,j,othertype35,type) Other land expansion (mio. ha) + oq35_other_reduction(t,j,ac,othertype35,type) Other land reduction (mio. ha) oq35_secdforest_expansion(t,j,type) Secdforest expansion (mio. ha) oq35_secdforest_reduction(t,j,ac,type) Secdforest reduction (mio. ha) oq35_primforest_reduction(t,j,type) Primforest reduction (mio. ha) @@ -125,7 +119,7 @@ parameters oq35_other_regeneration(t,j,type) Other land regeneration (mio. ha) oq35_other_est(t,j,ac,type) Distribution of other land additions over ac_est (mio. ha) oq35_secdforest_est(t,j,ac,type) Distribution of secdforest additions over ac_est (mio. ha) - oq35_hvarea_other(t,j,ac,type) Harvested area other land (mio. ha) + oq35_hvarea_other(t,j,ac,othertype35,type) Harvested area other land (mio. ha) oq35_hvarea_secdforest(t,j,ac,type) Harvested area secdforest (mio. ha) oq35_hvarea_primforest(t,j,type) Harvested area primforest (mio. ha) oq35_prod_secdforest(t,j,type) Production of woody biomass from secondary forests (mio. tDM per yr) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 14a7db4a1f..937693ac1c 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -10,7 +10,7 @@ q35_land_secdforest(j2) .. vm_land(j2,"secdforest") =e= sum(ac, v35_secdforest(j2,ac)); - q35_land_other(j2) .. vm_land(j2,"other") =e= sum(ac, v35_other(j2,ac)) + sum(ac, v35_youngsecdf(j2,ac)); + q35_land_other(j2) .. vm_land(j2,"other") =e= sum((ac,othertype35), vm_land_other(j2,ac,othertype35)); *' The total natural land area cannot be smaller than the total natural land conservation target. *' Area requirements for natural land conservation are derived from WDPA and formulated based on @@ -49,8 +49,7 @@ q35_carbon_other(j2,ag_pools,stockType) .. vm_carbon_stock(j2,"other",ag_pools,stockType) =e= - m_carbon_stock_ac(v35_other,pm_carbon_density_other_ac,"ac","ac_sub") - + m_carbon_stock_ac(v35_youngsecdf,pm_carbon_density_secdforest_ac,"ac","ac_sub"); + m_carbon_stock_ac(vm_land_other,p35_carbon_density_other,"ac,othertype35","ac_sub,othertype35"); *' The biodiversity value (BV) of primary forest, secondary forest and other land is computed by multiplying their respective land area with bii coefficients, which depend on the age class and whether the potential natural vegetation forest or non-forest (luh2 side layers). @@ -65,7 +64,7 @@ q35_bv_other(j2,potnatveg) .. vm_bv(j2,"other",potnatveg) =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v35_other(j2,ac)) * + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), sum(othertype35, vm_land_other(j2,ac,othertype35))) * fm_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); *' NPI/NDC land protection policies based on country reports are implemented as @@ -86,19 +85,19 @@ q35_landdiff .. vm_landdiff_natveg =e= sum(j2, - v35_other_expansion(j2) - + sum(ac_sub, v35_other_reduction(j2,ac_sub)) + sum(othertype35,v35_other_expansion(j2,othertype35)) + + sum((ac_sub,othertype35), v35_other_reduction(j2,ac_sub,othertype35)) + v35_secdforest_expansion(j2) - + sum(ac_sub, v35_secdforest_reduction(j2,ac_sub)) + + sum((ac_sub), v35_secdforest_reduction(j2,ac_sub)) + v35_primforest_reduction(j2)); - q35_other_expansion(j2) .. - v35_other_expansion(j2) =e= - sum(ac_est, v35_other(j2,ac_est)); + q35_other_expansion(j2,othertype35) .. + v35_other_expansion(j2,othertype35) =e= + sum(ac_est, vm_land_other(j2,ac_est,othertype35)); - q35_other_reduction(j2,ac_sub) .. - v35_other_reduction(j2,ac_sub) =e= - pc35_other(j2,ac_sub) - v35_other(j2,ac_sub); + q35_other_reduction(j2,ac_sub,othertype35) .. + v35_other_reduction(j2,ac_sub,othertype35) =e= + pc35_land_other(j2,ac_sub,othertype35) - vm_land_other(j2,ac_sub,othertype35); q35_secdforest_expansion(j2) .. v35_secdforest_expansion(j2) =e= @@ -127,8 +126,8 @@ q35_cost_hvarea(i2).. vm_cost_hvarea_natveg(i2) =e= sum((ct,cell(i2,j2),ac_sub), v35_hvarea_secdforest(j2,ac_sub)) * s35_timber_harvest_cost_secdforest - + sum((ct,cell(i2,j2),ac_sub), v35_hvarea_other(j2, ac_sub)) * s35_timber_harvest_cost_other - + sum((ct,cell(i2,j2)), v35_hvarea_primforest(j2)) * s35_timber_harvest_cost_primforest + + sum((ct,cell(i2,j2),ac_sub,othertype35), v35_hvarea_other(j2,ac_sub,othertype35)) * s35_timber_harvest_cost_other + + sum((ct,cell(i2,j2)), v35_hvarea_primforest(j2)) * s35_timber_harvest_cost_primforest ; ** Secondary forest @@ -136,8 +135,8 @@ q35_cost_hvarea(i2).. *' area under production with corresponding yields of secondary forests, divided by the timestep length. q35_prod_secdforest(j2).. - sum(kforestry, vm_prod_natveg(j2,"secdforest",kforestry)) - =e= + sum(kforestry, vm_prod_natveg(j2,"secdforest",kforestry)) + =e= sum(ac_sub, v35_hvarea_secdforest(j2,ac_sub) * sum(ct,pm_timber_yield(ct,j2,ac_sub,"secdforest"))) / m_timestep_length_forestry; ** Primary forest @@ -145,9 +144,9 @@ q35_prod_secdforest(j2).. *' area under production with corresponding yields of primary forests, divided by the timestep length. q35_prod_primforest(j2).. - sum(kforestry, vm_prod_natveg(j2,"primforest",kforestry)) - =e= - v35_hvarea_primforest(j2) * sum(ct, pm_timber_yield(ct,j2,"acx","primforest")) / m_timestep_length_forestry; + sum(kforestry, vm_prod_natveg(j2,"primforest",kforestry)) + =e= + v35_hvarea_primforest(j2) * sum(ct, pm_timber_yield(ct,j2,"acx","primforest")) / m_timestep_length_forestry; ** Other land *' Wood-fuel production from other land is calculated by multiplying the area under @@ -155,10 +154,12 @@ q35_prod_primforest(j2).. *' Wood production from other landis not allowed. q35_prod_other(j2).. - vm_prod_natveg(j2,"other","woodfuel") - =e= - sum(ac_sub, v35_hvarea_other(j2,ac_sub) * sum(ct, pm_timber_yield(ct,j2,ac_sub,"other"))) / m_timestep_length_forestry - ; + vm_prod_natveg(j2,"other","woodfuel") + =e= + (sum(ac_sub, v35_hvarea_other(j2,ac_sub,"othernat") * sum(ct, pm_timber_yield(ct,j2,ac_sub,"other"))) + + sum(ac_sub, v35_hvarea_other(j2,ac_sub,"youngsecdf") * sum(ct, pm_timber_yield(ct,j2,ac_sub,"secdforest")))) + / m_timestep_length_forestry + ; *' Following equations show the harvested area from natural vegetation i.e. primary *' forests, secondary forests and other land. Important to note here that no wood @@ -167,19 +168,19 @@ q35_prod_other(j2).. *' not all lost area is (or should be) used for production. q35_hvarea_secdforest(j2,ac_sub).. - v35_hvarea_secdforest(j2,ac_sub) - =l= - v35_secdforest_reduction(j2,ac_sub); + v35_hvarea_secdforest(j2,ac_sub) + =l= + v35_secdforest_reduction(j2,ac_sub); q35_hvarea_primforest(j2).. - v35_hvarea_primforest(j2) - =l= - v35_primforest_reduction(j2); + v35_hvarea_primforest(j2) + =l= + v35_primforest_reduction(j2); -q35_hvarea_other(j2,ac_sub).. - v35_hvarea_other(j2,ac_sub) - =l= - v35_other_reduction(j2,ac_sub); +q35_hvarea_other(j2,ac_sub,othertype35).. + v35_hvarea_other(j2,ac_sub,othertype35) + =l= + v35_other_reduction(j2,ac_sub,othertype35); *' The constraint for overall forest establishment, including forestry, is given @@ -187,11 +188,11 @@ q35_hvarea_other(j2,ac_sub).. *' natural forestarea minus the recovering secondary forest area. q35_max_forest_establishment(j2).. - sum(land_forest, vm_landexpansion(j2,land_forest)) - =l= - pcm_max_forest_est(j2) - - sum(ac, v35_youngsecdf(j2,ac)) - ; + sum(land_forest, vm_landexpansion(j2,land_forest)) + =l= + pcm_max_forest_est(j2) + - sum(ac, vm_land_other(j2,ac,"youngsecdf")) + ; *' Harvested secondary forest is still considered secondary forests due to *' restrictive NPI definitions. Also primary forest harvested will be considered @@ -199,20 +200,20 @@ q35_max_forest_establishment(j2).. *' secondary forest and ends up in the youngest age-class (and follows regrowth) q35_secdforest_regeneration(j2).. - sum(ac_est, v35_secdforest(j2,ac_est)) - =e= - sum(ac_sub,v35_hvarea_secdforest(j2,ac_sub)) - + v35_hvarea_primforest(j2) - + p35_land_restoration(j2,"secdforest") - ; + sum(ac_est, v35_secdforest(j2,ac_est)) + =e= + sum(ac_sub,v35_hvarea_secdforest(j2,ac_sub)) + + v35_hvarea_primforest(j2) + + p35_land_restoration(j2,"secdforest") + ; *' Harvested other land is still considered other land q35_other_regeneration(j2).. - sum(ac_est, v35_other(j2,ac_est)) - =g= - sum(ac_sub,v35_hvarea_other(j2,ac_sub)) - ; + sum(ac_est, vm_land_other(j2,ac_est,"othernat")) + =g= + sum((ac_sub,othertype35),v35_hvarea_other(j2,ac_sub,othertype35)) + ; *' The following two constraints distribute additions to secdforest and other land *' over ac_est, which depends on the time step length (e.g. ac0 and ac5 for a 10 year time step). @@ -221,5 +222,5 @@ q35_secdforest_est(j2,ac_est) .. v35_secdforest(j2,ac_est) =e= sum(ac_est2, v35_secdforest(j2,ac_est2))/card(ac_est2); q35_other_est(j2,ac_est) .. -v35_other(j2,ac_est) =e= sum(ac_est2, v35_other(j2,ac_est2))/card(ac_est2); +vm_land_other(j2,ac_est,"othernat") =e= sum(ac_est2, vm_land_other(j2,ac_est2,"othernat"))/card(ac_est2); diff --git a/modules/35_natveg/pot_forest_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms index d4be352bbe..b528058e11 100644 --- a/modules/35_natveg/pot_forest_may24/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -9,8 +9,7 @@ pc35_secdforest(j,ac) = v35_secdforest.l(j,ac); *other land age class calculation -pc35_other(j,ac) = v35_other.l(j,ac); -pc35_youngsecdf(j,ac) = v35_youngsecdf.l(j,ac); +pc35_land_other(j,ac,othertype35) = vm_land_other.l(j,ac,othertype35); * Reset forest establishment bound pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, vm_land.l(j,land_forest)); @@ -18,16 +17,15 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); - ov35_youngsecdf(t,j,ac,"marginal") = v35_youngsecdf.m(j,ac); - ov35_other(t,j,ac,"marginal") = v35_other.m(j,ac); + ov_land_other(t,j,ac,othertype35,"marginal") = vm_land_other.m(j,ac,othertype35); ov_landdiff_natveg(t,"marginal") = vm_landdiff_natveg.m; - ov35_other_expansion(t,j,"marginal") = v35_other_expansion.m(j); - ov35_other_reduction(t,j,ac,"marginal") = v35_other_reduction.m(j,ac); + ov35_other_expansion(t,j,othertype35,"marginal") = v35_other_expansion.m(j,othertype35); + ov35_other_reduction(t,j,ac,othertype35,"marginal") = v35_other_reduction.m(j,ac,othertype35); ov35_secdforest_expansion(t,j,"marginal") = v35_secdforest_expansion.m(j); ov35_secdforest_reduction(t,j,ac,"marginal") = v35_secdforest_reduction.m(j,ac); ov35_primforest_reduction(t,j,"marginal") = v35_primforest_reduction.m(j); ov35_hvarea_secdforest(t,j,ac,"marginal") = v35_hvarea_secdforest.m(j,ac); - ov35_hvarea_other(t,j,ac,"marginal") = v35_hvarea_other.m(j,ac); + ov35_hvarea_other(t,j,ac,othertype35,"marginal") = v35_hvarea_other.m(j,ac,othertype35); ov35_hvarea_primforest(t,j,"marginal") = v35_hvarea_primforest.m(j); ov_prod_natveg(t,j,land_natveg,kforestry,"marginal") = vm_prod_natveg.m(j,land_natveg,kforestry); ov_cost_hvarea_natveg(t,i,"marginal") = vm_cost_hvarea_natveg.m(i); @@ -39,8 +37,8 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_min_forest(t,j,"marginal") = q35_min_forest.m(j); oq35_min_other(t,j,"marginal") = q35_min_other.m(j); oq35_landdiff(t,"marginal") = q35_landdiff.m; - oq35_other_expansion(t,j,"marginal") = q35_other_expansion.m(j); - oq35_other_reduction(t,j,ac,"marginal") = q35_other_reduction.m(j,ac); + oq35_other_expansion(t,j,othertype35,"marginal") = q35_other_expansion.m(j,othertype35); + oq35_other_reduction(t,j,ac,othertype35,"marginal") = q35_other_reduction.m(j,ac,othertype35); oq35_secdforest_expansion(t,j,"marginal") = q35_secdforest_expansion.m(j); oq35_secdforest_reduction(t,j,ac,"marginal") = q35_secdforest_reduction.m(j,ac); oq35_primforest_reduction(t,j,"marginal") = q35_primforest_reduction.m(j); @@ -49,7 +47,7 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_other_regeneration(t,j,"marginal") = q35_other_regeneration.m(j); oq35_other_est(t,j,ac,"marginal") = q35_other_est.m(j,ac); oq35_secdforest_est(t,j,ac,"marginal") = q35_secdforest_est.m(j,ac); - oq35_hvarea_other(t,j,ac,"marginal") = q35_hvarea_other.m(j,ac); + oq35_hvarea_other(t,j,ac,othertype35,"marginal") = q35_hvarea_other.m(j,ac,othertype35); oq35_hvarea_secdforest(t,j,ac,"marginal") = q35_hvarea_secdforest.m(j,ac); oq35_hvarea_primforest(t,j,"marginal") = q35_hvarea_primforest.m(j); oq35_prod_secdforest(t,j,"marginal") = q35_prod_secdforest.m(j); @@ -63,16 +61,15 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_secdforest_restoration(t,j,"marginal") = q35_secdforest_restoration.m(j); oq35_other_restoration(t,j,"marginal") = q35_other_restoration.m(j); ov35_secdforest(t,j,ac,"level") = v35_secdforest.l(j,ac); - ov35_youngsecdf(t,j,ac,"level") = v35_youngsecdf.l(j,ac); - ov35_other(t,j,ac,"level") = v35_other.l(j,ac); + ov_land_other(t,j,ac,othertype35,"level") = vm_land_other.l(j,ac,othertype35); ov_landdiff_natveg(t,"level") = vm_landdiff_natveg.l; - ov35_other_expansion(t,j,"level") = v35_other_expansion.l(j); - ov35_other_reduction(t,j,ac,"level") = v35_other_reduction.l(j,ac); + ov35_other_expansion(t,j,othertype35,"level") = v35_other_expansion.l(j,othertype35); + ov35_other_reduction(t,j,ac,othertype35,"level") = v35_other_reduction.l(j,ac,othertype35); ov35_secdforest_expansion(t,j,"level") = v35_secdforest_expansion.l(j); ov35_secdforest_reduction(t,j,ac,"level") = v35_secdforest_reduction.l(j,ac); ov35_primforest_reduction(t,j,"level") = v35_primforest_reduction.l(j); ov35_hvarea_secdforest(t,j,ac,"level") = v35_hvarea_secdforest.l(j,ac); - ov35_hvarea_other(t,j,ac,"level") = v35_hvarea_other.l(j,ac); + ov35_hvarea_other(t,j,ac,othertype35,"level") = v35_hvarea_other.l(j,ac,othertype35); ov35_hvarea_primforest(t,j,"level") = v35_hvarea_primforest.l(j); ov_prod_natveg(t,j,land_natveg,kforestry,"level") = vm_prod_natveg.l(j,land_natveg,kforestry); ov_cost_hvarea_natveg(t,i,"level") = vm_cost_hvarea_natveg.l(i); @@ -84,8 +81,8 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_min_forest(t,j,"level") = q35_min_forest.l(j); oq35_min_other(t,j,"level") = q35_min_other.l(j); oq35_landdiff(t,"level") = q35_landdiff.l; - oq35_other_expansion(t,j,"level") = q35_other_expansion.l(j); - oq35_other_reduction(t,j,ac,"level") = q35_other_reduction.l(j,ac); + oq35_other_expansion(t,j,othertype35,"level") = q35_other_expansion.l(j,othertype35); + oq35_other_reduction(t,j,ac,othertype35,"level") = q35_other_reduction.l(j,ac,othertype35); oq35_secdforest_expansion(t,j,"level") = q35_secdforest_expansion.l(j); oq35_secdforest_reduction(t,j,ac,"level") = q35_secdforest_reduction.l(j,ac); oq35_primforest_reduction(t,j,"level") = q35_primforest_reduction.l(j); @@ -94,7 +91,7 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_other_regeneration(t,j,"level") = q35_other_regeneration.l(j); oq35_other_est(t,j,ac,"level") = q35_other_est.l(j,ac); oq35_secdforest_est(t,j,ac,"level") = q35_secdforest_est.l(j,ac); - oq35_hvarea_other(t,j,ac,"level") = q35_hvarea_other.l(j,ac); + oq35_hvarea_other(t,j,ac,othertype35,"level") = q35_hvarea_other.l(j,ac,othertype35); oq35_hvarea_secdforest(t,j,ac,"level") = q35_hvarea_secdforest.l(j,ac); oq35_hvarea_primforest(t,j,"level") = q35_hvarea_primforest.l(j); oq35_prod_secdforest(t,j,"level") = q35_prod_secdforest.l(j); @@ -108,16 +105,15 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_secdforest_restoration(t,j,"level") = q35_secdforest_restoration.l(j); oq35_other_restoration(t,j,"level") = q35_other_restoration.l(j); ov35_secdforest(t,j,ac,"upper") = v35_secdforest.up(j,ac); - ov35_youngsecdf(t,j,ac,"upper") = v35_youngsecdf.up(j,ac); - ov35_other(t,j,ac,"upper") = v35_other.up(j,ac); + ov_land_other(t,j,ac,othertype35,"upper") = vm_land_other.up(j,ac,othertype35); ov_landdiff_natveg(t,"upper") = vm_landdiff_natveg.up; - ov35_other_expansion(t,j,"upper") = v35_other_expansion.up(j); - ov35_other_reduction(t,j,ac,"upper") = v35_other_reduction.up(j,ac); + ov35_other_expansion(t,j,othertype35,"upper") = v35_other_expansion.up(j,othertype35); + ov35_other_reduction(t,j,ac,othertype35,"upper") = v35_other_reduction.up(j,ac,othertype35); ov35_secdforest_expansion(t,j,"upper") = v35_secdforest_expansion.up(j); ov35_secdforest_reduction(t,j,ac,"upper") = v35_secdforest_reduction.up(j,ac); ov35_primforest_reduction(t,j,"upper") = v35_primforest_reduction.up(j); ov35_hvarea_secdforest(t,j,ac,"upper") = v35_hvarea_secdforest.up(j,ac); - ov35_hvarea_other(t,j,ac,"upper") = v35_hvarea_other.up(j,ac); + ov35_hvarea_other(t,j,ac,othertype35,"upper") = v35_hvarea_other.up(j,ac,othertype35); ov35_hvarea_primforest(t,j,"upper") = v35_hvarea_primforest.up(j); ov_prod_natveg(t,j,land_natveg,kforestry,"upper") = vm_prod_natveg.up(j,land_natveg,kforestry); ov_cost_hvarea_natveg(t,i,"upper") = vm_cost_hvarea_natveg.up(i); @@ -129,8 +125,8 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_min_forest(t,j,"upper") = q35_min_forest.up(j); oq35_min_other(t,j,"upper") = q35_min_other.up(j); oq35_landdiff(t,"upper") = q35_landdiff.up; - oq35_other_expansion(t,j,"upper") = q35_other_expansion.up(j); - oq35_other_reduction(t,j,ac,"upper") = q35_other_reduction.up(j,ac); + oq35_other_expansion(t,j,othertype35,"upper") = q35_other_expansion.up(j,othertype35); + oq35_other_reduction(t,j,ac,othertype35,"upper") = q35_other_reduction.up(j,ac,othertype35); oq35_secdforest_expansion(t,j,"upper") = q35_secdforest_expansion.up(j); oq35_secdforest_reduction(t,j,ac,"upper") = q35_secdforest_reduction.up(j,ac); oq35_primforest_reduction(t,j,"upper") = q35_primforest_reduction.up(j); @@ -139,7 +135,7 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_other_regeneration(t,j,"upper") = q35_other_regeneration.up(j); oq35_other_est(t,j,ac,"upper") = q35_other_est.up(j,ac); oq35_secdforest_est(t,j,ac,"upper") = q35_secdforest_est.up(j,ac); - oq35_hvarea_other(t,j,ac,"upper") = q35_hvarea_other.up(j,ac); + oq35_hvarea_other(t,j,ac,othertype35,"upper") = q35_hvarea_other.up(j,ac,othertype35); oq35_hvarea_secdforest(t,j,ac,"upper") = q35_hvarea_secdforest.up(j,ac); oq35_hvarea_primforest(t,j,"upper") = q35_hvarea_primforest.up(j); oq35_prod_secdforest(t,j,"upper") = q35_prod_secdforest.up(j); @@ -153,16 +149,15 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_secdforest_restoration(t,j,"upper") = q35_secdforest_restoration.up(j); oq35_other_restoration(t,j,"upper") = q35_other_restoration.up(j); ov35_secdforest(t,j,ac,"lower") = v35_secdforest.lo(j,ac); - ov35_youngsecdf(t,j,ac,"lower") = v35_youngsecdf.lo(j,ac); - ov35_other(t,j,ac,"lower") = v35_other.lo(j,ac); + ov_land_other(t,j,ac,othertype35,"lower") = vm_land_other.lo(j,ac,othertype35); ov_landdiff_natveg(t,"lower") = vm_landdiff_natveg.lo; - ov35_other_expansion(t,j,"lower") = v35_other_expansion.lo(j); - ov35_other_reduction(t,j,ac,"lower") = v35_other_reduction.lo(j,ac); + ov35_other_expansion(t,j,othertype35,"lower") = v35_other_expansion.lo(j,othertype35); + ov35_other_reduction(t,j,ac,othertype35,"lower") = v35_other_reduction.lo(j,ac,othertype35); ov35_secdforest_expansion(t,j,"lower") = v35_secdforest_expansion.lo(j); ov35_secdforest_reduction(t,j,ac,"lower") = v35_secdforest_reduction.lo(j,ac); ov35_primforest_reduction(t,j,"lower") = v35_primforest_reduction.lo(j); ov35_hvarea_secdforest(t,j,ac,"lower") = v35_hvarea_secdforest.lo(j,ac); - ov35_hvarea_other(t,j,ac,"lower") = v35_hvarea_other.lo(j,ac); + ov35_hvarea_other(t,j,ac,othertype35,"lower") = v35_hvarea_other.lo(j,ac,othertype35); ov35_hvarea_primforest(t,j,"lower") = v35_hvarea_primforest.lo(j); ov_prod_natveg(t,j,land_natveg,kforestry,"lower") = vm_prod_natveg.lo(j,land_natveg,kforestry); ov_cost_hvarea_natveg(t,i,"lower") = vm_cost_hvarea_natveg.lo(i); @@ -174,8 +169,8 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_min_forest(t,j,"lower") = q35_min_forest.lo(j); oq35_min_other(t,j,"lower") = q35_min_other.lo(j); oq35_landdiff(t,"lower") = q35_landdiff.lo; - oq35_other_expansion(t,j,"lower") = q35_other_expansion.lo(j); - oq35_other_reduction(t,j,ac,"lower") = q35_other_reduction.lo(j,ac); + oq35_other_expansion(t,j,othertype35,"lower") = q35_other_expansion.lo(j,othertype35); + oq35_other_reduction(t,j,ac,othertype35,"lower") = q35_other_reduction.lo(j,ac,othertype35); oq35_secdforest_expansion(t,j,"lower") = q35_secdforest_expansion.lo(j); oq35_secdforest_reduction(t,j,ac,"lower") = q35_secdforest_reduction.lo(j,ac); oq35_primforest_reduction(t,j,"lower") = q35_primforest_reduction.lo(j); @@ -184,7 +179,7 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_other_regeneration(t,j,"lower") = q35_other_regeneration.lo(j); oq35_other_est(t,j,ac,"lower") = q35_other_est.lo(j,ac); oq35_secdforest_est(t,j,ac,"lower") = q35_secdforest_est.lo(j,ac); - oq35_hvarea_other(t,j,ac,"lower") = q35_hvarea_other.lo(j,ac); + oq35_hvarea_other(t,j,ac,othertype35,"lower") = q35_hvarea_other.lo(j,ac,othertype35); oq35_hvarea_secdforest(t,j,ac,"lower") = q35_hvarea_secdforest.lo(j,ac); oq35_hvarea_primforest(t,j,"lower") = q35_hvarea_primforest.lo(j); oq35_prod_secdforest(t,j,"lower") = q35_prod_secdforest.lo(j); diff --git a/modules/35_natveg/pot_forest_may24/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms index cce3cf00ca..773cc7587e 100644 --- a/modules/35_natveg/pot_forest_may24/preloop.gms +++ b/modules/35_natveg/pot_forest_may24/preloop.gms @@ -6,9 +6,8 @@ *** | Contact: magpie@pik-potsdam.de ** initialize other land -i35_other(j,ac) = 0; -i35_youngsecdf(j,ac) = 0; -i35_other(j,"acx") = pcm_land(j,"other"); +i35_land_other(j,ac,othertype35) = 0; +i35_land_other(j,"acx","othernat") = pcm_land(j,"other"); ** initialize secdforest area depending on switch. if(s35_secdf_distribution = 0, @@ -34,8 +33,7 @@ elseif s35_secdf_distribution = 2, i35_secdforest(j,"acx") = i35_secdforest(j,"acx") + (pcm_land(j,"secdforest") - sum(ac, i35_secdforest(j,ac))); *initialize parameter -p35_other(t,j,ac) = 0; -p35_youngsecdf(t,j,ac) = 0; +p35_land_other(t,j,ac,othertype35) = 0; p35_secdforest(t,j,ac) = 0; * initialize forest disturbance losses @@ -81,5 +79,4 @@ m_sigmoid_time_interpol(p35_damage_fader,sm_fix_SSP2,s35_forest_damage_end,0,1); * --------------------------------------- pc35_secdforest(j,ac) = i35_secdforest(j,ac); - pc35_youngsecdf(j,ac) = i35_youngsecdf(j,ac); - pc35_other(j,ac) = i35_other(j,ac); + pc35_land_other(j,ac,othertype35) = i35_land_other(j,ac,othertype35); diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index be972d342c..9d04ec6af1 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -45,21 +45,21 @@ vm_land.l(j,"primforest") = pcm_land(j,"primforest"); * ------------------------------------------------- *** Distribute forestry abandonement -* Abandoned forestry is directly shifted into pc35_youngsecdf because it is +* Abandoned forestry is directly shifted into pc35_land_other(j,ac_est,"youngsecdf") because it is * assumed that forestry was located in areas suitable to grow forests. -pc35_youngsecdf(j,ac_est) = vm_lu_transitions.l(j,"forestry","other")/card(ac_est2); -pc35_youngsecdf(j,ac_est)$(sum(ac_est2,pc35_youngsecdf(j,ac_est2)) > pcm_max_forest_est(j)) = pcm_max_forest_est(j)/card(ac_est2); +pc35_land_other(j,ac_est,"youngsecdf") = vm_lu_transitions.l(j,"forestry","other")/card(ac_est2); +pc35_land_other(j,ac_est,"youngsecdf")$(sum(ac_est2,pc35_land_other(j,ac_est2,"youngsecdf")) > pcm_max_forest_est(j)) = pcm_max_forest_est(j)/card(ac_est2); * The proportion of secondary forest recovery in total natveg recovery is derived * from the remaining forest recovery area -p35_max_forest_recovery(j) = pcm_max_forest_est(j) - sum(ac, pc35_youngsecdf(j,ac)); +p35_max_forest_recovery(j) = pcm_max_forest_est(j) - sum(ac, pc35_land_other(j,ac,"youngsecdf")); p35_forest_recovery_shr(j) = p35_max_forest_recovery(j) / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")+1e-10); p35_forest_recovery_shr(j)$(p35_forest_recovery_shr(j) > 1) = 1; -* Abandoned land pc35_other(j,ac_est) is then distributed proportionally using the forest recovery share. -p35_recovered_forest(t,j,ac_est) = pc35_other(j,ac_est) * p35_forest_recovery_shr(j); -p35_recovered_forest(t,j,ac_est)$(sum(ac_est2,p35_recovered_forest(t,j,ac_est2)) > p35_max_forest_recovery(j)) = p35_max_forest_recovery(j)/card(ac_est2); -pc35_other(j,ac_est) = pc35_other(j,ac_est) - p35_recovered_forest(t,j,ac_est); -pc35_youngsecdf(j,ac_est) = pc35_youngsecdf(j,ac_est) + p35_recovered_forest(t,j,ac_est); +* Abandoned land pc35_land_other(j,ac_est,"othernat") is then distributed proportionally using the forest recovery share. +p35_forest_recovery_area(t,j,ac_est) = pc35_land_other(j,ac_est,"othernat") * p35_forest_recovery_shr(j); +p35_forest_recovery_area(t,j,ac_est)$(sum(ac_est2,p35_forest_recovery_area(t,j,ac_est2)) > p35_max_forest_recovery(j)) = p35_max_forest_recovery(j)/card(ac_est2); +pc35_land_other(j,ac_est,"othernat") = pc35_land_other(j,ac_est,"othernat") - p35_forest_recovery_area(t,j,ac_est); +pc35_land_other(j,ac_est,"youngsecdf") = pc35_land_other(j,ac_est,"youngsecdf") + p35_forest_recovery_area(t,j,ac_est); * ------------------------------------------------ * Natural vegetation growth (age-class shift) @@ -68,16 +68,10 @@ pc35_youngsecdf(j,ac_est) = pc35_youngsecdf(j,ac_est) + p35_recovered_forest(t,j * Regrowth of natural vegetation (natural succession) is modelled by shifting age-classes according to time step length. s35_shift = m_timestep_length_forestry/5; * example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) - p35_other(t,j,ac)$(ord(ac) > s35_shift) = pc35_other(j,ac-s35_shift); + p35_land_other(t,j,ac,othertype35)$(ord(ac) > s35_shift) = pc35_land_other(j,ac-s35_shift,othertype35); * account for cases at the end of the age class set (s35_shift > 1) which are not shifted by the above calculation - p35_other(t,j,"acx") = p35_other(t,j,"acx") - + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_other(j,ac)); - -* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) - p35_youngsecdf(t,j,ac)$(ord(ac) > s35_shift) = pc35_youngsecdf(j,ac-s35_shift); -* account for cases at the end of the age class set (s35_shift > 1) which are not shifted by the above calculation - p35_youngsecdf(t,j,"acx") = p35_youngsecdf(t,j,"acx") - + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_youngsecdf(j,ac)); + p35_land_other(t,j,"acx",othertype35) = p35_land_other(t,j,"acx",othertype35) + + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_land_other(j,ac,othertype35)); * Usual shift * example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) @@ -96,8 +90,8 @@ s35_shift = m_timestep_length_forestry/5; *' exceeds a threshold of 20 tC/ha the respective area is shifted from young secondary *' forest, which is still considered other land, to secondary forest land. p35_maturesecdf(t,j,ac)$(not sameas(ac,"acx")) = - p35_youngsecdf(t,j,ac)$(pm_carbon_density_secdforest_ac(t,j,ac,"vegc") > 20); -p35_youngsecdf(t,j,ac) = p35_youngsecdf(t,j,ac) - p35_maturesecdf(t,j,ac); + p35_land_other(t,j,ac,"youngsecdf")$(pm_carbon_density_secdforest_ac(t,j,ac,"vegc") > 20); +p35_land_other(t,j,ac,"youngsecdf") = p35_land_other(t,j,ac,"youngsecdf") - p35_maturesecdf(t,j,ac); p35_secdforest(t,j,ac) = p35_secdforest(t,j,ac) + p35_maturesecdf(t,j,ac); *' @stop @@ -106,12 +100,11 @@ v35_secdforest.l(j,ac) = pc35_secdforest(j,ac); vm_land.l(j,"secdforest") = sum(ac, pc35_secdforest(j,ac)); pcm_land(j,"secdforest") = sum(ac, pc35_secdforest(j,ac)); -pc35_other(j,ac) = p35_other(t,j,ac); -v35_other.l(j,ac) = pc35_other(j,ac); -pc35_youngsecdf(j,ac) = p35_youngsecdf(t,j,ac); -v35_youngsecdf.l(j,ac) = pc35_youngsecdf(j,ac); -vm_land.l(j,"other") = sum(ac, pc35_other(j,ac)) + sum(ac, pc35_youngsecdf(j,ac)); -pcm_land(j,"other") = sum(ac, pc35_other(j,ac)) + sum(ac, pc35_youngsecdf(j,ac)); +pc35_land_other(j,ac,othertype35) = p35_land_other(t,j,ac,othertype35); +vm_land_other.l(j,ac,othertype35) = pc35_land_other(j,ac,othertype35); + +vm_land.l(j,"other") = sum((ac,othertype35), pc35_land_other(j,ac,othertype35)); +pcm_land(j,"other") = sum((ac,othertype35), pc35_land_other(j,ac,othertype35)); * ------------------------------------- * Set bounds based on land conservation @@ -177,26 +170,33 @@ vm_land.lo(j,"secdforest") = pm_land_conservation(t,j,"secdforest","protect") + ** Other land *reset bounds -v35_other.lo(j,ac) = 0; -v35_other.up(j,ac) = Inf; +vm_land_other.lo(j,ac,"othernat") = 0; +vm_land_other.up(j,ac,"othernat") = Inf; +vm_land_other.lo(j,ac,"youngsecdf") = 0; *set upper bound -v35_other.up(j,ac_sub) = pc35_other(j,ac_sub); -m_boundfix(v35_other,(j,ac_sub),l,1e-6); -v35_youngsecdf.lo(j,ac_sub) = 0; -v35_youngsecdf.up(j,ac_sub) = pc35_youngsecdf(j,ac_sub); -m_boundfix(v35_youngsecdf,(j,ac_sub),l,1e-6); -v35_youngsecdf.fx(j,ac_est) = 0; +vm_land_other.up(j,ac_sub,"othernat") = pc35_land_other(j,ac_sub,"othernat"); +vm_land_other.up(j,ac_sub,"youngsecdf") = pc35_land_other(j,ac_sub,"youngsecdf"); +vm_land_other.fx(j,ac_est,"youngsecdf") = 0; +m_boundfix(vm_land_other,(j,ac_sub,othertype35),l,1e-6); + * Other land conservation * protection bound fix -pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_other(j,ac_sub))) < 1e-6) = sum(ac_sub, pc35_other(j,ac_sub)); +pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_land_other(j,ac_sub,"othernat"))) < 1e-6) = sum(ac_sub, pc35_land_other(j,ac_sub,"othernat")); * set restoration target p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); * Do not restore other land in areas where total natural * land area meets the total natural land conservation target p35_land_restoration(j,"other")$(sum(land_natveg, pcm_land(j,land_natveg)) >= sum((land_natveg, consv_type), pm_land_conservation(t,j,land_natveg,consv_type))) = 0; * set conservation bound -vm_land.lo(j,"other") = pm_land_conservation(t,j,"other","protect") + p35_land_restoration(j,"other"); +vm_land_other.lo(j,ac,"othernat") = pm_land_conservation(t,j,"other","protect") + p35_land_restoration(j,"other"); + +* ---------------------------- +* Calculate carbon density +* ------------------------------ + +p35_carbon_density_other(t,j,ac,"othernat",ag_pools) = pm_carbon_density_other_ac(t,j,ac,ag_pools); +p35_carbon_density_other(t,j,ac,"youngsecdf",ag_pools) = pm_carbon_density_secdforest_ac(t,j,ac,ag_pools); * ---------------------------- * NPI/NDC protection policy @@ -208,18 +208,18 @@ p35_min_other(t,j)$(p35_min_other(t,j) > pcm_land(j,"other")) = pcm_land(j,"othe ** Youngest age classes are not allowed to be harvested v35_hvarea_secdforest.fx(j,ac_est) = 0; -v35_hvarea_other.fx(j,ac_est) = 0; +v35_hvarea_other.fx(j,ac_est,othertype35) = 0; v35_secdforest_reduction.fx(j,ac_est) = 0; -v35_other_reduction.fx(j,ac_est) = 0; +v35_other_reduction.fx(j,ac_est,othertype35) = 0; vm_prod_natveg.fx(j,"other","wood") = 0; if(s35_hvarea = 0, v35_hvarea_secdforest.fx(j,ac_sub) = 0; v35_hvarea_primforest.fx(j) = 0; - v35_hvarea_other.fx(j,ac_sub) = 0; + v35_hvarea_other.fx(j,ac_sub,othertype35) = 0; elseif s35_hvarea = 1, v35_hvarea_secdforest.fx(j,ac_sub) = (v35_secdforest.l(j,ac_sub) - v35_secdforest.lo(j,ac_sub))*s35_hvarea_secdforest*m_timestep_length_forestry; v35_hvarea_primforest.fx(j) = (vm_land.l(j,"primforest") - vm_land.lo(j,"primforest"))*s35_hvarea_primforest*m_timestep_length_forestry; - v35_hvarea_other.fx(j,ac_sub) = (v35_other.l(j,ac_sub) - v35_other.lo(j,ac_sub))*s35_hvarea_other*m_timestep_length_forestry; + v35_hvarea_other.fx(j,ac_sub,othertype35) = (vm_land_other.l(j,ac_sub,othertype35) - vm_land_other.lo(j,ac_sub,othertype35))*s35_hvarea_other*m_timestep_length_forestry; ); diff --git a/modules/35_natveg/pot_forest_may24/sets.gms b/modules/35_natveg/pot_forest_may24/sets.gms index c2c49b83d8..517e5d564b 100644 --- a/modules/35_natveg/pot_forest_may24/sets.gms +++ b/modules/35_natveg/pot_forest_may24/sets.gms @@ -20,6 +20,9 @@ sets pol_stock35 Land types for land protection policies / forest, other / + othertype35 Other land types + / othernat, youngsecdf / + shock_scen Scenario name of forest carbon shock / none, 002lin2030,004lin2030,008lin2030,016lin2030 / diff --git a/modules/59_som/cellpool_aug16/equations.gms b/modules/59_som/cellpool_aug16/equations.gms index ddf8108683..b51979302e 100644 --- a/modules/59_som/cellpool_aug16/equations.gms +++ b/modules/59_som/cellpool_aug16/equations.gms @@ -7,13 +7,13 @@ *' @equations -*' For every cell a new equilibrium value for the soil organic carbon pool +*' For every cell a new equilibrium value for the soil organic carbon pool *' on cropland as the sum over all crop types and irrigation regimes is calculated q59_som_target_cropland(j2) .. v59_som_target(j2,"crop") - =e= (sum((kcr,w), vm_area(j2,kcr,w) * i59_cratio(j2,kcr,w)) - + vm_fallow(j2) * i59_cratio_fallow(j2)) * + =e= (sum((kcr,w), vm_area(j2,kcr,w) * i59_cratio(j2,kcr,w)) + + vm_fallow(j2) * i59_cratio_fallow(j2)) * sum(ct,f59_topsoilc_density(ct,j2)) ; *' as well as for all non cropland given by @@ -23,25 +23,25 @@ q59_som_target_noncropland(j2,noncropland59) .. =e= vm_land(j2,noncropland59) * sum(ct,f59_topsoilc_density(ct,j2)) ; -*' Depending on the setting of `c59_som_scenario `climate impacts (`cc`) +*' Depending on the setting of `c59_som_scenario `climate impacts (`cc`) *' are taken into account or not (`nocc` and `nocc_hist`). -*' For a static climate `f59_topsoilc_density` is set to the value of 1995 +*' For a static climate `f59_topsoilc_density` is set to the value of 1995 *' within the input of the module realization. -*' To get the current size of the soil organic carbon pool, the carbon -*' pool of the previous timestep is developing into the direction of the -*' above calculated target values taken the timestep depending lossrate +*' To get the current size of the soil organic carbon pool, the carbon +*' pool of the previous timestep is developing into the direction of the +*' above calculated target values taken the timestep depending lossrate *' into account by q59_som_pool(j2,land) .. v59_som_pool(j2,land) =e= sum(ct,i59_lossrate(ct)) * v59_som_target(j2,land) + (1 - sum(ct,i59_lossrate(ct))) * - sum((ct,land_from), p59_carbon_density(ct,j2,land_from) * + sum((ct,land_from), p59_carbon_density(ct,j2,land_from) * vm_lu_transitions(j2,land_from,land)) ; -*' Note that to account correctly for land-use transitions, carbon densities +*' Note that to account correctly for land-use transitions, carbon densities *' multiplied by the land-use transition matrix of the current timestep *' is used. @@ -49,23 +49,23 @@ q59_som_pool(j2,land) .. *' and the reference soil carbon pool of the subsoil q59_carbon_soil(j2,land,stockType) .. - vm_carbon_stock(j2, land,"soilc",stockType) - =e= v59_som_pool(j2, land) + vm_land(j2, land) * + vm_carbon_stock(j2, land,"soilc",stockType) + =e= v59_som_pool(j2, land) + vm_land(j2, land) * sum(ct,i59_subsoilc_density(ct,j2)); -*' The annual nitrogen release (or sink) for cropland soils is than +*' The annual nitrogen release (or sink) for cropland soils is than *' calculated by the loss of soil organic carbon given by q59_nr_som(j2) .. vm_nr_som(j2) =e= sum(ct,i59_lossrate(ct))/m_timestep_length*1/15 - * (sum((ct,land_from), p59_carbon_density(ct,j2,land_from) * + * (sum((ct,land_from), p59_carbon_density(ct,j2,land_from) * vm_lu_transitions(j2,land_from,"crop")) - v59_som_target(j2,"crop")) ; *' with the carbon to nitrogen ratio of soils assumed to be 15:1. -*' The amount of nitrogen that becomes available to cropland farming is +*' The amount of nitrogen that becomes available to cropland farming is *' limited by loss of soil organic matter by q59_nr_som_fertilizer(j2) .. diff --git a/modules/59_som/cellpool_jan23/equations.gms b/modules/59_som/cellpool_jan23/equations.gms index ddf8108683..b51979302e 100644 --- a/modules/59_som/cellpool_jan23/equations.gms +++ b/modules/59_som/cellpool_jan23/equations.gms @@ -7,13 +7,13 @@ *' @equations -*' For every cell a new equilibrium value for the soil organic carbon pool +*' For every cell a new equilibrium value for the soil organic carbon pool *' on cropland as the sum over all crop types and irrigation regimes is calculated q59_som_target_cropland(j2) .. v59_som_target(j2,"crop") - =e= (sum((kcr,w), vm_area(j2,kcr,w) * i59_cratio(j2,kcr,w)) - + vm_fallow(j2) * i59_cratio_fallow(j2)) * + =e= (sum((kcr,w), vm_area(j2,kcr,w) * i59_cratio(j2,kcr,w)) + + vm_fallow(j2) * i59_cratio_fallow(j2)) * sum(ct,f59_topsoilc_density(ct,j2)) ; *' as well as for all non cropland given by @@ -23,25 +23,25 @@ q59_som_target_noncropland(j2,noncropland59) .. =e= vm_land(j2,noncropland59) * sum(ct,f59_topsoilc_density(ct,j2)) ; -*' Depending on the setting of `c59_som_scenario `climate impacts (`cc`) +*' Depending on the setting of `c59_som_scenario `climate impacts (`cc`) *' are taken into account or not (`nocc` and `nocc_hist`). -*' For a static climate `f59_topsoilc_density` is set to the value of 1995 +*' For a static climate `f59_topsoilc_density` is set to the value of 1995 *' within the input of the module realization. -*' To get the current size of the soil organic carbon pool, the carbon -*' pool of the previous timestep is developing into the direction of the -*' above calculated target values taken the timestep depending lossrate +*' To get the current size of the soil organic carbon pool, the carbon +*' pool of the previous timestep is developing into the direction of the +*' above calculated target values taken the timestep depending lossrate *' into account by q59_som_pool(j2,land) .. v59_som_pool(j2,land) =e= sum(ct,i59_lossrate(ct)) * v59_som_target(j2,land) + (1 - sum(ct,i59_lossrate(ct))) * - sum((ct,land_from), p59_carbon_density(ct,j2,land_from) * + sum((ct,land_from), p59_carbon_density(ct,j2,land_from) * vm_lu_transitions(j2,land_from,land)) ; -*' Note that to account correctly for land-use transitions, carbon densities +*' Note that to account correctly for land-use transitions, carbon densities *' multiplied by the land-use transition matrix of the current timestep *' is used. @@ -49,23 +49,23 @@ q59_som_pool(j2,land) .. *' and the reference soil carbon pool of the subsoil q59_carbon_soil(j2,land,stockType) .. - vm_carbon_stock(j2, land,"soilc",stockType) - =e= v59_som_pool(j2, land) + vm_land(j2, land) * + vm_carbon_stock(j2, land,"soilc",stockType) + =e= v59_som_pool(j2, land) + vm_land(j2, land) * sum(ct,i59_subsoilc_density(ct,j2)); -*' The annual nitrogen release (or sink) for cropland soils is than +*' The annual nitrogen release (or sink) for cropland soils is than *' calculated by the loss of soil organic carbon given by q59_nr_som(j2) .. vm_nr_som(j2) =e= sum(ct,i59_lossrate(ct))/m_timestep_length*1/15 - * (sum((ct,land_from), p59_carbon_density(ct,j2,land_from) * + * (sum((ct,land_from), p59_carbon_density(ct,j2,land_from) * vm_lu_transitions(j2,land_from,"crop")) - v59_som_target(j2,"crop")) ; *' with the carbon to nitrogen ratio of soils assumed to be 15:1. -*' The amount of nitrogen that becomes available to cropland farming is +*' The amount of nitrogen that becomes available to cropland farming is *' limited by loss of soil organic matter by q59_nr_som_fertilizer(j2) .. diff --git a/modules/59_som/static_jan19/declarations.gms b/modules/59_som/static_jan19/declarations.gms index e21b607893..85677def80 100644 --- a/modules/59_som/static_jan19/declarations.gms +++ b/modules/59_som/static_jan19/declarations.gms @@ -18,14 +18,16 @@ variables equations q59_soilcarbon_cropland(j,stockType) Cropland soil carbon content calculation (mio. tC) - q59_soilcarbon_noncropland(j,noncropland59,stockType) Non-cropland soil carbon content calculation (mio. tC) + q59_soilcarbon_regular(j,regularland59,stockType) Regular soil carbon content calculation (mio. tC) + q59_soilcarbon_other(j,stockType) Other land soil carbon content calculation (mio. tC) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_nr_som(t,j,type) Release of soil organic matter (Mt N per yr) - ov_nr_som_fertilizer(t,j,type) Uptake of soil organic matter from plants (Mt N per yr) - oq59_soilcarbon_cropland(t,j,stockType,type) Cropland soil carbon content calculation (mio. tC) - oq59_soilcarbon_noncropland(t,j,noncropland59,stockType,type) Non-cropland soil carbon content calculation (mio. tC) + ov_nr_som(t,j,type) Release of soil organic matter (Mt N per yr) + ov_nr_som_fertilizer(t,j,type) Uptake of soil organic matter from plants (Mt N per yr) + oq59_soilcarbon_cropland(t,j,stockType,type) Cropland soil carbon content calculation (mio. tC) + oq59_soilcarbon_regular(t,j,regularland59,stockType,type) Regular soil carbon content calculation (mio. tC) + oq59_soilcarbon_other(t,j,stockType,type) Other land soil carbon content calculation (mio. tC) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/59_som/static_jan19/equations.gms b/modules/59_som/static_jan19/equations.gms index ce63cccdb9..e2217bbe37 100644 --- a/modules/59_som/static_jan19/equations.gms +++ b/modules/59_som/static_jan19/equations.gms @@ -13,6 +13,14 @@ vm_land(j2,"crop") * sum(ct, i59_topsoilc_density(ct,j2) + i59_subsoilc_density(ct,j2)); *' The soil carbon content for all other land use types is calculated based on the full profile soil carbon density: - q59_soilcarbon_noncropland(j2,noncropland59,stockType) .. - vm_carbon_stock(j2,noncropland59,"soilc",stockType) =e= - sum(ct, vm_land(j2,noncropland59) * fm_carbon_density(ct,j2,noncropland59,"soilc")); + q59_soilcarbon_regular(j2,regularland59,stockType) .. + vm_carbon_stock(j2,regularland59,"soilc",stockType) =e= + sum(ct, vm_land(j2,regularland59) * fm_carbon_density(ct,j2,regularland59,"soilc")); + +q59_soilcarbon_other(j2,stockType) .. + vm_carbon_stock(j2,"other","soilc",stockType) =e= + sum((ct,ac), vm_land_other(j2,ac,"othernat") * fm_carbon_density(ct,j2,"other","soilc")) + + sum((ct,ac), vm_land_other(j2,ac,"youngsecdf") * fm_carbon_density(ct,j2,"secdforest","soilc")) ; + + + diff --git a/modules/59_som/static_jan19/postsolve.gms b/modules/59_som/static_jan19/postsolve.gms index 723fb9ba0a..36b8a66e20 100644 --- a/modules/59_som/static_jan19/postsolve.gms +++ b/modules/59_som/static_jan19/postsolve.gms @@ -8,21 +8,25 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_nr_som(t,j,"marginal") = vm_nr_som.m(j); - ov_nr_som_fertilizer(t,j,"marginal") = vm_nr_som_fertilizer.m(j); - oq59_soilcarbon_cropland(t,j,stockType,"marginal") = q59_soilcarbon_cropland.m(j,stockType); - oq59_soilcarbon_noncropland(t,j,noncropland59,stockType,"marginal") = q59_soilcarbon_noncropland.m(j,noncropland59,stockType); - ov_nr_som(t,j,"level") = vm_nr_som.l(j); - ov_nr_som_fertilizer(t,j,"level") = vm_nr_som_fertilizer.l(j); - oq59_soilcarbon_cropland(t,j,stockType,"level") = q59_soilcarbon_cropland.l(j,stockType); - oq59_soilcarbon_noncropland(t,j,noncropland59,stockType,"level") = q59_soilcarbon_noncropland.l(j,noncropland59,stockType); - ov_nr_som(t,j,"upper") = vm_nr_som.up(j); - ov_nr_som_fertilizer(t,j,"upper") = vm_nr_som_fertilizer.up(j); - oq59_soilcarbon_cropland(t,j,stockType,"upper") = q59_soilcarbon_cropland.up(j,stockType); - oq59_soilcarbon_noncropland(t,j,noncropland59,stockType,"upper") = q59_soilcarbon_noncropland.up(j,noncropland59,stockType); - ov_nr_som(t,j,"lower") = vm_nr_som.lo(j); - ov_nr_som_fertilizer(t,j,"lower") = vm_nr_som_fertilizer.lo(j); - oq59_soilcarbon_cropland(t,j,stockType,"lower") = q59_soilcarbon_cropland.lo(j,stockType); - oq59_soilcarbon_noncropland(t,j,noncropland59,stockType,"lower") = q59_soilcarbon_noncropland.lo(j,noncropland59,stockType); + ov_nr_som(t,j,"marginal") = vm_nr_som.m(j); + ov_nr_som_fertilizer(t,j,"marginal") = vm_nr_som_fertilizer.m(j); + oq59_soilcarbon_cropland(t,j,stockType,"marginal") = q59_soilcarbon_cropland.m(j,stockType); + oq59_soilcarbon_regular(t,j,regularland59,stockType,"marginal") = q59_soilcarbon_regular.m(j,regularland59,stockType); + oq59_soilcarbon_other(t,j,stockType,"marginal") = q59_soilcarbon_other.m(j,stockType); + ov_nr_som(t,j,"level") = vm_nr_som.l(j); + ov_nr_som_fertilizer(t,j,"level") = vm_nr_som_fertilizer.l(j); + oq59_soilcarbon_cropland(t,j,stockType,"level") = q59_soilcarbon_cropland.l(j,stockType); + oq59_soilcarbon_regular(t,j,regularland59,stockType,"level") = q59_soilcarbon_regular.l(j,regularland59,stockType); + oq59_soilcarbon_other(t,j,stockType,"level") = q59_soilcarbon_other.l(j,stockType); + ov_nr_som(t,j,"upper") = vm_nr_som.up(j); + ov_nr_som_fertilizer(t,j,"upper") = vm_nr_som_fertilizer.up(j); + oq59_soilcarbon_cropland(t,j,stockType,"upper") = q59_soilcarbon_cropland.up(j,stockType); + oq59_soilcarbon_regular(t,j,regularland59,stockType,"upper") = q59_soilcarbon_regular.up(j,regularland59,stockType); + oq59_soilcarbon_other(t,j,stockType,"upper") = q59_soilcarbon_other.up(j,stockType); + ov_nr_som(t,j,"lower") = vm_nr_som.lo(j); + ov_nr_som_fertilizer(t,j,"lower") = vm_nr_som_fertilizer.lo(j); + oq59_soilcarbon_cropland(t,j,stockType,"lower") = q59_soilcarbon_cropland.lo(j,stockType); + oq59_soilcarbon_regular(t,j,regularland59,stockType,"lower") = q59_soilcarbon_regular.lo(j,regularland59,stockType); + oq59_soilcarbon_other(t,j,stockType,"lower") = q59_soilcarbon_other.lo(j,stockType); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/59_som/static_jan19/sets.gms b/modules/59_som/static_jan19/sets.gms index a55bf9518a..3a81f90c9c 100644 --- a/modules/59_som/static_jan19/sets.gms +++ b/modules/59_som/static_jan19/sets.gms @@ -6,8 +6,8 @@ *** | Contact: magpie@pik-potsdam.de sets -noncropland59(land) Soil carbon conserving landuse types -/past, forestry, primforest, secdforest, other, urban/ +regularland59(land) Soil carbon conserving landuse types +/ past, forestry, primforest, secdforest, urban / exo_scen59 exogenous scenarios for soil organic matter loss /constant, fadeout_2050/ From a48cf606acf03e0eaa5ca4aef6df885a08ec45e7 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Fri, 24 May 2024 15:02:58 +0200 Subject: [PATCH 193/280] not used fix --- modules/59_som/cellpool_aug16/not_used.txt | 2 ++ modules/59_som/cellpool_jan23/not_used.txt | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 modules/59_som/cellpool_aug16/not_used.txt create mode 100644 modules/59_som/cellpool_jan23/not_used.txt diff --git a/modules/59_som/cellpool_aug16/not_used.txt b/modules/59_som/cellpool_aug16/not_used.txt new file mode 100644 index 0000000000..a62a4ec738 --- /dev/null +++ b/modules/59_som/cellpool_aug16/not_used.txt @@ -0,0 +1,2 @@ +name,type,reason +vm_land_other,input,not needed diff --git a/modules/59_som/cellpool_jan23/not_used.txt b/modules/59_som/cellpool_jan23/not_used.txt new file mode 100644 index 0000000000..a62a4ec738 --- /dev/null +++ b/modules/59_som/cellpool_jan23/not_used.txt @@ -0,0 +1,2 @@ +name,type,reason +vm_land_other,input,not needed From 8c8ee29e6b575b579e09b0b217a8966ccfdacac0 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Fri, 24 May 2024 15:44:10 +0200 Subject: [PATCH 194/280] other land bound fix --- modules/35_natveg/pot_forest_may24/presolve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 9d04ec6af1..354e77c0f0 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -189,7 +189,7 @@ p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); * land area meets the total natural land conservation target p35_land_restoration(j,"other")$(sum(land_natveg, pcm_land(j,land_natveg)) >= sum((land_natveg, consv_type), pm_land_conservation(t,j,land_natveg,consv_type))) = 0; * set conservation bound -vm_land_other.lo(j,ac,"othernat") = pm_land_conservation(t,j,"other","protect") + p35_land_restoration(j,"other"); +vm_land.lo(j,"other") = pm_land_conservation(t,j,"other","protect") + p35_land_restoration(j,"other"); * ---------------------------- * Calculate carbon density From 1cfad9d872fbe0920bb25d8625c1f606e48e86b1 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Mon, 27 May 2024 10:26:40 +0200 Subject: [PATCH 195/280] reodered dimensions of new parameters and variables in line with module 32 to facilitate reporting --- .../pot_forest_may24/declarations.gms | 28 ++++----- .../35_natveg/pot_forest_may24/equations.gms | 36 +++++------ .../35_natveg/pot_forest_may24/postsolve.gms | 42 ++++++------- .../35_natveg/pot_forest_may24/preloop.gms | 8 +-- .../35_natveg/pot_forest_may24/presolve.gms | 62 +++++++++---------- modules/59_som/static_jan19/equations.gms | 4 +- 6 files changed, 90 insertions(+), 90 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index 43532f0540..ff509557ed 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -11,11 +11,11 @@ scalars parameters i35_secdforest(j,ac) Initial secdforest (mio. ha) - i35_land_other(j,ac,othertype35) Initial other land (mio. ha) + i35_land_other(j,othertype35,ac) Initial other land (mio. ha) p35_secdforest(t,j,ac) Secdforest per age class (mio. ha) - p35_land_other(t,j,ac,othertype35) Other land per age class (mio. ha) + p35_land_other(t,j,othertype35,ac) Other land per age class (mio. ha) pc35_secdforest(j,ac) Secdforest per age class in current time step (mio. ha) - pc35_land_other(j,ac,othertype35) Other land per age class in current time step (mio. ha) + pc35_land_other(j,othertype35,ac) Other land per age class in current time step (mio. ha) p35_min_forest(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_damage_fader(t_all) Fader for forest damage (1) @@ -24,7 +24,7 @@ parameters p35_maturesecdf(t,j,ac) Matured secondary forest (mio. ha) pcm_max_forest_est(j) Overall forest establishment potential in current time step (mio. ha) p35_max_forest_recovery(j) Maximum forest recovery potential after land abandonement (mio. ha) - p35_carbon_density_other(t,j,ac,othertype35,ag_pools) Carbon density other land (tC per ha) + p35_carbon_density_other(t,j,othertype35,ac,ag_pools) Carbon density other land (tC per ha) p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) p35_disturbance_loss_primf(t,j) Loss due to disturbances in primary forest (mio. ha) i35_plantedclass_ac(j,ac) Area of age-classes in secondary forest (1) @@ -45,7 +45,7 @@ equations q35_min_other(j) Minimum other land constraint (mio. ha) q35_landdiff Difference in natveg land (mio. ha) q35_other_expansion(j,othertype35) Other land expansion (mio. ha) - q35_other_reduction(j,ac,othertype35) Other land reduction (mio. ha) + q35_other_reduction(j,othertype35,ac) Other land reduction (mio. ha) q35_secdforest_expansion(j) Secdforest expansion (mio. ha) q35_secdforest_reduction(j,ac) Secdforest reduction (mio. ha) q35_primforest_reduction(j) Primforest reduction (mio. ha) @@ -54,7 +54,7 @@ equations q35_other_regeneration(j) Other land regeneration (mio. ha) q35_other_est(j,ac) Distribution of other land additions over ac_est (mio. ha) q35_secdforest_est(j,ac) Distribution of secdforest additions over ac_est (mio. ha) - q35_hvarea_other(j,ac,othertype35) Harvested area other land (mio. ha) + q35_hvarea_other(j,othertype35,ac) Harvested area other land (mio. ha) q35_hvarea_secdforest(j,ac) Harvested area secdforest (mio. ha) q35_hvarea_primforest(j) Harvested area primforest (mio. ha) q35_prod_secdforest(j) Production of woody biomass from secondary forests (mio. tDM per yr) @@ -71,15 +71,15 @@ equations positive variables v35_secdforest(j,ac) Detailed stock of secdforest (mio. ha) - vm_land_other(j,ac,othertype35) Detailed stock of other land (mio. ha) + vm_land_other(j,othertype35,ac) Detailed stock of other land (mio. ha) vm_landdiff_natveg Aggregated difference in natveg land compared to previous timestep (mio. ha) v35_other_expansion(j,othertype35) Other land expansion compared to previous timestep (mio. ha) - v35_other_reduction(j,ac,othertype35) Other land reduction compared to previous timestep (mio. ha) + v35_other_reduction(j,othertype35,ac) Other land reduction compared to previous timestep (mio. ha) v35_secdforest_expansion(j) Secdforest reduction compared to previous timestep (mio. ha) v35_secdforest_reduction(j,ac) Secdforest reduction compared to previous timestep (mio. ha) v35_primforest_reduction(j) Primforest reduction compared to previous timestep (mio. ha) v35_hvarea_secdforest(j,ac) Harvested area from secondary forest (mio. ha) - v35_hvarea_other(j,ac,othertype35) Harvested area from other land (mio. ha) + v35_hvarea_other(j,othertype35,ac) Harvested area from other land (mio. ha) v35_hvarea_primforest(j) Harvested area from primary forest (mio. ha) vm_prod_natveg(j,land_natveg,kforestry) Production of woody biomass from natural vegetation (mio. tDM per yr) vm_cost_hvarea_natveg(i) Cost of harvesting natural vegetation (mio. USD) @@ -89,15 +89,15 @@ positive variables *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters ov35_secdforest(t,j,ac,type) Detailed stock of secdforest (mio. ha) - ov_land_other(t,j,ac,othertype35,type) Detailed stock of other land (mio. ha) + ov_land_other(t,j,othertype35,ac,type) Detailed stock of other land (mio. ha) ov_landdiff_natveg(t,type) Aggregated difference in natveg land compared to previous timestep (mio. ha) ov35_other_expansion(t,j,othertype35,type) Other land expansion compared to previous timestep (mio. ha) - ov35_other_reduction(t,j,ac,othertype35,type) Other land reduction compared to previous timestep (mio. ha) + ov35_other_reduction(t,j,othertype35,ac,type) Other land reduction compared to previous timestep (mio. ha) ov35_secdforest_expansion(t,j,type) Secdforest reduction compared to previous timestep (mio. ha) ov35_secdforest_reduction(t,j,ac,type) Secdforest reduction compared to previous timestep (mio. ha) ov35_primforest_reduction(t,j,type) Primforest reduction compared to previous timestep (mio. ha) ov35_hvarea_secdforest(t,j,ac,type) Harvested area from secondary forest (mio. ha) - ov35_hvarea_other(t,j,ac,othertype35,type) Harvested area from other land (mio. ha) + ov35_hvarea_other(t,j,othertype35,ac,type) Harvested area from other land (mio. ha) ov35_hvarea_primforest(t,j,type) Harvested area from primary forest (mio. ha) ov_prod_natveg(t,j,land_natveg,kforestry,type) Production of woody biomass from natural vegetation (mio. tDM per yr) ov_cost_hvarea_natveg(t,i,type) Cost of harvesting natural vegetation (mio. USD) @@ -110,7 +110,7 @@ parameters oq35_min_other(t,j,type) Minimum other land constraint (mio. ha) oq35_landdiff(t,type) Difference in natveg land (mio. ha) oq35_other_expansion(t,j,othertype35,type) Other land expansion (mio. ha) - oq35_other_reduction(t,j,ac,othertype35,type) Other land reduction (mio. ha) + oq35_other_reduction(t,j,othertype35,ac,type) Other land reduction (mio. ha) oq35_secdforest_expansion(t,j,type) Secdforest expansion (mio. ha) oq35_secdforest_reduction(t,j,ac,type) Secdforest reduction (mio. ha) oq35_primforest_reduction(t,j,type) Primforest reduction (mio. ha) @@ -119,7 +119,7 @@ parameters oq35_other_regeneration(t,j,type) Other land regeneration (mio. ha) oq35_other_est(t,j,ac,type) Distribution of other land additions over ac_est (mio. ha) oq35_secdforest_est(t,j,ac,type) Distribution of secdforest additions over ac_est (mio. ha) - oq35_hvarea_other(t,j,ac,othertype35,type) Harvested area other land (mio. ha) + oq35_hvarea_other(t,j,othertype35,ac,type) Harvested area other land (mio. ha) oq35_hvarea_secdforest(t,j,ac,type) Harvested area secdforest (mio. ha) oq35_hvarea_primforest(t,j,type) Harvested area primforest (mio. ha) oq35_prod_secdforest(t,j,type) Production of woody biomass from secondary forests (mio. tDM per yr) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 937693ac1c..eea810d8bc 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -10,7 +10,7 @@ q35_land_secdforest(j2) .. vm_land(j2,"secdforest") =e= sum(ac, v35_secdforest(j2,ac)); - q35_land_other(j2) .. vm_land(j2,"other") =e= sum((ac,othertype35), vm_land_other(j2,ac,othertype35)); + q35_land_other(j2) .. vm_land(j2,"other") =e= sum((othertype35,ac), vm_land_other(j2,othertype35,ac)); *' The total natural land area cannot be smaller than the total natural land conservation target. *' Area requirements for natural land conservation are derived from WDPA and formulated based on @@ -49,7 +49,7 @@ q35_carbon_other(j2,ag_pools,stockType) .. vm_carbon_stock(j2,"other",ag_pools,stockType) =e= - m_carbon_stock_ac(vm_land_other,p35_carbon_density_other,"ac,othertype35","ac_sub,othertype35"); + m_carbon_stock_ac(vm_land_other,p35_carbon_density_other,"othertype35,ac","othertype35,ac_sub"); *' The biodiversity value (BV) of primary forest, secondary forest and other land is computed by multiplying their respective land area with bii coefficients, which depend on the age class and whether the potential natural vegetation forest or non-forest (luh2 side layers). @@ -64,7 +64,7 @@ q35_bv_other(j2,potnatveg) .. vm_bv(j2,"other",potnatveg) =e= - sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), sum(othertype35, vm_land_other(j2,ac,othertype35))) * + sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), sum(othertype35, vm_land_other(j2,othertype35,ac))) * fm_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg); *' NPI/NDC land protection policies based on country reports are implemented as @@ -86,18 +86,18 @@ q35_landdiff .. vm_landdiff_natveg =e= sum(j2, sum(othertype35,v35_other_expansion(j2,othertype35)) - + sum((ac_sub,othertype35), v35_other_reduction(j2,ac_sub,othertype35)) + + sum((othertype35,ac_sub), v35_other_reduction(j2,othertype35,ac_sub)) + v35_secdforest_expansion(j2) + sum((ac_sub), v35_secdforest_reduction(j2,ac_sub)) + v35_primforest_reduction(j2)); q35_other_expansion(j2,othertype35) .. v35_other_expansion(j2,othertype35) =e= - sum(ac_est, vm_land_other(j2,ac_est,othertype35)); + sum(ac_est, vm_land_other(j2,othertype35,ac_est)); - q35_other_reduction(j2,ac_sub,othertype35) .. - v35_other_reduction(j2,ac_sub,othertype35) =e= - pc35_land_other(j2,ac_sub,othertype35) - vm_land_other(j2,ac_sub,othertype35); + q35_other_reduction(j2,othertype35,ac_sub) .. + v35_other_reduction(j2,othertype35,ac_sub) =e= + pc35_land_other(j2,othertype35,ac_sub) - vm_land_other(j2,othertype35,ac_sub); q35_secdforest_expansion(j2) .. v35_secdforest_expansion(j2) =e= @@ -126,7 +126,7 @@ q35_cost_hvarea(i2).. vm_cost_hvarea_natveg(i2) =e= sum((ct,cell(i2,j2),ac_sub), v35_hvarea_secdforest(j2,ac_sub)) * s35_timber_harvest_cost_secdforest - + sum((ct,cell(i2,j2),ac_sub,othertype35), v35_hvarea_other(j2,ac_sub,othertype35)) * s35_timber_harvest_cost_other + + sum((ct,cell(i2,j2),othertype35,ac_sub), v35_hvarea_other(j2,othertype35,ac_sub)) * s35_timber_harvest_cost_other + sum((ct,cell(i2,j2)), v35_hvarea_primforest(j2)) * s35_timber_harvest_cost_primforest ; @@ -156,8 +156,8 @@ q35_prod_primforest(j2).. q35_prod_other(j2).. vm_prod_natveg(j2,"other","woodfuel") =e= - (sum(ac_sub, v35_hvarea_other(j2,ac_sub,"othernat") * sum(ct, pm_timber_yield(ct,j2,ac_sub,"other"))) - + sum(ac_sub, v35_hvarea_other(j2,ac_sub,"youngsecdf") * sum(ct, pm_timber_yield(ct,j2,ac_sub,"secdforest")))) + (sum(ac_sub, v35_hvarea_other(j2,"othernat",ac_sub) * sum(ct, pm_timber_yield(ct,j2,ac_sub,"other"))) + + sum(ac_sub, v35_hvarea_other(j2,"youngsecdf",ac_sub) * sum(ct, pm_timber_yield(ct,j2,ac_sub,"secdforest")))) / m_timestep_length_forestry ; @@ -177,10 +177,10 @@ q35_hvarea_primforest(j2).. =l= v35_primforest_reduction(j2); -q35_hvarea_other(j2,ac_sub,othertype35).. - v35_hvarea_other(j2,ac_sub,othertype35) +q35_hvarea_other(j2,othertype35,ac_sub).. + v35_hvarea_other(j2,othertype35,ac_sub) =l= - v35_other_reduction(j2,ac_sub,othertype35); + v35_other_reduction(j2,othertype35,ac_sub); *' The constraint for overall forest establishment, including forestry, is given @@ -191,7 +191,7 @@ q35_max_forest_establishment(j2).. sum(land_forest, vm_landexpansion(j2,land_forest)) =l= pcm_max_forest_est(j2) - - sum(ac, vm_land_other(j2,ac,"youngsecdf")) + - sum(ac, vm_land_other(j2,"youngsecdf",ac) ) ; *' Harvested secondary forest is still considered secondary forests due to @@ -210,9 +210,9 @@ q35_secdforest_regeneration(j2).. *' Harvested other land is still considered other land q35_other_regeneration(j2).. - sum(ac_est, vm_land_other(j2,ac_est,"othernat")) + sum(ac_est, vm_land_other(j2,"othernat",ac_est)) =g= - sum((ac_sub,othertype35),v35_hvarea_other(j2,ac_sub,othertype35)) + sum((othertype35,ac_sub),v35_hvarea_other(j2,othertype35,ac_sub)) ; *' The following two constraints distribute additions to secdforest and other land @@ -222,5 +222,5 @@ q35_secdforest_est(j2,ac_est) .. v35_secdforest(j2,ac_est) =e= sum(ac_est2, v35_secdforest(j2,ac_est2))/card(ac_est2); q35_other_est(j2,ac_est) .. -vm_land_other(j2,ac_est,"othernat") =e= sum(ac_est2, vm_land_other(j2,ac_est2,"othernat"))/card(ac_est2); +vm_land_other(j2,"othernat",ac_est) =e= sum(ac_est2, vm_land_other(j2,"othernat",ac_est2))/card(ac_est2); diff --git a/modules/35_natveg/pot_forest_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms index b528058e11..d92c17f222 100644 --- a/modules/35_natveg/pot_forest_may24/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -9,7 +9,7 @@ pc35_secdforest(j,ac) = v35_secdforest.l(j,ac); *other land age class calculation -pc35_land_other(j,ac,othertype35) = vm_land_other.l(j,ac,othertype35); +pc35_land_other(j,othertype35,ac) = vm_land_other.l(j,othertype35,ac); * Reset forest establishment bound pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, vm_land.l(j,land_forest)); @@ -17,15 +17,15 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); - ov_land_other(t,j,ac,othertype35,"marginal") = vm_land_other.m(j,ac,othertype35); + ov_land_other(t,j,othertype35,ac,"marginal") = vm_land_other.m(j,othertype35,ac); ov_landdiff_natveg(t,"marginal") = vm_landdiff_natveg.m; ov35_other_expansion(t,j,othertype35,"marginal") = v35_other_expansion.m(j,othertype35); - ov35_other_reduction(t,j,ac,othertype35,"marginal") = v35_other_reduction.m(j,ac,othertype35); + ov35_other_reduction(t,j,othertype35,ac,"marginal") = v35_other_reduction.m(j,othertype35,ac); ov35_secdforest_expansion(t,j,"marginal") = v35_secdforest_expansion.m(j); ov35_secdforest_reduction(t,j,ac,"marginal") = v35_secdforest_reduction.m(j,ac); ov35_primforest_reduction(t,j,"marginal") = v35_primforest_reduction.m(j); ov35_hvarea_secdforest(t,j,ac,"marginal") = v35_hvarea_secdforest.m(j,ac); - ov35_hvarea_other(t,j,ac,othertype35,"marginal") = v35_hvarea_other.m(j,ac,othertype35); + ov35_hvarea_other(t,j,othertype35,ac,"marginal") = v35_hvarea_other.m(j,othertype35,ac); ov35_hvarea_primforest(t,j,"marginal") = v35_hvarea_primforest.m(j); ov_prod_natveg(t,j,land_natveg,kforestry,"marginal") = vm_prod_natveg.m(j,land_natveg,kforestry); ov_cost_hvarea_natveg(t,i,"marginal") = vm_cost_hvarea_natveg.m(i); @@ -38,7 +38,7 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_min_other(t,j,"marginal") = q35_min_other.m(j); oq35_landdiff(t,"marginal") = q35_landdiff.m; oq35_other_expansion(t,j,othertype35,"marginal") = q35_other_expansion.m(j,othertype35); - oq35_other_reduction(t,j,ac,othertype35,"marginal") = q35_other_reduction.m(j,ac,othertype35); + oq35_other_reduction(t,j,othertype35,ac,"marginal") = q35_other_reduction.m(j,othertype35,ac); oq35_secdforest_expansion(t,j,"marginal") = q35_secdforest_expansion.m(j); oq35_secdforest_reduction(t,j,ac,"marginal") = q35_secdforest_reduction.m(j,ac); oq35_primforest_reduction(t,j,"marginal") = q35_primforest_reduction.m(j); @@ -47,7 +47,7 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_other_regeneration(t,j,"marginal") = q35_other_regeneration.m(j); oq35_other_est(t,j,ac,"marginal") = q35_other_est.m(j,ac); oq35_secdforest_est(t,j,ac,"marginal") = q35_secdforest_est.m(j,ac); - oq35_hvarea_other(t,j,ac,othertype35,"marginal") = q35_hvarea_other.m(j,ac,othertype35); + oq35_hvarea_other(t,j,othertype35,ac,"marginal") = q35_hvarea_other.m(j,othertype35,ac); oq35_hvarea_secdforest(t,j,ac,"marginal") = q35_hvarea_secdforest.m(j,ac); oq35_hvarea_primforest(t,j,"marginal") = q35_hvarea_primforest.m(j); oq35_prod_secdforest(t,j,"marginal") = q35_prod_secdforest.m(j); @@ -61,15 +61,15 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_secdforest_restoration(t,j,"marginal") = q35_secdforest_restoration.m(j); oq35_other_restoration(t,j,"marginal") = q35_other_restoration.m(j); ov35_secdforest(t,j,ac,"level") = v35_secdforest.l(j,ac); - ov_land_other(t,j,ac,othertype35,"level") = vm_land_other.l(j,ac,othertype35); + ov_land_other(t,j,othertype35,ac,"level") = vm_land_other.l(j,othertype35,ac); ov_landdiff_natveg(t,"level") = vm_landdiff_natveg.l; ov35_other_expansion(t,j,othertype35,"level") = v35_other_expansion.l(j,othertype35); - ov35_other_reduction(t,j,ac,othertype35,"level") = v35_other_reduction.l(j,ac,othertype35); + ov35_other_reduction(t,j,othertype35,ac,"level") = v35_other_reduction.l(j,othertype35,ac); ov35_secdforest_expansion(t,j,"level") = v35_secdforest_expansion.l(j); ov35_secdforest_reduction(t,j,ac,"level") = v35_secdforest_reduction.l(j,ac); ov35_primforest_reduction(t,j,"level") = v35_primforest_reduction.l(j); ov35_hvarea_secdforest(t,j,ac,"level") = v35_hvarea_secdforest.l(j,ac); - ov35_hvarea_other(t,j,ac,othertype35,"level") = v35_hvarea_other.l(j,ac,othertype35); + ov35_hvarea_other(t,j,othertype35,ac,"level") = v35_hvarea_other.l(j,othertype35,ac); ov35_hvarea_primforest(t,j,"level") = v35_hvarea_primforest.l(j); ov_prod_natveg(t,j,land_natveg,kforestry,"level") = vm_prod_natveg.l(j,land_natveg,kforestry); ov_cost_hvarea_natveg(t,i,"level") = vm_cost_hvarea_natveg.l(i); @@ -82,7 +82,7 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_min_other(t,j,"level") = q35_min_other.l(j); oq35_landdiff(t,"level") = q35_landdiff.l; oq35_other_expansion(t,j,othertype35,"level") = q35_other_expansion.l(j,othertype35); - oq35_other_reduction(t,j,ac,othertype35,"level") = q35_other_reduction.l(j,ac,othertype35); + oq35_other_reduction(t,j,othertype35,ac,"level") = q35_other_reduction.l(j,othertype35,ac); oq35_secdforest_expansion(t,j,"level") = q35_secdforest_expansion.l(j); oq35_secdforest_reduction(t,j,ac,"level") = q35_secdforest_reduction.l(j,ac); oq35_primforest_reduction(t,j,"level") = q35_primforest_reduction.l(j); @@ -91,7 +91,7 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_other_regeneration(t,j,"level") = q35_other_regeneration.l(j); oq35_other_est(t,j,ac,"level") = q35_other_est.l(j,ac); oq35_secdforest_est(t,j,ac,"level") = q35_secdforest_est.l(j,ac); - oq35_hvarea_other(t,j,ac,othertype35,"level") = q35_hvarea_other.l(j,ac,othertype35); + oq35_hvarea_other(t,j,othertype35,ac,"level") = q35_hvarea_other.l(j,othertype35,ac); oq35_hvarea_secdforest(t,j,ac,"level") = q35_hvarea_secdforest.l(j,ac); oq35_hvarea_primforest(t,j,"level") = q35_hvarea_primforest.l(j); oq35_prod_secdforest(t,j,"level") = q35_prod_secdforest.l(j); @@ -105,15 +105,15 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_secdforest_restoration(t,j,"level") = q35_secdforest_restoration.l(j); oq35_other_restoration(t,j,"level") = q35_other_restoration.l(j); ov35_secdforest(t,j,ac,"upper") = v35_secdforest.up(j,ac); - ov_land_other(t,j,ac,othertype35,"upper") = vm_land_other.up(j,ac,othertype35); + ov_land_other(t,j,othertype35,ac,"upper") = vm_land_other.up(j,othertype35,ac); ov_landdiff_natveg(t,"upper") = vm_landdiff_natveg.up; ov35_other_expansion(t,j,othertype35,"upper") = v35_other_expansion.up(j,othertype35); - ov35_other_reduction(t,j,ac,othertype35,"upper") = v35_other_reduction.up(j,ac,othertype35); + ov35_other_reduction(t,j,othertype35,ac,"upper") = v35_other_reduction.up(j,othertype35,ac); ov35_secdforest_expansion(t,j,"upper") = v35_secdforest_expansion.up(j); ov35_secdforest_reduction(t,j,ac,"upper") = v35_secdforest_reduction.up(j,ac); ov35_primforest_reduction(t,j,"upper") = v35_primforest_reduction.up(j); ov35_hvarea_secdforest(t,j,ac,"upper") = v35_hvarea_secdforest.up(j,ac); - ov35_hvarea_other(t,j,ac,othertype35,"upper") = v35_hvarea_other.up(j,ac,othertype35); + ov35_hvarea_other(t,j,othertype35,ac,"upper") = v35_hvarea_other.up(j,othertype35,ac); ov35_hvarea_primforest(t,j,"upper") = v35_hvarea_primforest.up(j); ov_prod_natveg(t,j,land_natveg,kforestry,"upper") = vm_prod_natveg.up(j,land_natveg,kforestry); ov_cost_hvarea_natveg(t,i,"upper") = vm_cost_hvarea_natveg.up(i); @@ -126,7 +126,7 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_min_other(t,j,"upper") = q35_min_other.up(j); oq35_landdiff(t,"upper") = q35_landdiff.up; oq35_other_expansion(t,j,othertype35,"upper") = q35_other_expansion.up(j,othertype35); - oq35_other_reduction(t,j,ac,othertype35,"upper") = q35_other_reduction.up(j,ac,othertype35); + oq35_other_reduction(t,j,othertype35,ac,"upper") = q35_other_reduction.up(j,othertype35,ac); oq35_secdforest_expansion(t,j,"upper") = q35_secdforest_expansion.up(j); oq35_secdforest_reduction(t,j,ac,"upper") = q35_secdforest_reduction.up(j,ac); oq35_primforest_reduction(t,j,"upper") = q35_primforest_reduction.up(j); @@ -135,7 +135,7 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_other_regeneration(t,j,"upper") = q35_other_regeneration.up(j); oq35_other_est(t,j,ac,"upper") = q35_other_est.up(j,ac); oq35_secdforest_est(t,j,ac,"upper") = q35_secdforest_est.up(j,ac); - oq35_hvarea_other(t,j,ac,othertype35,"upper") = q35_hvarea_other.up(j,ac,othertype35); + oq35_hvarea_other(t,j,othertype35,ac,"upper") = q35_hvarea_other.up(j,othertype35,ac); oq35_hvarea_secdforest(t,j,ac,"upper") = q35_hvarea_secdforest.up(j,ac); oq35_hvarea_primforest(t,j,"upper") = q35_hvarea_primforest.up(j); oq35_prod_secdforest(t,j,"upper") = q35_prod_secdforest.up(j); @@ -149,15 +149,15 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_secdforest_restoration(t,j,"upper") = q35_secdforest_restoration.up(j); oq35_other_restoration(t,j,"upper") = q35_other_restoration.up(j); ov35_secdforest(t,j,ac,"lower") = v35_secdforest.lo(j,ac); - ov_land_other(t,j,ac,othertype35,"lower") = vm_land_other.lo(j,ac,othertype35); + ov_land_other(t,j,othertype35,ac,"lower") = vm_land_other.lo(j,othertype35,ac); ov_landdiff_natveg(t,"lower") = vm_landdiff_natveg.lo; ov35_other_expansion(t,j,othertype35,"lower") = v35_other_expansion.lo(j,othertype35); - ov35_other_reduction(t,j,ac,othertype35,"lower") = v35_other_reduction.lo(j,ac,othertype35); + ov35_other_reduction(t,j,othertype35,ac,"lower") = v35_other_reduction.lo(j,othertype35,ac); ov35_secdforest_expansion(t,j,"lower") = v35_secdforest_expansion.lo(j); ov35_secdforest_reduction(t,j,ac,"lower") = v35_secdforest_reduction.lo(j,ac); ov35_primforest_reduction(t,j,"lower") = v35_primforest_reduction.lo(j); ov35_hvarea_secdforest(t,j,ac,"lower") = v35_hvarea_secdforest.lo(j,ac); - ov35_hvarea_other(t,j,ac,othertype35,"lower") = v35_hvarea_other.lo(j,ac,othertype35); + ov35_hvarea_other(t,j,othertype35,ac,"lower") = v35_hvarea_other.lo(j,othertype35,ac); ov35_hvarea_primforest(t,j,"lower") = v35_hvarea_primforest.lo(j); ov_prod_natveg(t,j,land_natveg,kforestry,"lower") = vm_prod_natveg.lo(j,land_natveg,kforestry); ov_cost_hvarea_natveg(t,i,"lower") = vm_cost_hvarea_natveg.lo(i); @@ -170,7 +170,7 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_min_other(t,j,"lower") = q35_min_other.lo(j); oq35_landdiff(t,"lower") = q35_landdiff.lo; oq35_other_expansion(t,j,othertype35,"lower") = q35_other_expansion.lo(j,othertype35); - oq35_other_reduction(t,j,ac,othertype35,"lower") = q35_other_reduction.lo(j,ac,othertype35); + oq35_other_reduction(t,j,othertype35,ac,"lower") = q35_other_reduction.lo(j,othertype35,ac); oq35_secdforest_expansion(t,j,"lower") = q35_secdforest_expansion.lo(j); oq35_secdforest_reduction(t,j,ac,"lower") = q35_secdforest_reduction.lo(j,ac); oq35_primforest_reduction(t,j,"lower") = q35_primforest_reduction.lo(j); @@ -179,7 +179,7 @@ pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; oq35_other_regeneration(t,j,"lower") = q35_other_regeneration.lo(j); oq35_other_est(t,j,ac,"lower") = q35_other_est.lo(j,ac); oq35_secdforest_est(t,j,ac,"lower") = q35_secdforest_est.lo(j,ac); - oq35_hvarea_other(t,j,ac,othertype35,"lower") = q35_hvarea_other.lo(j,ac,othertype35); + oq35_hvarea_other(t,j,othertype35,ac,"lower") = q35_hvarea_other.lo(j,othertype35,ac); oq35_hvarea_secdforest(t,j,ac,"lower") = q35_hvarea_secdforest.lo(j,ac); oq35_hvarea_primforest(t,j,"lower") = q35_hvarea_primforest.lo(j); oq35_prod_secdforest(t,j,"lower") = q35_prod_secdforest.lo(j); diff --git a/modules/35_natveg/pot_forest_may24/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms index 773cc7587e..3f4750017f 100644 --- a/modules/35_natveg/pot_forest_may24/preloop.gms +++ b/modules/35_natveg/pot_forest_may24/preloop.gms @@ -6,8 +6,8 @@ *** | Contact: magpie@pik-potsdam.de ** initialize other land -i35_land_other(j,ac,othertype35) = 0; -i35_land_other(j,"acx","othernat") = pcm_land(j,"other"); +i35_land_other(j,othertype35,ac) = 0; +i35_land_other(j,"othernat","acx") = pcm_land(j,"other"); ** initialize secdforest area depending on switch. if(s35_secdf_distribution = 0, @@ -33,7 +33,7 @@ elseif s35_secdf_distribution = 2, i35_secdforest(j,"acx") = i35_secdforest(j,"acx") + (pcm_land(j,"secdforest") - sum(ac, i35_secdforest(j,ac))); *initialize parameter -p35_land_other(t,j,ac,othertype35) = 0; +p35_land_other(t,j,othertype35,ac) = 0; p35_secdforest(t,j,ac) = 0; * initialize forest disturbance losses @@ -79,4 +79,4 @@ m_sigmoid_time_interpol(p35_damage_fader,sm_fix_SSP2,s35_forest_damage_end,0,1); * --------------------------------------- pc35_secdforest(j,ac) = i35_secdforest(j,ac); - pc35_land_other(j,ac,othertype35) = i35_land_other(j,ac,othertype35); + pc35_land_other(j,othertype35,ac) = i35_land_other(j,othertype35,ac); diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 354e77c0f0..a9647b2fb6 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -45,21 +45,21 @@ vm_land.l(j,"primforest") = pcm_land(j,"primforest"); * ------------------------------------------------- *** Distribute forestry abandonement -* Abandoned forestry is directly shifted into pc35_land_other(j,ac_est,"youngsecdf") because it is +* Abandoned forestry is directly shifted into pc35_land_other(j,"youngsecdf",ac_est) because it is * assumed that forestry was located in areas suitable to grow forests. -pc35_land_other(j,ac_est,"youngsecdf") = vm_lu_transitions.l(j,"forestry","other")/card(ac_est2); -pc35_land_other(j,ac_est,"youngsecdf")$(sum(ac_est2,pc35_land_other(j,ac_est2,"youngsecdf")) > pcm_max_forest_est(j)) = pcm_max_forest_est(j)/card(ac_est2); +pc35_land_other(j,"youngsecdf",ac_est) = vm_lu_transitions.l(j,"forestry","other")/card(ac_est2); +pc35_land_other(j,"youngsecdf",ac_est)$(sum(ac_est2,pc35_land_other(j,"youngsecdf",ac_est2)) > pcm_max_forest_est(j)) = pcm_max_forest_est(j)/card(ac_est2); * The proportion of secondary forest recovery in total natveg recovery is derived * from the remaining forest recovery area -p35_max_forest_recovery(j) = pcm_max_forest_est(j) - sum(ac, pc35_land_other(j,ac,"youngsecdf")); +p35_max_forest_recovery(j) = pcm_max_forest_est(j) - sum(ac, pc35_land_other(j,"youngsecdf",ac)); p35_forest_recovery_shr(j) = p35_max_forest_recovery(j) / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")+1e-10); p35_forest_recovery_shr(j)$(p35_forest_recovery_shr(j) > 1) = 1; -* Abandoned land pc35_land_other(j,ac_est,"othernat") is then distributed proportionally using the forest recovery share. -p35_forest_recovery_area(t,j,ac_est) = pc35_land_other(j,ac_est,"othernat") * p35_forest_recovery_shr(j); +* Abandoned land pc35_land_other(j,"othernat",ac_est) is then distributed proportionally using the forest recovery share. +p35_forest_recovery_area(t,j,ac_est) = pc35_land_other(j,"othernat",ac_est) * p35_forest_recovery_shr(j); p35_forest_recovery_area(t,j,ac_est)$(sum(ac_est2,p35_forest_recovery_area(t,j,ac_est2)) > p35_max_forest_recovery(j)) = p35_max_forest_recovery(j)/card(ac_est2); -pc35_land_other(j,ac_est,"othernat") = pc35_land_other(j,ac_est,"othernat") - p35_forest_recovery_area(t,j,ac_est); -pc35_land_other(j,ac_est,"youngsecdf") = pc35_land_other(j,ac_est,"youngsecdf") + p35_forest_recovery_area(t,j,ac_est); +pc35_land_other(j,"othernat",ac_est) = pc35_land_other(j,"othernat",ac_est) - p35_forest_recovery_area(t,j,ac_est); +pc35_land_other(j,"youngsecdf",ac_est) = pc35_land_other(j,"youngsecdf",ac_est) + p35_forest_recovery_area(t,j,ac_est); * ------------------------------------------------ * Natural vegetation growth (age-class shift) @@ -68,10 +68,10 @@ pc35_land_other(j,ac_est,"youngsecdf") = pc35_land_other(j,ac_est,"youngsecdf") * Regrowth of natural vegetation (natural succession) is modelled by shifting age-classes according to time step length. s35_shift = m_timestep_length_forestry/5; * example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) - p35_land_other(t,j,ac,othertype35)$(ord(ac) > s35_shift) = pc35_land_other(j,ac-s35_shift,othertype35); + p35_land_other(t,j,othertype35,ac)$(ord(ac) > s35_shift) = pc35_land_other(j,othertype35,ac-s35_shift); * account for cases at the end of the age class set (s35_shift > 1) which are not shifted by the above calculation - p35_land_other(t,j,"acx",othertype35) = p35_land_other(t,j,"acx",othertype35) - + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_land_other(j,ac,othertype35)); + p35_land_other(t,j,othertype35,"acx") = p35_land_other(t,j,othertype35,"acx") + + sum(ac$(ord(ac) > card(ac)-s35_shift), pc35_land_other(j,othertype35,ac)); * Usual shift * example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s35_shift = 1) @@ -90,8 +90,8 @@ s35_shift = m_timestep_length_forestry/5; *' exceeds a threshold of 20 tC/ha the respective area is shifted from young secondary *' forest, which is still considered other land, to secondary forest land. p35_maturesecdf(t,j,ac)$(not sameas(ac,"acx")) = - p35_land_other(t,j,ac,"youngsecdf")$(pm_carbon_density_secdforest_ac(t,j,ac,"vegc") > 20); -p35_land_other(t,j,ac,"youngsecdf") = p35_land_other(t,j,ac,"youngsecdf") - p35_maturesecdf(t,j,ac); + p35_land_other(t,j,"youngsecdf",ac)$(pm_carbon_density_secdforest_ac(t,j,ac,"vegc") > 20); +p35_land_other(t,j,"youngsecdf",ac) = p35_land_other(t,j,"youngsecdf",ac) - p35_maturesecdf(t,j,ac); p35_secdforest(t,j,ac) = p35_secdforest(t,j,ac) + p35_maturesecdf(t,j,ac); *' @stop @@ -100,11 +100,11 @@ v35_secdforest.l(j,ac) = pc35_secdforest(j,ac); vm_land.l(j,"secdforest") = sum(ac, pc35_secdforest(j,ac)); pcm_land(j,"secdforest") = sum(ac, pc35_secdforest(j,ac)); -pc35_land_other(j,ac,othertype35) = p35_land_other(t,j,ac,othertype35); -vm_land_other.l(j,ac,othertype35) = pc35_land_other(j,ac,othertype35); +pc35_land_other(j,othertype35,ac) = p35_land_other(t,j,othertype35,ac); +vm_land_other.l(j,othertype35,ac) = pc35_land_other(j,othertype35,ac); -vm_land.l(j,"other") = sum((ac,othertype35), pc35_land_other(j,ac,othertype35)); -pcm_land(j,"other") = sum((ac,othertype35), pc35_land_other(j,ac,othertype35)); +vm_land.l(j,"other") = sum((othertype35,ac), pc35_land_other(j,othertype35,ac)); +pcm_land(j,"other") = sum((othertype35,ac), pc35_land_other(j,othertype35,ac)); * ------------------------------------- * Set bounds based on land conservation @@ -170,19 +170,19 @@ vm_land.lo(j,"secdforest") = pm_land_conservation(t,j,"secdforest","protect") + ** Other land *reset bounds -vm_land_other.lo(j,ac,"othernat") = 0; -vm_land_other.up(j,ac,"othernat") = Inf; -vm_land_other.lo(j,ac,"youngsecdf") = 0; +vm_land_other.lo(j,"othernat",ac) = 0; +vm_land_other.up(j,"othernat",ac) = Inf; +vm_land_other.lo(j,"youngsecdf",ac) = 0; *set upper bound -vm_land_other.up(j,ac_sub,"othernat") = pc35_land_other(j,ac_sub,"othernat"); -vm_land_other.up(j,ac_sub,"youngsecdf") = pc35_land_other(j,ac_sub,"youngsecdf"); -vm_land_other.fx(j,ac_est,"youngsecdf") = 0; -m_boundfix(vm_land_other,(j,ac_sub,othertype35),l,1e-6); +vm_land_other.up(j,"othernat",ac_sub) = pc35_land_other(j,"othernat",ac_sub); +vm_land_other.up(j,"youngsecdf",ac_sub) = pc35_land_other(j,"youngsecdf",ac_sub); +vm_land_other.fx(j,"youngsecdf",ac_est) = 0; +m_boundfix(vm_land_other,(j,othertype35,ac_sub),l,1e-6); * Other land conservation * protection bound fix -pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_land_other(j,ac_sub,"othernat"))) < 1e-6) = sum(ac_sub, pc35_land_other(j,ac_sub,"othernat")); +pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_land_other(j,"othernat",ac_sub))) < 1e-6) = sum(ac_sub, pc35_land_other(j,"othernat",ac_sub)); * set restoration target p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); * Do not restore other land in areas where total natural @@ -195,8 +195,8 @@ vm_land.lo(j,"other") = pm_land_conservation(t,j,"other","protect") + p35_land_r * Calculate carbon density * ------------------------------ -p35_carbon_density_other(t,j,ac,"othernat",ag_pools) = pm_carbon_density_other_ac(t,j,ac,ag_pools); -p35_carbon_density_other(t,j,ac,"youngsecdf",ag_pools) = pm_carbon_density_secdforest_ac(t,j,ac,ag_pools); +p35_carbon_density_other(t,j,"othernat",ac,ag_pools) = pm_carbon_density_other_ac(t,j,ac,ag_pools); +p35_carbon_density_other(t,j,"youngsecdf",ac,ag_pools) = pm_carbon_density_secdforest_ac(t,j,ac,ag_pools); * ---------------------------- * NPI/NDC protection policy @@ -208,18 +208,18 @@ p35_min_other(t,j)$(p35_min_other(t,j) > pcm_land(j,"other")) = pcm_land(j,"othe ** Youngest age classes are not allowed to be harvested v35_hvarea_secdforest.fx(j,ac_est) = 0; -v35_hvarea_other.fx(j,ac_est,othertype35) = 0; +v35_hvarea_other.fx(j,othertype35,ac_est) = 0; v35_secdforest_reduction.fx(j,ac_est) = 0; -v35_other_reduction.fx(j,ac_est,othertype35) = 0; +v35_other_reduction.fx(j,othertype35,ac_est) = 0; vm_prod_natveg.fx(j,"other","wood") = 0; if(s35_hvarea = 0, v35_hvarea_secdforest.fx(j,ac_sub) = 0; v35_hvarea_primforest.fx(j) = 0; - v35_hvarea_other.fx(j,ac_sub,othertype35) = 0; + v35_hvarea_other.fx(j,othertype35,ac_sub) = 0; elseif s35_hvarea = 1, v35_hvarea_secdforest.fx(j,ac_sub) = (v35_secdforest.l(j,ac_sub) - v35_secdforest.lo(j,ac_sub))*s35_hvarea_secdforest*m_timestep_length_forestry; v35_hvarea_primforest.fx(j) = (vm_land.l(j,"primforest") - vm_land.lo(j,"primforest"))*s35_hvarea_primforest*m_timestep_length_forestry; - v35_hvarea_other.fx(j,ac_sub,othertype35) = (vm_land_other.l(j,ac_sub,othertype35) - vm_land_other.lo(j,ac_sub,othertype35))*s35_hvarea_other*m_timestep_length_forestry; + v35_hvarea_other.fx(j,othertype35,ac_sub) = (vm_land_other.l(j,othertype35,ac_sub) - vm_land_other.lo(j,othertype35,ac_sub))*s35_hvarea_other*m_timestep_length_forestry; ); diff --git a/modules/59_som/static_jan19/equations.gms b/modules/59_som/static_jan19/equations.gms index e2217bbe37..2d77aa7917 100644 --- a/modules/59_som/static_jan19/equations.gms +++ b/modules/59_som/static_jan19/equations.gms @@ -19,8 +19,8 @@ q59_soilcarbon_other(j2,stockType) .. vm_carbon_stock(j2,"other","soilc",stockType) =e= - sum((ct,ac), vm_land_other(j2,ac,"othernat") * fm_carbon_density(ct,j2,"other","soilc")) - + sum((ct,ac), vm_land_other(j2,ac,"youngsecdf") * fm_carbon_density(ct,j2,"secdforest","soilc")) ; + sum((ct,ac), vm_land_other(j2,"othernat",ac) * fm_carbon_density(ct,j2,"other","soilc")) + + sum((ct,ac), vm_land_other(j2,"youngsecdf",ac) * fm_carbon_density(ct,j2,"secdforest","soilc")) ; From 147dcf2f0070e0610fd046557fdeb9520e39ea72 Mon Sep 17 00:00:00 2001 From: David Hoetten Date: Mon, 27 May 2024 14:07:31 +0200 Subject: [PATCH 196/280] added output report with corresponding r markdown --- scripts/output/projects/MAgPIE_EU_report.R | 3 + .../projects/MAgPIE_EU_report_notebook.Rmd | 249 ++++++++++++++++++ 2 files changed, 252 insertions(+) create mode 100644 scripts/output/projects/MAgPIE_EU_report.R create mode 100644 scripts/output/projects/MAgPIE_EU_report_notebook.Rmd diff --git a/scripts/output/projects/MAgPIE_EU_report.R b/scripts/output/projects/MAgPIE_EU_report.R new file mode 100644 index 0000000000..dae269932a --- /dev/null +++ b/scripts/output/projects/MAgPIE_EU_report.R @@ -0,0 +1,3 @@ +readArgs("outputdir") +rmarkdown::render("./scripts/output/projects/MAgPIE_EU_report_notebook.Rmd", + output_dir = paste0(outputdir, "/validation")) diff --git a/scripts/output/projects/MAgPIE_EU_report_notebook.Rmd b/scripts/output/projects/MAgPIE_EU_report_notebook.Rmd new file mode 100644 index 0000000000..3af76a13c7 --- /dev/null +++ b/scripts/output/projects/MAgPIE_EU_report_notebook.Rmd @@ -0,0 +1,249 @@ +--- +title: "Compare MAgPIE EU with LUH Data" +output: + html_document: + df_print: paged + code_folding: hide +--- + + +This output report validates spatial pattern of the EU regions against LUH2v2 data. + +# Setup and read data +```{r, setup, include=FALSE} +knitr::opts_knit$set(root.dir = dirname(dirname(dirname(getwd())))) +``` + +```{r load-libraries, echo = T, results = 'hide', message=FALSE, warning=FALSE} +# setup working dir and packages, read outputdir +readArgs("outputdir") +library(madrat) +library(mrcommons) +library(magpie4) + +library(ggplot2) +library(plotly) +library(gridExtra) +library(patchwork) + +library(dplyr) +library(tidyr) +library(stringr) +``` + +```{r} +print(paste0("Script started for output directory: ", outputdir)) +``` + +```{r read-data, echo = T, results = 'hide', message = FALSE, warning = FALSE} +compareYears <- c(1995, 2000, 2005, 2010) +# ----- Read model output and luh2v2 data, process and bind them to a validation object ----- +#### load and process reference data to match with model data +luh2v2 <- calcOutput("LanduseInitialisation", aggregate = FALSE, cellular = TRUE, + nclasses = "seven", cells = "lpjmlcell") +luh2v2 <- luh2v2[, compareYears, ] +# add subdimension for reference data +getNames(luh2v2) <- paste0(getNames(luh2v2), ".ref") + +#### load and process model data to match with reference data +path2landoutput <- file.path(outputdir, "cell.land_0.5.mz") +cellLand <- read.magpie(path2landoutput) +cellLand <- cellLand[, compareYears, ] +# add subdimension for model data +getNames(cellLand) <- paste0(getNames(cellLand), ".mod") +load(file.path(outputdir, "spatial_header.rda")) + +##### bind model and reference data +validationObj <- mbind(cellLand, luh2v2) + +##### extract EU countries +mapping <- toolGetMapping("regionmappingH12.csv") +countriesEU <- mapping$CountryCode[mapping$RegionCode == "EUR"] +``` + + +# Plot data + +```{r, load-plot-functions, echo = T, results = 'hide'} +# ----- Create a plotting functions ----- +convertToWideDataframe <- function(magclassObj) { + as.data.frame(magclassObj) %>% + pivot_wider(names_from = "Data2", values_from = "Value") +} + +subsetCountryCluster <- function(magclassObj, countries) { + magclassObj[intersect(countries, getItems(magclassObj, split=TRUE)[[1]][[1]]), , ] +} + +# combines a scatter plot with maps such that facets are aligned +plotCombined <- function(validationObj) { + # create the plots + p1 <- plotScatter(validationObj) + p2 <- plotMaps(validationObj) + + # combine and align the plots using patchwork + combinedPlot <- p1 / p2 + + # print the combined plot + print(combinedPlot) +} + +# create scatter plot +plotScatter <- function(validationObj) { + validationObj <- toolCoord2Isocell(validationObj, "lpjcell") + validationObj <- subsetCountryCluster(validationObj, countriesEU) + + ### Create quality measure dataframe with RMSE, MAE a.o. + qualityMeasuresDf <- NULL # list of dataframes, one for each year + numericYears <- as.numeric(gsub("y", "", getItems(validationObj, 2))) + for (year in numericYears) { + # get a vector with the quality measures + qualityMeasures <- luplot::qualityMeasure( + validationObj[, year, "mod"], validationObj[, year, "ref"], + measures = c("Willmott", "Willmott refined", "Nash Sutcliffe", "RMSE", "MAE") + ) + + # Create text for the year facet + text <- "" + for (i in seq_along(qualityMeasures)) { + text <- paste0(text, stringr::str_trunc(names(qualityMeasures)[i], 12, ellipsis = "."), + " : ", qualityMeasures[i], "\n") + } + + # Create df for that year + qualityMeasuresDf[[year]] <- data.frame( + Year = year, + text = text + ) + } + qualityMeasBinded <- dplyr::bind_rows(qualityMeasuresDf) # bind all year dataframes + + # Create the plot with facets + validationDF <- convertToWideDataframe(validationObj) + + p <- ggplot(validationDF, + aes(x = mod, y = ref, reg = Region, cell = Cell, relativeErr = (mod - ref) / ref)) + + geom_point(size = 0.5) + + geom_abline(color = "#663939", size = 1.5) + + facet_wrap(~ Year, scales = "free", ncol = 4) + # Create facets based on 'Year' + labs(x = "MAgPIE output", y = "luh2v2") + + theme(panel.background = element_rect(fill = "gray55"), + panel.grid.major = element_line(color = "gray62"), + panel.grid.minor = element_line(color = "grey58")) + + # Add quality measure text + p <- p + geom_text(x = 0, y = Inf, aes(label = text), color = "#ffb5b5", # bright color contrasting dark background + hjust = 0, vjust = 1.1, nudge_x = 10, size = 2.6, family = "sans", fontface = "bold", + data = qualityMeasBinded, inherit.aes = FALSE) + + return(p) +} + +# create maps +plotMaps <- function(validationObj) { + # create a ggplot object using luplot + relErr <- (validationObj[, , paste0("mod")] - validationObj[, , paste0("ref")]) / + (validationObj[, , paste0("ref")]) + + p <- luplot::plotmap2(relErr, + legend_range = c(-2, 2), legendname = "relative\n diff \n to \n LUH2v2", ncol = 4, + midcol = "#ffffff", lowcol = "blue", highcol = "red", midpoint = 0, + title = "" + ) + + # adjust the plot + p <- p + coord_sf(xlim = c(-10, 40), ylim = c(35, 70)) + facet_wrap(~ Year, ncol = 4) + + theme(aspect.ratio = 1, legend.title = element_text(size = 8)) + + p <- p + guides(fill = guide_colorbar(barheight = 5, barwidth = 0.2)) + return(p) +} + +# create and interactive scatterplot for eu countries of a year +plotInteractiveSub <- function(validationObj, year) { + p <- plotScatter(validationObj[, year, ]) + + p <- p + ggtitle(paste0("EU Countries ", year)) + p <- plotly::ggplotly(p) + p +} +``` + +## crop +```{r crop,message=FALSE, warning=FALSE, out.width="100%"} +type <- "crop" +plotCombined(validationObj[, , type]) +``` + +```{r crop2, message=FALSE, warning=FALSE, fig.align="center"} +plotInteractiveSub(validationObj[, , type], 2010) +``` + +## pasture +```{r past,message=FALSE, warning=FALSE, out.width="100%"} +type <- "past" +plotCombined(validationObj[, , type]) +``` + +```{r past2, message=FALSE, warning=FALSE, fig.align="center"} +plotInteractiveSub(validationObj[, , type], 2010) +``` + +## forestry +```{r forestry,message=FALSE, warning=FALSE, out.width="100%"} +type <- "forestry" +plotCombined(validationObj[, , type]) +``` + +```{r forestry2, message=FALSE, warning=FALSE, fig.align="center"} +plotInteractiveSub(validationObj[, , type], 2010) +``` + +## primforest +```{r primforest,message=FALSE, warning=FALSE, out.width="100%"} +type <- "primforest" +plotCombined(validationObj[, , type]) +``` + +```{r primforest2, message=FALSE, warning=FALSE, fig.align="center"} +plotInteractiveSub(validationObj[, , type], 2010) +``` + +## secdforest +```{r secdforest,message=FALSE, warning=FALSE, out.width="100%"} +type <- "secdforest" +plotCombined(validationObj[, , type]) +``` + +```{r secdforest2, message=FALSE, warning=FALSE, fig.align="center"} +plotInteractiveSub(validationObj[, , type], 2010) +``` + +## urban + +```{r urban,message=FALSE, warning=FALSE, out.width="100%"} +type <- "urban" +plotCombined(validationObj[, , type]) +``` + +```{r urban2, message=FALSE, warning=FALSE, fig.align="center"} +plotInteractiveSub(validationObj[, , type], 2010) +``` + +## other +```{r other, message=FALSE, warning=FALSE, out.width="100%"} +type <- "other" +plotCombined(validationObj[, , type]) +``` + +```{r other2, message=FALSE, warning=FALSE, fig.align="center"} +plotInteractiveSub(validationObj[, , type], 2010) +``` From eec7b46dd0e8e8c6bcd7386e7ea6310a8a748faf Mon Sep 17 00:00:00 2001 From: David Hoetten Date: Mon, 27 May 2024 14:57:33 +0200 Subject: [PATCH 197/280] renamed report --- scripts/output/projects/{MAgPIE_EU_report.R => EU_report.R} | 2 +- .../projects/{MAgPIE_EU_report_notebook.Rmd => EU_report.Rmd} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename scripts/output/projects/{MAgPIE_EU_report.R => EU_report.R} (53%) rename scripts/output/projects/{MAgPIE_EU_report_notebook.Rmd => EU_report.Rmd} (100%) diff --git a/scripts/output/projects/MAgPIE_EU_report.R b/scripts/output/projects/EU_report.R similarity index 53% rename from scripts/output/projects/MAgPIE_EU_report.R rename to scripts/output/projects/EU_report.R index dae269932a..d8b2126a24 100644 --- a/scripts/output/projects/MAgPIE_EU_report.R +++ b/scripts/output/projects/EU_report.R @@ -1,3 +1,3 @@ readArgs("outputdir") -rmarkdown::render("./scripts/output/projects/MAgPIE_EU_report_notebook.Rmd", +rmarkdown::render("./scripts/output/projects/EU_report.Rmd", output_dir = paste0(outputdir, "/validation")) diff --git a/scripts/output/projects/MAgPIE_EU_report_notebook.Rmd b/scripts/output/projects/EU_report.Rmd similarity index 100% rename from scripts/output/projects/MAgPIE_EU_report_notebook.Rmd rename to scripts/output/projects/EU_report.Rmd From 8b0fe3bda3a0abb1f5550ee5e7a7bf6a73d09da8 Mon Sep 17 00:00:00 2001 From: David Hoetten Date: Mon, 27 May 2024 14:59:14 +0200 Subject: [PATCH 198/280] added changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b558901db8..6690fd6cda 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **35_natveg** `vm_land(j2,"forestry")` included in NPI/NDC constraint `q35_min_forest` ### added +- **scripts** added Magpie EU report `EU_report.R` that uses `EU_report.Rmd` - **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` - **default.cfg** added technical cost for missing BII increase `cfg$gms$s44_cost_bii_missing` - **default.cfg** added settings for new price-driven bioenergy realization `1st2ndgen_priced_feb24`: `cfg$gms$s60_2ndgen_bioenergy_dem_min_post_fix`, `cfg$gms$c60_bioenergy_subsidy_fix_SSP2`, `s60_bioenergy_gj_price_1st`, From 48917e7c6319cbbe93465c6197648be6fb84dc38 Mon Sep 17 00:00:00 2001 From: DavidhoPIK <101278418+DavidhoPIK@users.noreply.github.com> Date: Mon, 27 May 2024 15:05:10 +0200 Subject: [PATCH 199/280] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6690fd6cda..457320063d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **35_natveg** `vm_land(j2,"forestry")` included in NPI/NDC constraint `q35_min_forest` ### added -- **scripts** added Magpie EU report `EU_report.R` that uses `EU_report.Rmd` +- **scripts** added output report `EU_report.R` that uses `EU_report.Rmd` - **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` - **default.cfg** added technical cost for missing BII increase `cfg$gms$s44_cost_bii_missing` - **default.cfg** added settings for new price-driven bioenergy realization `1st2ndgen_priced_feb24`: `cfg$gms$s60_2ndgen_bioenergy_dem_min_post_fix`, `cfg$gms$c60_bioenergy_subsidy_fix_SSP2`, `s60_bioenergy_gj_price_1st`, From 43d3496c3c36aaa9d452e2a7cf976414ded76262 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Mon, 27 May 2024 15:12:10 +0200 Subject: [PATCH 200/280] redefined p35_forest_recovery_area to improve reporting --- .../pot_forest_may24/declarations.gms | 5 +-- .../35_natveg/pot_forest_may24/presolve.gms | 31 +++++++++++-------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index ff509557ed..eb6882d1d7 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -19,11 +19,12 @@ parameters p35_min_forest(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_damage_fader(t_all) Fader for forest damage (1) - p35_forest_recovery_shr(j) Forest share in natveg recovery (1) + p35_forestry_abandon_area(j) Abandoned forestry area (mio. ha) + pc35_forest_recovery_shr(j) Forest share in natveg recovery (1) p35_forest_recovery_area(t,j,ac) Recovered forest (mio. ha) p35_maturesecdf(t,j,ac) Matured secondary forest (mio. ha) pcm_max_forest_est(j) Overall forest establishment potential in current time step (mio. ha) - p35_max_forest_recovery(j) Maximum forest recovery potential after land abandonement (mio. ha) + pc35_max_forest_recovery(j) Maximum forest recovery potential after land abandonement (mio. ha) p35_carbon_density_other(t,j,othertype35,ac,ag_pools) Carbon density other land (tC per ha) p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) p35_disturbance_loss_primf(t,j) Loss due to disturbances in primary forest (mio. ha) diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index a9647b2fb6..bbb3a48e35 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -44,20 +44,25 @@ vm_land.l(j,"primforest") = pcm_land(j,"primforest"); * Calculate area of secondary forest recovery * ------------------------------------------------- +*** Calculate the upper boundary for secondary forest recovery +pc35_max_forest_recovery(j) = pcm_max_forest_est(j) - sum(ac_sub, pc35_land_other(j,"youngsecdf",ac_sub)); + *** Distribute forestry abandonement -* Abandoned forestry is directly shifted into pc35_land_other(j,"youngsecdf",ac_est) because it is +* Abandoned forestry is directly shifted into p35_forest_recovery_area(t,j,ac_est) because it is * assumed that forestry was located in areas suitable to grow forests. -pc35_land_other(j,"youngsecdf",ac_est) = vm_lu_transitions.l(j,"forestry","other")/card(ac_est2); -pc35_land_other(j,"youngsecdf",ac_est)$(sum(ac_est2,pc35_land_other(j,"youngsecdf",ac_est2)) > pcm_max_forest_est(j)) = pcm_max_forest_est(j)/card(ac_est2); - -* The proportion of secondary forest recovery in total natveg recovery is derived -* from the remaining forest recovery area -p35_max_forest_recovery(j) = pcm_max_forest_est(j) - sum(ac, pc35_land_other(j,"youngsecdf",ac)); -p35_forest_recovery_shr(j) = p35_max_forest_recovery(j) / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")+1e-10); -p35_forest_recovery_shr(j)$(p35_forest_recovery_shr(j) > 1) = 1; -* Abandoned land pc35_land_other(j,"othernat",ac_est) is then distributed proportionally using the forest recovery share. -p35_forest_recovery_area(t,j,ac_est) = pc35_land_other(j,"othernat",ac_est) * p35_forest_recovery_shr(j); -p35_forest_recovery_area(t,j,ac_est)$(sum(ac_est2,p35_forest_recovery_area(t,j,ac_est2)) > p35_max_forest_recovery(j)) = p35_max_forest_recovery(j)/card(ac_est2); +p35_forest_recovery_area(t,j,ac_est) = vm_lu_transitions.l(j,"forestry","other")/card(ac_est2); +p35_forest_recovery_area(t,j,ac_est)$(sum(ac_est2, p35_forest_recovery_area(t,j,ac_est2)) > pc35_max_forest_recovery(j)) = pc35_max_forest_recovery(j)/card(ac_est2); + +* The proportion of secondary forest recovery in total natveg +* recovery is derived from the remaining forest recovery area +pc35_max_forest_recovery(j) = pc35_max_forest_recovery(j) - sum(ac_est, p35_forest_recovery_area(t,j,ac_est)); +pc35_forest_recovery_shr(j) = pc35_max_forest_recovery(j) / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")+1e-10); +pc35_forest_recovery_shr(j)$(pc35_forest_recovery_shr(j) > 1) = 1; +* Abandoned land pc35_land_other(j,"othernat",ac_est) that has not yet been allocated to +* p35_forest_recovery_area(t,j,ac_est) is then distributed proportionally using the forest recovery share. +p35_forest_recovery_area(t,j,ac_est) = p35_forest_recovery_area(t,j,ac_est) + + (pc35_land_other(j,"othernat",ac_est) - p35_forest_recovery_area(t,j,ac_est)) + * pc35_forest_recovery_shr(j); pc35_land_other(j,"othernat",ac_est) = pc35_land_other(j,"othernat",ac_est) - p35_forest_recovery_area(t,j,ac_est); pc35_land_other(j,"youngsecdf",ac_est) = pc35_land_other(j,"youngsecdf",ac_est) + p35_forest_recovery_area(t,j,ac_est); @@ -159,7 +164,7 @@ p35_land_restoration(j,"secdforest")$(sum(land_natveg, pcm_land(j,land_natveg)) * Since forest restoration cannot be bigger than the potential area for secdforest recovery, * any remaining restoration area is substracted and shifted to other land restoration. -p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - p35_max_forest_recovery(j); +p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - pc35_max_forest_recovery(j); p35_restoration_shift(j)$(p35_restoration_shift(j) < 0) = 0; p35_land_restoration(j,"secdforest") = p35_land_restoration(j,"secdforest") - p35_restoration_shift(j); pm_land_conservation(t,j,"other","restore") = pm_land_conservation(t,j,"other","restore") + p35_restoration_shift(j); From 74fd1a80e37b5659958c7451b93a1aa533d0de40 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Mon, 27 May 2024 15:21:21 +0200 Subject: [PATCH 201/280] parameter not needed --- modules/35_natveg/pot_forest_may24/declarations.gms | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index eb6882d1d7..e440e3a270 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -19,12 +19,11 @@ parameters p35_min_forest(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha) p35_damage_fader(t_all) Fader for forest damage (1) - p35_forestry_abandon_area(j) Abandoned forestry area (mio. ha) - pc35_forest_recovery_shr(j) Forest share in natveg recovery (1) + pc35_forest_recovery_shr(j) Forest share in natveg recovery (1) p35_forest_recovery_area(t,j,ac) Recovered forest (mio. ha) p35_maturesecdf(t,j,ac) Matured secondary forest (mio. ha) pcm_max_forest_est(j) Overall forest establishment potential in current time step (mio. ha) - pc35_max_forest_recovery(j) Maximum forest recovery potential after land abandonement (mio. ha) + pc35_max_forest_recovery(j) Maximum forest recovery potential after land abandonement (mio. ha) p35_carbon_density_other(t,j,othertype35,ac,ag_pools) Carbon density other land (tC per ha) p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) p35_disturbance_loss_primf(t,j) Loss due to disturbances in primary forest (mio. ha) From b846b240b317d445b787d84b3f81c24e98fede85 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Mon, 27 May 2024 16:03:10 +0200 Subject: [PATCH 202/280] max forest recovery fix --- modules/35_natveg/pot_forest_may24/presolve.gms | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index bbb3a48e35..8d2ac2ede8 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -45,7 +45,7 @@ vm_land.l(j,"primforest") = pcm_land(j,"primforest"); * ------------------------------------------------- *** Calculate the upper boundary for secondary forest recovery -pc35_max_forest_recovery(j) = pcm_max_forest_est(j) - sum(ac_sub, pc35_land_other(j,"youngsecdf",ac_sub)); +pc35_max_forest_recovery(j) = pcm_max_forest_est(j) - sum(ac, pc35_land_other(j,"youngsecdf",ac)); *** Distribute forestry abandonement * Abandoned forestry is directly shifted into p35_forest_recovery_area(t,j,ac_est) because it is @@ -55,14 +55,15 @@ p35_forest_recovery_area(t,j,ac_est)$(sum(ac_est2, p35_forest_recovery_area(t,j, * The proportion of secondary forest recovery in total natveg * recovery is derived from the remaining forest recovery area -pc35_max_forest_recovery(j) = pc35_max_forest_recovery(j) - sum(ac_est, p35_forest_recovery_area(t,j,ac_est)); -pc35_forest_recovery_shr(j) = pc35_max_forest_recovery(j) / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")+1e-10); +pc35_forest_recovery_shr(j) = (pc35_max_forest_recovery(j) - sum(ac_est, p35_forest_recovery_area(t,j,ac_est))) + / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")+1e-10); pc35_forest_recovery_shr(j)$(pc35_forest_recovery_shr(j) > 1) = 1; * Abandoned land pc35_land_other(j,"othernat",ac_est) that has not yet been allocated to * p35_forest_recovery_area(t,j,ac_est) is then distributed proportionally using the forest recovery share. p35_forest_recovery_area(t,j,ac_est) = p35_forest_recovery_area(t,j,ac_est) + (pc35_land_other(j,"othernat",ac_est) - p35_forest_recovery_area(t,j,ac_est)) * pc35_forest_recovery_shr(j); +p35_forest_recovery_area(t,j,ac_est)$(sum(ac_est2, p35_forest_recovery_area(t,j,ac_est2)) > pc35_max_forest_recovery(j)) = pc35_max_forest_recovery(j)/card(ac_est2); pc35_land_other(j,"othernat",ac_est) = pc35_land_other(j,"othernat",ac_est) - p35_forest_recovery_area(t,j,ac_est); pc35_land_other(j,"youngsecdf",ac_est) = pc35_land_other(j,"youngsecdf",ac_est) + p35_forest_recovery_area(t,j,ac_est); From 94ab66ac512ac0ce100db996e5f9413033ccb4b1 Mon Sep 17 00:00:00 2001 From: DavidhoPIK <101278418+DavidhoPIK@users.noreply.github.com> Date: Tue, 28 May 2024 10:42:45 +0200 Subject: [PATCH 203/280] Minor update of comment in EU_report.Rmd --- scripts/output/projects/EU_report.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/output/projects/EU_report.Rmd b/scripts/output/projects/EU_report.Rmd index 3af76a13c7..88afd2d1ad 100644 --- a/scripts/output/projects/EU_report.Rmd +++ b/scripts/output/projects/EU_report.Rmd @@ -6,7 +6,7 @@ output: code_folding: hide --- + This output report validates spatial pattern of the EU regions against LUH2v2 data. -# Setup and read data +# Setup data and plot functions ```{r, setup, include=FALSE} knitr::opts_knit$set(root.dir = dirname(dirname(dirname(getwd())))) ``` @@ -45,15 +47,15 @@ print(paste0("Script started for output directory: ", outputdir)) ```{r read-data, echo = T, results = 'hide', message = FALSE, warning = FALSE} compareYears <- c(1995, 2000, 2005, 2010) -# ----- Read model output and luh2v2 data, process and bind them to a validation object ----- -#### load and process reference data to match with model data +# ----- Read and process model output and luh2v2 data; then bind data to a validation object ----- +# load and process reference data to match with model data luh2v2 <- calcOutput("LanduseInitialisation", aggregate = FALSE, cellular = TRUE, nclasses = "seven", cells = "lpjmlcell") luh2v2 <- luh2v2[, compareYears, ] # add subdimension for reference data getNames(luh2v2) <- paste0(getNames(luh2v2), ".ref") -#### load and process model data to match with reference data +# load and process model data to match with reference data path2landoutput <- file.path(outputdir, "cell.land_0.5.mz") cellLand <- read.magpie(path2landoutput) cellLand <- cellLand[, compareYears, ] @@ -61,29 +63,28 @@ cellLand <- cellLand[, compareYears, ] getNames(cellLand) <- paste0(getNames(cellLand), ".mod") load(file.path(outputdir, "spatial_header.rda")) -##### bind model and reference data +# bind model and reference data validationObj <- mbind(cellLand, luh2v2) -##### extract EU countries +# get EU countries mapping <- toolGetMapping("regionmappingH12.csv") countriesEU <- mapping$CountryCode[mapping$RegionCode == "EUR"] ``` - -# Plot data - ```{r, load-plot-functions, echo = T, results = 'hide'} # ----- Create a plotting functions ----- +# helper function to convert magclass obj to wide dataframe convertToWideDataframe <- function(magclassObj) { as.data.frame(magclassObj) %>% pivot_wider(names_from = "Data2", values_from = "Value") } +# helper function to subset all cluster of a country subsetCountryCluster <- function(magclassObj, countries) { magclassObj[intersect(countries, getItems(magclassObj, split=TRUE)[[1]][[1]]), , ] } -# combines a scatter plot with maps such that facets are aligned +# function combines a scatter plot with maps such that facets are aligned plotCombined <- function(validationObj) { # create the plots p1 <- plotScatter(validationObj) @@ -96,12 +97,12 @@ plotCombined <- function(validationObj) { print(combinedPlot) } -# create scatter plot +# create scatter plot for eu countries faceted by year plotScatter <- function(validationObj) { validationObj <- toolCoord2Isocell(validationObj, "lpjcell") validationObj <- subsetCountryCluster(validationObj, countriesEU) - ### Create quality measure dataframe with RMSE, MAE a.o. + # create quality measure dataframe with RMSE, MAE a.o. qualityMeasuresDf <- NULL # list of dataframes, one for each year numericYears <- as.numeric(gsub("y", "", getItems(validationObj, 2))) for (year in numericYears) { @@ -111,14 +112,14 @@ plotScatter <- function(validationObj) { measures = c("Willmott", "Willmott refined", "Nash Sutcliffe", "RMSE", "MAE") ) - # Create text for the year facet + # create text for the year facet text <- "" for (i in seq_along(qualityMeasures)) { text <- paste0(text, stringr::str_trunc(names(qualityMeasures)[i], 12, ellipsis = "."), " : ", qualityMeasures[i], "\n") } - # Create df for that year + # create dataframe for that year qualityMeasuresDf[[year]] <- data.frame( Year = year, text = text @@ -126,7 +127,7 @@ plotScatter <- function(validationObj) { } qualityMeasBinded <- dplyr::bind_rows(qualityMeasuresDf) # bind all year dataframes - # Create the plot with facets + # create the plot with facets validationDF <- convertToWideDataframe(validationObj) p <- ggplot(validationDF, @@ -139,7 +140,7 @@ plotScatter <- function(validationObj) { panel.grid.major = element_line(color = "gray62"), panel.grid.minor = element_line(color = "grey58")) - # Add quality measure text + # add quality measure text p <- p + geom_text(x = 0, y = Inf, aes(label = text), color = "#ffb5b5", # bright color contrasting dark background hjust = 0, vjust = 1.1, nudge_x = 10, size = 2.6, family = "sans", fontface = "bold", data = qualityMeasBinded, inherit.aes = FALSE) @@ -147,7 +148,7 @@ plotScatter <- function(validationObj) { return(p) } -# create maps +# create EU maps faceted by year plotMaps <- function(validationObj) { # create a ggplot object using luplot relErr <- (validationObj[, , paste0("mod")] - validationObj[, , paste0("ref")]) / @@ -167,16 +168,17 @@ plotMaps <- function(validationObj) { return(p) } -# create and interactive scatterplot for eu countries of a year +# create an interactive scatterplot for eu countries of a year plotInteractiveSub <- function(validationObj, year) { p <- plotScatter(validationObj[, year, ]) - p <- p + ggtitle(paste0("EU Countries ", year)) p <- plotly::ggplotly(p) - p + return(p) } ``` +# Plot data + ## crop ```{r crop,message=FALSE, warning=FALSE, out.width="100%"} type <- "crop" From 01fa7a3ebce0551d2d8b96e210f590387da97e5a Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 28 May 2024 18:30:55 +0200 Subject: [PATCH 205/280] merged solve conflict in scenario config --- config/scenario_config.csv | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/config/scenario_config.csv b/config/scenario_config.csv index ddfa0d2589..131070f9a1 100755 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -1,10 +1,12 @@ ;cc;nocc;nocc_hist;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SDP;SDP-EI;SDP-RC;SDP-MC;BASE;NPI;NDC;coupling;emulator;input;Tland;eat_lancet_diet;EL2_PHD;EL2_Demand;EL2_default;LAMA_Inequal;LAMA_Inequal-SustDemand;LAMA_Inequal-EnvirProt;LAMA_Inequal-GHGPrice;LAMA_Sustainability;NAVIGATE_AllOff;NAVIGATE_LandSup;NAVIGATE_LandDem;NAVIGATE_AllOn;ForestryEndo;ForestryExo;ForestryOff;frst_shock_none;frst_shock_002lin2030;frst_shock_004lin2030;frst_shock_008lin2030;frst_shock_016lin2030;rcp1p9;rcp2p6;rcp4p5;rcp6p0;rcp7p0;rcp8p5;NGFS_o_lowdem;GENIE_SCP +gms$c_timesteps;;;;;;;;;;;;;;;;;less_TS;less_TS;;;;;;;5year;5year;5year;5year;5year;;;;;;;;;;;;;;;;;;;;coup2110 gms$c09_pop_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SSP1;SSP1;SSP1;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;; gms$c09_gdp_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SDP_EI;SDP_RC;SDP_MC;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;; gms$c09_pal_scenario;;;;SSP1;SSP2;SSP2EU;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;;SDP;SDP;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;; gms$s12_interest_lic;;;;;;;;;;;;;;;;;;;;;;0.06;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s12_interest_hic;;;;;;;;;;;;;;;;;;;;;;0.04;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c13_tccost;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;high +gms$c14_yields_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;;nocc gms$food;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;anthropometrics_jan18 gms$c15_food_scenario;;;;SSP1;SSP2;SSP2;SSP3;SSP4;SSP5;SSP1;SSP2;SSP1;SSP1;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;SSP2; gms$c15_food_scenario_noselect;;;;;;;;;;;;;;;;;;;;;;;;;SSP4;SSP1;SSP4;SSP4;SSP1;;;;;;;;;;;;;;;;;;;SSP2; @@ -46,7 +48,7 @@ gms$s30_snv_scenario_target;;;;;;;;;;;;;2030;;;;;;;;;;;;2030;2030;2030;2030;2030 gms$s30_annual_max_growth;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0.02 gms$c31_grassl_yld_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c32_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;; -gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;4;4;0;;;;;;;;;;;;; +gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;;;;;; gms$s32_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;1;0;;;;;;;;;;;;; gms$s32_aff_plantation;;;;0;0;0;0;0;0;0;1;0;0;;;;;;;0;;;;0;;;;;;;;;;;;;;;;;;;;;;;;; gms$s32_aff_bii_coeff;;;;0;0;0;0;0;0;0;1;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -58,19 +60,23 @@ gms$s32_planing_horizon;;;;50;50;50;50;50;50;50;30;50;50;;;;;;;50;;;;;;;;;;;;;;; gms$c35_ad_policy;;;;;;;;;;;;;;none;npi;ndc;;;;;;;;;ndc;ndc;ndc;ndc;ndc;;;;;;;;;;;;;;;;;;;; gms$c35_aolc_policy;;;;;;;;;;;;;;none;npi;ndc;;;;;;;;;ndc;ndc;ndc;ndc;ndc;;;;;;;;;;;;;;;;;;;; gms$s35_forest_damage_end;;;;2030;2050;2050;2050;2050;2030;2030;2030;2030;2030;;;;;;;2030;;;;;2030;2030;2030;2030;2030;;;;;;;;;;;;;;;;;;;; -gms$s35_secdf_distribution;;;;;;;;;;;;;;;;;;;;;;;;;0;0;0;0;0;;;;;0;0;0;;;;;;;;;;;;; -gms$s35_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;;;; gms$c35_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;; gms$s35_forest_damage;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;;;; +gms$s35_secdf_distribution;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;;;; +gms$s35_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;;;; gms$factor_costs;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sticky_feb18 +gms$c42_watdem_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; gms$s42_watdem_nonagr_scenario;;;;1;2;2;3;2;1;1;1;3;1;;;;;;;;;;;;2;1;2;2;1;;;;;;;;;;;;;;;;;;;; gms$s42_irrig_eff_scenario;;;;2;2;2;2;2;2;3;3;3;3;;;;;;;3;;;;;3;3;3;3;3;;;;;;;;;;;;;;;;;;;; gms$c42_env_flow_policy;;;;on;off;off;off;mixed;on;on;on;on;on;;;;;;;on;;;;;on;on;on;on;on;;;;;;;;;;;;;;;;;;;; gms$s42_efp_targetyear;;;;2040;2040;2040;2040;2040;2040;2040;2050;2070;2050;;;;;;;2040;;;;;2040;2040;2040;2040;2040;;;;;;;;;;;;;;;;;;;; +gms$c43_watavail_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; gms$s44_target_price;;;;0;0;0;0;0;0;0;0;0;0;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s44_cost_bii_missing;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;10000000 gms$c50_scen_neff;;;;baseeff_add3_add10_add20_max75;baseeff_add3_add5_add10_max65;baseeff_add3_add5_add10_max65;baseeff_add3_add0_add0_max55;baseeff_add3_add10_add15_max75;baseeff_add3_add5_add15_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max65;baseeff_add3_add15_add25_max75;;;;;;;baseeff_add3_add15_add25_max75;;;;;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;;;;;;;;;;;;;;;;;;;; gms$c50_scen_neff_noselect;;;;baseeff_add3_add10_add20_max75;baseeff_add3_add5_add10_max65;baseeff_add3_add5_add10_max65;baseeff_add3_add0_add0_max55;baseeff_add3_add10_add15_max75;baseeff_add3_add5_add15_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max75;baseeff_add3_add15_add25_max65;baseeff_add3_add15_add25_max75;;;;;;;baseeff_add3_add15_add25_max75;;;;;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;baseeff_add3_add10_add15_max75;;;;;;;;;;;;;;;;;;;; +gms$c52_carbon_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; +gms$c52_land_carbon_sink_rcp;;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;RCP19;RCP26;RCP45;RCP60;RCPBU;RCPBU;; gms$c55_scen_conf;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;ssp1;ssp1;ssp1;ssp1;;;;;;;ssp1;;;;;ssp1;ssp1;ssp1;ssp1;ssp1;;;;;;;;;;;;;;;;;;;; gms$c55_scen_conf_noselect;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;ssp1;ssp1;ssp1;ssp1;;;;;;;ssp1;;;;;ssp4;ssp4;ssp1;ssp4;ssp1;;;;;;;;;;;;;;;;;;;; gms$c56_pollutant_prices;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi @@ -79,6 +85,11 @@ gms$s56_c_price_exp_aff;;;;50;50;50;50;50;50;50;30;50;50;;;;;;;50;;;;;;;;;;;;;;; gms$s56_buffer_aff;;;;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.5;0.2;0.3;;;;;;;0.5;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c56_emis_policy;;;;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;reddnatveg_nosoil;redd_nosoil;all_nosoil;;;;;;;reddnatveg_nosoil;;;;none;;;;;;;;;;;;;;;;;;;;;;;;; gms$s56_minimum_cprice;;;;;;;;;;;;;;0;0;18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$c56_mute_ghgprices_until;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;y2020 +gms$c57_macc_version;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PBL_2022;PBL_2022;PBL_2022;PBL_2022;;;;;;;;;;;;;;;; +gms$c57_macc_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Default;Optimistic;Default;Optimistic;;;;;;;;;;;;;;;; +gms$s58_rewetting_switch;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0;1;0;1;;;;;;;;;;;;;;;; +gms$c59_som_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; gms$maccs;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$bioenergy;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1st2ndgen_priced_feb24 gms$c60_2ndgen_biodem;;;;;;;;;;;;;;;;;coupling;emulator;coupling;;;;;none;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;R21M42-SDP-PkBudg1000;;;;;;;;;;;;;;;;;;;;R32M46-SSP2EU-NPi @@ -88,27 +99,6 @@ gms$c60_biodem_level;;;;;;;;;;;;;;;;;1;0;;;;;;;1;1;1;1;1;;;;;;;;;;;;;;;;;;;; gms$c60_bioenergy_subsidy;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c60_res_2ndgenBE_dem;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;sdp;ssp2;sdp;sdp;;;;;;;sdp;;;;;ssp4;sdp;ssp4;ssp4;sdp;;;;;;;;;;;;;;;;;;;; gms$c70_feed_scen;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;ssp1;ssp5;ssp1;ssp1;;;;;;;ssp1;;ssp1;;;ssp4;ssp1;ssp4;ssp4;ssp1;;;;;;;;;;;;;;;;;;;; -gms$c_timesteps;;;;;;;;;;;;;;;;;less_TS;less_TS;;;;;;;5year;5year;5year;5year;5year;;;;;;;;;;;;;;;;;;;;coup2110 -gms$c14_yields_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;;nocc -gms$c42_watdem_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; -gms$c43_watavail_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; -gms$c52_carbon_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; -gms$c59_som_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; -gms$s32_initial_distribution;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;;;;;; -gms$s32_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;1;0;;;;;;;;;;;;; -gms$s35_secdf_distribution;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;;;; -gms$s35_hvarea;;;;;;;;;;;;;;;;;;;;;;;;;2;2;2;2;2;;;;;2;2;0;;;;;;;;;;;;; gms$s73_timber_demand_switch;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;;;;;; -gms$s35_forest_damage;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4;4;4;4;4;;;;;;;; -gms$c32_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;; -gms$c35_shock_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;none;002lin2030;004lin2030;008lin2030;016lin2030;;;;;;;; input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.106_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.106_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.106_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.106_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.106_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;; -gms$c52_land_carbon_sink_rcp;;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;RCP19;RCP26;RCP45;RCP60;RCPBU;RCPBU;; -gms$c56_mute_ghgprices_until;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;y2020 -gms$c57_macc_version;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;PBL_2022;PBL_2022;PBL_2022;PBL_2022;;;;;;;;;;;;;;;; -gms$c57_macc_scenario;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Default;Optimistic;Default;Optimistic;;;;;;;;;;;;;;;; -gms$s58_rewetting_switch;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0;1;0;1;;;;;;;;;;;;;;;; -gms$c59_som_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; -gms$s73_timber_demand_switch;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;;;;;; -input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.105_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.105_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.105_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.105_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.105_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.105_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;; magicc_emis_scen;;;;;;;;;;;;;;;;;;;;;;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;;;;;;;;;;;;;;;;;;;;;;;;; From 404be5cde5024b7a4c96238e62ef163dab57843e Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 29 May 2024 09:49:27 +0200 Subject: [PATCH 206/280] bugfix --- modules/35_natveg/pot_forest_may24/presolve.gms | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 399363a7f3..8d2ac2ede8 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -156,11 +156,7 @@ m_boundfix(v35_secdforest,(j,ac_sub),l,1e-6); * Secondary forest conservation * protection bound fix -<<<<<<< HEAD:modules/35_natveg/dynamic_feb21/presolve.gms -pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 1e-10) = sum(ac_sub, pc35_secdforest(j,ac_sub)); -======= pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 1e-6) = sum(ac_sub, pc35_secdforest(j,ac_sub)); ->>>>>>> 77d5df1d3bc91c04600d105414d2bbfcd4f01714:modules/35_natveg/pot_forest_may24/presolve.gms * set restoration target p35_land_restoration(j,"secdforest") = pm_land_conservation(t,j,"secdforest","restore"); * Do not restore secdforest in areas where total natural From 1ef1ccca4096d7945995046813c69da1561b7fbd Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 29 May 2024 16:59:18 +0200 Subject: [PATCH 207/280] bugfix othernat --- modules/35_natveg/pot_forest_may24/presolve.gms | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 8d2ac2ede8..c20b972644 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -55,8 +55,11 @@ p35_forest_recovery_area(t,j,ac_est)$(sum(ac_est2, p35_forest_recovery_area(t,j, * The proportion of secondary forest recovery in total natveg * recovery is derived from the remaining forest recovery area -pc35_forest_recovery_shr(j) = (pc35_max_forest_recovery(j) - sum(ac_est, p35_forest_recovery_area(t,j,ac_est))) - / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")+1e-10); +pc35_forest_recovery_shr(j) = 0; +pc35_forest_recovery_shr(j)$((sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")) > +1e-10) = + (pc35_max_forest_recovery(j) - sum(ac_est, p35_forest_recovery_area(t,j,ac_est))) + / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")); +pc35_forest_recovery_shr(j)$(pc35_forest_recovery_shr(j) < 0) = 0; pc35_forest_recovery_shr(j)$(pc35_forest_recovery_shr(j) > 1) = 1; * Abandoned land pc35_land_other(j,"othernat",ac_est) that has not yet been allocated to * p35_forest_recovery_area(t,j,ac_est) is then distributed proportionally using the forest recovery share. From f9be6ac59d69d5d537a22f100653a6b6b6e1a087 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 29 May 2024 18:50:39 +0200 Subject: [PATCH 208/280] revisions --- CHANGELOG.md | 2 +- config/default.cfg | 4 ++- core/macros.gms | 5 ++-- modules/10_land/input/files | 2 -- .../29_cropland/detail_apr24/equations.gms | 3 ++- modules/29_cropland/detail_apr24/input.gms | 2 +- modules/29_cropland/detail_apr24/presolve.gms | 17 ++++++++++++ modules/29_cropland/detail_apr24/sets.gms | 3 --- modules/29_cropland/module.gms | 2 +- modules/29_cropland/simple_apr24/input.gms | 2 +- .../29_cropland/simple_apr24/realization.gms | 6 +++++ modules/29_cropland/simple_apr24/sets.gms | 3 --- .../30_croparea/detail_apr24/equations.gms | 27 ++++++++++++------- modules/30_croparea/detail_apr24/preloop.gms | 5 ++-- modules/30_croparea/detail_apr24/presolve.gms | 2 ++ .../32_forestry/dynamic_may24/presolve.gms | 5 +++- .../35_natveg/pot_forest_may24/presolve.gms | 7 +++-- .../macceff_aug22/equations.gms | 10 ------- .../59_som/cellpool_jan23/declarations.gms | 1 + modules/59_som/cellpool_jan23/preloop.gms | 3 +++ 20 files changed, 71 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad38a3f888..3abfa65845 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### changed - **29_ageclass** module 29_ageclass has been renamed to 28_ageclass to make space for `29_cropland` just before `30_croparea` - **30_crop** module `30_crop` renamed to `30_croparea`, which now only accounts for crop area. -- **30_crop** SNV implementation has been moved from `30_crop` to `29_cropland` +- **30_crop** Semi-Natural Vegetation (SNV) implementation has been moved from `30_crop` to `29_cropland` - **30_crop** the two realizations `penalty_apr22` and `rotation_apr22` have been merged into a single `30_croparea/detail_apr24` realization - **30_crop** the previous `30_crop/endo_apr21` realization has been moved to `30_croparea/simple_apr24` - **default.cfg** update additional data to rev4.51 diff --git a/config/default.cfg b/config/default.cfg index f1b28d2754..2312deade7 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -717,7 +717,7 @@ cfg$gms$s29_snv_shr_noselect <- 0 # def = 0 # * Start year (should be close to 2019): cfg$gms$s29_snv_scenario_start <- 2020 # def = 2020 # * Target year (year when full implementation is reached): -cfg$gms$s29_snv_scenario_target <- 2029 # def = 2029 +cfg$gms$s29_snv_scenario_target <- 2030 # def = 2030 # * Switch and specification of countries for which SNV policy in # * s29_snv_shr apply. # * Options: list of iso-codes of countries where SNV policy should be applied @@ -732,6 +732,7 @@ cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, f # *** Options only available for `detail_apr24` realization *** +## Agroforestry settings for treecover on cropland # * Sigmoid fader for minimum area share of treecover on total cropland at cluster level # * Minimum area share of treecover on total cropland in target year cfg$gms$s29_treecover_target <- 0 # def = 0 @@ -779,6 +780,7 @@ cfg$gms$c30_bioen_type <- "all" # def = "all" # * (c30_bioen_water): switch for irrigation of bioenergy crops; options: rainfed, irrigated, all cfg$gms$c30_bioen_water <- "rainfed" # def = "rainfed" +## Agroforestry settings for bioenergy trees # * Sigmoid fader for minimum area share of bioenergy trees (betr) on total cropland at cluster level # * Minimum area share of bioenergy trees on total cropland in start year cfg$gms$s30_betr_start <- 0 # def = 0 diff --git a/core/macros.gms b/core/macros.gms index 70830f9d68..b2304979ef 100644 --- a/core/macros.gms +++ b/core/macros.gms @@ -8,8 +8,9 @@ *****************************Technical macros*********************************** * Macro for fixing a variable in the case that lower and upper bound are too -* close to each other (closer than argument "sens") -* EXAMPLE: ma_boundfix(vm_land,(j,"ifft"),up,1e-6); +* close to each other (closer than argument "sens"). +* "arg" specifies the set for fixing. "sufx" specifies to what value the variable should be fixed ("l","lo","up"). +* EXAMPLE: m_boundfix(vm_land,(j,"ifft"),up,1e-6); $macro m_boundfix(x,arg,sufx,sens) x.fx arg$(x.up arg-x.lo arg0) + 0$(sum(s,w)<=0); diff --git a/modules/10_land/input/files b/modules/10_land/input/files index d6124da3a7..27b769596d 100644 --- a/modules/10_land/input/files +++ b/modules/10_land/input/files @@ -3,5 +3,3 @@ avl_land_t.cs3 avl_land_t_0.5.mz luh2_side_layers.cs3 avl_land_t_iso.cs3 -CroplandTreecover.cs2 -CroplandTreecover_0.5.mz diff --git a/modules/29_cropland/detail_apr24/equations.gms b/modules/29_cropland/detail_apr24/equations.gms index b5eab82988..8d4f749503 100644 --- a/modules/29_cropland/detail_apr24/equations.gms +++ b/modules/29_cropland/detail_apr24/equations.gms @@ -116,7 +116,8 @@ v29_cost_treecover_recur(j2) =e= sum(ac_sub, v29_treecover(j2,ac_sub)) * s29_cost_treecover_recur; -*' Cropland tree cover establishment rules. +*' Cropland tree cover establishment rules for distributing areas equally to age-classes. +*' For a 5-year time step ac_est includes only ac0. But for a 10-year time step ac_est includes ac0 and ac5. q29_treecover_est(j2,ac_est) .. v29_treecover(j2,ac_est) =e= sum(ac_est2, v29_treecover(j2,ac_est2))/card(ac_est2); diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms index 50b306a32c..b9c53108eb 100644 --- a/modules/29_cropland/detail_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -12,7 +12,7 @@ scalars s29_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / s29_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / s29_snv_scenario_start SNV scenario start year / 2020 / - s29_snv_scenario_target SNV scenario target year / 2029 / + s29_snv_scenario_target SNV scenario target year / 2030 / s29_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / s29_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / s29_cost_treecover_est Tree cover establishment cost (USD05MER per ha) / 2000 / diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index 6894f2bacd..dba380188e 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -5,6 +5,10 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de +* ------------------------------------------------------- +* Semi-Natural Vegetation (SNV) +* ------------------------------------------------------- + *' @code *' Minimum semi-natural vegetation (SNV) share is fading in after 2020 p29_snv_shr(t,j) = i29_snv_scenario_fader(t) * @@ -32,6 +36,10 @@ p29_avl_cropland(t,j) = f29_avl_cropland(j,"%c29_marginal_land%") * (1 - p29_snv *' @stop +* ------------------------------------------------------- +* Tree cover on cropland +* ------------------------------------------------------- + * Growth of trees on cropland is modelled by shifting age-classes according to time step length. s29_shift = m_timestep_length_forestry/5; * example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s29_shift = 1) @@ -46,6 +54,7 @@ v29_treecover.l(j,ac) = p29_treecover(t,j,ac); * create treecover target and penalty scenario i29_treecover_target(t,j) = s29_treecover_target * i29_treecover_scenario_fader(t); +* calculate treecover share pc29_treecover_share(j) = 0; pc29_treecover_share(j)$(pcm_land(j,"crop") > 1e-10) = sum(ac, pc29_treecover(j,ac)) / pcm_land(j,"crop"); pc29_treecover_share(j)$(pc29_treecover_share(j) > s29_treecover_max) = s29_treecover_max; @@ -53,18 +62,21 @@ if (s29_treecover_keep = 1, i29_treecover_target(t,j)$(i29_treecover_target(t,j) < pc29_treecover_share(j)) = pc29_treecover_share(j); ); +* Bounds for treecover. Only ac_est can increase in optimization. ac_sub can only decrease. v29_treecover.lo(j,ac_est) = 0; v29_treecover.up(j,ac_est) = Inf; v29_treecover.lo(j,ac_sub) = 0; v29_treecover.up(j,ac_sub) = pc29_treecover(j,ac_sub); m_boundfix(v29_treecover,(j,ac_sub),l,1e-6); +* set treecover penalty if (m_year(t) <= s29_treecover_scenario_start, i29_treecover_penalty(t) = s29_treecover_penalty_before; else i29_treecover_penalty(t) = s29_treecover_penalty; ); +* fix missing tree cover variable to zero in case of no penalty if (i29_treecover_penalty(t) > 0, v29_treecover_missing.lo(j) = 0; v29_treecover_missing.up(j) = Inf; @@ -72,6 +84,10 @@ else v29_treecover_missing.fx(j) = 0; ); +* ------------------------------------------------------- +* Fallow land +* ------------------------------------------------------- + * create fallow land target and penalty scenario i29_fallow_target(t) = s29_fallow_target * i29_fallow_scenario_fader(t); @@ -88,6 +104,7 @@ else ); ); +* Bounds for fallow land vm_fallow.lo(j) = 0; vm_fallow.up(j) = p29_avl_cropland(t,j); m_boundfix(vm_fallow,(j),l,1e-6); diff --git a/modules/29_cropland/detail_apr24/sets.gms b/modules/29_cropland/detail_apr24/sets.gms index e5d8286326..aa5a49bb36 100644 --- a/modules/29_cropland/detail_apr24/sets.gms +++ b/modules/29_cropland/detail_apr24/sets.gms @@ -10,9 +10,6 @@ sets marginal_land29 Marginal land scenarios / all_marginal, q33_marginal, no_marginal / - policy_target29 Target year for cropland policy - / none, by2029, by2050 / - relocation_target29 Cropland requiring relocation based on different SNV targets / SNV20TargetCropland, SNV50TargetCropland / diff --git a/modules/29_cropland/module.gms b/modules/29_cropland/module.gms index e330dbc7e6..bcf335c661 100644 --- a/modules/29_cropland/module.gms +++ b/modules/29_cropland/module.gms @@ -12,7 +12,7 @@ *' Area and carbon stocks for fallow land and tree cover are defined in this module. -*' @authors Florian Humpenöder +*' @authors Florian Humpenöder, Benjamin Bodirsky, Patrick v. Jeetze *###################### R SECTION START (MODULETYPES) ########################## $Ifi "%cropland%" == "detail_apr24" $include "./modules/29_cropland/detail_apr24/realization.gms" diff --git a/modules/29_cropland/simple_apr24/input.gms b/modules/29_cropland/simple_apr24/input.gms index eb33c95ec9..fdf7cdf40c 100644 --- a/modules/29_cropland/simple_apr24/input.gms +++ b/modules/29_cropland/simple_apr24/input.gms @@ -12,7 +12,7 @@ scalars s29_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / s29_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / s29_snv_scenario_start SNV scenario start year / 2020 / - s29_snv_scenario_target SNV scenario target year / 2029 / + s29_snv_scenario_target SNV scenario target year / 2030 / s29_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / s29_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / ; diff --git a/modules/29_cropland/simple_apr24/realization.gms b/modules/29_cropland/simple_apr24/realization.gms index 3257388faa..ae6d324c77 100644 --- a/modules/29_cropland/simple_apr24/realization.gms +++ b/modules/29_cropland/simple_apr24/realization.gms @@ -11,6 +11,12 @@ *' Biodiversity BII values are fixed to zero. *' Costs are fixed to zero. +*' This realisation also includes the option to reserve a minimum semi-natural +*' vegetation share within the total available cropland for other land cover +*' classes, including grassland, forest, and other land (by a given target year), +*' in order to provide species habitats and to benefit from ecosystem ervices in +*' agricultural landscapes. + *' @limitations Fallow land and tree cover on cropland are fixed to zero *####################### R SECTION START (PHASES) ############################## diff --git a/modules/29_cropland/simple_apr24/sets.gms b/modules/29_cropland/simple_apr24/sets.gms index e5d8286326..aa5a49bb36 100644 --- a/modules/29_cropland/simple_apr24/sets.gms +++ b/modules/29_cropland/simple_apr24/sets.gms @@ -10,9 +10,6 @@ sets marginal_land29 Marginal land scenarios / all_marginal, q33_marginal, no_marginal / - policy_target29 Target year for cropland policy - / none, by2029, by2050 / - relocation_target29 Cropland requiring relocation based on different SNV targets / SNV20TargetCropland, SNV50TargetCropland / diff --git a/modules/30_croparea/detail_apr24/equations.gms b/modules/30_croparea/detail_apr24/equations.gms index 7f4a192878..e51d334eac 100644 --- a/modules/30_croparea/detail_apr24/equations.gms +++ b/modules/30_croparea/detail_apr24/equations.gms @@ -23,17 +23,15 @@ vm_land(j2,"crop") * sum(ct, i30_betr_target(ct)) - vm_area(j2,"betr","rainfed"); *' Rotational constraints prevent over-specialization. In this realization, -*' they are either implemented via a rules (i30_implementation = 1) or +*' they are either implemented via rules (i30_implementation = 1) or *' a penalty payment if the constraints are violated (i30_implementation = 0). - q30_rotation_penalty(i2) .. - vm_rotation_penalty(i2) =g= - sum(cell(i2,j2), - sum(rota30, v30_penalty(j2,rota30) * sum(ct, i30_rotation_incentives(ct,rota30))) - + sum(rotamax_red30, v30_penalty_max_irrig(j2,rotamax_red30) - * sum(ct, i30_rotation_incentives(ct,rotamax_red30))) - + v30_betr_missing(j2) * sum(ct, i30_betr_penalty(ct)) - ); +*' Rule-based rotational constraints (i30_implementation = 1): + +*' Minimum and maximum rotational constraints limit +*' the placing of crops. These rotational constraints reflect +*' crop rotations limiting the share a specific crop can cover of the total area +*' of a cluster. q30_rotation_max(j2,rotamax_red30)$(i30_implementation = 1) .. sum((rota_kcr30(rotamax_red30,kcr),w), vm_area(j2,kcr,w)) =l= @@ -43,6 +41,17 @@ sum((rota_kcr30(rotamin_red30,kcr),w), vm_area(j2,kcr,w)) =g= sum((kcr,w),vm_area(j2,kcr,w)) * sum(ct,i30_rotation_rules(ct,rotamin_red30)); +* 'Penalty-based rotational constraints (i30_implementation = 0): + + q30_rotation_penalty(i2) .. + vm_rotation_penalty(i2) =g= + sum(cell(i2,j2), + sum(rota30, v30_penalty(j2,rota30) * sum(ct, i30_rotation_incentives(ct,rota30))) + + sum(rotamax_red30, v30_penalty_max_irrig(j2,rotamax_red30) + * sum(ct, i30_rotation_incentives(ct,rotamax_red30))) + + v30_betr_missing(j2) * sum(ct, i30_betr_penalty(ct)) + ); + *' The penalty applies to the areas which exceed a certain maximum *' share of the land. Below this share, negative benefits are *' avoided by defining the penalty to be positive. diff --git a/modules/30_croparea/detail_apr24/preloop.gms b/modules/30_croparea/detail_apr24/preloop.gms index 8d2ac45a5f..61c6d15a85 100644 --- a/modules/30_croparea/detail_apr24/preloop.gms +++ b/modules/30_croparea/detail_apr24/preloop.gms @@ -10,12 +10,12 @@ m_sigmoid_time_interpol(i30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1); m_sigmoid_time_interpol(i30_betr_scenario_fader,s30_betr_scenario_start,s30_betr_scenario_target,0,1); -** create crop rotation scenario +** Fader for rotational constraints i30_rotation_rules(t_all,rota30) = f30_rotation_rules(rota30,"default") * (1-i30_rotation_scenario_fader(t_all)) + f30_rotation_rules(rota30,"%c30_rotation_rules%") * (i30_rotation_scenario_fader(t_all)); -** create crop rotation scenario +** Fader for penalty for violating rotational constraints i30_rotation_incentives(t_all,rota30) = f30_rotation_incentives(rota30,"default") * (1-i30_rotation_scenario_fader(t_all)) + f30_rotation_incentives(rota30,"%c30_rotation_incentives%") * (i30_rotation_scenario_fader(t_all)); @@ -26,6 +26,7 @@ i30_rotation_incentives(t_all,rota30) = *cannot be smaller than 0! fm_croparea(t_past,j,w,kcr)$(fm_croparea(t_past,j,w,kcr)<0) = 0; +* fix penalty to zero in case of rule-based rotational contraints if(s30_implementation = 1, v30_penalty.fx(j,rota30) = 0; ); diff --git a/modules/30_croparea/detail_apr24/presolve.gms b/modules/30_croparea/detail_apr24/presolve.gms index 8b6bbb14b7..047c05ed2d 100644 --- a/modules/30_croparea/detail_apr24/presolve.gms +++ b/modules/30_croparea/detail_apr24/presolve.gms @@ -12,6 +12,8 @@ vm_area.fx(j,kbe30,w)=0; *' Second, the bounds for 2nd generation bioenergy area are released depending on *' the dynamic sets bioen_type_30 and bioen_water_30. *' SSP2 default settings are used for the historic period. +*' In addition, rule-based rotational constraints (i30_implementation = 1) +*' are assumed for the historic period. if(m_year(t) <= sm_fix_SSP2, vm_area.up(j,kbe30,"rainfed") = Inf; i30_implementation = 1; diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 532966fe11..5537c528fc 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -14,7 +14,10 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; p32_aff_pol_timestep("y1995",j) = 0; p32_aff_pol_timestep(t,j)$(ord(t)>1) = p32_aff_pol(t,j) - p32_aff_pol(t-1,j); * Suitable area (`p32_aff_pot`) for NPI/NDC afforestation - p32_aff_pot(t,j) = sum((kcr,w),vm_area.l(j,kcr,w) - vm_area.lo(j,kcr,w)) + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore"); + p32_aff_pot(t,j) = sum((kcr,w),vm_area.l(j,kcr,w) - vm_area.lo(j,kcr,w)) + + (vm_fallow.l(j) - vm_fallow.lo(j)) + + (vm_land.l(j,"past") - vm_land.lo(j,"past")) + - pm_land_conservation(t,j,"other","restore"); *** NDC/NPI re/afforesation is further constrained by the remaining forest establishment potential p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pcm_max_forest_est(j)) = pcm_max_forest_est(j); * suitable area `p32_aff_pot` can be negative, if land restoration is switched on (level smaller than lower bound), therefore set negative values to 0 diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 8d2ac2ede8..c20b972644 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -55,8 +55,11 @@ p35_forest_recovery_area(t,j,ac_est)$(sum(ac_est2, p35_forest_recovery_area(t,j, * The proportion of secondary forest recovery in total natveg * recovery is derived from the remaining forest recovery area -pc35_forest_recovery_shr(j) = (pc35_max_forest_recovery(j) - sum(ac_est, p35_forest_recovery_area(t,j,ac_est))) - / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")+1e-10); +pc35_forest_recovery_shr(j) = 0; +pc35_forest_recovery_shr(j)$((sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")) > +1e-10) = + (pc35_max_forest_recovery(j) - sum(ac_est, p35_forest_recovery_area(t,j,ac_est))) + / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")); +pc35_forest_recovery_shr(j)$(pc35_forest_recovery_shr(j) < 0) = 0; pc35_forest_recovery_shr(j)$(pc35_forest_recovery_shr(j) > 1) = 1; * Abandoned land pc35_land_other(j,"othernat",ac_est) that has not yet been allocated to * p35_forest_recovery_area(t,j,ac_est) is then distributed proportionally using the forest recovery share. diff --git a/modules/50_nr_soil_budget/macceff_aug22/equations.gms b/modules/50_nr_soil_budget/macceff_aug22/equations.gms index f292521c1b..8133c1316f 100644 --- a/modules/50_nr_soil_budget/macceff_aug22/equations.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/equations.gms @@ -24,8 +24,6 @@ q50_nr_inputs(i2) .. vm_res_recycling(i2,"nr") + sum((cell(i2,j2),kcr,w), vm_area(j2,kcr,w) * f50_nr_fix_area(kcr)) + sum(cell(i2,j2),vm_fallow(j2) * f50_nr_fix_area("tece")) -* Commented out for consistency with q50_nr_surplus_nonagland -* + sum(cell(i2,j2),vm_treecover(j2)) * sum(ct,f50_nr_fixation_rates_nonagland(ct,i2)) + vm_manure_recycling(i2,"nr") + sum(kli, vm_manure(i2, kli, "stubble_grazing","nr")) + vm_nr_inorg_fert_reg(i2,"crop") @@ -86,14 +84,6 @@ q50_nr_surplus_pasture(i2) .. v50_nr_withdrawals_pasture(i2) =e= vm_prod_reg(i2,"pasture") * fm_attributes("nr","pasture"); -* Calculating Budget surplus for non-agricultural land - -* q50_nr_surplus_nonagland(i2) .. -* vm_nr_surplus_nonagland(i2) -* =e= -* sum((cell(i2,j2),nonagland50), vm_land(j2,nonagland50)) * sum(ct,f50_nr_fixation_rates_nonagland(ct,i2)) -* + sum(nonagland50, v50_nr_deposition(i2,nonagland50)); - *' For both crop land and pasture land, this equation gives the amount of nitrogen deposited from the atmosphere. q50_nr_deposition(i2,land) .. v50_nr_deposition(i2,land) =e= diff --git a/modules/59_som/cellpool_jan23/declarations.gms b/modules/59_som/cellpool_jan23/declarations.gms index 46831d6429..c4896263a5 100644 --- a/modules/59_som/cellpool_jan23/declarations.gms +++ b/modules/59_som/cellpool_jan23/declarations.gms @@ -12,6 +12,7 @@ parameters i59_input_share(i,inputs59) Share of land under input class (1) i59_cratio(j,kcr,w) Ratio of carbon density of land relative to natural vegetaion (1) i59_cratio_fallow(j) Ratio of carbon density of fallow land relative to natural vegetation (1) + i59_cratio_treecover Ratio of carbon density of tree cover on cropland relative to natural vegetation (1) p59_som_pool(j,land) Actual C pool (mio. tC) i59_subsoilc_density(t_all,j) Subsoil carbon density of a hectare of land (tC per ha) p59_land_before(j,land) Land area in previous time step (mio. ha) diff --git a/modules/59_som/cellpool_jan23/preloop.gms b/modules/59_som/cellpool_jan23/preloop.gms index 0454db31bb..26d2488ff8 100644 --- a/modules/59_som/cellpool_jan23/preloop.gms +++ b/modules/59_som/cellpool_jan23/preloop.gms @@ -73,6 +73,9 @@ i59_cratio_fallow(j) = sum((cell(i,j),climate59), * f59_cratio_landuse(i,climate59,"maiz") * f59_cratio_tillage(climate59,"reduced_tillage") * f59_cratio_inputs(climate59,"low_input")); + +i59_cratio_treecover = 1; + *' @stop p59_carbon_density(t,j,land) = 0; From f56a0c143b4ed711c6673c42f7b2023e40031b91 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 30 May 2024 08:26:24 +0200 Subject: [PATCH 209/280] bugfix carbon density --- modules/29_cropland/detail_apr24/preloop.gms | 4 ++-- modules/29_cropland/simple_apr24/not_used.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/29_cropland/detail_apr24/preloop.gms b/modules/29_cropland/detail_apr24/preloop.gms index b65a0c2b43..c45d550fd2 100644 --- a/modules/29_cropland/detail_apr24/preloop.gms +++ b/modules/29_cropland/detail_apr24/preloop.gms @@ -32,9 +32,9 @@ pc29_treecover(j,ac) = (pc29_treecover_share(j) * pm_land_hist("y1995",j,"crop") *' 0 = Use natveg growth curve towards LPJmL natural vegetation *' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation if(s29_treecover_plantation = 0, - p29_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools); + p29_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_secdforest_ac(t,j,ac,ag_pools); elseif s29_treecover_plantation = 1, - p29_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools); + p29_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_plantation_ac(t,j,ac,ag_pools); ); ** set bii coefficients diff --git a/modules/29_cropland/simple_apr24/not_used.txt b/modules/29_cropland/simple_apr24/not_used.txt index a60069f62b..9ee70dc271 100644 --- a/modules/29_cropland/simple_apr24/not_used.txt +++ b/modules/29_cropland/simple_apr24/not_used.txt @@ -3,6 +3,6 @@ pm_land_hist,input,not needed fm_luh2_side_layers,input,not needed pm_interest,input,not needed fm_bii_coeff,input,not needed -pm_carbon_density_ac,input,not needed -pm_carbon_density_ac_forestry,input,not needed +pm_carbon_density_secdforest_ac,input,not needed +pm_carbon_density_plantation_ac,input,not needed fm_carbon_density,input,not needed From dce8e0d28dfa9ebe7e56963a7cfbd0840a189137 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 30 May 2024 10:28:21 +0200 Subject: [PATCH 210/280] cleanup and consistency 32_forestry --- .../32_forestry/dynamic_may24/declarations.gms | 5 ++--- modules/32_forestry/dynamic_may24/postsolve.gms | 2 +- modules/32_forestry/dynamic_may24/preloop.gms | 3 +++ modules/32_forestry/dynamic_may24/presolve.gms | 17 +++-------------- 4 files changed, 9 insertions(+), 18 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/declarations.gms b/modules/32_forestry/dynamic_may24/declarations.gms index 6b679b0a4d..c04fc094d7 100644 --- a/modules/32_forestry/dynamic_may24/declarations.gms +++ b/modules/32_forestry/dynamic_may24/declarations.gms @@ -20,8 +20,8 @@ parameters p32_carbon_density_ac(t,j,type32,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) p32_carbon_density_ac_forestry(t_all,j,ac) Above ground carbon density for age classes and carbon pools (tC per ha) p32_carbon_density_ac_marg(t_all,j,ac) Marginal above ground carbon density for age classes and carbon pools (tC per ha) - p32_land(t,j,type32,ac) Forestry land for each cell wood type and age class before and after optimization (mio. ha) - pc32_land(j,type32,ac) Forestry land per forestry land type initialization of the optimization (mio. ha) + p32_land(t,j,type32,ac) Forestry land pools before optimization (mio. ha) + pc32_land(j,type32,ac) Forestry land pools in current time step (mio. ha) p32_yield_forestry_future(t,j) Cellular timber yield expected in the future (m3 per ha per year) p32_IGR(t_all,j,ac) Instantaneous growth rate or periodic annual increment of forest growth (1) p32_rot_flg(t_all,j,ac) Identifier flag when calculating rotation length (1) @@ -32,7 +32,6 @@ parameters p32_cdr_ac(t,j,ac) Non-cumulative CDR from afforestation plantations for each age-class depending on planning horizon (tC per ha) p32_rotation_offset Offset calc in age class equivalents (1) p32_land_start_ac(j,type32,ac) Saving first value of starting land (mio. ha) - p32_land_before(t,j,type32,ac) Saving time value of starting land (mio. ha) p32_time(ac) Time as a function of age-classes (yr) p32_discount_factor(t_all,j,ac) Discount factor for each age class (1) p32_net_present_value(t_all,j,ac) Net present value for a representative 1ha land of plantations (mio. USD) diff --git a/modules/32_forestry/dynamic_may24/postsolve.gms b/modules/32_forestry/dynamic_may24/postsolve.gms index 1ec319b88b..d8aa765167 100644 --- a/modules/32_forestry/dynamic_may24/postsolve.gms +++ b/modules/32_forestry/dynamic_may24/postsolve.gms @@ -6,7 +6,7 @@ *** | Contact: magpie@pik-potsdam.de *' @code *' Exchange land information after optimization -p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); +pc32_land(j,type32,ac) = v32_land.l(j,type32,ac); *' @stop *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### diff --git a/modules/32_forestry/dynamic_may24/preloop.gms b/modules/32_forestry/dynamic_may24/preloop.gms index a3f792c24d..3fec5a9101 100644 --- a/modules/32_forestry/dynamic_may24/preloop.gms +++ b/modules/32_forestry/dynamic_may24/preloop.gms @@ -170,6 +170,9 @@ loop(j, ); ); +** Initialize forestry land types +pc32_land(j,type32,ac) = p32_land_start_ac(j,type32,ac); + *** NPI/NDC policies BEGIN ** Afforestation policies NPI and NDCs p32_aff_pol(t,j) = round(f32_aff_pol(t,j,"%c32_aff_policy%"),6); diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 5537c528fc..b7854d8e6a 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -47,12 +47,6 @@ p32_cdr_ac(t,j,ac)$(ord(ac) > 1 AND (ord(ac)-1) <= s32_planing_horizon/5) = p32_carbon_density_ac(t,j,"aff",ac,"vegc") - p32_carbon_density_ac(t,j,"aff",ac-1,"vegc"); * Disturbance from generic sources to managed and natural forests -if((ord(t) = 1), - pc32_land(j,type32,ac) = p32_land_start_ac(j,type32,ac); -else - pc32_land(j,type32,ac) = p32_land(t-1,j,type32,ac); -); - p32_disturbance_loss_ftype32(t,j,"aff",ac_sub) = pc32_land(j,"aff",ac_sub) * f32_forest_shock(t,"%c32_shock_scenario%") * m_timestep_length; pc32_land(j,"aff",ac_est) = pc32_land(j,"aff",ac_est) + sum(ac_sub,p32_disturbance_loss_ftype32(t,j,"aff",ac_sub))/card(ac_est2); @@ -64,25 +58,20 @@ pc32_land(j,"aff",ac_sub) = pc32_land(j,"aff",ac_sub) - p32_disturbance_loss_fty s32_shift = m_yeardiff_forestry(t)/5; *' @stop -*' Shifting of age-classes in land. +*' Shifting of age-classes *` @code -if((ord(t)=1), -p32_land(t,j,type32,ac)$(ord(ac) > s32_shift) = p32_land_start_ac(j,type32,ac-s32_shift); -p32_land(t,j,type32,"acx") = p32_land(t,j,type32,"acx") + sum(ac$(ord(ac) > card(ac)-s32_shift), p32_land_start_ac(j,type32,ac)); -else * Example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s32_shift = 1) p32_land(t,j,type32,ac)$(ord(ac) > s32_shift) = pc32_land(j,type32,ac-s32_shift); * Account for cases at the end of the age class set (s32_shift > 1) which are not shifted by the above calculation p32_land(t,j,type32,"acx") = p32_land(t,j,type32,"acx") + sum(ac$(ord(ac) > card(ac)-s32_shift), pc32_land(j,type32,ac)); -); + * set ac_est to zero p32_land(t,j,type32,ac_est) = 0; *' @stop ** Calculate v32_land.l v32_land.l(j,type32,ac) = p32_land(t,j,type32,ac); -pc32_land(j,type32,ac) = v32_land.l(j,type32,ac); -p32_land_before(t,j,type32,ac) = p32_land(t,j,type32,ac); +pc32_land(j,type32,ac) = p32_land(t,j,type32,ac); vm_land.l(j,"forestry") = sum((type32,ac), v32_land.l(j,type32,ac)); pcm_land(j,"forestry") = sum((type32,ac), v32_land.l(j,type32,ac)); pcm_land_forestry(j,type32) = sum(ac, v32_land.l(j,type32,ac)); From 6119e522a3c93bafc980c2bb3871a45e8b56b96e Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 1 Jun 2024 13:13:01 +0200 Subject: [PATCH 211/280] revision 59_som --- .../59_som/cellpool_aug16/declarations.gms | 7 +++--- modules/59_som/cellpool_aug16/postsolve.gms | 6 ++--- modules/59_som/cellpool_aug16/preloop.gms | 12 ++++++---- modules/59_som/cellpool_aug16/presolve.gms | 24 +++++++++---------- .../59_som/cellpool_jan23/declarations.gms | 9 +++---- modules/59_som/cellpool_jan23/postsolve.gms | 6 ++--- modules/59_som/cellpool_jan23/preloop.gms | 12 ++++++---- modules/59_som/cellpool_jan23/presolve.gms | 24 +++++++++---------- 8 files changed, 53 insertions(+), 47 deletions(-) diff --git a/modules/59_som/cellpool_aug16/declarations.gms b/modules/59_som/cellpool_aug16/declarations.gms index 80e3155d46..81eff1839a 100644 --- a/modules/59_som/cellpool_aug16/declarations.gms +++ b/modules/59_som/cellpool_aug16/declarations.gms @@ -7,15 +7,16 @@ parameters i59_lossrate(t) Rate of loss or recovery of SOM pool per timestep (1) - p59_carbon_density(t_all,j,land) Carbon density of a hectare of land (tC per ha) + p59_carbon_density(t_all,j,land) Soil carbon density of a hectare of land (tC per ha) + pc59_carbon_density(j,land) Soil carbon density of a hectare of land between time steps (tC per ha) i59_tillage_share(i,tillage59) Share of land under tillage class (1) i59_input_share(i,inputs59) Share of land under input class (1) i59_cratio(j,kcr,w) Ratio of carbon density of land relative to natural vegetaion (1) i59_cratio_fallow(j) Ratio of carbon density of fallow land relative to natural vegetation (1) i59_cratio_treecover Ratio of carbon density of tree cover on cropland relative to natural vegetation (1) - p59_som_pool(j,land) Actual C pool (mio. tC) + pc59_som_pool(j,land) Actual C pool (mio. tC) i59_subsoilc_density(t_all,j) Subsoil carbon density of a hectare of land (tC per ha) - p59_land_before(j,land) Land area in previous time step (mio. ha) + pc59_land_before(j,land) Land area in previous time step (mio. ha) ; equations diff --git a/modules/59_som/cellpool_aug16/postsolve.gms b/modules/59_som/cellpool_aug16/postsolve.gms index cd03390003..60e1f2c60f 100644 --- a/modules/59_som/cellpool_aug16/postsolve.gms +++ b/modules/59_som/cellpool_aug16/postsolve.gms @@ -5,9 +5,9 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -p59_som_pool(j,land) = v59_som_pool.l(j,land); -p59_land_before(j,land) = vm_land.l(j,land); -p59_carbon_density(t,j,land)$(pcm_land(j,land) > 1e-10) = p59_som_pool(j,land) / pcm_land(j,land); +pc59_som_pool(j,land) = v59_som_pool.l(j,land); +pc59_land_before(j,land) = vm_land.l(j,land); +pc59_carbon_density(j,land)$(pc59_land_before(j,land) > 1e-10) = pc59_som_pool(j,land) / pc59_land_before(j,land); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov59_som_target(t,j,land,"marginal") = v59_som_target.m(j,land); diff --git a/modules/59_som/cellpool_aug16/preloop.gms b/modules/59_som/cellpool_aug16/preloop.gms index 41fc1b9447..a2625bdf21 100644 --- a/modules/59_som/cellpool_aug16/preloop.gms +++ b/modules/59_som/cellpool_aug16/preloop.gms @@ -11,12 +11,12 @@ i59_subsoilc_density(t_all,j) = fm_carbon_density(t_all,j,"secdforest","soilc") - f59_topsoilc_density(t_all,j); -p59_som_pool(j,"crop") = +pc59_som_pool(j,"crop") = sum((climate59,kcr),sum(clcl_climate59(clcl,climate59), pm_climate_class(j,clcl)) * f59_cratio_landuse(climate59,kcr) * f59_topsoilc_density("y1995",j) * sum(w, fm_croparea("y1995",j,w,kcr))); -p59_som_pool(j,noncropland59) = +pc59_som_pool(j,noncropland59) = f59_topsoilc_density("y1995",j) * pm_land_start(j,noncropland59); @@ -28,7 +28,7 @@ p59_som_pool(j,noncropland59) = * ATTENTION: emissions in 1995 are not meaningful vm_carbon_stock.l(j,"crop","soilc",stockType) = - p59_som_pool(j,"crop") + i59_subsoilc_density("y1995",j) * pm_land_start(j,"crop"); + pc59_som_pool(j,"crop") + i59_subsoilc_density("y1995",j) * pm_land_start(j,"crop"); vm_carbon_stock.l(j,noncropland59,"soilc",stockType) = fm_carbon_density("y1995",j,noncropland59,"soilc") * pm_land_start(j,noncropland59); @@ -78,6 +78,8 @@ i59_cratio_treecover = 1; *' @stop -p59_carbon_density(t,j,land) = 0; +pc59_land_before(j,land) = pm_land_start(j,land); -p59_land_before(j,land) = pm_land_start(j,land); +p59_carbon_density(t,j,land) = 0; +pc59_carbon_density(j,land) = 0; +pc59_carbon_density(j,land)$(pc59_land_before(j,land) > 1e-10) = pc59_som_pool(j,land) / pc59_land_before(j,land); diff --git a/modules/59_som/cellpool_aug16/presolve.gms b/modules/59_som/cellpool_aug16/presolve.gms index 26cdb91674..1cf578801c 100644 --- a/modules/59_som/cellpool_aug16/presolve.gms +++ b/modules/59_som/cellpool_aug16/presolve.gms @@ -12,18 +12,18 @@ * Note: This will only account for transitions of primary forest to secondary forest and * other land to secondary forest. See current version of 35_natveg to check consistency. -p59_som_pool(j,"secdforest") = p59_som_pool(j,"secdforest") + - (p59_land_before(j,"primforest") - pcm_land(j,"primforest")) * - p59_carbon_density(t-1,j,"primforest") + - (p59_land_before(j,"other") - pcm_land(j,"other")) * - p59_carbon_density(t-1,j,"other"); +pc59_som_pool(j,"secdforest") = pc59_som_pool(j,"secdforest") + + (pc59_land_before(j,"primforest") - pcm_land(j,"primforest")) * + pc59_carbon_density(j,"primforest") + + (pc59_land_before(j,"other") - pcm_land(j,"other")) * + pc59_carbon_density(j,"other"); -p59_som_pool(j,"other") = p59_som_pool(j,"other") - - (p59_land_before(j,"other") - pcm_land(j,"other")) * - p59_carbon_density(t-1,j,"other"); +pc59_som_pool(j,"other") = pc59_som_pool(j,"other") - + (pc59_land_before(j,"other") - pcm_land(j,"other")) * + pc59_carbon_density(j,"other"); -p59_som_pool(j,"primforest") = p59_som_pool(j,"primforest") - - (p59_land_before(j,"primforest") - pcm_land(j,"primforest")) * - p59_carbon_density(t-1,j,"primforest"); +pc59_som_pool(j,"primforest") = pc59_som_pool(j,"primforest") - + (pc59_land_before(j,"primforest") - pcm_land(j,"primforest")) * + pc59_carbon_density(j,"primforest"); -p59_carbon_density(t,j,land)$(pcm_land(j,land) > 1e-10) = p59_som_pool(j,land) / pcm_land(j,land); +p59_carbon_density(t,j,land)$(pcm_land(j,land) > 1e-10) = pc59_som_pool(j,land) / pcm_land(j,land); diff --git a/modules/59_som/cellpool_jan23/declarations.gms b/modules/59_som/cellpool_jan23/declarations.gms index c4896263a5..632aba9c32 100644 --- a/modules/59_som/cellpool_jan23/declarations.gms +++ b/modules/59_som/cellpool_jan23/declarations.gms @@ -7,15 +7,16 @@ parameters i59_lossrate(t) Rate of loss or recovery of SOM pool per timestep (1) - p59_carbon_density(t_all,j,land) Carbon density of a hectare of land (tC per ha) + p59_carbon_density(t_all,j,land) Soil carbon density of a hectare of land (tC per ha) + pc59_carbon_density(j,land) Soil carbon density of a hectare of land between time steps (tC per ha) i59_tillage_share(i,tillage59) Share of land under tillage class (1) i59_input_share(i,inputs59) Share of land under input class (1) i59_cratio(j,kcr,w) Ratio of carbon density of land relative to natural vegetaion (1) i59_cratio_fallow(j) Ratio of carbon density of fallow land relative to natural vegetation (1) i59_cratio_treecover Ratio of carbon density of tree cover on cropland relative to natural vegetation (1) - p59_som_pool(j,land) Actual C pool (mio. tC) + pc59_som_pool(j,land) Actual C pool (mio. tC) i59_subsoilc_density(t_all,j) Subsoil carbon density of a hectare of land (tC per ha) - p59_land_before(j,land) Land area in previous time step (mio. ha) + pc59_land_before(j,land) Land area in previous time step (mio. ha) ; equations @@ -25,7 +26,7 @@ equations q59_nr_som(j) Soil organic matter loss (Mt N per yr) q59_nr_som_fertilizer(j) Bound of nitrogen fertilizer of soil organic matter loss (Mt N per yr) q59_nr_som_fertilizer2(j) Fraction of soil organic matter loss take is taken up by plants (Mt N per yr) - q59_carbon_soil(j,land,stockType) Soil carbon content calculation (mio. tC) + q59_carbon_soil(j,land,stockType) Soil carbon content calculation (mio. tC) ; positive variables diff --git a/modules/59_som/cellpool_jan23/postsolve.gms b/modules/59_som/cellpool_jan23/postsolve.gms index cd03390003..60e1f2c60f 100644 --- a/modules/59_som/cellpool_jan23/postsolve.gms +++ b/modules/59_som/cellpool_jan23/postsolve.gms @@ -5,9 +5,9 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -p59_som_pool(j,land) = v59_som_pool.l(j,land); -p59_land_before(j,land) = vm_land.l(j,land); -p59_carbon_density(t,j,land)$(pcm_land(j,land) > 1e-10) = p59_som_pool(j,land) / pcm_land(j,land); +pc59_som_pool(j,land) = v59_som_pool.l(j,land); +pc59_land_before(j,land) = vm_land.l(j,land); +pc59_carbon_density(j,land)$(pc59_land_before(j,land) > 1e-10) = pc59_som_pool(j,land) / pc59_land_before(j,land); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov59_som_target(t,j,land,"marginal") = v59_som_target.m(j,land); diff --git a/modules/59_som/cellpool_jan23/preloop.gms b/modules/59_som/cellpool_jan23/preloop.gms index 26d2488ff8..8393b1f201 100644 --- a/modules/59_som/cellpool_jan23/preloop.gms +++ b/modules/59_som/cellpool_jan23/preloop.gms @@ -11,12 +11,12 @@ i59_subsoilc_density(t_all,j) = fm_carbon_density(t_all,j,"secdforest","soilc") - f59_topsoilc_density(t_all,j); -p59_som_pool(j,"crop") = +pc59_som_pool(j,"crop") = sum((climate59,kcr),sum(clcl_climate59(clcl,climate59), pm_climate_class(j,clcl)) * sum(cell(i,j), f59_cratio_landuse(i,climate59,kcr)) * f59_topsoilc_density("y1995",j) * sum(w, fm_croparea("y1995",j,w,kcr))); -p59_som_pool(j,noncropland59) = +pc59_som_pool(j,noncropland59) = f59_topsoilc_density("y1995",j) * pm_land_start(j,noncropland59); @@ -28,7 +28,7 @@ p59_som_pool(j,noncropland59) = * ATTENTION: emissions in 1995 are not meaningful vm_carbon_stock.l(j,"crop","soilc",stockType) = - p59_som_pool(j,"crop") + i59_subsoilc_density("y1995",j) * pm_land_start(j,"crop"); + pc59_som_pool(j,"crop") + i59_subsoilc_density("y1995",j) * pm_land_start(j,"crop"); vm_carbon_stock.l(j,noncropland59,"soilc",stockType) = fm_carbon_density("y1995",j,noncropland59,"soilc") * pm_land_start(j,noncropland59); @@ -78,6 +78,8 @@ i59_cratio_treecover = 1; *' @stop -p59_carbon_density(t,j,land) = 0; +pc59_land_before(j,land) = pm_land_start(j,land); -p59_land_before(j,land) = pm_land_start(j,land); +p59_carbon_density(t,j,land) = 0; +pc59_carbon_density(j,land) = 0; +pc59_carbon_density(j,land)$(pc59_land_before(j,land) > 1e-10) = pc59_som_pool(j,land) / pc59_land_before(j,land); diff --git a/modules/59_som/cellpool_jan23/presolve.gms b/modules/59_som/cellpool_jan23/presolve.gms index 26cdb91674..1cf578801c 100644 --- a/modules/59_som/cellpool_jan23/presolve.gms +++ b/modules/59_som/cellpool_jan23/presolve.gms @@ -12,18 +12,18 @@ * Note: This will only account for transitions of primary forest to secondary forest and * other land to secondary forest. See current version of 35_natveg to check consistency. -p59_som_pool(j,"secdforest") = p59_som_pool(j,"secdforest") + - (p59_land_before(j,"primforest") - pcm_land(j,"primforest")) * - p59_carbon_density(t-1,j,"primforest") + - (p59_land_before(j,"other") - pcm_land(j,"other")) * - p59_carbon_density(t-1,j,"other"); +pc59_som_pool(j,"secdforest") = pc59_som_pool(j,"secdforest") + + (pc59_land_before(j,"primforest") - pcm_land(j,"primforest")) * + pc59_carbon_density(j,"primforest") + + (pc59_land_before(j,"other") - pcm_land(j,"other")) * + pc59_carbon_density(j,"other"); -p59_som_pool(j,"other") = p59_som_pool(j,"other") - - (p59_land_before(j,"other") - pcm_land(j,"other")) * - p59_carbon_density(t-1,j,"other"); +pc59_som_pool(j,"other") = pc59_som_pool(j,"other") - + (pc59_land_before(j,"other") - pcm_land(j,"other")) * + pc59_carbon_density(j,"other"); -p59_som_pool(j,"primforest") = p59_som_pool(j,"primforest") - - (p59_land_before(j,"primforest") - pcm_land(j,"primforest")) * - p59_carbon_density(t-1,j,"primforest"); +pc59_som_pool(j,"primforest") = pc59_som_pool(j,"primforest") - + (pc59_land_before(j,"primforest") - pcm_land(j,"primforest")) * + pc59_carbon_density(j,"primforest"); -p59_carbon_density(t,j,land)$(pcm_land(j,land) > 1e-10) = p59_som_pool(j,land) / pcm_land(j,land); +p59_carbon_density(t,j,land)$(pcm_land(j,land) > 1e-10) = pc59_som_pool(j,land) / pcm_land(j,land); From 442a7ab7503a18c6fc64c51932013d46473749e6 Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 2 Jun 2024 10:28:18 +0200 Subject: [PATCH 212/280] bugfix disaggregation --- config/default.cfg | 2 +- scripts/output/extra/disaggregation.R | 73 +++++++++++++++------------ 2 files changed, 41 insertions(+), 34 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 2312deade7..565c1d7d69 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -2068,7 +2068,7 @@ cfg$files2export$start <- c("input/info.txt", "modules/14_yields/input/lpj_yields_0.5.mz", "modules/22_land_conservation/input/wdpa_baseline_0.5.mz", "modules/22_land_conservation/input/consv_prio_areas_0.5.mz", - "modules/30_crop/endo_apr21/input/avl_cropland_0.5.mz", + "modules/29_cropland/input/avl_cropland_0.5.mz", "modules/50_nr_soil_budget/input/f50_NitrogenFixationRateNatural_0.5.mz", "modules/50_nr_soil_budget/input/f50_AtmosphericDepositionRates_0.5.mz", "input/f34_urbanland_0.5.mz", diff --git a/scripts/output/extra/disaggregation.R b/scripts/output/extra/disaggregation.R index ef98b04fca..1ead0e46b7 100644 --- a/scripts/output/extra/disaggregation.R +++ b/scripts/output/extra/disaggregation.R @@ -21,7 +21,7 @@ library(gms) # Basic configuration # ============================================= if (!exists("source_include")) { - outputdir <- "output/LAMA65_Sustainability/" + outputdir <- "output/default_2024-06-01_15.40.24/" readArgs("outputdir") } map_file <- Sys.glob(file.path(outputdir, "clustermap_*.rds")) @@ -75,12 +75,11 @@ if (length(map_file) > 1) { level = "cell", products = "kcr", product_aggr = FALSE, water_aggr = FALSE ) - fallow <- fallow(gdx, level = "cell") - area_shr <- area / (dimSums(area, dim = 3) + setNames(fallow, NULL) + 10^-10) + area_shr <- area / (dimSums(area, dim = 3) + 10^-10) # calculate share of crop land on total cell area crop_shr <- land_hr / dimSums(land_hr, dim = 3) - crop_shr <- setNames(crop_shr[, getYears(area_shr), "crop"], NULL) + crop_shr <- setNames(crop_shr[, getYears(area_shr), "crop_area"], NULL) # calculate crop area as share of total cell area area_shr_hr <- madrat::toolAggregate(area_shr, map_file, to = "cell") * crop_shr @@ -291,24 +290,15 @@ if (file.exists(wdpa_hr_file)) { # Account for country-specific SNV shares in post-processing # ------------------------------------------------------------- iso <- readGDX(gdx, "iso") -snv_pol_iso <- readGDX(gdx, "policy_countries30") -snv_pol_select <- readGDX(gdx, "s30_snv_shr", "s30_set_aside_shr") -snv_pol_noselect <- readGDX(gdx, "s30_snv_shr_noselect", "s30_set_aside_shr_noselect") +snv_pol_iso <- readGDX(gdx, "policy_countries29") +snv_pol_select <- readGDX(gdx, "s29_snv_shr") +snv_pol_noselect <- readGDX(gdx, "s29_snv_shr_noselect") snv_pol_shr <- new.magpie(iso, fill = snv_pol_noselect) snv_pol_shr[snv_pol_iso, , ] <- snv_pol_select avl_cropland_hr <- file.path(outputdir, "avl_cropland_0.5.mz") # available cropland (at high resolution) -marginal_land <- cfg$gms$c30_marginal_land # marginal land scenario -target_year <- cfg$gms$c30_snv_target # target year of SNV policy (default: "none") -if (is.null(target_year)) { - target_year <- cfg$gms$c30_set_aside_target -} -snv_pol_fader <- readGDX(gdx, "f30_scenario_fader", "f30_set_aside_fader", - format = "first_found", react = "silent" -)[, , target_year] -if (is.null(snv_pol_fader)) { - snv_pol_fader <- readGDX(gdx, "p30_snv_scenario_fader", format = "first_found") -} +marginal_land <- cfg$gms$c29_marginal_land # marginal land scenario +snv_pol_fader <- readGDX(gdx, "i29_snv_scenario_fader") # ============================================ # Start disaggregation @@ -345,30 +335,49 @@ land_hr <- .fixCoords(land_hr) ) gc() +# --------------------------------- +# Split land pools +# --------------------------------- +t <- readGDX(gdx,"t") +land_split_hr <- land_hr[ ,t , ] + +# split "crop" into crop_area, crop_fallow and crop_treecover +message("Disaggregating cropland") +carea <- land(gdx, level = "cell", subcategories = c("crop"))[,,c("crop_area","crop_fallow","crop_treecover")] +carea_shr <- carea / (dimSums(carea, dim = 3) + 10^-10) +# calculate crop area as share of total cell area +carea_hr <- madrat::toolAggregate(carea_shr, map_file, to = "cell") * setNames(land_split_hr[, , "crop"], NULL) +# check +if (abs(sum(dimSums(carea_hr, dim = 3) - setNames(land_split_hr[, , "crop"], NULL), na.rm = T)) > 0.1) warning("large Difference in crop disaggregation detected!") + +# drop crop +land_split_hr <- land_split_hr[, , "crop", invert = TRUE] +# combine land_split_hr with carea_hr +land_split_hr <- mbind(carea_hr, land_split_hr) + +rm(carea, carea_shr, carea_hr) +gc() + # --------------------------------- # Disaggregate MAgPIE crop types # --------------------------------- message("Disaggregating MAgPIE crop types") -area_shr_hr <- .dissagcrop(gdx, land_hr, map = map_file) +area_shr_hr <- .dissagcrop(gdx, land_split_hr, map = map_file) # Write output .writeDisagg(area_shr_hr, croparea_hr_share_out_file, comment = "unit: croparea fractions of total grid-cell", - message = "Write outputs cell.cropara_share" + message = "Write outputs cell.croparea_share" ) gc() -# --------------------------------- -# Split land pools -# --------------------------------- -land_split_hr <- land_hr[, getYears(area_shr_hr), ] area_hr <- area_shr_hr * dimSums(land_split_hr, dim = 3) rm(area_shr_hr) gc() -# replace crop in land_hr in with crop_kfo_rf, crop_kfo_ir, crop_kbe_rf +# replace crop_area in land_hr in with crop_kfo_rf, crop_kfo_ir, crop_kbe_rf # and crop_kbe_ir kbe <- c("betr", "begr") kfo <- setdiff(getNames(area_hr, dim = 1), kbe) @@ -389,14 +398,12 @@ crop_kbe_ir <- setNames( "crop_kbe_ir" ) crop_hr <- mbind(crop_kfo_rf, crop_kfo_ir, crop_kbe_rf, crop_kbe_ir) -# calculate Fallow -fallow <- setNames(land_split_hr[, , "crop"] - dimSums(area_hr, dim = 3), "fallow") -# drop crop -land_split_hr <- land_split_hr[, , "crop", invert = TRUE] +# drop crop_area +land_split_hr <- land_split_hr[, , "crop_area", invert = TRUE] # combine land_split_hr with crop_hr. -land_split_hr <- mbind(crop_hr, fallow, land_split_hr) +land_split_hr <- mbind(crop_hr, land_split_hr) -rm(crop_kfo_rf, crop_kfo_ir, crop_kbe_rf, crop_kbe_ir, crop_hr, fallow, area_hr) +rm(crop_kfo_rf, crop_kfo_ir, crop_kbe_rf, crop_kbe_ir, crop_hr, area_hr) # split "forestry" into timber plantations, pre-scribed afforestation (NPi/NDC) and endogenous afforestation (CO2 price driven) message("Disaggregating forestry") @@ -405,7 +412,7 @@ farea_shr <- farea / (dimSums(farea, dim = 3) + 10^-10) # calculate forestry area as share of total cell area farea_hr <- madrat::toolAggregate(farea_shr, map_file, to = "cell") * setNames(land_split_hr[, , "forestry"], NULL) # check -if (abs(sum(dimSums(farea_hr, dim = 3) - setNames(land_split_hr[, , "forestry"], NULL), na.rm = T)) > 0.1) warning("large Difference in crop disaggregation detected!") +if (abs(sum(dimSums(farea_hr, dim = 3) - setNames(land_split_hr[, , "forestry"], NULL), na.rm = T)) > 0.1) warning("large Difference in forestry disaggregation detected!") # rename df <- data.frame(matrix(nrow = 3, ncol = 2)) names(df) <- c("internal", "output") @@ -506,7 +513,7 @@ rm(land_consv_hr, urban_land_hr) land_bii_hr <- .fixCoords(land_bii_hr) -# Add primary and secondaray other land +# Add primary and secondary other land land_bii_hr <- PrimSecdOtherLand(land_bii_hr, land_hr_file) # specify potential natural vegetation From d81391a6c5674300e1f57e48ddf298c92ec58ebe Mon Sep 17 00:00:00 2001 From: Jake Tommey Date: Fri, 24 May 2024 17:03:02 +0200 Subject: [PATCH 213/280] modified agmip merge report script to use piamInterfaces --- CHANGELOG.md | 1 + scripts/output/projects/agmip_merge_report.R | 37 ++++++++++++++++---- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d7b181f9e..954636af1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **35_natveg** `vm_land(j2,"forestry")` included in NPI/NDC constraint `q35_min_forest` - **35_natveg** replaced the realisation `dynamic_feb21` with realisation `pot_forest_may24`. The new realisation provides additional information on the potential forest area, which is now used to constrain forest and forestry expansion and recovery. The remaining area for forest establishment is provided to the forestry module via the new interface parameter `pcm_max_forest_est`. - **52_carbon** Separate carbon densities for forest and other land. Before there was only a single carbon density for natural vegetation land. +- **scripts** modified agmip_merge_report to use piamInterfaces ### added - **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` diff --git a/scripts/output/projects/agmip_merge_report.R b/scripts/output/projects/agmip_merge_report.R index 94dfa25996..a442673e22 100644 --- a/scripts/output/projects/agmip_merge_report.R +++ b/scripts/output/projects/agmip_merge_report.R @@ -14,8 +14,9 @@ library(lucode2) library(magclass) library(quitte) library(madrat) -library(iamc) +library(piamInterfaces) library(gms) +library(dplyr) options(error=function()traceback(2)) @@ -64,10 +65,32 @@ if (!is.null(missing)) { } if (file.exists("output/agmip_report_full.csv")) { - #saveRDS(read.quitte("output/agmip_report_full.csv"),file = "output/agmip_report_full.rds") - #agmip_report_full <- read.report(file="agmip_report_full.csv") - write.reportProject(mif = "output/agmip_report_full.csv", - mapping = system.file("extdata", mapping = "variablemappingAgMIP.csv", package = "magpie4"), - file = "output/agmip_report_subset.csv", format = "AgMIP") - #write.reportProject(mif="output/agmip_report_full.csv",mapping = "mapping_magpie_agmip.csv", file = "agmip_report_subset.csv",format="AgMIP") + submission <- generateIIASASubmission( + mifs = "output/agmip_report_full.csv", + mapping = "AgMIP", + model = "MAgPIE", + outputFilename = NULL, + timesteps = c(seq(1900, 2100, 1)), + naAction = "na.pass" + ) + submission <- submission %>% + mutate( + "item" := gsub(".*\\.", "", variable), + "variable" := gsub("\\..*", "", variable) + ) %>% + select( + "Model" = "model", + "Scenario" = "scenario", + "Region" = "region", + "Item" = "item", + "Variable" = "variable", + "Year" = "period", + "Unit" = "unit", + "Value" = "value" + ) + write.csv(submission, + quote = FALSE, + file = "output/agmip_submission_report.csv", + row.names = FALSE + ) } From 315b9a02261662620f52f1655633a1dc511aa1d7 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 3 Jun 2024 15:28:12 +0200 Subject: [PATCH 214/280] bugfix negative values in p35_forest_recovery_area --- modules/35_natveg/pot_forest_may24/presolve.gms | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index c20b972644..8a7415e985 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -56,7 +56,7 @@ p35_forest_recovery_area(t,j,ac_est)$(sum(ac_est2, p35_forest_recovery_area(t,j, * The proportion of secondary forest recovery in total natveg * recovery is derived from the remaining forest recovery area pc35_forest_recovery_shr(j) = 0; -pc35_forest_recovery_shr(j)$((sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")) > +1e-10) = +pc35_forest_recovery_shr(j)$((sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")) > 0) = (pc35_max_forest_recovery(j) - sum(ac_est, p35_forest_recovery_area(t,j,ac_est))) / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")); pc35_forest_recovery_shr(j)$(pc35_forest_recovery_shr(j) < 0) = 0; @@ -67,6 +67,8 @@ p35_forest_recovery_area(t,j,ac_est) = p35_forest_recovery_area(t,j,ac_est) + (pc35_land_other(j,"othernat",ac_est) - p35_forest_recovery_area(t,j,ac_est)) * pc35_forest_recovery_shr(j); p35_forest_recovery_area(t,j,ac_est)$(sum(ac_est2, p35_forest_recovery_area(t,j,ac_est2)) > pc35_max_forest_recovery(j)) = pc35_max_forest_recovery(j)/card(ac_est2); +p35_forest_recovery_area(t,j,ac_est)$(p35_forest_recovery_area(t,j,ac_est) > pc35_land_other(j,"othernat",ac_est)) = pc35_land_other(j,"othernat",ac_est); +p35_forest_recovery_area(t,j,ac_est)$(p35_forest_recovery_area(t,j,ac_est) < 0) = 0; pc35_land_other(j,"othernat",ac_est) = pc35_land_other(j,"othernat",ac_est) - p35_forest_recovery_area(t,j,ac_est); pc35_land_other(j,"youngsecdf",ac_est) = pc35_land_other(j,"youngsecdf",ac_est) + p35_forest_recovery_area(t,j,ac_est); From b7b532378ef1b25145872c1fda10bade70880389 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 4 Jun 2024 08:51:32 +0200 Subject: [PATCH 215/280] bugfix negative values in p35_land_restoration --- modules/10_land/landmatrix_dec18/presolve.gms | 2 +- modules/35_natveg/pot_forest_may24/presolve.gms | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/10_land/landmatrix_dec18/presolve.gms b/modules/10_land/landmatrix_dec18/presolve.gms index edee5163dc..5a79286fe5 100644 --- a/modules/10_land/landmatrix_dec18/presolve.gms +++ b/modules/10_land/landmatrix_dec18/presolve.gms @@ -22,4 +22,4 @@ vm_lu_transitions.up(j,"primforest","primforest") = Inf; *' @stop -m_boundfix(vm_land,(j,land),up,10e-5); +m_boundfix(vm_land,(j,land),up,1e-6); diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 8a7415e985..de60662f9e 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -149,7 +149,10 @@ vm_land.up(j,"primforest") = pcm_land(j,"primforest"); v35_secdforest.lo(j,ac) = 0; v35_secdforest.up(j,ac) = Inf; -p35_protection_dist(j,ac_sub) = (pc35_secdforest(j,ac_sub)/sum(ac_sub2,pc35_secdforest(j,ac_sub2)))$(sum(ac_sub2,pc35_secdforest(j,ac_sub2))>0); +* Secondary forest conservation +p35_protection_dist(j,ac_sub) = 0; +p35_protection_dist(j,ac_sub)$(sum(ac_sub2,pc35_secdforest(j,ac_sub2)) > 0) = pc35_secdforest(j,ac_sub) / sum(ac_sub2,pc35_secdforest(j,ac_sub2)); +pm_land_conservation(t,j,"secdforest","protect")$(pm_land_conservation(t,j,"secdforest","protect") > sum(ac_sub, pc35_secdforest(j,ac_sub))) = sum(ac_sub, pc35_secdforest(j,ac_sub)); if (sum(sameas(t_past,t),1) = 1, v35_secdforest.lo(j,ac_sub) = pm_land_conservation(t,j,"secdforest","protect") * p35_protection_dist(j,ac_sub); else @@ -159,9 +162,6 @@ v35_secdforest.lo(j,ac_sub) = max((1-s35_natveg_harvest_shr) * pc35_secdforest(j v35_secdforest.up(j,ac_sub) = pc35_secdforest(j,ac_sub); m_boundfix(v35_secdforest,(j,ac_sub),l,1e-6); -* Secondary forest conservation -* protection bound fix -pm_land_conservation(t,j,"secdforest","protect")$(abs(pm_land_conservation(t,j,"secdforest","protect") - sum(ac_sub, pc35_secdforest(j,ac_sub))) < 1e-6) = sum(ac_sub, pc35_secdforest(j,ac_sub)); * set restoration target p35_land_restoration(j,"secdforest") = pm_land_conservation(t,j,"secdforest","restore"); * Do not restore secdforest in areas where total natural @@ -172,6 +172,7 @@ p35_land_restoration(j,"secdforest")$(sum(land_natveg, pcm_land(j,land_natveg)) * any remaining restoration area is substracted and shifted to other land restoration. p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - pc35_max_forest_recovery(j); p35_restoration_shift(j)$(p35_restoration_shift(j) < 0) = 0; +p35_restoration_shift(j)$(p35_restoration_shift(j) > p35_land_restoration(j,"secdforest")) = p35_land_restoration(j,"secdforest"); p35_land_restoration(j,"secdforest") = p35_land_restoration(j,"secdforest") - p35_restoration_shift(j); pm_land_conservation(t,j,"other","restore") = pm_land_conservation(t,j,"other","restore") + p35_restoration_shift(j); @@ -193,7 +194,7 @@ m_boundfix(vm_land_other,(j,othertype35,ac_sub),l,1e-6); * Other land conservation * protection bound fix -pm_land_conservation(t,j,"other","protect")$(abs(pm_land_conservation(t,j,"other","protect") - sum(ac_sub, pc35_land_other(j,"othernat",ac_sub))) < 1e-6) = sum(ac_sub, pc35_land_other(j,"othernat",ac_sub)); +pm_land_conservation(t,j,"other","protect")$(pm_land_conservation(t,j,"other","protect") > sum(ac_sub, pc35_land_other(j,"othernat",ac_sub))) = sum(ac_sub, pc35_land_other(j,"othernat",ac_sub)); * set restoration target p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); * Do not restore other land in areas where total natural @@ -202,6 +203,9 @@ p35_land_restoration(j,"other")$(sum(land_natveg, pcm_land(j,land_natveg)) >= su * set conservation bound vm_land.lo(j,"other") = pm_land_conservation(t,j,"other","protect") + p35_land_restoration(j,"other"); +* boundfix for land_natveg +m_boundfix(vm_land,(j,land),up,1e-6); + * ---------------------------- * Calculate carbon density * ------------------------------ From ce151bc7c726b86c7492c8049211e7b58918d4e1 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 4 Jun 2024 10:29:34 +0200 Subject: [PATCH 216/280] bugfix test_runs.R --- CHANGELOG.md | 1 + scripts/start/test_runs.R | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d7b181f9e..0e56c71ec2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **start/projects/fsec.R** scenario settings - **80_optimization** fixed a bug in nlp_apr17; cycling through CONOPT4, CONOPT4 without preprocessing and CONOPT3 was not working - **58_peatland** Added balance variable to avoid random infeasibilites +- **scripts/start/test_runs.R** include all default output script, in particular disaggregation.R, which is needed for BII ## [4.7.3] - 2024-04-12 diff --git a/scripts/start/test_runs.R b/scripts/start/test_runs.R index e30a77ab08..334a514ffb 100644 --- a/scripts/start/test_runs.R +++ b/scripts/start/test_runs.R @@ -26,7 +26,6 @@ download_and_update(cfg) # create additional information to describe the runs cfg$info$flag <- "weeklyTests" -cfg$output <- c("rds_report") # Only run rds_report after model run cfg$results_folder <- "output/:title:" cfg$force_replace <- TRUE From d74c41169fbfe2240cea45fac67444a1a7d273c4 Mon Sep 17 00:00:00 2001 From: Jake Tommey Date: Tue, 4 Jun 2024 11:01:21 +0200 Subject: [PATCH 217/280] change the agmip_merge_report script to start in 1995 --- scripts/output/projects/agmip_merge_report.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/output/projects/agmip_merge_report.R b/scripts/output/projects/agmip_merge_report.R index a442673e22..301c111cf6 100644 --- a/scripts/output/projects/agmip_merge_report.R +++ b/scripts/output/projects/agmip_merge_report.R @@ -70,7 +70,7 @@ if (file.exists("output/agmip_report_full.csv")) { mapping = "AgMIP", model = "MAgPIE", outputFilename = NULL, - timesteps = c(seq(1900, 2100, 1)), + timesteps = c(seq(1995, 2100, 1)), naAction = "na.pass" ) submission <- submission %>% From c5a0c57c9735014dcd9900a6e5e2249b88e6c7fe Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 4 Jun 2024 15:49:42 +0200 Subject: [PATCH 218/280] update --- modules/35_natveg/pot_forest_may24/equations.gms | 3 ++- modules/35_natveg/pot_forest_may24/presolve.gms | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index eea810d8bc..5052d648f8 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -211,8 +211,9 @@ q35_secdforest_regeneration(j2).. q35_other_regeneration(j2).. sum(ac_est, vm_land_other(j2,"othernat",ac_est)) - =g= + =e= sum((othertype35,ac_sub),v35_hvarea_other(j2,othertype35,ac_sub)) + + vm_landexpansion(j2,"other") ; *' The following two constraints distribute additions to secdforest and other land diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index de60662f9e..abad4f86bf 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -194,7 +194,9 @@ m_boundfix(vm_land_other,(j,othertype35,ac_sub),l,1e-6); * Other land conservation * protection bound fix -pm_land_conservation(t,j,"other","protect")$(pm_land_conservation(t,j,"other","protect") > sum(ac_sub, pc35_land_other(j,"othernat",ac_sub))) = sum(ac_sub, pc35_land_other(j,"othernat",ac_sub)); +pm_land_conservation(t,j,"other","protect")$(pm_land_conservation(t,j,"other","protect") > + sum((othertype35,ac_sub), pc35_land_other(j,othertype35,ac_sub))) = + sum((othertype35,ac_sub), pc35_land_other(j,othertype35,ac_sub)); * set restoration target p35_land_restoration(j,"other") = pm_land_conservation(t,j,"other","restore"); * Do not restore other land in areas where total natural @@ -204,7 +206,7 @@ p35_land_restoration(j,"other")$(sum(land_natveg, pcm_land(j,land_natveg)) >= su vm_land.lo(j,"other") = pm_land_conservation(t,j,"other","protect") + p35_land_restoration(j,"other"); * boundfix for land_natveg -m_boundfix(vm_land,(j,land),up,1e-6); +m_boundfix(vm_land,(j,land_natveg),up,1e-6); * ---------------------------- * Calculate carbon density From 11a568021ddff79fe588ba9061103a01a833aca4 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 4 Jun 2024 18:46:33 +0200 Subject: [PATCH 219/280] bugfix max forest recovery --- modules/35_natveg/pot_forest_may24/declarations.gms | 2 +- modules/35_natveg/pot_forest_may24/equations.gms | 2 +- modules/35_natveg/pot_forest_may24/postsolve.gms | 10 +++++++--- modules/35_natveg/pot_forest_may24/preloop.gms | 13 +++++++++++-- modules/35_natveg/pot_forest_may24/presolve.gms | 2 +- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index e440e3a270..5caf9dd1a6 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -22,7 +22,7 @@ parameters pc35_forest_recovery_shr(j) Forest share in natveg recovery (1) p35_forest_recovery_area(t,j,ac) Recovered forest (mio. ha) p35_maturesecdf(t,j,ac) Matured secondary forest (mio. ha) - pcm_max_forest_est(j) Overall forest establishment potential in current time step (mio. ha) + pcm_max_forest_est(t,j) Overall forest establishment potential in current time step (mio. ha) pc35_max_forest_recovery(j) Maximum forest recovery potential after land abandonement (mio. ha) p35_carbon_density_other(t,j,othertype35,ac,ag_pools) Carbon density other land (tC per ha) p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 5052d648f8..662fbd9146 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -190,7 +190,7 @@ q35_hvarea_other(j2,othertype35,ac_sub).. q35_max_forest_establishment(j2).. sum(land_forest, vm_landexpansion(j2,land_forest)) =l= - pcm_max_forest_est(j2) + sum(ct, pcm_max_forest_est(ct,j2)) - sum(ac, vm_land_other(j2,"youngsecdf",ac) ) ; diff --git a/modules/35_natveg/pot_forest_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms index d92c17f222..73a02e8bcb 100644 --- a/modules/35_natveg/pot_forest_may24/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -12,9 +12,13 @@ pc35_secdforest(j,ac) = v35_secdforest.l(j,ac); pc35_land_other(j,othertype35,ac) = vm_land_other.l(j,othertype35,ac); * Reset forest establishment bound -pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, vm_land.l(j,land_forest)); -pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; - +if(m_year(t) <= sm_fix_SSP2, + pcm_max_forest_est(t,j) = 0; + pcm_max_forest_est(t,j)$(fm_carbon_density(t,j,"secdforest","vegc") > 20) = sum(land, vm_land.l(j,land)) - sum(land_forest, vm_land.l(j,land_forest)); +else + pcm_max_forest_est(t,j) = f35_pot_forest_area(j) - sum(land_forest, vm_land.l(j,land_forest)); + pcm_max_forest_est(t,j)$(pcm_max_forest_est(t,j) < 0) = 0; +); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); ov_land_other(t,j,othertype35,ac,"marginal") = vm_land_other.m(j,othertype35,ac); diff --git a/modules/35_natveg/pot_forest_may24/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms index 3f4750017f..62aa874c01 100644 --- a/modules/35_natveg/pot_forest_may24/preloop.gms +++ b/modules/35_natveg/pot_forest_may24/preloop.gms @@ -47,8 +47,17 @@ p35_disturbance_loss_primf(t,j) = 0; * Forest establishment is constrained by the potential forest area in each cluster. * Hence, the area for forest establishments is given by the potential forest * area minus all forest areas in the previous time step. -pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); -pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; + +loop(t, + if(m_year(t) <= sm_fix_SSP2, + pcm_max_forest_est(t,j) = 0; + pcm_max_forest_est(t,j)$(fm_carbon_density(t,j,"secdforest","vegc") > 20) = sum(land, pcm_land(j,land)) - sum(land_forest, pcm_land(j,land_forest)); + else + pcm_max_forest_est(t,j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); + pcm_max_forest_est(t,j)$(pcm_max_forest_est(t,j) < 0) = 0; + ); +); + * ----------------------------------------- * Land conservation for climate mitigation diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index abad4f86bf..e2f42a5013 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -45,7 +45,7 @@ vm_land.l(j,"primforest") = pcm_land(j,"primforest"); * ------------------------------------------------- *** Calculate the upper boundary for secondary forest recovery -pc35_max_forest_recovery(j) = pcm_max_forest_est(j) - sum(ac, pc35_land_other(j,"youngsecdf",ac)); +pc35_max_forest_recovery(j) = pcm_max_forest_est(t,j) - sum(ac, pc35_land_other(j,"youngsecdf",ac)); *** Distribute forestry abandonement * Abandoned forestry is directly shifted into p35_forest_recovery_area(t,j,ac_est) because it is From 48c12080ec62d9c39540e85d81b6ec7098fde651 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 4 Jun 2024 19:09:42 +0200 Subject: [PATCH 220/280] bugfix --- modules/32_forestry/dynamic_may24/presolve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 65d4e73373..74f6cb5d2c 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -23,7 +23,7 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; * Suitable area (`p32_aff_pot`) for NPI/NDC afforestation p32_aff_pot(t,j) = sum((kcr,w),vm_area.l(j,kcr,w) - vm_area.lo(j,kcr,w)) + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore"); *** NDC/NPI re/afforesation is further constrained by the remaining forest establishment potential - p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pcm_max_forest_est(j)) = pcm_max_forest_est(j); + p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pcm_max_forest_est(t,j)) = pcm_max_forest_est(t,j); * suitable area `p32_aff_pot` can be negative, if land restoration is switched on (level smaller than lower bound), therefore set negative values to 0 p32_aff_pot(t,j)$(p32_aff_pot(t,j) < 0) = 0; * Limit prescribed NPI/NDC afforestation in `p32_aff_pol_timestep` if not enough suitable area (`p32_aff_pot`) for afforestation is available From 2ed583e7d90bd0f7c3a9890afd0f3958aa99370f Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 5 Jun 2024 14:16:42 +0200 Subject: [PATCH 221/280] reverting back pcm_max_forest_est --- modules/32_forestry/dynamic_may24/presolve.gms | 2 +- modules/35_natveg/pot_forest_may24/declarations.gms | 2 +- modules/35_natveg/pot_forest_may24/equations.gms | 2 +- modules/35_natveg/pot_forest_may24/postsolve.gms | 10 +++++++--- modules/35_natveg/pot_forest_may24/preloop.gms | 13 +++++++++++-- modules/35_natveg/pot_forest_may24/presolve.gms | 2 +- 6 files changed, 22 insertions(+), 9 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 65d4e73373..74f6cb5d2c 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -23,7 +23,7 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; * Suitable area (`p32_aff_pot`) for NPI/NDC afforestation p32_aff_pot(t,j) = sum((kcr,w),vm_area.l(j,kcr,w) - vm_area.lo(j,kcr,w)) + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore"); *** NDC/NPI re/afforesation is further constrained by the remaining forest establishment potential - p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pcm_max_forest_est(j)) = pcm_max_forest_est(j); + p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pcm_max_forest_est(t,j)) = pcm_max_forest_est(t,j); * suitable area `p32_aff_pot` can be negative, if land restoration is switched on (level smaller than lower bound), therefore set negative values to 0 p32_aff_pot(t,j)$(p32_aff_pot(t,j) < 0) = 0; * Limit prescribed NPI/NDC afforestation in `p32_aff_pol_timestep` if not enough suitable area (`p32_aff_pot`) for afforestation is available diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index e440e3a270..5caf9dd1a6 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -22,7 +22,7 @@ parameters pc35_forest_recovery_shr(j) Forest share in natveg recovery (1) p35_forest_recovery_area(t,j,ac) Recovered forest (mio. ha) p35_maturesecdf(t,j,ac) Matured secondary forest (mio. ha) - pcm_max_forest_est(j) Overall forest establishment potential in current time step (mio. ha) + pcm_max_forest_est(t,j) Overall forest establishment potential in current time step (mio. ha) pc35_max_forest_recovery(j) Maximum forest recovery potential after land abandonement (mio. ha) p35_carbon_density_other(t,j,othertype35,ac,ag_pools) Carbon density other land (tC per ha) p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 5052d648f8..662fbd9146 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -190,7 +190,7 @@ q35_hvarea_other(j2,othertype35,ac_sub).. q35_max_forest_establishment(j2).. sum(land_forest, vm_landexpansion(j2,land_forest)) =l= - pcm_max_forest_est(j2) + sum(ct, pcm_max_forest_est(ct,j2)) - sum(ac, vm_land_other(j2,"youngsecdf",ac) ) ; diff --git a/modules/35_natveg/pot_forest_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms index d92c17f222..73a02e8bcb 100644 --- a/modules/35_natveg/pot_forest_may24/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -12,9 +12,13 @@ pc35_secdforest(j,ac) = v35_secdforest.l(j,ac); pc35_land_other(j,othertype35,ac) = vm_land_other.l(j,othertype35,ac); * Reset forest establishment bound -pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, vm_land.l(j,land_forest)); -pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; - +if(m_year(t) <= sm_fix_SSP2, + pcm_max_forest_est(t,j) = 0; + pcm_max_forest_est(t,j)$(fm_carbon_density(t,j,"secdforest","vegc") > 20) = sum(land, vm_land.l(j,land)) - sum(land_forest, vm_land.l(j,land_forest)); +else + pcm_max_forest_est(t,j) = f35_pot_forest_area(j) - sum(land_forest, vm_land.l(j,land_forest)); + pcm_max_forest_est(t,j)$(pcm_max_forest_est(t,j) < 0) = 0; +); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); ov_land_other(t,j,othertype35,ac,"marginal") = vm_land_other.m(j,othertype35,ac); diff --git a/modules/35_natveg/pot_forest_may24/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms index 3f4750017f..62aa874c01 100644 --- a/modules/35_natveg/pot_forest_may24/preloop.gms +++ b/modules/35_natveg/pot_forest_may24/preloop.gms @@ -47,8 +47,17 @@ p35_disturbance_loss_primf(t,j) = 0; * Forest establishment is constrained by the potential forest area in each cluster. * Hence, the area for forest establishments is given by the potential forest * area minus all forest areas in the previous time step. -pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); -pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; + +loop(t, + if(m_year(t) <= sm_fix_SSP2, + pcm_max_forest_est(t,j) = 0; + pcm_max_forest_est(t,j)$(fm_carbon_density(t,j,"secdforest","vegc") > 20) = sum(land, pcm_land(j,land)) - sum(land_forest, pcm_land(j,land_forest)); + else + pcm_max_forest_est(t,j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); + pcm_max_forest_est(t,j)$(pcm_max_forest_est(t,j) < 0) = 0; + ); +); + * ----------------------------------------- * Land conservation for climate mitigation diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index abad4f86bf..e2f42a5013 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -45,7 +45,7 @@ vm_land.l(j,"primforest") = pcm_land(j,"primforest"); * ------------------------------------------------- *** Calculate the upper boundary for secondary forest recovery -pc35_max_forest_recovery(j) = pcm_max_forest_est(j) - sum(ac, pc35_land_other(j,"youngsecdf",ac)); +pc35_max_forest_recovery(j) = pcm_max_forest_est(t,j) - sum(ac, pc35_land_other(j,"youngsecdf",ac)); *** Distribute forestry abandonement * Abandoned forestry is directly shifted into p35_forest_recovery_area(t,j,ac_est) because it is From 50923e77bf87b8a73383a1b728cf54faae1504d4 Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 5 Jun 2024 14:22:41 +0200 Subject: [PATCH 222/280] Revert "bugfix" This reverts commit 48c12080ec62d9c39540e85d81b6ec7098fde651. --- modules/32_forestry/dynamic_may24/presolve.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 74f6cb5d2c..65d4e73373 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -23,7 +23,7 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; * Suitable area (`p32_aff_pot`) for NPI/NDC afforestation p32_aff_pot(t,j) = sum((kcr,w),vm_area.l(j,kcr,w) - vm_area.lo(j,kcr,w)) + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore"); *** NDC/NPI re/afforesation is further constrained by the remaining forest establishment potential - p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pcm_max_forest_est(t,j)) = pcm_max_forest_est(t,j); + p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pcm_max_forest_est(j)) = pcm_max_forest_est(j); * suitable area `p32_aff_pot` can be negative, if land restoration is switched on (level smaller than lower bound), therefore set negative values to 0 p32_aff_pot(t,j)$(p32_aff_pot(t,j) < 0) = 0; * Limit prescribed NPI/NDC afforestation in `p32_aff_pol_timestep` if not enough suitable area (`p32_aff_pot`) for afforestation is available From 7c99ab6d1616919f85358eaae589ffe4871a4dab Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 5 Jun 2024 14:22:51 +0200 Subject: [PATCH 223/280] Revert "bugfix max forest recovery" This reverts commit 11a568021ddff79fe588ba9061103a01a833aca4. --- modules/35_natveg/pot_forest_may24/declarations.gms | 2 +- modules/35_natveg/pot_forest_may24/equations.gms | 2 +- modules/35_natveg/pot_forest_may24/postsolve.gms | 10 +++------- modules/35_natveg/pot_forest_may24/preloop.gms | 13 ++----------- modules/35_natveg/pot_forest_may24/presolve.gms | 2 +- 5 files changed, 8 insertions(+), 21 deletions(-) diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index 5caf9dd1a6..e440e3a270 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -22,7 +22,7 @@ parameters pc35_forest_recovery_shr(j) Forest share in natveg recovery (1) p35_forest_recovery_area(t,j,ac) Recovered forest (mio. ha) p35_maturesecdf(t,j,ac) Matured secondary forest (mio. ha) - pcm_max_forest_est(t,j) Overall forest establishment potential in current time step (mio. ha) + pcm_max_forest_est(j) Overall forest establishment potential in current time step (mio. ha) pc35_max_forest_recovery(j) Maximum forest recovery potential after land abandonement (mio. ha) p35_carbon_density_other(t,j,othertype35,ac,ag_pools) Carbon density other land (tC per ha) p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index 662fbd9146..5052d648f8 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -190,7 +190,7 @@ q35_hvarea_other(j2,othertype35,ac_sub).. q35_max_forest_establishment(j2).. sum(land_forest, vm_landexpansion(j2,land_forest)) =l= - sum(ct, pcm_max_forest_est(ct,j2)) + pcm_max_forest_est(j2) - sum(ac, vm_land_other(j2,"youngsecdf",ac) ) ; diff --git a/modules/35_natveg/pot_forest_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms index 73a02e8bcb..d92c17f222 100644 --- a/modules/35_natveg/pot_forest_may24/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -12,13 +12,9 @@ pc35_secdforest(j,ac) = v35_secdforest.l(j,ac); pc35_land_other(j,othertype35,ac) = vm_land_other.l(j,othertype35,ac); * Reset forest establishment bound -if(m_year(t) <= sm_fix_SSP2, - pcm_max_forest_est(t,j) = 0; - pcm_max_forest_est(t,j)$(fm_carbon_density(t,j,"secdforest","vegc") > 20) = sum(land, vm_land.l(j,land)) - sum(land_forest, vm_land.l(j,land_forest)); -else - pcm_max_forest_est(t,j) = f35_pot_forest_area(j) - sum(land_forest, vm_land.l(j,land_forest)); - pcm_max_forest_est(t,j)$(pcm_max_forest_est(t,j) < 0) = 0; -); +pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, vm_land.l(j,land_forest)); +pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; + *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); ov_land_other(t,j,othertype35,ac,"marginal") = vm_land_other.m(j,othertype35,ac); diff --git a/modules/35_natveg/pot_forest_may24/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms index 62aa874c01..3f4750017f 100644 --- a/modules/35_natveg/pot_forest_may24/preloop.gms +++ b/modules/35_natveg/pot_forest_may24/preloop.gms @@ -47,17 +47,8 @@ p35_disturbance_loss_primf(t,j) = 0; * Forest establishment is constrained by the potential forest area in each cluster. * Hence, the area for forest establishments is given by the potential forest * area minus all forest areas in the previous time step. - -loop(t, - if(m_year(t) <= sm_fix_SSP2, - pcm_max_forest_est(t,j) = 0; - pcm_max_forest_est(t,j)$(fm_carbon_density(t,j,"secdforest","vegc") > 20) = sum(land, pcm_land(j,land)) - sum(land_forest, pcm_land(j,land_forest)); - else - pcm_max_forest_est(t,j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); - pcm_max_forest_est(t,j)$(pcm_max_forest_est(t,j) < 0) = 0; - ); -); - +pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); +pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; * ----------------------------------------- * Land conservation for climate mitigation diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index e2f42a5013..abad4f86bf 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -45,7 +45,7 @@ vm_land.l(j,"primforest") = pcm_land(j,"primforest"); * ------------------------------------------------- *** Calculate the upper boundary for secondary forest recovery -pc35_max_forest_recovery(j) = pcm_max_forest_est(t,j) - sum(ac, pc35_land_other(j,"youngsecdf",ac)); +pc35_max_forest_recovery(j) = pcm_max_forest_est(j) - sum(ac, pc35_land_other(j,"youngsecdf",ac)); *** Distribute forestry abandonement * Abandoned forestry is directly shifted into p35_forest_recovery_area(t,j,ac_est) because it is From 05e3dc3ceaeb9e74f20c9a68aefad3f496fa8508 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Wed, 5 Jun 2024 17:13:01 +0200 Subject: [PATCH 224/280] added time dimension to potential forest area --- config/default.cfg | 6 ++++++ config/scenario_config.csv | 1 + modules/32_forestry/dynamic_may24/presolve.gms | 2 +- modules/35_natveg/pot_forest_may24/declarations.gms | 2 +- modules/35_natveg/pot_forest_may24/equations.gms | 2 +- modules/35_natveg/pot_forest_may24/input.gms | 11 ++++++++++- modules/35_natveg/pot_forest_may24/postsolve.gms | 6 +++--- modules/35_natveg/pot_forest_may24/preloop.gms | 4 ++-- modules/35_natveg/pot_forest_may24/presolve.gms | 2 +- modules/35_natveg/pot_forest_may24/realization.gms | 2 +- 10 files changed, 27 insertions(+), 11 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 693b579897..9f7017f7e2 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -974,6 +974,12 @@ cfg$gms$s35_hvarea <- 2 # def = 2 # * ("016lin2030") Disturbance applied to 1p6 percent per year linear phase-in over 20yrs from 0 in 2030 cfg$gms$c35_shock_scenario = "none" # def = "none" +# * Scenario for potential forest area +# * options: cc (climate change) +# * nocc (no climate change) +# * nocc_hist (no climate change after year defined by sm_fix_cc) +cfg$gms$c35_pot_forest_scenario <- "cc" # def = "cc" + # ***--------------------- 36_employment ------------------------------- # * This module calculates agricultural employment. # * (exo_may22): employment is calculated based on labor costs and not affecting the diff --git a/config/scenario_config.csv b/config/scenario_config.csv index fd673c0b0e..a96bebeba2 100644 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -50,6 +50,7 @@ gms$c32_aff_policy;;;;;;;;;;;;;;none;npi;ndc;;;;;;;;;ndc;ndc;ndc;ndc;ndc;;;;;;;; gms$s32_planing_horizon;;;;50;50;50;50;50;50;50;30;50;50;;;;;;;50;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c35_ad_policy;;;;;;;;;;;;;;none;npi;ndc;;;;;;;;;ndc;ndc;ndc;ndc;ndc;;;;;;;;;;;;;;;;;;;; gms$c35_aolc_policy;;;;;;;;;;;;;;none;npi;ndc;;;;;;;;;ndc;ndc;ndc;ndc;ndc;;;;;;;;;;;;;;;;;;;; +gms$c35_pot_forest_scenario;cc;nocc;nocc_hist;;;;;;;;;;;;;;;;;;;;;;cc;cc;cc;cc;cc;;;;;;;;;;;;;;;;;;;; gms$s35_forest_damage_end;;;;2030;2050;2050;2050;2050;2030;2030;2030;2030;2030;;;;;;;2030;;;;;2030;2030;2030;2030;2030;;;;;;;;;;;;;;;;;;;; gms$s42_watdem_nonagr_scenario;;;;1;2;2;3;2;1;1;1;3;1;;;;;;;;;;;;2;1;2;2;1;;;;;;;;;;;;;;;;;;;; gms$s42_irrig_eff_scenario;;;;2;2;2;2;2;2;3;3;3;3;;;;;;;3;;;;;3;3;3;3;3;;;;;;;;;;;;;;;;;;;; diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 65d4e73373..0d37dcd651 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -23,7 +23,7 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; * Suitable area (`p32_aff_pot`) for NPI/NDC afforestation p32_aff_pot(t,j) = sum((kcr,w),vm_area.l(j,kcr,w) - vm_area.lo(j,kcr,w)) + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore"); *** NDC/NPI re/afforesation is further constrained by the remaining forest establishment potential - p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pcm_max_forest_est(j)) = pcm_max_forest_est(j); + p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pm_max_forest_est(t,j)) = pm_max_forest_est(t,j); * suitable area `p32_aff_pot` can be negative, if land restoration is switched on (level smaller than lower bound), therefore set negative values to 0 p32_aff_pot(t,j)$(p32_aff_pot(t,j) < 0) = 0; * Limit prescribed NPI/NDC afforestation in `p32_aff_pol_timestep` if not enough suitable area (`p32_aff_pot`) for afforestation is available diff --git a/modules/35_natveg/pot_forest_may24/declarations.gms b/modules/35_natveg/pot_forest_may24/declarations.gms index e440e3a270..a583d4da6c 100644 --- a/modules/35_natveg/pot_forest_may24/declarations.gms +++ b/modules/35_natveg/pot_forest_may24/declarations.gms @@ -22,7 +22,7 @@ parameters pc35_forest_recovery_shr(j) Forest share in natveg recovery (1) p35_forest_recovery_area(t,j,ac) Recovered forest (mio. ha) p35_maturesecdf(t,j,ac) Matured secondary forest (mio. ha) - pcm_max_forest_est(j) Overall forest establishment potential in current time step (mio. ha) + pm_max_forest_est(t,j) Overall forest establishment potential in current time step (mio. ha) pc35_max_forest_recovery(j) Maximum forest recovery potential after land abandonement (mio. ha) p35_carbon_density_other(t,j,othertype35,ac,ag_pools) Carbon density other land (tC per ha) p35_disturbance_loss_secdf(t,j,ac) Loss due to disturbances in secondary forest (mio. ha) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index eea810d8bc..e1ecbbbd61 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -190,7 +190,7 @@ q35_hvarea_other(j2,othertype35,ac_sub).. q35_max_forest_establishment(j2).. sum(land_forest, vm_landexpansion(j2,land_forest)) =l= - pcm_max_forest_est(j2) + sum(ct,pm_max_forest_est(ct,j2)) - sum(ac, vm_land_other(j2,"youngsecdf",ac) ) ; diff --git a/modules/35_natveg/pot_forest_may24/input.gms b/modules/35_natveg/pot_forest_may24/input.gms index 0ed373a22b..d4922eae94 100644 --- a/modules/35_natveg/pot_forest_may24/input.gms +++ b/modules/35_natveg/pot_forest_may24/input.gms @@ -9,6 +9,11 @@ $setglobal c35_ad_policy npi $setglobal c35_aolc_policy npi $setglobal c35_shock_scenario none +$setglobal c35_pot_forest_scenario cc +* options: cc (climate change) +* nocc (no climate change) +* nocc_hist (no climate change after year defined by sm_fix_cc) + scalars s35_hvarea Flag for harvested area (0=zero 1=exognous 2=endogneous) / 2 / s35_hvarea_secdforest annual secdforest harvest rate for s35_hvarea equals 1 (percent per year) / 0 / @@ -48,9 +53,13 @@ $include "./modules/35_natveg/input/f35_forest_disturbance_share.cs4" $offdelim /; -parameter f35_pot_forest_area(j) Potential forest area (mio. ha) +parameter f35_pot_forest_area(t_all,j) Potential forest area (mio. ha) / $ondelim $include "./modules/35_natveg/input/pot_forest_area.cs2" $offdelim /; + +$if "%c35_pot_forest_scenario%" == "nocc" f35_pot_forest_area(t_all,j) = f35_pot_forest_area("y1995",j); +$if "%c35_pot_forest_scenario%" == "nocc_hist" f35_pot_forest_area(t_all,j)$(m_year(t_all) > sm_fix_cc) = f35_pot_forest_area(t_all,j)$(m_year(t_all) = sm_fix_cc); +m_fillmissingyears(f35_pot_forest_area,"j"); diff --git a/modules/35_natveg/pot_forest_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms index d92c17f222..cad9959091 100644 --- a/modules/35_natveg/pot_forest_may24/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -11,9 +11,9 @@ pc35_secdforest(j,ac) = v35_secdforest.l(j,ac); *other land age class calculation pc35_land_other(j,othertype35,ac) = vm_land_other.l(j,othertype35,ac); -* Reset forest establishment bound -pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, vm_land.l(j,land_forest)); -pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; +* Set the forest establishment bound for the next time step +pm_max_forest_est(t+1,j) = f35_pot_forest_area(t+1,j) - sum(land_forest, vm_land.l(j,land_forest)); +pm_max_forest_est(t+1,j)$(pm_max_forest_est(t+1,j) < 0) = 0; *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); diff --git a/modules/35_natveg/pot_forest_may24/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms index 3f4750017f..3b61137ec0 100644 --- a/modules/35_natveg/pot_forest_may24/preloop.gms +++ b/modules/35_natveg/pot_forest_may24/preloop.gms @@ -47,8 +47,8 @@ p35_disturbance_loss_primf(t,j) = 0; * Forest establishment is constrained by the potential forest area in each cluster. * Hence, the area for forest establishments is given by the potential forest * area minus all forest areas in the previous time step. -pcm_max_forest_est(j) = f35_pot_forest_area(j) - sum(land_forest, pcm_land(j,land_forest)); -pcm_max_forest_est(j)$(pcm_max_forest_est(j) < 0) = 0; +pm_max_forest_est(t,j) = f35_pot_forest_area(t,j) - sum(land_forest, pcm_land(j,land_forest)); +pm_max_forest_est(t,j)$(pm_max_forest_est(t,j) < 0) = 0; * ----------------------------------------- * Land conservation for climate mitigation diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 8d2ac2ede8..068d8f1f44 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -45,7 +45,7 @@ vm_land.l(j,"primforest") = pcm_land(j,"primforest"); * ------------------------------------------------- *** Calculate the upper boundary for secondary forest recovery -pc35_max_forest_recovery(j) = pcm_max_forest_est(j) - sum(ac, pc35_land_other(j,"youngsecdf",ac)); +pc35_max_forest_recovery(j) = pm_max_forest_est(t,j) - sum(ac, pc35_land_other(j,"youngsecdf",ac)); *** Distribute forestry abandonement * Abandoned forestry is directly shifted into p35_forest_recovery_area(t,j,ac_est) because it is diff --git a/modules/35_natveg/pot_forest_may24/realization.gms b/modules/35_natveg/pot_forest_may24/realization.gms index 0003ac36b0..33081fc6d6 100644 --- a/modules/35_natveg/pot_forest_may24/realization.gms +++ b/modules/35_natveg/pot_forest_may24/realization.gms @@ -13,7 +13,7 @@ *' Forest establishment is constrained by the potential forest area, which is defined by *' areas with a potential carbon density of >20 tC/ha. The remaining forest establishment *' area in the current time step is provided to the [32_forestry] module via the -*' interface parameter `pcm_max_forest_est`. +*' interface parameter `pm_max_forest_est`. *' This realization also includes national policies implemented (NPI) and nationally *' determined contributions to the Paris agreement (NDC) with regard to forest and other *' land protection. The NPI/NDC polices ramp up until 2030 and are assumed constant From 79737dd2de133449cc493aef92e5cbfbfeb9320b Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 6 Jun 2024 16:15:49 +0200 Subject: [PATCH 225/280] update defaults from 2020 to 2025 --- CHANGELOG.md | 1 + config/default.cfg | 22 +++++++++---------- config/scenario_config.csv | 2 +- .../selfsuff_reduced_bilateral22/input.gms | 2 +- .../area_based_apr22/input.gms | 4 ++-- modules/30_crop/endo_apr21/input.gms | 6 ++--- modules/30_crop/penalty_apr22/input.gms | 6 ++--- modules/30_crop/rotation_apr22/input.gms | 6 ++--- .../38_factor_costs/sticky_labor/input.gms | 2 +- .../agr_sector_aug13/input.gms | 2 +- .../all_sectors_aug13/input.gms | 2 +- 11 files changed, 28 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e56c71ec2..6cf653c367 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **35_natveg** `vm_land(j2,"forestry")` included in NPI/NDC constraint `q35_min_forest` - **35_natveg** replaced the realisation `dynamic_feb21` with realisation `pot_forest_may24`. The new realisation provides additional information on the potential forest area, which is now used to constrain forest and forestry expansion and recovery. The remaining area for forest establishment is provided to the forestry module via the new interface parameter `pcm_max_forest_est`. - **52_carbon** Separate carbon densities for forest and other land. Before there was only a single carbon density for natural vegetation land. +- **default.cfg** defaults for `cfg$gms$sm_fix_SSP2`, `cfg$gms$sm_fix_cc` and other switches changed from 2020 to 2025 ### added - **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` diff --git a/config/default.cfg b/config/default.cfg index 23cc26d900..75315aa837 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -192,10 +192,10 @@ cfg$gms$c09_pal_scenario <- "SSP2" # def = SSP2 # * SDP: "SDP", "SDP_EI", "SDP_MC", "SDP_RC" # Year until which all parameters are fixed to SSP2 values -cfg$gms$sm_fix_SSP2 <- 2020 +cfg$gms$sm_fix_SSP2 <- 2025 # Year until which all parameters affected by climate change are fixed to historical values -cfg$gms$sm_fix_cc <- 2020 +cfg$gms$sm_fix_cc <- 2025 # ***--------------------- 10_land ---------------------------------------- # * (landmatrix_dec18): includes a land transition matrix @@ -604,8 +604,8 @@ cfg$gms$s21_trade_tariff <- 1 # def =1 # * whether to fade out trade tariffs (bilateral trade realization) # def = 0 cfg$gms$s21_trade_tariff_fadeout <- 0 -# * start year of fadeout if s21_trade_tariff_fadeout = 1 # def = 2020 -cfg$gms$s21_trade_tariff_startyear <- 2020 +# * start year of fadeout if s21_trade_tariff_fadeout = 1 # def = 2025 +cfg$gms$s21_trade_tariff_startyear <- 2025 # * end year of fadeout if s21_trade_tariff_fadeout = 1 # def = 2050 cfg$gms$s21_trade_tariff_targetyear <- 2050 @@ -675,9 +675,9 @@ cfg$gms$s22_restore_land <- 1 # def = 1 # * sigmoidal trajectory. NOTE: This switch is only relevant # * if one of the 'future options' (e.g. BH) is chosen. # * Start year: -cfg$gms$s22_conservation_start <- 2020 # def = 2020 +cfg$gms$s22_conservation_start <- 2025 # def = 2025 # * Target year (year when full protection is reached): -cfg$gms$s22_conservation_target <- 2030 # def = 2030 +cfg$gms$s22_conservation_target <- 2050 # def = 2050 # ***--------------------- 29_ageclass ----------------------------------- # * (feb21): Distribution of age-classes according to Poulter et al 2018 @@ -706,7 +706,7 @@ cfg$gms$c30_rotation_constraints <- "on" # def = "on" cfg$gms$c30_rotation_scenario <- "default" # def = "default" # * Year by which rotation scenario is fully implemented: # * Start year: -cfg$gms$s30_rotation_scenario_start <- 2020 # def = 2020 +cfg$gms$s30_rotation_scenario_start <- 2025 # def = 2025 # * Target year (year when full implementation is reached): cfg$gms$s30_rotation_scenario_target <- 2050 # def = 2050 @@ -732,9 +732,9 @@ cfg$gms$s30_snv_shr <- 0 # def = 0 cfg$gms$s30_snv_shr_noselect <- 0 # def = 0 # * Year by which SNV policy ('s30_snv_shr') is fully implemented. # * Start year (should be close to 2019): -cfg$gms$s30_snv_scenario_start <- 2020 # def = 2020 +cfg$gms$s30_snv_scenario_start <- 2025 # def = 2025 # * Target year (year when full implementation is reached): -cfg$gms$s30_snv_scenario_target <- 2030 # def = 2030 +cfg$gms$s30_snv_scenario_target <- 2050 # def = 2050 # * Switch and specification of countries for which SNV policy in # * s30_snv_shr apply. # * Options: list of iso-codes of countries where SNV policy should be applied @@ -1042,7 +1042,7 @@ cfg$gms$c38_fac_req <- "glo" # default "glo" # * Year until which the capital share should be fixed to the historical values, not allowing for endogenous # * substitution between labor and capital. -cfg$gms$s38_startyear_labor_substitution <- 2020 # default 2020 +cfg$gms$s38_startyear_labor_substitution <- 2025 # default 2025 # * The following two settings are to create exogenous scenarios in which capital is substituted by labor to increase # * employment: @@ -1146,7 +1146,7 @@ cfg$gms$c42_env_flow_policy <- "off" # def = "off" # * Defines when linear fading in of policy starts and when the target of # * full protection based on 's42_env_flow_scenario' is reached # * Start year: -cfg$gms$s42_efp_startyear <- 2020 # def = 2020 +cfg$gms$s42_efp_startyear <- 2025 # def = 2025 # * Target year (year when full protection is reached): cfg$gms$s42_efp_targetyear <- 2040 # def = 2040 diff --git a/config/scenario_config.csv b/config/scenario_config.csv index 54029f3184..60c00ffa42 100755 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -18,7 +18,7 @@ gms$s15_food_substitution_target;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$kfo_rd;;;;;;;;;;;livst_rum;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;livst_rum,livst_milk gms$s15_exo_foodscen_convergence;;;;;;;;;;1;1;1;1;;;;;;;1;1;1;1;;;1;;;1;;;;;;;;;;;;;;;;;;;1; gms$s15_exo_foodscen_functional_form;;;;;;;;;;1;1;1;1;;;;;;;1;1;1;1;;;1;;;1;;;;;;;;;;;;;;;;;;;1; -gms$s15_exo_foodscen_start;;;;;;;;;;2020;2020;2020;2020;;;;;;;2020;2020;2020;2020;;;2020;;;2020;;;;;;;;;;;;;;;;;;;2020; +gms$s15_exo_foodscen_start;;;;;;;;;;2020;2020;2020;2020;;;;;;;2020;2025;2020;2020;;;2020;;;2020;;;;;;;;;;;;;;;;;;;2020; gms$s15_exo_foodscen_target;;;;;;;;;;2050;2050;2050;2070;;;;;;;2050;2050;2050;2050;;;2050;;;2050;;;;;;;;;;;;;;;;;;;2050; gms$s15_exo_waste;;;;0;0;0;0;0;0;1;1;1;1;;;;;;;1;0;1;1;;0;1;0;0;1;0;0;1;1;;;;;;;;;;;;;;;1; gms$s15_waste_scen;;;;;;;;;;1.2;1.3;1.2;1.25;;;;;;;1.2;1.2;1.2;1.2;;;1.2;;;1.2;;;;;;;;;;;;;;;;;;;1.2; diff --git a/modules/21_trade/selfsuff_reduced_bilateral22/input.gms b/modules/21_trade/selfsuff_reduced_bilateral22/input.gms index 52055626c4..e73d9007a3 100644 --- a/modules/21_trade/selfsuff_reduced_bilateral22/input.gms +++ b/modules/21_trade/selfsuff_reduced_bilateral22/input.gms @@ -16,7 +16,7 @@ sets scalars s21_trade_tariff Trade tariff switch (1=on 0=off) (1) / 1 / s21_trade_tariff_fadeout fadeout scenario setting for trade tariffs / 0 / - s21_trade_tariff_startyear year to start fading out trade tariffs / 2020 / + s21_trade_tariff_startyear year to start fading out trade tariffs / 2025 / s21_trade_tariff_targetyear year to finish fading out trade tariffs / 2050 / s21_cost_import Cost for additional imports to maintain feasibility (USD05MER per tDM) / 10000 / s21_min_trade_margin_forestry Minimum trade margin for forestry products (USD05MER per tDM) / 50 / diff --git a/modules/22_land_conservation/area_based_apr22/input.gms b/modules/22_land_conservation/area_based_apr22/input.gms index f72e91fe8a..d2a1d29841 100644 --- a/modules/22_land_conservation/area_based_apr22/input.gms +++ b/modules/22_land_conservation/area_based_apr22/input.gms @@ -12,8 +12,8 @@ $setglobal c22_protect_scenario_noselect none scalars s22_restore_land If land restoration is allowed (0=no 1=yes) / 1 / -s22_conservation_start Land conservation start year / 2020 / -s22_conservation_target Land conservation target year / 2030 / +s22_conservation_start Land conservation start year / 2025 / +s22_conservation_target Land conservation target year / 2050 / ; * Set-switch for countries affected by regional land conservation policy diff --git a/modules/30_crop/endo_apr21/input.gms b/modules/30_crop/endo_apr21/input.gms index cd040e783b..d96b3d1aef 100644 --- a/modules/30_crop/endo_apr21/input.gms +++ b/modules/30_crop/endo_apr21/input.gms @@ -23,11 +23,11 @@ $setglobal c30_rotation_constraints on scalars s30_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / s30_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / -s30_snv_scenario_start SNV scenario start year / 2020 / -s30_snv_scenario_target SNV scenario target year / 2030 / +s30_snv_scenario_start SNV scenario start year / 2025 / +s30_snv_scenario_target SNV scenario target year / 2050 / s30_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / s30_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / -s30_rotation_scenario_start Rotation scenario start year / 2020 / +s30_rotation_scenario_start Rotation scenario start year / 2025 / s30_rotation_scenario_target Rotation scenario target year / 2050 / s30_annual_max_growth Max annual cropland growth as share of previous cropland (1) / Inf / ; diff --git a/modules/30_crop/penalty_apr22/input.gms b/modules/30_crop/penalty_apr22/input.gms index 540f7df5ea..021ede1339 100644 --- a/modules/30_crop/penalty_apr22/input.gms +++ b/modules/30_crop/penalty_apr22/input.gms @@ -29,9 +29,9 @@ $setglobal c30_rotation_scenario_speed by2050 scalars s30_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / s30_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / -s30_snv_scenario_start SNV scenario start year / 2020 / -s30_snv_scenario_target SNV scenario target year / 2030 / -s30_rotation_scenario_start Rotation scenario start year / 2020 / +s30_snv_scenario_start SNV scenario start year / 2025 / +s30_snv_scenario_target SNV scenario target year / 2050 / +s30_rotation_scenario_start Rotation scenario start year / 2025 / s30_rotation_scenario_target Rotation scenario target year / 2050 / s30_annual_max_growth Max annual cropland growth as share of previous cropland (1) / Inf / s30_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / diff --git a/modules/30_crop/rotation_apr22/input.gms b/modules/30_crop/rotation_apr22/input.gms index f7b3c06424..0f60afd2e5 100644 --- a/modules/30_crop/rotation_apr22/input.gms +++ b/modules/30_crop/rotation_apr22/input.gms @@ -29,9 +29,9 @@ $setglobal c30_rotation_scenario_speed by2050 scalars s30_snv_shr Share of available cropland that is witheld for other land cover types (1) / 0 / s30_snv_shr_noselect Share of available cropland that is witheld for other land cover types (1) / 0 / -s30_snv_scenario_start SNV scenario start year / 2020 / -s30_snv_scenario_target SNV scenario target year / 2030 / -s30_rotation_scenario_start Rotation scenario start year / 2020 / +s30_snv_scenario_start SNV scenario start year / 2025 / +s30_snv_scenario_target SNV scenario target year / 2050 / +s30_rotation_scenario_start Rotation scenario start year / 2025 / s30_rotation_scenario_target Rotation scenario target year / 2050 / s30_annual_max_growth Max annual cropland growth as share of previous cropland (1) / Inf / s30_snv_relocation_data_x1 First reference value in SNV target cropland data (1) / 0.2 / diff --git a/modules/38_factor_costs/sticky_labor/input.gms b/modules/38_factor_costs/sticky_labor/input.gms index 1d9b6416e4..f19986da00 100644 --- a/modules/38_factor_costs/sticky_labor/input.gms +++ b/modules/38_factor_costs/sticky_labor/input.gms @@ -14,7 +14,7 @@ s38_depreciation_rate depreciation rate (share of costs) / 0.05 / * Share of immobile capital. s38_immobile immobile capital (share) / 1 / s38_ces_elast_subst Elasticity of substitution in CES function (1) / 0.3 / -s38_startyear_labor_substitution Year until which labor and capital requirements are fixed to historic values (year) / 2020 / +s38_startyear_labor_substitution Year until which labor and capital requirements are fixed to historic values (year) / 2025 / s38_target_labor_share Target labor share out of labor plus capital needed (1) / 0 / s38_targetyear_labor_share Year for which the target labor share should be set (year) / 2050 / s38_target_fulfillment Share by which a region moves from its baseline labor share towards the target value (1) / 0.5 / diff --git a/modules/42_water_demand/agr_sector_aug13/input.gms b/modules/42_water_demand/agr_sector_aug13/input.gms index fab1d14de8..30d9b37dfc 100644 --- a/modules/42_water_demand/agr_sector_aug13/input.gms +++ b/modules/42_water_demand/agr_sector_aug13/input.gms @@ -29,7 +29,7 @@ s42_env_flow_scenario EFP scenario. (1) / 2 / * s42_env_flow_fraction has no effect. * Linear fading in of environmental flow policy between startyear and targetyear -s42_efp_startyear Environmental flow policy start year / 2020 / +s42_efp_startyear Environmental flow policy start year / 2025 / s42_efp_targetyear Environmental flow policy target year / 2040 / s42_env_flow_base_fraction Fraction of available water that is reserved for the environment where no EFP policy is implemented (1) / 0.05 / diff --git a/modules/42_water_demand/all_sectors_aug13/input.gms b/modules/42_water_demand/all_sectors_aug13/input.gms index 07b0da00f0..a725f58cff 100644 --- a/modules/42_water_demand/all_sectors_aug13/input.gms +++ b/modules/42_water_demand/all_sectors_aug13/input.gms @@ -32,7 +32,7 @@ s42_env_flow_scenario Environmental flow protection scenario * s42_env_flow_fraction has no effect. * Linear fading in of environmental flow policy between startyear and targetyear -s42_efp_startyear Environmental flow policy start year / 2020 / +s42_efp_startyear Environmental flow policy start year / 2025 / s42_efp_targetyear Environmental flow policy target year / 2040 / s42_env_flow_base_fraction Fraction of available water that is reserved for the environment if no EFR protection policy is implemented (1) / 0.05 / s42_env_flow_fraction Fraction of available water that is reserved under protection policies (1) / 0.2 / From d10387baac70280afed49eb317a82472d4a150f6 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 7 Jun 2024 17:39:45 +0200 Subject: [PATCH 226/280] bugfix --- modules/09_drivers/aug17/declarations.gms | 3 --- modules/09_drivers/aug17/input.gms | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/09_drivers/aug17/declarations.gms b/modules/09_drivers/aug17/declarations.gms index ac0ea2b3e5..004c7bc854 100644 --- a/modules/09_drivers/aug17/declarations.gms +++ b/modules/09_drivers/aug17/declarations.gms @@ -33,7 +33,4 @@ parameters im_physical_inactivity(t_all,iso,sex,age) Share of population which is physically inactive (1) im_demography(t_all,iso,sex,age) Population by groups (mio. per yr) -* Years where SSPs and nocc/cc scenarios diverge - sm_fix_SSP2 year until which all parameters are fixed to SSP2 values (year) / 2020 / - sm_fix_cc year until which all parameters affected by cc are fixed to historical values (year) / 2020 / ; diff --git a/modules/09_drivers/aug17/input.gms b/modules/09_drivers/aug17/input.gms index 6266da6fe6..627d78607b 100644 --- a/modules/09_drivers/aug17/input.gms +++ b/modules/09_drivers/aug17/input.gms @@ -17,6 +17,11 @@ $setglobal c09_pal_scenario SSP2 * options: SSP: "SSP1", "SSP2", "SSP3", "SSP4", "SSP5", "SSP2EU" * SDP: "SDP", "SDP_EI", "SDP_MC", "SDP_RC" +parameters +* Years where SSPs and nocc/cc scenarios diverge + sm_fix_SSP2 year until which all parameters are fixed to SSP2 values (year) / 2025 / + sm_fix_cc year until which all parameters affected by cc are fixed to historical values (year) / 2025 / +; table f09_gdp_ppp_iso(t_all,iso,pop_gdp_scen09) Income in purchasing power parity (mio. USD05PPP per yr) $ondelim From 772f3217a5dd6c9fdc528ce0ba4a3418a2e67701 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 7 Jun 2024 21:50:35 +0200 Subject: [PATCH 227/280] bugfix --- modules/73_timber/default/preloop.gms | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/73_timber/default/preloop.gms b/modules/73_timber/default/preloop.gms index 8eed23dbf4..d5c9f58b72 100644 --- a/modules/73_timber/default/preloop.gms +++ b/modules/73_timber/default/preloop.gms @@ -13,7 +13,7 @@ p73_forestry_demand_prod_specific(t_past_forestry,iso,total_wood_products) = f73 ** Loop over time to calculate future demand ** Calculations based on Lauri et al. 2019 -loop(t_all$(m_year(t_all) >= sm_fix_SSP2 AND m_year(t_all) <= 2150), +loop(t_all$(m_year(t_all) > 2015 AND m_year(t_all) <= 2150), p73_forestry_demand_prod_specific(t_all,iso,total_wood_products)$(im_gdp_pc_ppp_iso(t_all,iso)>0 AND im_pop_iso(t_all,iso)>0) = p73_forestry_demand_prod_specific(t_all-1,iso,total_wood_products) * @@ -29,15 +29,15 @@ p73_timber_demand_gdp_pop(t_all,i,kforestry) = sum((i_to_iso(i,iso),kforestry_to ** Hard additive calibration for timber demand if(s73_timber_demand_switch=1, loop (t_all, - if(m_year(t_all) < sm_fix_SSP2, + if(m_year(t_all) <= 2015, p73_demand_calib(t_all,i,"wood") = f73_regional_timber_demand(t_all,i,"industrial_roundwood") - p73_timber_demand_gdp_pop(t_all,i,"wood"); p73_timber_demand_gdp_pop(t_all,i,"wood") = p73_timber_demand_gdp_pop(t_all,i,"wood") + p73_demand_calib(t_all,i,"wood"); ); ); - loop (t_all$(m_year(t_all)>=sm_fix_SSP2), - p73_timber_demand_gdp_pop(t_all,i,"wood")$(p73_timber_demand_gdp_pop(t_all,i,"wood") s73_increase_ceiling) = p73_timber_demand_gdp_pop(t_all-1,i,"wood") * s73_increase_ceiling; + loop (t_all$(m_year(t_all) > 2015), + p73_timber_demand_gdp_pop(t_all,i,"wood")$(p73_timber_demand_gdp_pop(t_all,i,"wood") < p73_timber_demand_gdp_pop(t_all-1,i,"wood")) = p73_timber_demand_gdp_pop(t_all-1,i,"wood") * s73_increase_ceiling; + p73_timber_demand_gdp_pop(t_all,i,"wood")$(p73_timber_demand_gdp_pop(t_all,i,"wood")/p73_timber_demand_gdp_pop(t_all-1,i,"wood") > s73_increase_ceiling) = p73_timber_demand_gdp_pop(t_all-1,i,"wood") * s73_increase_ceiling; ); ); @@ -59,7 +59,7 @@ pm_demand_forestry(t_all,i,kforestry) = round(p73_timber_demand_gdp_pop(t_all,i, p73_fraction(t_all) = s73_expansion/(m_year("y2100") - sm_fix_SSP2); ** Populate the fraction for each time step -loop(t_all$(m_year(t_all)>=sm_fix_SSP2), +loop(t_all$(m_year(t_all) > 2015), p73_fraction(t_all) = s73_expansion/(m_year("y2100") - sm_fix_SSP2) * m_yeardiff(t_all) + p73_fraction(t_all-1); ); From b369996d0bffa43e1901b0f199bb65a43d16f310 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 7 Jun 2024 21:56:04 +0200 Subject: [PATCH 228/280] update input data --- config/default.cfg | 6 +++--- config/scenario_config.csv | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 75315aa837..2dec6eef9a 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -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.106_h12_magpie.tgz", - cellular = "rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.106_h12_validation.tgz", +cfg$input <- c(regional = "rev4.108_h12_magpie.tgz", + cellular = "rev4.108_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.108_h12_validation.tgz", additional = "additional_data_rev4.50.tgz", calibration = "calibration_H12_26Mar24.tgz") diff --git a/config/scenario_config.csv b/config/scenario_config.csv index 60c00ffa42..a6c0a9ac2c 100755 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -101,5 +101,5 @@ gms$c60_bioenergy_subsidy;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c60_res_2ndgenBE_dem;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;sdp;ssp2;sdp;sdp;;;;;;;sdp;;;;;ssp4;sdp;ssp4;ssp4;sdp;;;;;;;;;;;;;;;;;;;; gms$c70_feed_scen;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;ssp1;ssp5;ssp1;ssp1;;;;;;;ssp1;;ssp1;;;ssp4;ssp1;ssp4;ssp4;ssp1;;;;;;;;;;;;;;;;;;;; gms$s73_timber_demand_switch;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;;;;;; -input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.106_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.106_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.106_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.106_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.106_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;; +input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.108_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.108_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.108_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.108_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.108_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.108_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;; magicc_emis_scen;;;;;;;;;;;;;;;;;;;;;;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;;;;;;;;;;;;;;;;;;;;;;;;; From 67598ada8be72218828519e517cfdd241068ec3b Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 8 Jun 2024 09:46:27 +0200 Subject: [PATCH 229/280] bugfix 2025 --- .../all_sectors_aug13/presolve.gms | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/modules/42_water_demand/all_sectors_aug13/presolve.gms b/modules/42_water_demand/all_sectors_aug13/presolve.gms index 67275b377a..e3c7a4f9f7 100644 --- a/modules/42_water_demand/all_sectors_aug13/presolve.gms +++ b/modules/42_water_demand/all_sectors_aug13/presolve.gms @@ -37,12 +37,16 @@ if ((s42_pumping = 1), * Water withdrawals in manufacturing, electricity, domestic, ecosystem * depends on the socioeconomic scenario -if ((s42_watdem_nonagr_scenario = 1), - vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp1",watdem_ineldo); -Elseif(s42_watdem_nonagr_scenario = 2), - vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp2",watdem_ineldo); -Elseif(s42_watdem_nonagr_scenario = 3), - vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp3",watdem_ineldo); +if (m_year(t) <= sm_fix_SSP2, + vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp2",watdem_ineldo); +else + if ((s42_watdem_nonagr_scenario = 1), + vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp1",watdem_ineldo); + Elseif(s42_watdem_nonagr_scenario = 2), + vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp2",watdem_ineldo); + Elseif(s42_watdem_nonagr_scenario = 3), + vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp3",watdem_ineldo); + ); ); From c54900439f642f0d46c2cecbb6af0dd8ce5f5df4 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Sat, 8 Jun 2024 15:58:53 +0200 Subject: [PATCH 230/280] updated paths to most up to date coupled runs --- scripts/start/projects/project_EAT2p0.R | 4 +- .../start/projects/project_EAT2p0_DeepDive.R | 38 +++++++------------ 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/scripts/start/projects/project_EAT2p0.R b/scripts/start/projects/project_EAT2p0.R index e941839731..6bd47137e0 100644 --- a/scripts/start/projects/project_EAT2p0.R +++ b/scripts/start/projects/project_EAT2p0.R @@ -133,9 +133,9 @@ waste <- function(cfg) { # Reference: Humpenöder, F., Popp, A., Merfort, L., Luderer, G., Weindl, I., Bodirsky, B., Stevanović, M., Klein, D., Rodrigues, R., Bauer, N., Dietrich, J., Lotze-Campen, H., & Rockström, J. (2023). Data repository - Dietary shifts increase the feasibility of 1.5°C pathways (Version 1) [Data set]. Zenodo. https://doi.org/10.5281/zenodo.8328217 miti <- function(cfg) { # Mitigation: consistent with 1.5C considering diet change - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive/remind/output/C_SSP2EU-DSPkB500-noDS-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS-rem-5.mif" + cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-DSPkB650-DS_betax_AgMIP-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS-rem-5.mif" cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive/remind/output/C_SSP2EU-DSPkB500-noDS-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS-rem-5.mif" + cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-DSPkB650-DS_betax_AgMIP-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS-rem-5.mif" cfg$gms$c60_2ndgen_biodem <- "coupling" return(cfg) diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index a9a21192e9..ced82df466 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -41,6 +41,10 @@ cfg$output <- c( ) +# Set path to own coupled runs: +path2NPIrun <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" +path2MitigationRun <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" + ####################### # SCENARIO DEFINITION # ####################### @@ -74,13 +78,13 @@ bau <- function(cfg) { cfg$gms$c70_feed_scen <- "ssp2" # default # Mitigation: no mitigation beyond NPi cfg$gms$c56_emis_policy <- "none" - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" + cfg$path_to_report_ghgprices <- path2NPIrun cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" + cfg$path_to_report_bioenergy <- path2NPIrun cfg$gms$c60_2ndgen_biodem <- "coupling" # Setting REMIND scenario for blackmagicc - cfg$magicc_emis_scen <- "REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" + cfg$magicc_emis_scen <- "REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-5.mif" return(cfg) } @@ -124,9 +128,9 @@ waste <- function(cfg) { # starting from 2020 and diet shift. miti <- function(cfg) { # Mitigation: consistent with 1.5C considering Diet change - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" + cfg$path_to_report_ghgprices <- path2MitigationRun cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" + cfg$path_to_report_bioenergy <- path2MitigationRun cfg$gms$c60_2ndgen_biodem <- "coupling" # ecoSysProtAll: (Above ground CO2 emis from LUC in forest, forestry, natveg; All types of emis from peatland; All CH4 and N2O emis), cfg$gms$c56_emis_policy <- "ecoSysProtAll" @@ -137,7 +141,7 @@ miti <- function(cfg) { # Bioenergy demand only. No carbon price on land included. bioenergy <- function(cfg) { # Mitigation: only Bioenergy demand from coupled REMIND-MAgPIE run where 1.5 is reached with ghg prices on land and considering diet shift - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" + cfg$path_to_report_bioenergy <- path2MitigationRun cfg$gms$c60_2ndgen_biodem <- "coupling" return(cfg) @@ -147,7 +151,7 @@ bioenergy <- function(cfg) { priceCO2 <- function(cfg) { # Mitigation: only price land CO2 cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" + cfg$path_to_report_ghgprices <- path2MitigationRun cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" #### double-check Florian or Leon return(cfg) @@ -157,7 +161,7 @@ priceCO2 <- function(cfg) { priceNonCO2 <- function(cfg) { # Mitigation: only CH4 and N2O price cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" + cfg$path_to_report_ghgprices <- path2MitigationRun cfg$gms$c56_emis_policy <- "ecoSysProtOff" ### double-check Florian or Leon return(cfg) @@ -174,20 +178,6 @@ cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) start_run(cfg, codeCheck = FALSE) -### Composition ### -# Mitigation components: -# (1a) Nationally Determined Contributions (NDCs) -#cfg$title <- "BAU_NDC" -#cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) -#cfg <- bau(cfg = cfg) -# set path to bioenergy and prices to NDC run -#cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NDC-rem-5/REMIND_generic_C_SSP2EU-NDC-rem-5.mif" -#cfg$gms$c56_pollutant_prices <- "coupling" -#cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NDC-rem-5/REMIND_generic_C_SSP2EU-NDC-rem-5.mif" -#cfg$gms$c60_2ndgen_biodem <- "coupling" -#start_run(cfg, codeCheck = FALSE) -# Note: Exclude NDC run for now. Starting point is NPi and we do not look at policies, but only mitigation measures (demand side vs. supply side) - # (1b) BAU + Bioenergy # # Decomposition Scenario. Adds bioenergy demand from coupled run with land-use policies consistent with 1.5C by 2050 to BAU cfg$title <- "BAU_Bioenergy" @@ -233,7 +223,7 @@ cfg <- bau(cfg = cfg) # Mitigation cfg <- miti(cfg = cfg) cfg$gms$c60_2ndgen_biodem <- "coupling" -cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" +cfg$path_to_report_bioenergy <- path2NPIrun start_run(cfg, codeCheck = FALSE) # BAU_MITI - non-CO2 # @@ -322,7 +312,7 @@ cfg <- bau(cfg = cfg) # Mitigation cfg <- miti(cfg = cfg) cfg$gms$c60_2ndgen_biodem <- "coupling" -cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" +cfg$path_to_report_bioenergy <- path2NPIrun # PHD cfg <- diet(cfg = cfg) #cfg <- prod(cfg = cfg) From 3ed0d5cc22ade2709753187d444ca84311d7b060 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Sat, 8 Jun 2024 16:41:51 +0200 Subject: [PATCH 231/280] bugfix in path to mitigation run --- scripts/start/projects/project_EAT2p0_DeepDive.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index ced82df466..e12c14a980 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -43,7 +43,7 @@ cfg$output <- c( # Set path to own coupled runs: path2NPIrun <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" -path2MitigationRun <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" +path2MitigationRun <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-5.mif" ####################### # SCENARIO DEFINITION # From 61464e8404df2df9df313dd533c32d052c1b2c8b Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 8 Jun 2024 20:18:54 +0200 Subject: [PATCH 232/280] update FSEC --- config/scenario_fsec.csv | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/scenario_fsec.csv b/config/scenario_fsec.csv index dfb83a5046..cdea1e2cef 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -74,9 +74,9 @@ gms$s62_max_dem_bioplastic;0;;;;400;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c70_fac_req_regr;reg;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c70_feed_scen;;;;;;;;;;;;;;;;;;ssp1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c73_build_demand;;;;;;;;;;;;;;;;;;;;;;;;50pc;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['cellular'];rev4.106_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.106_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.106_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.106_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.106_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.106_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.106_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;; -input['regional'];rev4.106_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['validation'];rev4.106_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['cellular'];rev4.108_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.108_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.108_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.108_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.108_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.108_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.108_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;; +input['regional'];rev4.108_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['validation'];rev4.108_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['additional'];additional_data_rev4.50.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['calibration'];calibration_FSEC_26Mar24.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; magicc_emis_scen;bjoernAR6_C_SSP2-NDC.mif;;;bjoernAR6_C_SSP2-PkBudg900.mif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bjoernAR6_C_SSP1-NDC.mif;;;;;;;;;;;;bjoernAR6_C_RemSDP-900-MagSSP1.mif;; From 00040a9e8aa319dc52d29151ef106276b781cff8 Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 9 Jun 2024 00:13:52 +0200 Subject: [PATCH 233/280] bugfix --- modules/35_natveg/pot_forest_may24/presolve.gms | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 0eb39f9aea..50131a05d3 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -191,6 +191,8 @@ vm_land_other.up(j,"youngsecdf",ac_sub) = pc35_land_other(j,"youngsecdf",ac_sub) vm_land_other.fx(j,"youngsecdf",ac_est) = 0; m_boundfix(vm_land_other,(j,othertype35,ac_sub),l,1e-6); +pm_max_forest_est(t,j)$(pm_max_forest_est(t,j) < sum(ac, pc35_land_other(j,"youngsecdf",ac))) = + sum(ac, pc35_land_other(j,"youngsecdf",ac)); * Other land conservation * protection bound fix From 119137e9db53ae9d08f4a8d6a98d1e743180130d Mon Sep 17 00:00:00 2001 From: florianh Date: Sun, 9 Jun 2024 07:33:55 +0200 Subject: [PATCH 234/280] bugfix --- modules/35_natveg/pot_forest_may24/equations.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/35_natveg/pot_forest_may24/equations.gms b/modules/35_natveg/pot_forest_may24/equations.gms index c5b48dbdf2..034a61129b 100644 --- a/modules/35_natveg/pot_forest_may24/equations.gms +++ b/modules/35_natveg/pot_forest_may24/equations.gms @@ -19,7 +19,7 @@ q35_natveg_conservation(j2) .. sum(land_natveg, vm_land(j2,land_natveg)) =g= - sum((ct,land_natveg,consv_type), pm_land_conservation(ct,j2,land_natveg,consv_type)); + sum((ct,land_natveg), pm_land_conservation(ct,j2,land_natveg,"protect")); q35_secdforest_restoration(j2) .. sum(land_ag, vm_lu_transitions(j2,land_ag,"secdforest")) From 4d6e186577f6c34278d613db35d1151701a051f1 Mon Sep 17 00:00:00 2001 From: Pascal Sauer Date: Mon, 10 Jun 2024 13:58:55 +0200 Subject: [PATCH 235/280] magpie release 4.8.0 --- .zenodo.json | 11 ++++++--- CHANGELOG.md | 64 +++++++++++++++++++++++++++------------------------- CITATION.cff | 4 ++-- README.md | 6 ++--- 4 files changed, 46 insertions(+), 39 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index efa149f699..59c68fb06d 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "MAgPIE - An Open Source land-use modeling framework", - "version": "4.7.3dev", + "version": "4.8.0", "creators": [ { "name": "Dietrich, Jan Philipp", @@ -99,6 +99,11 @@ "affiliation": "Potsdam Institute for Climate Impact Research", "orcid": "0000-0003-0328-4750" }, + { + "name": "Steinhauser, Jan", + "affiliation": "Potsdam Institute for Climate Impact Research", + "orcid": "0000-0002-5989-6855" + }, { "name": "Lotze-Campen, Hermann", "affiliation": "Potsdam Institute for Climate Impact Research", @@ -110,9 +115,9 @@ "orcid": "0000-0001-9500-1986" } ], - "keywords": ["landuse", "modeling", "nlp", "partial equilibrium"], + "keywords": ["landuse", "modeling", "model", "nlp", "partial equilibrium"], "license": { "id": "AGPL-3.0-or-later" }, - "publication_date": "2024-04-12" + "publication_date": "2024-06-10" } diff --git a/CHANGELOG.md b/CHANGELOG.md index c4cc96eb79..f65b05a489 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,66 +4,67 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [Unreleased] +## [4.8.0] - 2024-06-10 ### changed -- **41_area_equipped_for_irrigation** updated (non-default) AEI data (from Mehta2022 to Mehta2024) -- **22_land_conservation and default.cfg** Added options for baseline protection +- **14_yields** revised timber yield calculations - **15_food, default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying food substitution scenarios and exogeneous food intake scenarios -- **70_livestock** default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying feed substitution with SCP scenarios -- **default.cfg** update additional data to rev4.50 -- **default.cfg** changed default realization for 44_biodiversity to new realization `bii_target_apr24` -- **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE, CONOPT4 without preprocessing and CONOPT3. -- **scripts** start/test_runs.R added 2 more test runs from FSEC -- **32_forestry** revision and simplification of forestry implementation, renamed realization from `dynamic_feb21` to `dynamic_may24`. +- **22_land_conservation and default.cfg** Added options for baseline protection - **32_forestry** renamed interface `pm_demand_ext` to `pm_demand_forestry` -- **default.cfg** Forestry sector included by default by using the `ForestryEndo` settings from `scenario_config.csv`: `s32_initial_distribution = 1`, `s32_demand_establishment = 1`, `s32_hvarea = 2`, `s35_secdf_distribution = 2`, `s35_hvarea = 2`, `s73_timber_demand_switch = 1` -- **14_yields** revised timber yield calculations +- **32_forestry** revision and simplification of forestry implementation, renamed realization from `dynamic_feb21` to `dynamic_may24`. - **35_natveg** `vm_land(j2,"forestry")` included in NPI/NDC constraint `q35_min_forest` - **35_natveg** replaced the realisation `dynamic_feb21` with realisation `pot_forest_may24`. The new realisation provides additional information on the potential forest area, which is now used to constrain forest and forestry expansion and recovery. The remaining area for forest establishment is provided to the forestry module via the new interface parameter `pcm_max_forest_est`. +- **41_area_equipped_for_irrigation** updated (non-default) AEI data (from Mehta2022 to Mehta2024) - **52_carbon** Separate carbon densities for forest and other land. Before there was only a single carbon density for natural vegetation land. +- **70_livestock** default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying feed substitution with SCP scenarios +- **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE, CONOPT4 without preprocessing and CONOPT3. +- **default.cfg** changed default realization for 44_biodiversity to new realization `bii_target_apr24` - **default.cfg** defaults for `cfg$gms$sm_fix_SSP2`, `cfg$gms$sm_fix_cc` and other switches changed from 2020 to 2025 +- **default.cfg** Forestry sector included by default by using the `ForestryEndo` settings from `scenario_config.csv`: `s32_initial_distribution = 1`, `s32_demand_establishment = 1`, `s32_hvarea = 2`, `s35_secdf_distribution = 2`, `s35_hvarea = 2`, `s73_timber_demand_switch = 1` +- **default.cfg** update additional data to rev4.50 - **scripts** modified agmip_merge_report to use piamInterfaces +- **scripts** start/test_runs.R added 2 more test runs from FSEC ### added -- **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` -- **default.cfg** added technical cost for missing BII increase `cfg$gms$s44_cost_bii_missing` -- **default.cfg** added settings for new price-driven bioenergy realization `1st2ndgen_priced_feb24`: `cfg$gms$s60_2ndgen_bioenergy_dem_min_post_fix`, `cfg$gms$c60_bioenergy_subsidy_fix_SSP2`, `s60_bioenergy_gj_price_1st`, -`s60_bioenergy_price_2nd`, `c60_price_implementation` -- **core** added `coup2110`timesteps - **15_food** added additional sigmoid food substition scenarios `sigmoid_75pc_25_50`, `sigmoid_50pc_25_50` and `sigmoid_25pc_25_50` +- **21_trade** Minimum trade margin for forestry products `s21_min_trade_margin_forestry` - **30_crop** added regional cropland equation `q30_crop_reg` and presolve growth constraint - **44_biodiversity** added new realization `bii_target_apr24`, taking into account `f44_rr_layer` - **60_bioenergy** added new realization `1st2ndgen_priced_feb24` to enable price-driven 2nd gen bioenergy production -- **scripts** added automatic set writer for new bioenergy realization to `start_functions` -- **scripts** added start scripts for the GENIE project -- **scenario_config.csv** added preset for GENIE project -- **default.cfg** cfg$gms$s80_secondsolve option for second solve statement with 0=off as default -- **21_trade** Minimum trade margin for forestry products `s21_min_trade_margin_forestry` - **73_timber** added interface `im_timber_prod_cost` -- **scripts** added "checkSummation" output script for consistency checking a report.mif - **citation** added abstract +- **core** added `coup2110`timesteps +- **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` +- **default.cfg** added settings for new price-driven bioenergy realization `1st2ndgen_priced_feb24`: `cfg$gms$s60_2ndgen_bioenergy_dem_min_post_fix`, `cfg$gms$c60_bioenergy_subsidy_fix_SSP2`, `s60_bioenergy_gj_price_1st`, +- **default.cfg** added technical cost for missing BII increase `cfg$gms$s44_cost_bii_missing` +- **default.cfg** cfg$gms$s80_secondsolve option for second solve statement with 0=off as default +- **scenario_config.csv** added preset for GENIE project +- **scripts** added "checkSummation" output script for consistency checking a report.mif +- **scripts** added automatic set writer for new bioenergy realization to `start_functions` +- **scripts** added start scripts for the GENIE project +`s60_bioenergy_price_2nd`, `c60_price_implementation` ### removed -- **scripts/output/extra** removed scripts disaggregation_cropsplit and disaggregation_transitions -- **scripts** removed support for spam files in start_functions - **14_yields** removed interface `pm_timber_yield_initial` - **21_trade** removed interface `pm_selfsuff_ext`, removed `v21_manna_from_heaven` - **32_forestry** removed interface `pm_representative_rotation` -- **73_timber** removed interfaces `pm_demand_forestry_future` and `sm_wood_density` -- **62_material/16_demand** Removed double structure for forestry products. `pm_demand_foresty` is now used in `62_material` - **35_natveg** removed growing stock calculation and calibration, which is no longer needed. +- **62_material/16_demand** Removed double structure for forestry products. `pm_demand_foresty` is now used in `62_material` +- **73_timber** removed interfaces `pm_demand_forestry_future` and `sm_wood_density` +- **scripts** removed support for spam files in start_functions +- **scripts/output/extra** removed scripts disaggregation_cropsplit and disaggregation_transitions ### fixed - **14_yields** fix division by zero in preloop of managementcalib_aug19 -- **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs - **44_biodiversity** avoid division by zero +- **58_peatland** Added balance variable to avoid random infeasibilites +- **80_optimization** fixed a bug in nlp_apr17; cycling through CONOPT4, CONOPT4 without preprocessing and CONOPT3 was not working +- **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs - **scenario_config.csv** same revision for input files as in default.cfg - **scenario_fsec.csv** scenario settings -- **start/projects/fsec.R** scenario settings -- **80_optimization** fixed a bug in nlp_apr17; cycling through CONOPT4, CONOPT4 without preprocessing and CONOPT3 was not working -- **58_peatland** Added balance variable to avoid random infeasibilites - **scripts/start/test_runs.R** include all default output script, in particular disaggregation.R, which is needed for BII +- **start/projects/fsec.R** scenario settings + ## [4.7.3] - 2024-04-12 @@ -932,7 +933,8 @@ This release version is focussed on consistency between the MAgPIE setup and the First open source release of the framework. See [MAgPIE 4.0 paper](https://doi.org/10.5194/gmd-12-1299-2019) for more information. -[Unreleased]: https://github.com/magpiemodel/magpie/compare/v4.7.3...develop +[Unreleased]: https://github.com/magpiemodel/magpie/compare/v4.8.0...develop +[4.8.0]: https://github.com/magpiemodel/magpie/compare/v4.7.3...v4.8.0 [4.7.3]: https://github.com/magpiemodel/magpie/compare/v4.7.2...v4.7.3 [4.7.2]: https://github.com/magpiemodel/magpie/compare/v4.7.1...v4.7.2 [4.7.1]: https://github.com/magpiemodel/magpie/compare/v4.7.0...v4.7.1 diff --git a/CITATION.cff b/CITATION.cff index dfdfa23a75..79a17ee781 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -151,8 +151,8 @@ abstract: The *Model of Agricultural Production and its Impact on the Environmen exogenously given population in 10 food energy categories, based on regional diets. Future trends in food demand are derived from a cross-country regression analysis, based on future scenarios on GDP and population growth. -version: 4.7.3dev -date-released: 2024-04-12 +version: 4.8.0 +date-released: 2024-06-10 repository-code: https://github.com/magpiemodel/magpie keywords: - landuse diff --git a/README.md b/README.md index 221d210608..175f8dd5b2 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,8 @@ https://www.pik-potsdam.de/research/projects/activities/land-use-modelling/magpi A framework description paper has been published in Geoscientific Model Development (GMD): https://doi.org/10.5194/gmd-12-1299-2019 -The model documentation for version 4.7.3 can be found at -https://rse.pik-potsdam.de/doc/magpie/4.7.3/ +The model documentation for version 4.8.0 can be found at +https://rse.pik-potsdam.de/doc/magpie/4.8.0/ A most recent version of the documentation can also be extracted from the model source code via the R package goxygen @@ -226,7 +226,7 @@ magpie@pik-potsdam.de Please contact magpie@pik-potsdam.de ## CITATION -See file CITATION.cff or the [How-to-Cite section](https://rse.pik-potsdam.de/doc/magpie/4.7.3/#how-to-cite) in the model documentation for information how to cite the model. +See file CITATION.cff or the [How-to-Cite section](https://rse.pik-potsdam.de/doc/magpie/4.8.0/#how-to-cite) in the model documentation for information how to cite the model. ## AUTHORS See list of authors in CITATION.cff From 14a3a4e665eb819e8b4c291f92c915d9895fc1ea Mon Sep 17 00:00:00 2001 From: Pascal Sauer Date: Mon, 10 Jun 2024 14:22:46 +0200 Subject: [PATCH 236/280] degree symbol caused goxygen pdf problems --- CITATION.cff | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CITATION.cff b/CITATION.cff index 79a17ee781..a089928475 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -141,7 +141,7 @@ title: MAgPIE - An Open Source land-use modeling framework abstract: The *Model of Agricultural Production and its Impact on the Environment* (MAgPIE) is a modular open source framework for modeling global land-systems, which is coupled to the grid-based dynamic vegetation model LPJmL, with a spatial resolution - of 0.5°x0.5°. It takes regional economic conditions such as demand for agricultural + of 0.5degx0.5deg. It takes regional economic conditions such as demand for agricultural commodities, technological development and production costs as well as spatially explicit data on potential crop yields, land and water constraints (from LPJmL) into account. Based on these, the model derives specific land use patterns, yields and From f6792ba96b66fe8029f915ab4e299e7b92647504 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 10 Jun 2024 17:13:26 +0200 Subject: [PATCH 237/280] bugfix disaggregation --- scripts/output/extra/disaggregation.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/output/extra/disaggregation.R b/scripts/output/extra/disaggregation.R index ef98b04fca..cceede6c25 100644 --- a/scripts/output/extra/disaggregation.R +++ b/scripts/output/extra/disaggregation.R @@ -444,7 +444,7 @@ message("Disaggregating BII values") land_ini_hr <- read.magpie(land_hr_file)[, "y1995", ] side_layers_hr <- read.magpie(luh_side_layers) landArea <- dimSums(land_ini_hr, dim = 3) -side_layers_lr <- toolAggregate(x = side_layers_hr, rel = map_file, weight = landArea, from = "cell", to = "cluster") +side_layers_lr <- toolAggregate(x = side_layers_hr, rel = map_file, weight = landArea, from = "cell", to = "cluster", zeroWeight = "allow") # Convert land types for BII disaggregation land_ini_hr <- mbind( From 3355cf027a6e89c486e348fd670f4517fd5a8395 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 10 Jun 2024 18:31:20 +0200 Subject: [PATCH 238/280] bugfix warning --- scripts/output/extra/disaggregation.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/output/extra/disaggregation.R b/scripts/output/extra/disaggregation.R index cceede6c25..7590163b43 100644 --- a/scripts/output/extra/disaggregation.R +++ b/scripts/output/extra/disaggregation.R @@ -161,7 +161,7 @@ if (length(map_file) > 1) { # for grassland and natural vegetation natveg <- c("primforest", "secdforest", "other") consv_sum_lr <- mbind( - dimSums(land_consv_lr[, , "past"], 3.2), + dimSums(land_consv_lr[, , "past"], 3), setNames(dimSums(land_consv_lr[, , natveg], dim = 3), "natveg") ) consv_sum_hr_agg <- mbind( From b2813f7bb8a1f5f48f54d6f5a9390dd4cd1d5401 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 10 Jun 2024 18:35:48 +0200 Subject: [PATCH 239/280] bugfix warning --- scripts/output/extra/disaggregation.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/output/extra/disaggregation.R b/scripts/output/extra/disaggregation.R index 7590163b43..0c532f6bec 100644 --- a/scripts/output/extra/disaggregation.R +++ b/scripts/output/extra/disaggregation.R @@ -161,7 +161,7 @@ if (length(map_file) > 1) { # for grassland and natural vegetation natveg <- c("primforest", "secdforest", "other") consv_sum_lr <- mbind( - dimSums(land_consv_lr[, , "past"], 3), + land_consv_lr[, , "past"], setNames(dimSums(land_consv_lr[, , natveg], dim = 3), "natveg") ) consv_sum_hr_agg <- mbind( From 4cf96d1f8c5bd2c958c64b2b2f7abafa8e6ebe99 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 11 Jun 2024 10:15:03 +0200 Subject: [PATCH 240/280] revert zero weight note --- scripts/output/extra/disaggregation.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/output/extra/disaggregation.R b/scripts/output/extra/disaggregation.R index 0c532f6bec..1b8546dd24 100644 --- a/scripts/output/extra/disaggregation.R +++ b/scripts/output/extra/disaggregation.R @@ -444,7 +444,7 @@ message("Disaggregating BII values") land_ini_hr <- read.magpie(land_hr_file)[, "y1995", ] side_layers_hr <- read.magpie(luh_side_layers) landArea <- dimSums(land_ini_hr, dim = 3) -side_layers_lr <- toolAggregate(x = side_layers_hr, rel = map_file, weight = landArea, from = "cell", to = "cluster", zeroWeight = "allow") +side_layers_lr <- toolAggregate(x = side_layers_hr, rel = map_file, weight = landArea, from = "cell", to = "cluster") # Convert land types for BII disaggregation land_ini_hr <- mbind( From 7c57c3603876f3fe8d9ddb460ac80a224a193577 Mon Sep 17 00:00:00 2001 From: Pascal Sauer Date: Tue, 11 Jun 2024 15:20:20 +0200 Subject: [PATCH 241/280] merge master into develop --- .zenodo.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ CITATION.cff | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index 59c68fb06d..9497ab145e 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "MAgPIE - An Open Source land-use modeling framework", - "version": "4.8.0", + "version": "4.8.0dev", "creators": [ { "name": "Dietrich, Jan Philipp", diff --git a/CHANGELOG.md b/CHANGELOG.md index f65b05a489..168f84389e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [Unreleased] + +### changed +- + +### added +- + +### removed +- + +### fixed +- + + ## [4.8.0] - 2024-06-10 ### changed diff --git a/CITATION.cff b/CITATION.cff index a089928475..d14a599543 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -151,7 +151,7 @@ abstract: The *Model of Agricultural Production and its Impact on the Environmen exogenously given population in 10 food energy categories, based on regional diets. Future trends in food demand are derived from a cross-country regression analysis, based on future scenarios on GDP and population growth. -version: 4.8.0 +version: 4.8.0dev date-released: 2024-06-10 repository-code: https://github.com/magpiemodel/magpie keywords: From 07b187baf496e776c5bdc20de506ffdec98756e9 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 11 Jun 2024 15:40:14 +0200 Subject: [PATCH 242/280] fix --- CHANGELOG.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 102c1f6ba6..6901ec309b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -84,12 +84,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs - **scenario_config.csv** same revision for input files as in default.cfg - **scenario_fsec.csv** scenario settings -<<<<<<< HEAD -- **start/projects/fsec.R** scenario settings - **80_optimization** bugfix in nlp_par. Double solve statement was not working - **58_peatland** Added balance variable to avoid random infeasibilites -======= ->>>>>>> dc38aad92521933a64ae0860240a1c5859589590 - **scripts/start/test_runs.R** include all default output script, in particular disaggregation.R, which is needed for BII - **start/projects/fsec.R** scenario settings From 6496d8fd86f6a36d7d5f5719ec1c29b3c38f987e Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 11 Jun 2024 15:41:28 +0200 Subject: [PATCH 243/280] fix changelog --- CHANGELOG.md | 58 +++++++++++++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6901ec309b..37a0a1d040 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,65 +29,63 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [4.8.0] - 2024-06-10 ### changed -- **14_yields** revised timber yield calculations -- **15_food, default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying food substitution scenarios and exogeneous food intake scenarios +- **41_area_equipped_for_irrigation** updated (non-default) AEI data (from Mehta2022 to Mehta2024) - **22_land_conservation and default.cfg** Added options for baseline protection -- **32_forestry** renamed interface `pm_demand_ext` to `pm_demand_forestry` +- **15_food, default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying food substitution scenarios and exogeneous food intake scenarios +- **70_livestock** default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying feed substitution with SCP scenarios +- **default.cfg** update additional data to rev4.50 +- **default.cfg** changed default realization for 44_biodiversity to new realization `bii_target_apr24` +- **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE, CONOPT4 without preprocessing and CONOPT3. +- **scripts** start/test_runs.R added 2 more test runs from FSEC - **32_forestry** revision and simplification of forestry implementation, renamed realization from `dynamic_feb21` to `dynamic_may24`. +- **32_forestry** renamed interface `pm_demand_ext` to `pm_demand_forestry` +- **default.cfg** Forestry sector included by default by using the `ForestryEndo` settings from `scenario_config.csv`: `s32_initial_distribution = 1`, `s32_demand_establishment = 1`, `s32_hvarea = 2`, `s35_secdf_distribution = 2`, `s35_hvarea = 2`, `s73_timber_demand_switch = 1` +- **14_yields** revised timber yield calculations - **35_natveg** `vm_land(j2,"forestry")` included in NPI/NDC constraint `q35_min_forest` - **35_natveg** replaced the realisation `dynamic_feb21` with realisation `pot_forest_may24`. The new realisation provides additional information on the potential forest area, which is now used to constrain forest and forestry expansion and recovery. The remaining area for forest establishment is provided to the forestry module via the new interface parameter `pcm_max_forest_est`. -- **41_area_equipped_for_irrigation** updated (non-default) AEI data (from Mehta2022 to Mehta2024) - **52_carbon** Separate carbon densities for forest and other land. Before there was only a single carbon density for natural vegetation land. -- **70_livestock** default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying feed substitution with SCP scenarios -- **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE, CONOPT4 without preprocessing and CONOPT3. -- **default.cfg** changed default realization for 44_biodiversity to new realization `bii_target_apr24` - **default.cfg** defaults for `cfg$gms$sm_fix_SSP2`, `cfg$gms$sm_fix_cc` and other switches changed from 2020 to 2025 -- **default.cfg** Forestry sector included by default by using the `ForestryEndo` settings from `scenario_config.csv`: `s32_initial_distribution = 1`, `s32_demand_establishment = 1`, `s32_hvarea = 2`, `s35_secdf_distribution = 2`, `s35_hvarea = 2`, `s73_timber_demand_switch = 1` -- **default.cfg** update additional data to rev4.50 - **scripts** modified agmip_merge_report to use piamInterfaces -- **scripts** start/test_runs.R added 2 more test runs from FSEC ### added +- **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` +- **default.cfg** added technical cost for missing BII increase `cfg$gms$s44_cost_bii_missing` +- **default.cfg** added settings for new price-driven bioenergy realization `1st2ndgen_priced_feb24`: `cfg$gms$s60_2ndgen_bioenergy_dem_min_post_fix`, `cfg$gms$c60_bioenergy_subsidy_fix_SSP2`, `s60_bioenergy_gj_price_1st`, +`s60_bioenergy_price_2nd`, `c60_price_implementation` +- **core** added `coup2110`timesteps - **15_food** added additional sigmoid food substition scenarios `sigmoid_75pc_25_50`, `sigmoid_50pc_25_50` and `sigmoid_25pc_25_50` -- **21_trade** Minimum trade margin for forestry products `s21_min_trade_margin_forestry` - **30_crop** added regional cropland equation `q30_crop_reg` and presolve growth constraint - **44_biodiversity** added new realization `bii_target_apr24`, taking into account `f44_rr_layer` - **60_bioenergy** added new realization `1st2ndgen_priced_feb24` to enable price-driven 2nd gen bioenergy production -- **73_timber** added interface `im_timber_prod_cost` -- **citation** added abstract -- **core** added `coup2110`timesteps -- **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` -- **default.cfg** added settings for new price-driven bioenergy realization `1st2ndgen_priced_feb24`: `cfg$gms$s60_2ndgen_bioenergy_dem_min_post_fix`, `cfg$gms$c60_bioenergy_subsidy_fix_SSP2`, `s60_bioenergy_gj_price_1st`, -- **default.cfg** added technical cost for missing BII increase `cfg$gms$s44_cost_bii_missing` -- **default.cfg** cfg$gms$s80_secondsolve option for second solve statement with 0=off as default -- **scenario_config.csv** added preset for GENIE project -- **scripts** added "checkSummation" output script for consistency checking a report.mif - **scripts** added automatic set writer for new bioenergy realization to `start_functions` - **scripts** added start scripts for the GENIE project -`s60_bioenergy_price_2nd`, `c60_price_implementation` +- **scenario_config.csv** added preset for GENIE project +- **default.cfg** cfg$gms$s80_secondsolve option for second solve statement with 0=off as default +- **21_trade** Minimum trade margin for forestry products `s21_min_trade_margin_forestry` +- **73_timber** added interface `im_timber_prod_cost` +- **scripts** added "checkSummation" output script for consistency checking a report.mif +- **citation** added abstract ### removed +- **scripts/output/extra** removed scripts disaggregation_cropsplit and disaggregation_transitions +- **scripts** removed support for spam files in start_functions - **14_yields** removed interface `pm_timber_yield_initial` - **21_trade** removed interface `pm_selfsuff_ext`, removed `v21_manna_from_heaven` - **32_forestry** removed interface `pm_representative_rotation` -- **35_natveg** removed growing stock calculation and calibration, which is no longer needed. -- **62_material/16_demand** Removed double structure for forestry products. `pm_demand_foresty` is now used in `62_material` - **73_timber** removed interfaces `pm_demand_forestry_future` and `sm_wood_density` -- **scripts** removed support for spam files in start_functions -- **scripts/output/extra** removed scripts disaggregation_cropsplit and disaggregation_transitions +- **62_material/16_demand** Removed double structure for forestry products. `pm_demand_foresty` is now used in `62_material` +- **35_natveg** removed growing stock calculation and calibration, which is no longer needed. ### fixed - **14_yields** fix division by zero in preloop of managementcalib_aug19 -- **44_biodiversity** avoid division by zero -- **58_peatland** Added balance variable to avoid random infeasibilites -- **80_optimization** fixed a bug in nlp_apr17; cycling through CONOPT4, CONOPT4 without preprocessing and CONOPT3 was not working - **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs +- **44_biodiversity** avoid division by zero - **scenario_config.csv** same revision for input files as in default.cfg - **scenario_fsec.csv** scenario settings -- **80_optimization** bugfix in nlp_par. Double solve statement was not working +- **start/projects/fsec.R** scenario settings +- **80_optimization** fixed a bug in nlp_apr17; cycling through CONOPT4, CONOPT4 without preprocessing and CONOPT3 was not working - **58_peatland** Added balance variable to avoid random infeasibilites - **scripts/start/test_runs.R** include all default output script, in particular disaggregation.R, which is needed for BII -- **start/projects/fsec.R** scenario settings ## [4.7.3] - 2024-04-12 From b42d80959f9cf5ebf3a9d679439f06d6e5d13b45 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 11 Jun 2024 15:42:52 +0200 Subject: [PATCH 244/280] fix changelog --- CHANGELOG.md | 58 ++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37a0a1d040..99fe45d58d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,63 +29,63 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [4.8.0] - 2024-06-10 ### changed -- **41_area_equipped_for_irrigation** updated (non-default) AEI data (from Mehta2022 to Mehta2024) -- **22_land_conservation and default.cfg** Added options for baseline protection +- **14_yields** revised timber yield calculations - **15_food, default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying food substitution scenarios and exogeneous food intake scenarios -- **70_livestock** default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying feed substitution with SCP scenarios -- **default.cfg** update additional data to rev4.50 -- **default.cfg** changed default realization for 44_biodiversity to new realization `bii_target_apr24` -- **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE, CONOPT4 without preprocessing and CONOPT3. -- **scripts** start/test_runs.R added 2 more test runs from FSEC -- **32_forestry** revision and simplification of forestry implementation, renamed realization from `dynamic_feb21` to `dynamic_may24`. +- **22_land_conservation and default.cfg** Added options for baseline protection - **32_forestry** renamed interface `pm_demand_ext` to `pm_demand_forestry` -- **default.cfg** Forestry sector included by default by using the `ForestryEndo` settings from `scenario_config.csv`: `s32_initial_distribution = 1`, `s32_demand_establishment = 1`, `s32_hvarea = 2`, `s35_secdf_distribution = 2`, `s35_hvarea = 2`, `s73_timber_demand_switch = 1` -- **14_yields** revised timber yield calculations +- **32_forestry** revision and simplification of forestry implementation, renamed realization from `dynamic_feb21` to `dynamic_may24`. - **35_natveg** `vm_land(j2,"forestry")` included in NPI/NDC constraint `q35_min_forest` - **35_natveg** replaced the realisation `dynamic_feb21` with realisation `pot_forest_may24`. The new realisation provides additional information on the potential forest area, which is now used to constrain forest and forestry expansion and recovery. The remaining area for forest establishment is provided to the forestry module via the new interface parameter `pcm_max_forest_est`. +- **41_area_equipped_for_irrigation** updated (non-default) AEI data (from Mehta2022 to Mehta2024) - **52_carbon** Separate carbon densities for forest and other land. Before there was only a single carbon density for natural vegetation land. +- **70_livestock** default.cfg and scenario_config.csv** changed fader setup and introduced new switches for specifying feed substitution with SCP scenarios +- **80_optimization** Simplifed cycling through CONOPT4, CONOPT4 with OPTFILE, CONOPT4 without preprocessing and CONOPT3. +- **default.cfg** changed default realization for 44_biodiversity to new realization `bii_target_apr24` - **default.cfg** defaults for `cfg$gms$sm_fix_SSP2`, `cfg$gms$sm_fix_cc` and other switches changed from 2020 to 2025 +- **default.cfg** Forestry sector included by default by using the `ForestryEndo` settings from `scenario_config.csv`: `s32_initial_distribution = 1`, `s32_demand_establishment = 1`, `s32_hvarea = 2`, `s35_secdf_distribution = 2`, `s35_hvarea = 2`, `s73_timber_demand_switch = 1` +- **default.cfg** update additional data to rev4.50 - **scripts** modified agmip_merge_report to use piamInterfaces +- **scripts** start/test_runs.R added 2 more test runs from FSEC ### added -- **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` -- **default.cfg** added technical cost for missing BII increase `cfg$gms$s44_cost_bii_missing` -- **default.cfg** added settings for new price-driven bioenergy realization `1st2ndgen_priced_feb24`: `cfg$gms$s60_2ndgen_bioenergy_dem_min_post_fix`, `cfg$gms$c60_bioenergy_subsidy_fix_SSP2`, `s60_bioenergy_gj_price_1st`, -`s60_bioenergy_price_2nd`, `c60_price_implementation` -- **core** added `coup2110`timesteps - **15_food** added additional sigmoid food substition scenarios `sigmoid_75pc_25_50`, `sigmoid_50pc_25_50` and `sigmoid_25pc_25_50` +- **21_trade** Minimum trade margin for forestry products `s21_min_trade_margin_forestry` - **30_crop** added regional cropland equation `q30_crop_reg` and presolve growth constraint - **44_biodiversity** added new realization `bii_target_apr24`, taking into account `f44_rr_layer` - **60_bioenergy** added new realization `1st2ndgen_priced_feb24` to enable price-driven 2nd gen bioenergy production -- **scripts** added automatic set writer for new bioenergy realization to `start_functions` -- **scripts** added start scripts for the GENIE project -- **scenario_config.csv** added preset for GENIE project -- **default.cfg** cfg$gms$s80_secondsolve option for second solve statement with 0=off as default -- **21_trade** Minimum trade margin for forestry products `s21_min_trade_margin_forestry` - **73_timber** added interface `im_timber_prod_cost` -- **scripts** added "checkSummation" output script for consistency checking a report.mif - **citation** added abstract +- **core** added `coup2110`timesteps +- **default.cfg** added cropland growth constraint `cfg$gms$s30_annual_max_growth` +- **default.cfg** added settings for new price-driven bioenergy realization `1st2ndgen_priced_feb24`: `cfg$gms$s60_2ndgen_bioenergy_dem_min_post_fix`, `cfg$gms$c60_bioenergy_subsidy_fix_SSP2`, `s60_bioenergy_gj_price_1st`, +- **default.cfg** added technical cost for missing BII increase `cfg$gms$s44_cost_bii_missing` +- **default.cfg** cfg$gms$s80_secondsolve option for second solve statement with 0=off as default +- **scenario_config.csv** added preset for GENIE project +- **scripts** added "checkSummation" output script for consistency checking a report.mif +- **scripts** added automatic set writer for new bioenergy realization to `start_functions` +- **scripts** added start scripts for the GENIE project +`s60_bioenergy_price_2nd`, `c60_price_implementation` ### removed -- **scripts/output/extra** removed scripts disaggregation_cropsplit and disaggregation_transitions -- **scripts** removed support for spam files in start_functions - **14_yields** removed interface `pm_timber_yield_initial` - **21_trade** removed interface `pm_selfsuff_ext`, removed `v21_manna_from_heaven` - **32_forestry** removed interface `pm_representative_rotation` -- **73_timber** removed interfaces `pm_demand_forestry_future` and `sm_wood_density` -- **62_material/16_demand** Removed double structure for forestry products. `pm_demand_foresty` is now used in `62_material` - **35_natveg** removed growing stock calculation and calibration, which is no longer needed. +- **62_material/16_demand** Removed double structure for forestry products. `pm_demand_foresty` is now used in `62_material` +- **73_timber** removed interfaces `pm_demand_forestry_future` and `sm_wood_density` +- **scripts** removed support for spam files in start_functions +- **scripts/output/extra** removed scripts disaggregation_cropsplit and disaggregation_transitions ### fixed - **14_yields** fix division by zero in preloop of managementcalib_aug19 -- **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs - **44_biodiversity** avoid division by zero +- **58_peatland** Added balance variable to avoid random infeasibilites +- **80_optimization** fixed a bug in nlp_apr17; cycling through CONOPT4, CONOPT4 without preprocessing and CONOPT3 was not working +- **extra/disaggregation** fixed bug in disaggregation of land conservation related to switch from 59k to 67k that produced erroneous outputs - **scenario_config.csv** same revision for input files as in default.cfg - **scenario_fsec.csv** scenario settings -- **start/projects/fsec.R** scenario settings -- **80_optimization** fixed a bug in nlp_apr17; cycling through CONOPT4, CONOPT4 without preprocessing and CONOPT3 was not working -- **58_peatland** Added balance variable to avoid random infeasibilites - **scripts/start/test_runs.R** include all default output script, in particular disaggregation.R, which is needed for BII +- **start/projects/fsec.R** scenario settings ## [4.7.3] - 2024-04-12 From 58d5ef86c79147a4e11b965b9ce33e734423a7fb Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 12 Jun 2024 16:35:45 +0200 Subject: [PATCH 245/280] test --- modules/32_forestry/dynamic_may24/declarations.gms | 2 -- modules/32_forestry/dynamic_may24/equations.gms | 4 ++-- modules/32_forestry/dynamic_may24/postsolve.gms | 4 ---- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/declarations.gms b/modules/32_forestry/dynamic_may24/declarations.gms index c04fc094d7..5a806f3fa4 100644 --- a/modules/32_forestry/dynamic_may24/declarations.gms +++ b/modules/32_forestry/dynamic_may24/declarations.gms @@ -62,7 +62,6 @@ positive variables v32_cost_hvarea(i) Cost of harvesting timber from forests (mio. USD per yr) v32_land(j,type32,ac) Forestry land pools (mio. ha) v32_land_missing(j) Technical area balance term for timber plantation establishment (mio. ha) - v32_land_missing_ndc(j) Technical area balance term for NPI NDC reforestation (mio. ha) vm_landdiff_forestry Aggregated difference in forestry land compared to previous timestep (mio. ha) v32_cost_recur(i) Recurring forest management costs (USD per ha) v32_land_expansion(j,type32) Forestry land expansion (mio. ha) @@ -118,7 +117,6 @@ parameters ov32_cost_hvarea(t,i,type) Cost of harvesting timber from forests (mio. USD per yr) ov32_land(t,j,type32,ac,type) Forestry land pools (mio. ha) ov32_land_missing(t,j,type) Technical area balance term for timber plantation establishment (mio. ha) - ov32_land_missing_ndc(t,j,type) Technical area balance term for NPI NDC reforestation (mio. ha) ov_landdiff_forestry(t,type) Aggregated difference in forestry land compared to previous timestep (mio. ha) ov32_cost_recur(t,i,type) Recurring forest management costs (USD per ha) ov32_land_expansion(t,j,type32,type) Forestry land expansion (mio. ha) diff --git a/modules/32_forestry/dynamic_may24/equations.gms b/modules/32_forestry/dynamic_may24/equations.gms index d583c2040c..1cfdcf2597 100644 --- a/modules/32_forestry/dynamic_may24/equations.gms +++ b/modules/32_forestry/dynamic_may24/equations.gms @@ -24,7 +24,7 @@ q32_cost_total(i2) .. vm_cost_fore(i2) =e= v32_cost_recur(i2) + v32_cost_establishment(i2) + v32_cost_hvarea(i2) - + sum(cell(i2,j2), v32_land_missing(j2) + v32_land_missing_ndc(j2)) * s32_free_land_cost + + sum(cell(i2,j2), v32_land_missing(j2)) * s32_free_land_cost ; *----------------------------------------------- @@ -68,7 +68,7 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( *' The constraint `q32_aff_pol` accounts for the exogenous afforestation prescribed by NPI/NDC policies. q32_aff_pol(j2) .. - sum(ac_est, v32_land(j2,"ndc",ac_est)) + v32_land_missing_ndc(j2) =e= sum(ct, p32_aff_pol_timestep(ct,j2)); + sum(ac_est, v32_land(j2,"ndc",ac_est)) =e= sum(ct, p32_aff_pol_timestep(ct,j2)); *' The constraint `q32_max_aff` accounts for the allowed maximum global endogenous *' afforestation defined in `i32_max_aff_area_glo`. diff --git a/modules/32_forestry/dynamic_may24/postsolve.gms b/modules/32_forestry/dynamic_may24/postsolve.gms index d8aa765167..be0c978644 100644 --- a/modules/32_forestry/dynamic_may24/postsolve.gms +++ b/modules/32_forestry/dynamic_may24/postsolve.gms @@ -14,7 +14,6 @@ pc32_land(j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_hvarea(t,i,"marginal") = v32_cost_hvarea.m(i); ov32_land(t,j,type32,ac,"marginal") = v32_land.m(j,type32,ac); ov32_land_missing(t,j,"marginal") = v32_land_missing.m(j); - ov32_land_missing_ndc(t,j,"marginal") = v32_land_missing_ndc.m(j); ov_landdiff_forestry(t,"marginal") = vm_landdiff_forestry.m; ov32_cost_recur(t,i,"marginal") = v32_cost_recur.m(i); ov32_land_expansion(t,j,type32,"marginal") = v32_land_expansion.m(j,type32); @@ -59,7 +58,6 @@ pc32_land(j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_hvarea(t,i,"level") = v32_cost_hvarea.l(i); ov32_land(t,j,type32,ac,"level") = v32_land.l(j,type32,ac); ov32_land_missing(t,j,"level") = v32_land_missing.l(j); - ov32_land_missing_ndc(t,j,"level") = v32_land_missing_ndc.l(j); ov_landdiff_forestry(t,"level") = vm_landdiff_forestry.l; ov32_cost_recur(t,i,"level") = v32_cost_recur.l(i); ov32_land_expansion(t,j,type32,"level") = v32_land_expansion.l(j,type32); @@ -104,7 +102,6 @@ pc32_land(j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_hvarea(t,i,"upper") = v32_cost_hvarea.up(i); ov32_land(t,j,type32,ac,"upper") = v32_land.up(j,type32,ac); ov32_land_missing(t,j,"upper") = v32_land_missing.up(j); - ov32_land_missing_ndc(t,j,"upper") = v32_land_missing_ndc.up(j); ov_landdiff_forestry(t,"upper") = vm_landdiff_forestry.up; ov32_cost_recur(t,i,"upper") = v32_cost_recur.up(i); ov32_land_expansion(t,j,type32,"upper") = v32_land_expansion.up(j,type32); @@ -149,7 +146,6 @@ pc32_land(j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_hvarea(t,i,"lower") = v32_cost_hvarea.lo(i); ov32_land(t,j,type32,ac,"lower") = v32_land.lo(j,type32,ac); ov32_land_missing(t,j,"lower") = v32_land_missing.lo(j); - ov32_land_missing_ndc(t,j,"lower") = v32_land_missing_ndc.lo(j); ov_landdiff_forestry(t,"lower") = vm_landdiff_forestry.lo; ov32_cost_recur(t,i,"lower") = v32_cost_recur.lo(i); ov32_land_expansion(t,j,type32,"lower") = v32_land_expansion.lo(j,type32); From 00d08cf1a0f2701293df75dce187bb1eaba26cb2 Mon Sep 17 00:00:00 2001 From: Pascal Sauer <156898545+pascal-sauer@users.noreply.github.com> Date: Thu, 13 Jun 2024 10:37:12 +0200 Subject: [PATCH 246/280] Delete renv/settings.dcf --- renv/settings.dcf | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 renv/settings.dcf diff --git a/renv/settings.dcf b/renv/settings.dcf deleted file mode 100644 index 169d82f1bc..0000000000 --- a/renv/settings.dcf +++ /dev/null @@ -1,10 +0,0 @@ -bioconductor.version: -external.libraries: -ignored.packages: -package.dependency.fields: Imports, Depends, LinkingTo -r.version: -snapshot.type: implicit -use.cache: TRUE -vcs.ignore.cellar: TRUE -vcs.ignore.library: TRUE -vcs.ignore.local: TRUE From 6db3dcb7f94de8cf76005e9119d05cb3a0df4e7d Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 14 Jun 2024 08:48:34 +0200 Subject: [PATCH 247/280] accuracy in conditions changed to avoid very small numbers --- .../22_land_conservation/area_based_apr22/presolve.gms | 8 ++++---- modules/29_cropland/detail_apr24/presolve.gms | 2 +- modules/29_cropland/simple_apr24/presolve.gms | 2 +- modules/32_forestry/dynamic_may24/preloop.gms | 4 ++-- modules/32_forestry/dynamic_may24/presolve.gms | 6 +++--- modules/35_natveg/pot_forest_may24/postsolve.gms | 2 +- modules/35_natveg/pot_forest_may24/preloop.gms | 2 +- modules/35_natveg/pot_forest_may24/presolve.gms | 6 +++--- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/modules/22_land_conservation/area_based_apr22/presolve.gms b/modules/22_land_conservation/area_based_apr22/presolve.gms index 9debb3b725..e11d2d046e 100644 --- a/modules/22_land_conservation/area_based_apr22/presolve.gms +++ b/modules/22_land_conservation/area_based_apr22/presolve.gms @@ -70,7 +70,7 @@ pm_land_conservation(t,j,"past","restore")$(p22_conservation_area(t,j,"past") > pm_land_conservation(t,j,"secdforest","restore") = (p22_conservation_area(t,j,"primforest") + p22_conservation_area(t,j,"secdforest")) - (pcm_land(j,"primforest") + pcm_land(j,"secdforest")); -pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") < 0) = 0; +pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") < 1e-6) = 0; * Other land pm_land_conservation(t,j,"other","restore")$(p22_conservation_area(t,j,"other") > pcm_land(j,"other")) = p22_conservation_area(t,j,"other") - pcm_land(j,"other"); @@ -82,7 +82,7 @@ p22_secdforest_restore_pot(t,j) = sum(land, pcm_land(j, land)) - pcm_land(j, "urban") - sum(land_natveg, pcm_land(j, land_natveg)) - pm_land_conservation(t,j,"past","protect"); -p22_secdforest_restore_pot(t,j)$(p22_secdforest_restore_pot(t,j) < 0) = 0; +p22_secdforest_restore_pot(t,j)$(p22_secdforest_restore_pot(t,j) < 1e-6) = 0; pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") > p22_secdforest_restore_pot(t,j)) = p22_secdforest_restore_pot(t,j); * Grassland restoration is limited by grassland restoration potential @@ -91,7 +91,7 @@ p22_past_restore_pot(t,j) = sum(land, pcm_land(j, land)) - sum(land_timber, pcm_land(j, land_timber)) - pm_land_conservation(t,j,"past","protect") - pm_land_conservation(t,j,"secdforest","restore"); -p22_past_restore_pot(t,j)$(p22_past_restore_pot(t,j) < 0) = 0; +p22_past_restore_pot(t,j)$(p22_past_restore_pot(t,j) < 1e-6) = 0; pm_land_conservation(t,j,"past","restore")$(pm_land_conservation(t,j,"past","restore") > p22_past_restore_pot(t,j)) = p22_past_restore_pot(t,j); * Other land restoration is limited by other land restoration potential @@ -100,7 +100,7 @@ p22_other_restore_pot(t,j) = sum(land, pcm_land(j, land)) - sum(land_timber, pcm_land(j, land_timber)) - sum(consv_type, pm_land_conservation(t,j,"past",consv_type)) - pm_land_conservation(t,j,"secdforest","restore"); -p22_other_restore_pot(t,j)$(p22_other_restore_pot(t,j) < 0) = 0; +p22_other_restore_pot(t,j)$(p22_other_restore_pot(t,j) < 1e-6) = 0; pm_land_conservation(t,j,"other","restore")$(pm_land_conservation(t,j,"other","restore") > p22_other_restore_pot(t,j)) = p22_other_restore_pot(t,j); else diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index dba380188e..b01a5b3690 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -28,7 +28,7 @@ p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t- *' cases of cropland reduction p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * pcm_land(j,"crop") - sum(ac, pc29_treecover(j,ac)); -p29_max_snv_relocation(t,j)$(p29_max_snv_relocation(t,j) < 0) = 0; +p29_max_snv_relocation(t,j)$(p29_max_snv_relocation(t,j) < 1e-6) = 0; p29_snv_relocation(t,j)$(p29_snv_relocation(t, j) > p29_max_snv_relocation(t,j)) = p29_max_snv_relocation(t,j); *' Area potentially available for cropping diff --git a/modules/29_cropland/simple_apr24/presolve.gms b/modules/29_cropland/simple_apr24/presolve.gms index cebdb11b33..a49c401f8b 100644 --- a/modules/29_cropland/simple_apr24/presolve.gms +++ b/modules/29_cropland/simple_apr24/presolve.gms @@ -25,7 +25,7 @@ p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t- *' cases of cropland reduction p29_max_snv_relocation(t,j) = p29_snv_shr(t,j) * (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * pcm_land(j,"crop") - vm_treecover.l(j); -p29_max_snv_relocation(t,j)$(p29_max_snv_relocation(t,j) < 0) = 0; +p29_max_snv_relocation(t,j)$(p29_max_snv_relocation(t,j) < 1e-6) = 0; p29_snv_relocation(t,j)$(p29_snv_relocation(t, j) > p29_max_snv_relocation(t,j)) = p29_max_snv_relocation(t,j); *' Area potentially available for cropping diff --git a/modules/32_forestry/dynamic_may24/preloop.gms b/modules/32_forestry/dynamic_may24/preloop.gms index 3fec5a9101..bcf1b96ed1 100644 --- a/modules/32_forestry/dynamic_may24/preloop.gms +++ b/modules/32_forestry/dynamic_may24/preloop.gms @@ -185,12 +185,12 @@ p32_aff_togo(t,i) = smax(t2, sum(cell(i,j), p32_aff_pol(t2,j))) - sum(cell(i,j), * The global (`s32_max_aff_area`) and regional limit (`f32_max_aff_area`) for total afforestation (sum of endogenous and exogenous) is reduced by exogenous NPI/NDC afforestation (`p32_aff_pol`). if(s32_max_aff_area_glo = 1, i32_max_aff_area_glo(t) = s32_max_aff_area - smax(t2, sum(j, p32_aff_pol(t2,j))); - i32_max_aff_area_glo(t)$(i32_max_aff_area_glo(t) < 0) = 0; + i32_max_aff_area_glo(t)$(i32_max_aff_area_glo(t) < 1e-6) = 0; i32_max_aff_area_glo(t)$(m_year(t) <= sm_fix_SSP2) = Inf; i32_max_aff_area_reg(t,i) = 0; elseif s32_max_aff_area_glo = 0, i32_max_aff_area_reg(t,i) = f32_max_aff_area(i) - smax(t2, sum(cell(i,j), p32_aff_pol(t2,j))); - i32_max_aff_area_reg(t,i)$(i32_max_aff_area_reg(t,i) < 0) = 0; + i32_max_aff_area_reg(t,i)$(i32_max_aff_area_reg(t,i) < 1e-6) = 0; i32_max_aff_area_reg(t,i)$(m_year(t) <= sm_fix_SSP2) = Inf; i32_max_aff_area_glo(t) = 0; ); diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index cb8b22a51d..6ebf6d3240 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -14,14 +14,14 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; p32_aff_pol_timestep("y1995",j) = 0; p32_aff_pol_timestep(t,j)$(ord(t)>1) = p32_aff_pol(t,j) - p32_aff_pol(t-1,j); * Suitable area (`p32_aff_pot`) for NPI/NDC afforestation - p32_aff_pot(t,j) = sum((kcr,w),vm_area.l(j,kcr,w) - vm_area.lo(j,kcr,w)) + p32_aff_pot(t,j) = 0.95 * (sum((kcr,w),vm_area.l(j,kcr,w) - vm_area.lo(j,kcr,w)) + (vm_fallow.l(j) - vm_fallow.lo(j)) + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - - pm_land_conservation(t,j,"other","restore"); + - pm_land_conservation(t,j,"other","restore")); *** NDC/NPI re/afforesation is further constrained by the remaining forest establishment potential p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pm_max_forest_est(t,j)) = pm_max_forest_est(t,j); * suitable area `p32_aff_pot` can be negative, if land restoration is switched on (level smaller than lower bound), therefore set negative values to 0 - p32_aff_pot(t,j)$(p32_aff_pot(t,j) < 0) = 0; + p32_aff_pot(t,j)$(p32_aff_pot(t,j) < 1e-6) = 0; * Limit prescribed NPI/NDC afforestation in `p32_aff_pol_timestep` if not enough suitable area (`p32_aff_pot`) for afforestation is available p32_aff_pol_timestep(t,j)$(p32_aff_pol_timestep(t,j) > p32_aff_pot(t,j)) = p32_aff_pot(t,j); ** END ndc ** diff --git a/modules/35_natveg/pot_forest_may24/postsolve.gms b/modules/35_natveg/pot_forest_may24/postsolve.gms index cad9959091..ec39f68557 100644 --- a/modules/35_natveg/pot_forest_may24/postsolve.gms +++ b/modules/35_natveg/pot_forest_may24/postsolve.gms @@ -13,7 +13,7 @@ pc35_land_other(j,othertype35,ac) = vm_land_other.l(j,othertype35,ac); * Set the forest establishment bound for the next time step pm_max_forest_est(t+1,j) = f35_pot_forest_area(t+1,j) - sum(land_forest, vm_land.l(j,land_forest)); -pm_max_forest_est(t+1,j)$(pm_max_forest_est(t+1,j) < 0) = 0; +pm_max_forest_est(t+1,j)$(pm_max_forest_est(t+1,j) < 1e-6) = 0; *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov35_secdforest(t,j,ac,"marginal") = v35_secdforest.m(j,ac); diff --git a/modules/35_natveg/pot_forest_may24/preloop.gms b/modules/35_natveg/pot_forest_may24/preloop.gms index 3b61137ec0..7d04a1928d 100644 --- a/modules/35_natveg/pot_forest_may24/preloop.gms +++ b/modules/35_natveg/pot_forest_may24/preloop.gms @@ -48,7 +48,7 @@ p35_disturbance_loss_primf(t,j) = 0; * Hence, the area for forest establishments is given by the potential forest * area minus all forest areas in the previous time step. pm_max_forest_est(t,j) = f35_pot_forest_area(t,j) - sum(land_forest, pcm_land(j,land_forest)); -pm_max_forest_est(t,j)$(pm_max_forest_est(t,j) < 0) = 0; +pm_max_forest_est(t,j)$(pm_max_forest_est(t,j) < 1e-6) = 0; * ----------------------------------------- * Land conservation for climate mitigation diff --git a/modules/35_natveg/pot_forest_may24/presolve.gms b/modules/35_natveg/pot_forest_may24/presolve.gms index 50131a05d3..406ccbc762 100644 --- a/modules/35_natveg/pot_forest_may24/presolve.gms +++ b/modules/35_natveg/pot_forest_may24/presolve.gms @@ -59,7 +59,7 @@ pc35_forest_recovery_shr(j) = 0; pc35_forest_recovery_shr(j)$((sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")) > 0) = (pc35_max_forest_recovery(j) - sum(ac_est, p35_forest_recovery_area(t,j,ac_est))) / (sum(land_ag, pcm_land(j,land_ag))+pcm_land(j,"urban")); -pc35_forest_recovery_shr(j)$(pc35_forest_recovery_shr(j) < 0) = 0; +pc35_forest_recovery_shr(j)$(pc35_forest_recovery_shr(j) < 1e-6) = 0; pc35_forest_recovery_shr(j)$(pc35_forest_recovery_shr(j) > 1) = 1; * Abandoned land pc35_land_other(j,"othernat",ac_est) that has not yet been allocated to * p35_forest_recovery_area(t,j,ac_est) is then distributed proportionally using the forest recovery share. @@ -68,7 +68,7 @@ p35_forest_recovery_area(t,j,ac_est) = p35_forest_recovery_area(t,j,ac_est) * pc35_forest_recovery_shr(j); p35_forest_recovery_area(t,j,ac_est)$(sum(ac_est2, p35_forest_recovery_area(t,j,ac_est2)) > pc35_max_forest_recovery(j)) = pc35_max_forest_recovery(j)/card(ac_est2); p35_forest_recovery_area(t,j,ac_est)$(p35_forest_recovery_area(t,j,ac_est) > pc35_land_other(j,"othernat",ac_est)) = pc35_land_other(j,"othernat",ac_est); -p35_forest_recovery_area(t,j,ac_est)$(p35_forest_recovery_area(t,j,ac_est) < 0) = 0; +p35_forest_recovery_area(t,j,ac_est)$(p35_forest_recovery_area(t,j,ac_est) < 1e-6) = 0; pc35_land_other(j,"othernat",ac_est) = pc35_land_other(j,"othernat",ac_est) - p35_forest_recovery_area(t,j,ac_est); pc35_land_other(j,"youngsecdf",ac_est) = pc35_land_other(j,"youngsecdf",ac_est) + p35_forest_recovery_area(t,j,ac_est); @@ -171,7 +171,7 @@ p35_land_restoration(j,"secdforest")$(sum(land_natveg, pcm_land(j,land_natveg)) * Since forest restoration cannot be bigger than the potential area for secdforest recovery, * any remaining restoration area is substracted and shifted to other land restoration. p35_restoration_shift(j) = p35_land_restoration(j,"secdforest") - pc35_max_forest_recovery(j); -p35_restoration_shift(j)$(p35_restoration_shift(j) < 0) = 0; +p35_restoration_shift(j)$(p35_restoration_shift(j) < 1e-6) = 0; p35_restoration_shift(j)$(p35_restoration_shift(j) > p35_land_restoration(j,"secdforest")) = p35_land_restoration(j,"secdforest"); p35_land_restoration(j,"secdforest") = p35_land_restoration(j,"secdforest") - p35_restoration_shift(j); pm_land_conservation(t,j,"other","restore") = pm_land_conservation(t,j,"other","restore") + p35_restoration_shift(j); From 1d64e11be8d6bbf5944edffcb1fd1eb053433e00 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 14 Jun 2024 16:30:39 +0200 Subject: [PATCH 248/280] bugfix land restoration and country switches for agroforestry --- config/default.cfg | 27 +++++++++++---- .../area_based_apr22/presolve.gms | 14 +++++--- .../29_cropland/detail_apr24/declarations.gms | 4 +-- modules/29_cropland/detail_apr24/input.gms | 6 ++-- modules/29_cropland/detail_apr24/preloop.gms | 11 ++++--- modules/29_cropland/detail_apr24/presolve.gms | 12 ++++--- .../29_cropland/simple_apr24/declarations.gms | 4 +-- modules/29_cropland/simple_apr24/input.gms | 5 +-- modules/29_cropland/simple_apr24/preloop.gms | 10 +++--- modules/29_cropland/simple_apr24/presolve.gms | 8 ++--- .../30_croparea/detail_apr24/declarations.gms | 4 ++- .../30_croparea/detail_apr24/equations.gms | 2 +- modules/30_croparea/detail_apr24/input.gms | 32 ++++++++++++++++++ modules/30_croparea/detail_apr24/preloop.gms | 9 +++++ modules/30_croparea/detail_apr24/presolve.gms | 8 +++-- .../30_croparea/simple_apr24/declarations.gms | 4 ++- .../30_croparea/simple_apr24/equations.gms | 2 +- modules/30_croparea/simple_apr24/input.gms | 33 +++++++++++++++++++ modules/30_croparea/simple_apr24/preloop.gms | 8 +++++ modules/30_croparea/simple_apr24/presolve.gms | 8 +++-- 20 files changed, 165 insertions(+), 46 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 9f0d72281c..fd45e39a2d 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -703,6 +703,12 @@ cfg$gms$cropland <- "simple_apr24" # def = simple_apr24 # * with observed cropland patterns and is recommended for productive runs. cfg$gms$c29_marginal_land <- "q33_marginal" # def = "q33_marginal" +# * Switch and specification of countries for selected policies in apply. +# * Options: list of iso-codes of countries where SNV policy should be applied +# * Note: must be written in the format: "IND, BRA, DEU" +# * Default: all iso countries +cfg$gms$policy_countries29 <- all_iso_countries + # * Share of available cropland that is withheld for maintaining semi-natural vegetation (SNV) # * in each square km in cropland areas, including grassland, forest and other land. For example, # * a share of 0.2 corresponds to 20 % of SNV in terms of the available cropland. @@ -718,12 +724,6 @@ cfg$gms$s29_snv_shr_noselect <- 0 # def = 0 cfg$gms$s29_snv_scenario_start <- 2025 # def = 2025 # * Target year (year when full implementation is reached): cfg$gms$s29_snv_scenario_target <- 2050 # def = 2050 -# * Switch and specification of countries for which SNV policy in -# * s29_snv_shr apply. -# * Options: list of iso-codes of countries where SNV policy should be applied -# * Note: must be written in the format: "IND, BRA, DEU" -# * Default: all iso countries -cfg$gms$policy_countries29 <- all_iso_countries # * Land types included in the SNV policy. This option allows for sensitivity analyses. # * plausible options: "secdforest, forestry, past, other", # * "secdforest, other", @@ -735,7 +735,10 @@ cfg$gms$land_snv <- "secdforest, forestry, past, other" #def = "secdforest, f ## Agroforestry settings for treecover on cropland # * Sigmoid fader for minimum area share of treecover on total cropland at cluster level # * Minimum area share of treecover on total cropland in target year +# Note: s29_treecover_target applies to countries selected in policy_countries29 +# s29_treecover_target_noselect applies to all other countries. cfg$gms$s29_treecover_target <- 0 # def = 0 +cfg$gms$s29_treecover_target_noselect <- 0 # def = 0 # * Avoid loss of existing treecover (1=yes 0=no). # * If set to 1, `s29_treecover_target` will be adjusted based existing treecover area. cfg$gms$s29_treecover_keep <- 1 # def = 1 @@ -780,12 +783,24 @@ cfg$gms$c30_bioen_type <- "all" # def = "all" # * (c30_bioen_water): switch for irrigation of bioenergy crops; options: rainfed, irrigated, all cfg$gms$c30_bioen_water <- "rainfed" # def = "rainfed" +# * Switch and specification of countries for selected policies in apply. +# * Options: list of iso-codes of countries where SNV policy should be applied +# * Note: must be written in the format: "IND, BRA, DEU" +# * Default: all iso countries +cfg$gms$policy_countries30 <- all_iso_countries + ## Agroforestry settings for bioenergy trees # * Sigmoid fader for minimum area share of bioenergy trees (betr) on total cropland at cluster level # * Minimum area share of bioenergy trees on total cropland in start year +# Note: s30_betr_start applies to countries selected in policy_countries30, +# s30_betr_start_noselect applies to all other countries. cfg$gms$s30_betr_start <- 0 # def = 0 +cfg$gms$s30_betr_start_noselect <- 0 # def = 0 # * Minimum area share of bioenergy trees on total cropland in target year +# Note: s30_betr_target applies to countries selected in policy_countries30, +# s30_betr_target_noselect applies to all other countries. cfg$gms$s30_betr_target <- 0 # def = 0 +cfg$gms$s30_betr_target_noselect <- 0 # def = 0 # * Start year of fader cfg$gms$s30_betr_scenario_start <- 2025 # def = 2025 # * Target year of fader (year when full implementation is reached) diff --git a/modules/22_land_conservation/area_based_apr22/presolve.gms b/modules/22_land_conservation/area_based_apr22/presolve.gms index e11d2d046e..bfcd84b69e 100644 --- a/modules/22_land_conservation/area_based_apr22/presolve.gms +++ b/modules/22_land_conservation/area_based_apr22/presolve.gms @@ -80,8 +80,10 @@ pm_land_conservation(t,j,"other","restore")$(p22_conservation_area(t,j,"other") * Secondary forest restoration is limited by secondary forest restoration potential p22_secdforest_restore_pot(t,j) = sum(land, pcm_land(j, land)) - pcm_land(j, "urban") - - sum(land_natveg, pcm_land(j, land_natveg)) - - pm_land_conservation(t,j,"past","protect"); + - sum(land_timber, pcm_land(j, land_timber)) + - pm_land_conservation(t,j,"past","protect") + - vm_land.lo(j,"crop") + - vm_treecover.l(j); p22_secdforest_restore_pot(t,j)$(p22_secdforest_restore_pot(t,j) < 1e-6) = 0; pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secdforest","restore") > p22_secdforest_restore_pot(t,j)) = p22_secdforest_restore_pot(t,j); @@ -90,7 +92,9 @@ p22_past_restore_pot(t,j) = sum(land, pcm_land(j, land)) - pcm_land(j, "urban") - sum(land_timber, pcm_land(j, land_timber)) - pm_land_conservation(t,j,"past","protect") - - pm_land_conservation(t,j,"secdforest","restore"); + - pm_land_conservation(t,j,"secdforest","restore") + - vm_land.lo(j,"crop") + - vm_treecover.l(j); p22_past_restore_pot(t,j)$(p22_past_restore_pot(t,j) < 1e-6) = 0; pm_land_conservation(t,j,"past","restore")$(pm_land_conservation(t,j,"past","restore") > p22_past_restore_pot(t,j)) = p22_past_restore_pot(t,j); @@ -99,7 +103,9 @@ p22_other_restore_pot(t,j) = sum(land, pcm_land(j, land)) - pcm_land(j, "urban") - sum(land_timber, pcm_land(j, land_timber)) - sum(consv_type, pm_land_conservation(t,j,"past",consv_type)) - - pm_land_conservation(t,j,"secdforest","restore"); + - pm_land_conservation(t,j,"secdforest","restore") + - vm_land.lo(j,"crop") + - vm_treecover.l(j); p22_other_restore_pot(t,j)$(p22_other_restore_pot(t,j) < 1e-6) = 0; pm_land_conservation(t,j,"other","restore")$(pm_land_conservation(t,j,"other","restore") > p22_other_restore_pot(t,j)) = p22_other_restore_pot(t,j); diff --git a/modules/29_cropland/detail_apr24/declarations.gms b/modules/29_cropland/detail_apr24/declarations.gms index 81699b8691..bfa7e79f98 100644 --- a/modules/29_cropland/detail_apr24/declarations.gms +++ b/modules/29_cropland/detail_apr24/declarations.gms @@ -11,13 +11,13 @@ scalars parameters p29_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) - p29_country_snv_weight(i) SNV policy country weight per region (1) + p29_country_weight(i) Policy country weight per region (1) p29_snv_shr(t,j) Share of semi-natural vegetation in cropland areas (1) i29_snv_relocation_target(j) Overall cropland area that requires relocation due to SNV policy (mio. ha) p29_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha) p29_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) p29_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1) - i29_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) + pm_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) i29_snv_scenario_fader(t_all) SNV scenario fader (1) i29_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1) diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms index b8f49a524f..f974d223f1 100644 --- a/modules/29_cropland/detail_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -22,6 +22,7 @@ scalars s29_treecover_scenario_start Cropland treecover scenario start year / 2025 / s29_treecover_scenario_target Cropland treecover scenario target year / 2050 / s29_treecover_target Minimum share of treecover on total cropland in target year (1) / 0 / + s29_treecover_target_noselect Minimum share of treecover on total cropland in target year (1) / 0 / s29_treecover_keep Avoid loss of existing treecover (1=yes 0=no) / 1 / s29_treecover_max Maximum share of treecover on total cropland (1) / 0.4 / s29_treecover_penalty_before Penalty for violation of treecover target before scenario start (USD05MER per ha) / 2000 / @@ -34,10 +35,11 @@ scalars ; -* Set-switch for countries affected by regional SNV policy +* Set-switch for countries affected by certain policies * Default: all iso countries selected sets - policy_countries29(iso) countries to be affected by SNV policy / ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, + policy_countries29(iso) countries to be affected by SNV policy + / ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, ASM,ATA,ATF,ATG,AUS,AUT,AZE,BDI,BEL,BEN, BES,BFA,BGD,BGR,BHR,BHS,BIH,BLM,BLR,BLZ, BMU,BOL,BRA,BRB,BRN,BTN,BVT,BWA,CAF,CAN, diff --git a/modules/29_cropland/detail_apr24/preloop.gms b/modules/29_cropland/detail_apr24/preloop.gms index c45d550fd2..1f288bd228 100644 --- a/modules/29_cropland/detail_apr24/preloop.gms +++ b/modules/29_cropland/detail_apr24/preloop.gms @@ -28,6 +28,8 @@ pc29_treecover_share(j)$(pm_land_hist("y2015",j,"crop") > 1e-10) = f29_treecover pc29_treecover_share(j)$(pc29_treecover_share(j) > s29_treecover_max) = s29_treecover_max; pc29_treecover(j,ac) = (pc29_treecover_share(j) * pm_land_hist("y1995",j,"crop")) / card(ac); +vm_treecover.l(j) = sum(ac, pc29_treecover(j,ac)); + *' Switch for tree cover on cropland: *' 0 = Use natveg growth curve towards LPJmL natural vegetation *' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation @@ -46,13 +48,12 @@ elseif s29_treecover_bii_coeff = 1, ); -****** Regional share of semi-natural vegetation (SNV) in cropland areas for selective countries: -* Country switch to determine countries for which a SNV policy shall be applied. -* In the default case, the SNV policy affects all countries when activated. +* Country switch to determine countries for which certain policies shall be applied. +* In the default case, the policy affects all countries when activated. p29_country_dummy(iso) = 0; p29_country_dummy(policy_countries29) = 1; * Because MAgPIE is not run at country-level, but at region level, a region * share is calculated that translates the countries' influence to regional level. * Countries are weighted by available cropland area. -i29_avl_cropland_iso(iso) = f29_avl_cropland_iso(iso,"%c29_marginal_land%"); -p29_country_snv_weight(i) = sum(i_to_iso(i,iso), p29_country_dummy(iso) * i29_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i29_avl_cropland_iso(iso)); +pm_avl_cropland_iso(iso) = f29_avl_cropland_iso(iso,"%c29_marginal_land%"); +p29_country_weight(i) = sum(i_to_iso(i,iso), p29_country_dummy(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso)); diff --git a/modules/29_cropland/detail_apr24/presolve.gms b/modules/29_cropland/detail_apr24/presolve.gms index b01a5b3690..e1a7d63bcf 100644 --- a/modules/29_cropland/detail_apr24/presolve.gms +++ b/modules/29_cropland/detail_apr24/presolve.gms @@ -12,16 +12,16 @@ *' @code *' Minimum semi-natural vegetation (SNV) share is fading in after 2020 p29_snv_shr(t,j) = i29_snv_scenario_fader(t) * - (s29_snv_shr * sum(cell(i,j), p29_country_snv_weight(i)) - + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_snv_weight(i))); + (s29_snv_shr * sum(cell(i,j), p29_country_weight(i)) + + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_weight(i))); *' Cropland relocation in response to SNV policy is based on exogeneous land *' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). *' The rate of the policy implementation is derived based *' on the difference of scenario fader values in consecutive time steps p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * - (i29_snv_relocation_target(j) * sum(cell(i,j), p29_country_snv_weight(i)) - + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_snv_weight(i))); + (i29_snv_relocation_target(j) * sum(cell(i,j), p29_country_weight(i)) + + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_weight(i))); *' The following lines take care of mismatches in the input *' data (derived from satellite imagery from the Copernicus *' Global Land Service (@buchhorn_copernicus_2020)) and in @@ -52,7 +52,9 @@ pc29_treecover(j,ac) = p29_treecover(t,j,ac); v29_treecover.l(j,ac) = p29_treecover(t,j,ac); * create treecover target and penalty scenario -i29_treecover_target(t,j) = s29_treecover_target * i29_treecover_scenario_fader(t); +i29_treecover_target(t,j) = i29_treecover_scenario_fader(t) * + (s29_treecover_target * sum(cell(i,j), p29_country_weight(i)) + + s29_treecover_target_noselect * sum(cell(i,j), 1-p29_country_weight(i))); * calculate treecover share pc29_treecover_share(j) = 0; diff --git a/modules/29_cropland/simple_apr24/declarations.gms b/modules/29_cropland/simple_apr24/declarations.gms index 34207a40de..625f819b2c 100644 --- a/modules/29_cropland/simple_apr24/declarations.gms +++ b/modules/29_cropland/simple_apr24/declarations.gms @@ -7,13 +7,13 @@ parameters p29_avl_cropland(t,j) Total available land for crop cultivation (mio. ha) - p29_country_snv_weight(i) SNV policy country weight per region (1) + p29_country_weight(i) Policy country weight per region (1) p29_snv_shr(t,j) Share of semi-natural vegetation in cropland areas (1) i29_snv_relocation_target(j) Overall cropland area that requires relocation due to SNV policy (mio. ha) p29_snv_relocation(t,j) Cropland area that is actually relocated during time step (mio. ha) p29_max_snv_relocation(t,j) Maximum cropland relocation during time step (mio. ha) p29_country_dummy(iso) Dummy parameter indicating whether country is affected by selected cropland policy (1) - i29_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) + pm_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha) i29_snv_scenario_fader(t_all) SNV scenario fader (1) ; diff --git a/modules/29_cropland/simple_apr24/input.gms b/modules/29_cropland/simple_apr24/input.gms index ab9e0beed5..f13c46f56f 100644 --- a/modules/29_cropland/simple_apr24/input.gms +++ b/modules/29_cropland/simple_apr24/input.gms @@ -17,10 +17,11 @@ scalars s29_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 / ; -* Set-switch for countries affected by regional SNV policy +* Set-switch for countries affected by certain policies * Default: all iso countries selected sets - policy_countries29(iso) countries to be affected by SNV policy / ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, + policy_countries29(iso) countries to be affected by SNV policy + / ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, ASM,ATA,ATF,ATG,AUS,AUT,AZE,BDI,BEL,BEN, BES,BFA,BGD,BGR,BHR,BHS,BIH,BLM,BLR,BLZ, BMU,BOL,BRA,BRB,BRN,BTN,BVT,BWA,CAF,CAN, diff --git a/modules/29_cropland/simple_apr24/preloop.gms b/modules/29_cropland/simple_apr24/preloop.gms index 3113ccb053..9b06b11d8f 100644 --- a/modules/29_cropland/simple_apr24/preloop.gms +++ b/modules/29_cropland/simple_apr24/preloop.gms @@ -25,14 +25,12 @@ elseif s29_snv_shr > s29_snv_relocation_data_x1, m_linear_cell_data_interpol(i29_snv_relocation_target, s29_snv_shr,s29_snv_relocation_data_x1, s29_snv_relocation_data_x2,f29_snv_target_cropland(j, "SNV20TargetCropland"), f29_snv_target_cropland(j, "SNV50TargetCropland")); ); -****** Regional share of semi-natural vegetation (SNV) in cropland areas for selective countries: -* Country switch to determine countries for which a SNV policy shall be applied. -* In the default case, the SNV policy affects all countries when activated. +* Country switch to determine countries for which certain policies shall be applied. +* In the default case, the policy affects all countries when activated. p29_country_dummy(iso) = 0; p29_country_dummy(policy_countries29) = 1; * Because MAgPIE is not run at country-level, but at region level, a region * share is calculated that translates the countries' influence to regional level. * Countries are weighted by available cropland area. -i29_avl_cropland_iso(iso) = f29_avl_cropland_iso(iso,"%c29_marginal_land%"); -p29_country_snv_weight(i) = sum(i_to_iso(i,iso), p29_country_dummy(iso) * i29_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i29_avl_cropland_iso(iso)); - +pm_avl_cropland_iso(iso) = f29_avl_cropland_iso(iso,"%c29_marginal_land%"); +p29_country_weight(i) = sum(i_to_iso(i,iso), p29_country_dummy(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso)); diff --git a/modules/29_cropland/simple_apr24/presolve.gms b/modules/29_cropland/simple_apr24/presolve.gms index a49c401f8b..955befb1e4 100644 --- a/modules/29_cropland/simple_apr24/presolve.gms +++ b/modules/29_cropland/simple_apr24/presolve.gms @@ -9,16 +9,16 @@ *' @code *' Minimum semi-natural vegetation (SNV) share is fading in after 2020 p29_snv_shr(t,j) = i29_snv_scenario_fader(t) * - (s29_snv_shr * sum(cell(i,j), p29_country_snv_weight(i)) - + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_snv_weight(i))); + (s29_snv_shr * sum(cell(i,j), p29_country_weight(i)) + + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_weight(i))); *' Cropland relocation in response to SNV policy is based on exogeneous land *' cover information from the Copernicus Global Land Service (@buchhorn_copernicus_2020). *' The rate of the policy implementation is derived based *' on the difference of scenario fader values in consecutive time steps p29_snv_relocation(t,j) = (i29_snv_scenario_fader(t) - i29_snv_scenario_fader(t-1)) * - (i29_snv_relocation_target(j) * sum(cell(i,j), p29_country_snv_weight(i)) - + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_snv_weight(i))); + (i29_snv_relocation_target(j) * sum(cell(i,j), p29_country_weight(i)) + + s29_snv_shr_noselect * sum(cell(i,j), 1-p29_country_weight(i))); *' The following lines take care of mismatches in the input *' data (derived from satellite imagery from the Copernicus *' Global Land Service (@buchhorn_copernicus_2020)) and in diff --git a/modules/30_croparea/detail_apr24/declarations.gms b/modules/30_croparea/detail_apr24/declarations.gms index 1191876e08..749c03c37b 100644 --- a/modules/30_croparea/detail_apr24/declarations.gms +++ b/modules/30_croparea/detail_apr24/declarations.gms @@ -11,8 +11,10 @@ parameters i30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) i30_implementation Switch for rule-based (1) or penalty-based (0) implementation of rotation scenarios i30_betr_scenario_fader(t_all) Bioenergy land scenario fader (1) - i30_betr_target(t) Target share for bioenergy land on total cropland (1) + i30_betr_target(t,j) Target share for bioenergy land on total cropland (1) i30_betr_penalty(t) Penalty for violation of betr target (USD05MER per ha) + p30_country_weight(i) Policy country weight per region (1) + p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected policy (1) ; positive variables diff --git a/modules/30_croparea/detail_apr24/equations.gms b/modules/30_croparea/detail_apr24/equations.gms index e51d334eac..2015529b0d 100644 --- a/modules/30_croparea/detail_apr24/equations.gms +++ b/modules/30_croparea/detail_apr24/equations.gms @@ -20,7 +20,7 @@ q30_betr_missing(j2)$(sum(ct, i30_betr_penalty(ct)) > 0) .. v30_betr_missing(j2) =g= - vm_land(j2,"crop") * sum(ct, i30_betr_target(ct)) - vm_area(j2,"betr","rainfed"); + vm_land(j2,"crop") * sum(ct, i30_betr_target(ct,j2)) - vm_area(j2,"betr","rainfed"); *' Rotational constraints prevent over-specialization. In this realization, *' they are either implemented via rules (i30_implementation = 1) or diff --git a/modules/30_croparea/detail_apr24/input.gms b/modules/30_croparea/detail_apr24/input.gms index 057eaef0d4..68b3a60d11 100644 --- a/modules/30_croparea/detail_apr24/input.gms +++ b/modules/30_croparea/detail_apr24/input.gms @@ -26,11 +26,43 @@ scalars s30_betr_scenario_start Bioenergy land scenario start year / 2025 / s30_betr_scenario_target Bioenergy land scenario target year / 2050 / s30_betr_start Share of bioenergy land on total cropland in start year (1) / 0 / + s30_betr_start_noselect Share of bioenergy land on total cropland in start year (1) / 0 / s30_betr_target Share of bioenergy land on total cropland in target year (1) / 0 / + s30_betr_target_noselect Share of bioenergy land on total cropland in target year (1) / 0 / s30_betr_penalty Penalty for violation of betr target (USD05MER per ha) / 2000 / s30_annual_max_growth Max annual cropland growth as share of previous cropland (1) / Inf / ; +* Set-switch for countries affected by certain policies +* Default: all iso countries selected +sets + policy_countries30(iso) countries to be affected by SNV policy + / ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, + ASM,ATA,ATF,ATG,AUS,AUT,AZE,BDI,BEL,BEN, + BES,BFA,BGD,BGR,BHR,BHS,BIH,BLM,BLR,BLZ, + BMU,BOL,BRA,BRB,BRN,BTN,BVT,BWA,CAF,CAN, + CCK,CHN,CHE,CHL,CIV,CMR,COD,COG,COK,COL, + COM,CPV,CRI,CUB,CUW,CXR,CYM,CYP,CZE,DEU, + DJI,DMA,DNK,DOM,DZA,ECU,EGY,ERI,ESH,ESP, + EST,ETH,FIN,FJI,FLK,FRA,FRO,FSM,GAB,GBR, + GEO,GGY,GHA,GIB,GIN,GLP,GMB,GNB,GNQ,GRC, + GRD,GRL,GTM,GUF,GUM,GUY,HKG,HMD,HND,HRV, + HTI,HUN,IDN,IMN,IND,IOT,IRL,IRN,IRQ,ISL, + ISR,ITA,JAM,JEY,JOR,JPN,KAZ,KEN,KGZ,KHM, + KIR,KNA,KOR,KWT,LAO,LBN,LBR,LBY,LCA,LIE, + LKA,LSO,LTU,LUX,LVA,MAC,MAF,MAR,MCO,MDA, + MDG,MDV,MEX,MHL,MKD,MLI,MLT,MMR,MNE,MNG, + MNP,MOZ,MRT,MSR,MTQ,MUS,MWI,MYS,MYT,NAM, + NCL,NER,NFK,NGA,NIC,NIU,NLD,NOR,NPL,NRU, + NZL,OMN,PAK,PAN,PCN,PER,PHL,PLW,PNG,POL, + PRI,PRK,PRT,PRY,PSE,PYF,QAT,REU,ROU,RUS, + RWA,SAU,SDN,SEN,SGP,SGS,SHN,SJM,SLB,SLE, + SLV,SMR,SOM,SPM,SRB,SSD,STP,SUR,SVK,SVN, + SWE,SWZ,SXM,SYC,SYR,TCA,TCD,TGO,THA,TJK, + TKL,TKM,TLS,TON,TTO,TUN,TUR,TUV,TWN,TZA, + UGA,UKR,UMI,URY,USA,UZB,VAT,VCT,VEN,VGB, + VIR,VNM,VUT,WLF,WSM,YEM,ZAF,ZMB,ZWE / +; $ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes; $else bioen_type_30("%c30_bioen_type%") = yes; diff --git a/modules/30_croparea/detail_apr24/preloop.gms b/modules/30_croparea/detail_apr24/preloop.gms index 61c6d15a85..cdef528e7f 100644 --- a/modules/30_croparea/detail_apr24/preloop.gms +++ b/modules/30_croparea/detail_apr24/preloop.gms @@ -30,3 +30,12 @@ fm_croparea(t_past,j,w,kcr)$(fm_croparea(t_past,j,w,kcr)<0) = 0; if(s30_implementation = 1, v30_penalty.fx(j,rota30) = 0; ); + +* Country switch to determine countries for which certain policies shall be applied. +* In the default case, the policy affects all countries when activated. +p30_country_dummy(iso) = 0; +p30_country_dummy(policy_countries30) = 1; +* Because MAgPIE is not run at country-level, but at region level, a region +* share is calculated that translates the countries' influence to regional level. +* Countries are weighted by available cropland area. +p30_country_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso)); diff --git a/modules/30_croparea/detail_apr24/presolve.gms b/modules/30_croparea/detail_apr24/presolve.gms index 047c05ed2d..fb18d303f3 100644 --- a/modules/30_croparea/detail_apr24/presolve.gms +++ b/modules/30_croparea/detail_apr24/presolve.gms @@ -33,8 +33,12 @@ else ); * create betr target and penalty scenario -i30_betr_target(t) = s30_betr_start * (1-i30_betr_scenario_fader(t)) - + s30_betr_target * i30_betr_scenario_fader(t); +i30_betr_target(t,j) = (1-i30_betr_scenario_fader(t)) * + (s30_betr_start * sum(cell(i,j), p29_country_weight(i)) + + s30_betr_start_noselect * sum(cell(i,j), 1-p29_country_weight(i))) + + i30_betr_scenario_fader(t) * + (s30_betr_target * sum(cell(i,j), p29_country_weight(i)) + + s30_betr_target_noselect * sum(cell(i,j), 1-p29_country_weight(i))); if (m_year(t) <= s30_betr_scenario_start, i30_betr_penalty(t) = 0; diff --git a/modules/30_croparea/simple_apr24/declarations.gms b/modules/30_croparea/simple_apr24/declarations.gms index 4013e895e8..cc118fa84a 100644 --- a/modules/30_croparea/simple_apr24/declarations.gms +++ b/modules/30_croparea/simple_apr24/declarations.gms @@ -8,8 +8,10 @@ parameters i30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1) i30_betr_scenario_fader(t_all) Bioenergy land scenario fader (1) - i30_betr_target(t) Target share for bioenergy land on total cropland (1) + i30_betr_target(t,j) Target share for bioenergy land on total cropland (1) i30_betr_penalty(t) Penalty for violation of betr target (USD05MER per ha) + p30_country_weight(i) Policy country weight per region (1) + p30_country_dummy(iso) Dummy parameter indicating whether country is affected by selected policy (1) ; positive variables diff --git a/modules/30_croparea/simple_apr24/equations.gms b/modules/30_croparea/simple_apr24/equations.gms index 4df6b25bbf..42f01c1794 100644 --- a/modules/30_croparea/simple_apr24/equations.gms +++ b/modules/30_croparea/simple_apr24/equations.gms @@ -20,7 +20,7 @@ q30_betr_missing(j2)$(sum(ct, i30_betr_penalty(ct)) > 0) .. v30_betr_missing(j2) =g= - vm_land(j2,"crop") * sum(ct, i30_betr_target(ct)) - vm_area(j2,"betr","rainfed"); + vm_land(j2,"crop") * sum(ct, i30_betr_target(ct,j2)) - vm_area(j2,"betr","rainfed"); q30_cost(i2) .. vm_rotation_penalty(i2) =g= diff --git a/modules/30_croparea/simple_apr24/input.gms b/modules/30_croparea/simple_apr24/input.gms index 7fdea61cea..e99a128cb0 100644 --- a/modules/30_croparea/simple_apr24/input.gms +++ b/modules/30_croparea/simple_apr24/input.gms @@ -20,11 +20,44 @@ scalars s30_betr_scenario_start Bioenergy land scenario start year / 2025 / s30_betr_scenario_target Bioenergy land scenario target year / 2050 / s30_betr_start Share of bioenergy land on total cropland in start year (1) / 0 / + s30_betr_start_noselect Share of bioenergy land on total cropland in start year (1) / 0 / s30_betr_target Share of bioenergy land on total cropland in target year (1) / 0 / + s30_betr_target_noselect Share of bioenergy land on total cropland in target year (1) / 0 / s30_betr_penalty Penalty for violation of betr target (USD05MER per ha) / 2000 / s30_annual_max_growth Max annual cropland growth as share of previous cropland (1) / Inf / ; +* Set-switch for countries affected by certain policies +* Default: all iso countries selected +sets + policy_countries30(iso) countries to be affected by SNV policy + / ABW,AFG,AGO,AIA,ALA,ALB,AND,ARE,ARG,ARM, + ASM,ATA,ATF,ATG,AUS,AUT,AZE,BDI,BEL,BEN, + BES,BFA,BGD,BGR,BHR,BHS,BIH,BLM,BLR,BLZ, + BMU,BOL,BRA,BRB,BRN,BTN,BVT,BWA,CAF,CAN, + CCK,CHN,CHE,CHL,CIV,CMR,COD,COG,COK,COL, + COM,CPV,CRI,CUB,CUW,CXR,CYM,CYP,CZE,DEU, + DJI,DMA,DNK,DOM,DZA,ECU,EGY,ERI,ESH,ESP, + EST,ETH,FIN,FJI,FLK,FRA,FRO,FSM,GAB,GBR, + GEO,GGY,GHA,GIB,GIN,GLP,GMB,GNB,GNQ,GRC, + GRD,GRL,GTM,GUF,GUM,GUY,HKG,HMD,HND,HRV, + HTI,HUN,IDN,IMN,IND,IOT,IRL,IRN,IRQ,ISL, + ISR,ITA,JAM,JEY,JOR,JPN,KAZ,KEN,KGZ,KHM, + KIR,KNA,KOR,KWT,LAO,LBN,LBR,LBY,LCA,LIE, + LKA,LSO,LTU,LUX,LVA,MAC,MAF,MAR,MCO,MDA, + MDG,MDV,MEX,MHL,MKD,MLI,MLT,MMR,MNE,MNG, + MNP,MOZ,MRT,MSR,MTQ,MUS,MWI,MYS,MYT,NAM, + NCL,NER,NFK,NGA,NIC,NIU,NLD,NOR,NPL,NRU, + NZL,OMN,PAK,PAN,PCN,PER,PHL,PLW,PNG,POL, + PRI,PRK,PRT,PRY,PSE,PYF,QAT,REU,ROU,RUS, + RWA,SAU,SDN,SEN,SGP,SGS,SHN,SJM,SLB,SLE, + SLV,SMR,SOM,SPM,SRB,SSD,STP,SUR,SVK,SVN, + SWE,SWZ,SXM,SYC,SYR,TCA,TCD,TGO,THA,TJK, + TKL,TKM,TLS,TON,TTO,TUN,TUR,TUV,TWN,TZA, + UGA,UKR,UMI,URY,USA,UZB,VAT,VCT,VEN,VGB, + VIR,VNM,VUT,WLF,WSM,YEM,ZAF,ZMB,ZWE / +; + $ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes; $else bioen_type_30("%c30_bioen_type%") = yes; $endif diff --git a/modules/30_croparea/simple_apr24/preloop.gms b/modules/30_croparea/simple_apr24/preloop.gms index 899afc80c9..adffa58780 100644 --- a/modules/30_croparea/simple_apr24/preloop.gms +++ b/modules/30_croparea/simple_apr24/preloop.gms @@ -15,3 +15,11 @@ m_sigmoid_time_interpol(i30_betr_scenario_fader,s30_betr_scenario_start,s30_betr *cannot be smaller than 0! fm_croparea(t_past,j,w,kcr)$(fm_croparea(t_past,j,w,kcr)<0) = 0; +* Country switch to determine countries for which certain policies shall be applied. +* In the default case, the policy affects all countries when activated. +p30_country_dummy(iso) = 0; +p30_country_dummy(policy_countries30) = 1; +* Because MAgPIE is not run at country-level, but at region level, a region +* share is calculated that translates the countries' influence to regional level. +* Countries are weighted by available cropland area. +p30_country_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * pm_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), pm_avl_cropland_iso(iso)); diff --git a/modules/30_croparea/simple_apr24/presolve.gms b/modules/30_croparea/simple_apr24/presolve.gms index c89314e5c7..2f23d5fb7f 100644 --- a/modules/30_croparea/simple_apr24/presolve.gms +++ b/modules/30_croparea/simple_apr24/presolve.gms @@ -24,8 +24,12 @@ crpmax30(crp30) = yes$(f30_rotation_max_shr(crp30) < 1); crpmin30(crp30) = yes$(f30_rotation_min_shr(crp30) > 0); * create betr target and penalty scenario -i30_betr_target(t) = s30_betr_start * (1-i30_betr_scenario_fader(t)) - + s30_betr_target * i30_betr_scenario_fader(t); +i30_betr_target(t,j) = (1-i30_betr_scenario_fader(t)) * + (s30_betr_start * sum(cell(i,j), p29_country_weight(i)) + + s30_betr_start_noselect * sum(cell(i,j), 1-p29_country_weight(i))) + + i30_betr_scenario_fader(t) * + (s30_betr_target * sum(cell(i,j), p29_country_weight(i)) + + s30_betr_target_noselect * sum(cell(i,j), 1-p29_country_weight(i))); if (m_year(t) <= s30_betr_scenario_start, i30_betr_penalty(t) = 0; From e3686daaae42f145797775a1477c846b2d74ce78 Mon Sep 17 00:00:00 2001 From: Jan Philipp Dietrich Date: Fri, 14 Jun 2024 19:17:30 +0200 Subject: [PATCH 249/280] update slurm job handling --- output.R | 3 +- scripts/run_submit/submit_medium.sh | 1 - scripts/run_submit/submit_priority.sh | 1 - scripts/run_submit/submit_priority_maxMem.sh | 1 - scripts/run_submit/submit_short.sh | 1 - scripts/run_submit/submit_short_maxMem.sh | 1 - scripts/run_submit/submit_standby.sh | 1 - scripts/run_submit/submit_standby_dayMax.sh | 1 - scripts/run_submit/submit_standby_maxMem.sh | 1 - .../submit_standby_maxMem_dayMax.sh | 1 - scripts/slurmStart.yml | 4 + scripts/start_functions.R | 2 +- start.R | 110 ++++++++---------- 13 files changed, 56 insertions(+), 72 deletions(-) create mode 100644 scripts/slurmStart.yml diff --git a/output.R b/output.R index a439f41537..c5e2ac2a43 100644 --- a/output.R +++ b/output.R @@ -77,7 +77,8 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { } choose_submit <- function(title="Please choose run submission type") { - slurm <- suppressWarnings(ifelse(system2("srun",stdout=FALSE,stderr=FALSE) != 127, TRUE, FALSE)) + #Is SLURM available? + slurm <- lucode2::SystemCommandAvailable("srun") modes <- c("SLURM standby", "SLURM standby maxMem", "SLURM priority", "SLURM priority maxMem","Direct execution", "Background execution", "Debug mode") if(slurm) { cat("\nCurrent cluster utilization:\n") diff --git a/scripts/run_submit/submit_medium.sh b/scripts/run_submit/submit_medium.sh index 46939f54cf..a8d81b7deb 100644 --- a/scripts/run_submit/submit_medium.sh +++ b/scripts/run_submit/submit_medium.sh @@ -5,6 +5,5 @@ #SBATCH --output=slurm.log #SBATCH --mail-type=END #SBATCH --cpus-per-task=3 -#SBATCH --partition=standard Rscript submit.R diff --git a/scripts/run_submit/submit_priority.sh b/scripts/run_submit/submit_priority.sh index c0722ac8fe..052080501f 100644 --- a/scripts/run_submit/submit_priority.sh +++ b/scripts/run_submit/submit_priority.sh @@ -5,6 +5,5 @@ #SBATCH --output=slurm.log #SBATCH --mail-type=END #SBATCH --cpus-per-task=3 -#SBATCH --partition=priority Rscript submit.R diff --git a/scripts/run_submit/submit_priority_maxMem.sh b/scripts/run_submit/submit_priority_maxMem.sh index 1681ef78f9..286be68440 100644 --- a/scripts/run_submit/submit_priority_maxMem.sh +++ b/scripts/run_submit/submit_priority_maxMem.sh @@ -6,6 +6,5 @@ #SBATCH --mail-type=END #SBATCH --cpus-per-task=16 #SBATCH --mem-per-cpu=0 -#SBATCH --partition=priority Rscript submit.R diff --git a/scripts/run_submit/submit_short.sh b/scripts/run_submit/submit_short.sh index e0ab5ada21..fb89bdaf15 100644 --- a/scripts/run_submit/submit_short.sh +++ b/scripts/run_submit/submit_short.sh @@ -5,6 +5,5 @@ #SBATCH --output=slurm.log #SBATCH --mail-type=END #SBATCH --cpus-per-task=3 -#SBATCH --partition=standard Rscript submit.R diff --git a/scripts/run_submit/submit_short_maxMem.sh b/scripts/run_submit/submit_short_maxMem.sh index c1da4fa176..b11c9e62a0 100644 --- a/scripts/run_submit/submit_short_maxMem.sh +++ b/scripts/run_submit/submit_short_maxMem.sh @@ -6,7 +6,6 @@ #SBATCH --mail-type=END #SBATCH --cpus-per-task=16 #SBATCH --mem-per-cpu=0 -#SBATCH --partition=standard Rscript submit.R diff --git a/scripts/run_submit/submit_standby.sh b/scripts/run_submit/submit_standby.sh index f959e505a3..c508d0bdec 100644 --- a/scripts/run_submit/submit_standby.sh +++ b/scripts/run_submit/submit_standby.sh @@ -5,6 +5,5 @@ #SBATCH --output=slurm.log #SBATCH --mail-type=END #SBATCH --cpus-per-task=3 -#SBATCH --partition=priority Rscript submit.R diff --git a/scripts/run_submit/submit_standby_dayMax.sh b/scripts/run_submit/submit_standby_dayMax.sh index a63c56cd31..80a981279a 100644 --- a/scripts/run_submit/submit_standby_dayMax.sh +++ b/scripts/run_submit/submit_standby_dayMax.sh @@ -5,7 +5,6 @@ #SBATCH --output=slurm.log #SBATCH --mail-type=END #SBATCH --cpus-per-task=3 -#SBATCH --partition=priority #SBATCH --time=24:00:00 Rscript submit.R diff --git a/scripts/run_submit/submit_standby_maxMem.sh b/scripts/run_submit/submit_standby_maxMem.sh index 0b2497b9bb..dcfcd12169 100644 --- a/scripts/run_submit/submit_standby_maxMem.sh +++ b/scripts/run_submit/submit_standby_maxMem.sh @@ -6,6 +6,5 @@ #SBATCH --mail-type=END #SBATCH --cpus-per-task=16 #SBATCH --mem-per-cpu=0 -#SBATCH --partition=priority Rscript submit.R diff --git a/scripts/run_submit/submit_standby_maxMem_dayMax.sh b/scripts/run_submit/submit_standby_maxMem_dayMax.sh index f5cd6a05a7..0af5490672 100644 --- a/scripts/run_submit/submit_standby_maxMem_dayMax.sh +++ b/scripts/run_submit/submit_standby_maxMem_dayMax.sh @@ -6,7 +6,6 @@ #SBATCH --mail-type=END #SBATCH --cpus-per-task=16 #SBATCH --mem-per-cpu=0 -#SBATCH --partition=priority #SBATCH --time=24:00:00 Rscript submit.R diff --git a/scripts/slurmStart.yml b/scripts/slurmStart.yml new file mode 100644 index 0000000000..513adadf2e --- /dev/null +++ b/scripts/slurmStart.yml @@ -0,0 +1,4 @@ +slurmjobs: + SLURM priority: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END --wrap=\"Rscript %SCRIPT\" --qos=priority --cpus-per-task=3" + SLURM standby: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END --wrap=\"Rscript %SCRIPT\" --qos=standby --cpus-per-task=3" + SLURM medium: "sbatch --job-name=%NAME --output=logs/%NAME-%j.out --mail-type=END --wrap=\"Rscript %SCRIPT\" --qos=medium --cpus-per-task=3" diff --git a/scripts/start_functions.R b/scripts/start_functions.R index 2a0872fd38..1ce4a2f9c5 100644 --- a/scripts/start_functions.R +++ b/scripts/start_functions.R @@ -521,7 +521,7 @@ start_run <- function(cfg, scenario = NULL, codeCheck = TRUE, lock_model = TRUE) cfg$qos <- "standby" } else if(all(load > 80)) { cfg$qos <- "priority" - } else if(load["priority"] < load["standard"]) { + } else if(all(c("priority", "standard") %in% names(load)) && load["priority"] < load["standard"]) { cfg$qos <- "standby" } else { cfg$qos <- "short" diff --git a/start.R b/start.R index 79771dc14c..b9e349bcff 100644 --- a/start.R +++ b/start.R @@ -31,99 +31,87 @@ if (!is.null(renv::project())) { library(lucode2) library(gms) +library(yaml) runOutputs <- function(runscripts=NULL, submit=NULL) { - choose_submit <- function(title="Please choose run submission type") { - slurm <- suppressWarnings(ifelse(system2("srun",stdout=FALSE,stderr=FALSE) != 127, TRUE, FALSE)) - modes <- c("SLURM priority", - "SLURM standby", - "SLURM medium", - "Direct execution", + chooseSubmit <- function(title="Please choose run submission type", + slurmModes="scripts/slurmStart.yml") { + modes <- c("Direct execution", "Background execution", "Debug mode") + + #Is SLURM available? + slurm <- lucode2::SystemCommandAvailable("srun") if(slurm) { - cat("\nCurrent cluster utilization:\n") - system("sclass") - cat("\n") - } else { - modes <- grep("SLURM",modes,invert=TRUE,value=TRUE) + slurmModes <- yaml::read_yaml(slurmModes)$slurmjobs + modes <- c(names(slurmModes, modes)) + if(lucode2::SystemCommandAvailable("sclass")) { + cat("\nCurrent cluster utilization:\n") + system("sclass") + cat("\n") + } } + cat("\n",title,":\n", sep="") cat(paste(seq_along(modes), modes, sep=": " ),sep="\n") cat("Number: ") identifier <- gms::getLine() - identifier <- as.numeric(strsplit(identifier,",")[[1]]) - if(slurm) { - comp <- switch(identifier, - "1" = "slurmpriority", - "2" = "slurmstandby", - "3" = "slurmmedium", - "4" = "direct", - "5" = "background", - "6" = "debug") - } else { - comp <- switch(identifier, - "1" = "direct", - "2" = "background", - "3" = "debug") - } - if(is.null(comp)) stop("This type is invalid. Please choose a valid type") + identifier <- as.integer(strsplit(identifier,",")[[1]]) + comp <- modes[identifier] + if(is.null(comp) || is.na(comp)) stop("This type is invalid. Please choose a valid type") return(comp) } - runsubmit <- function(runscripts, submit) { + runSubmit <- function(runscripts, submit, + slurmModes="scripts/slurmStart.yml") { if(!dir.exists("logs")) dir.create("logs") for(rout in runscripts){ - name <- paste0("./scripts/start/",rout) - if(!file.exists(name)) { - name2 <- paste0(name,".R") - if(!file.exists(name2)) { - warning("Script ",name2, " could not be found. Skip execution!") + script <- paste0("./scripts/start/",rout) + if(!file.exists(script)) { + script <- paste0(script,".R") + if(!file.exists(script)) { + warning("Script ",script, " could not be found. Skip execution!") next } - name <- name2 } - cat("Executing",name,"\n") - rout_name <- sub("\\.R$","",sub("/","_",rout)) - sbatch_command <- paste0("sbatch --job-name=",rout_name," --output=logs/",rout_name,"-%j.out --mail-type=END --wrap=\"Rscript ",name,"\"") - if(submit=="direct") { + cat("Executing",script,"\n") + name <- sub("\\.R$","",sub("/","_",rout)) + if(submit %in% c("Direct execution", "direct")) { tmp.env <- new.env() - tmp.error <- try(sys.source(name,envir=tmp.env)) - if(!is.null(tmp.error)) warning("Script ",name," was stopped by an error and not executed properly!") + tmp.error <- try(sys.source(script, envir=tmp.env)) + if(!is.null(tmp.error)) warning("Script ",script," was stopped by an error and not executed properly!") rm(tmp.env) - } else if(submit=="background") { - log <- format(Sys.time(), paste0("logs/", rout_name, "-%Y-%H-%M-%S-%OS3.log")) - system2("Rscript",name, stderr = log, stdout = log, wait=FALSE) - } else if(submit=="slurmpriority") { - system(paste(sbatch_command,"--qos=priority --cpus-per-task=3")) - Sys.sleep(1) - } else if(submit=="slurmstandby") { - system(paste(sbatch_command,"--qos=standby --cpus-per-task=3")) - Sys.sleep(1) - } else if(submit=="slurmmedium") { - system(paste(sbatch_command,"--qos=medium --cpus-per-task=3")) - Sys.sleep(1) - } else if(submit=="debug") { + } else if(submit %in% c("Background execution", "background")) { + log <- format(Sys.time(), paste0("logs/", name, "-%Y-%H-%M-%S-%OS3.log")) + system2("Rscript",script, stderr = log, stdout = log, wait=FALSE) + } else if(submit %in% c("Debug mode", "debug")) { tmp.env <- new.env() - sys.source(name,envir=tmp.env) + sys.source(script,envir=tmp.env) rm(tmp.env) } else { - stop("Unknown submission type") + slurmModes <- yaml::read_yaml(slurmModes)$slurmjobs + if(submit %in% names(slurmModes)) { + command <- slurmModes[submit] + command <- gsub("%NAME", name, command) + command <- gsub("%SCRIPT", script, command) + system(command) + Sys.sleep(1) + } else { + stop("Unknown submission type") + } } } } - - if(is.null(runscripts)) runscripts <- gms::selectScript("./scripts/start") if(is.null(runscripts)) { message("No start script selected! Stop here.") return(invisible(NULL)) } - if(is.null(submit)) submit <- choose_submit("Choose submission type") - runsubmit(runscripts, submit) + if(is.null(submit)) submit <- chooseSubmit("Choose submission type") + runSubmit(runscripts, submit) } @@ -131,5 +119,5 @@ system("git config core.hooksPath .githooks") submit <- NULL runscripts <- NULL -lucode2::readArgs("runscripts","submit", .silent=TRUE) -runOutputs(runscripts=runscripts, submit=submit) +lucode2::readArgs("runscripts", "submit", .silent = TRUE) +runOutputs(runscripts = runscripts, submit = submit) From eebeea68ce0ae5cfe96f354bbfa134a422705175 Mon Sep 17 00:00:00 2001 From: Jan Philipp Dietrich Date: Fri, 14 Jun 2024 19:20:06 +0200 Subject: [PATCH 250/280] fix --- start.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/start.R b/start.R index b9e349bcff..f76a471c9e 100644 --- a/start.R +++ b/start.R @@ -44,7 +44,7 @@ runOutputs <- function(runscripts=NULL, submit=NULL) { slurm <- lucode2::SystemCommandAvailable("srun") if(slurm) { slurmModes <- yaml::read_yaml(slurmModes)$slurmjobs - modes <- c(names(slurmModes, modes)) + modes <- c(names(slurmModes), modes) if(lucode2::SystemCommandAvailable("sclass")) { cat("\nCurrent cluster utilization:\n") system("sclass") From 4b703be35752391a5f4b15c216978b2b393f0b22 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 14 Jun 2024 19:42:59 +0200 Subject: [PATCH 251/280] added EUR --- config/default.cfg | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/default.cfg b/config/default.cfg index fd45e39a2d..73aac6eb88 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -175,6 +175,11 @@ oecd90andEU <- "ALB,AUS,AUT,BEL,BIH,BGR,CAN,CYP,CZE,DNK,EST,FIN,FRA, NLD,NOR,NZL,POL,PRT,ROU,SRB,SVK,SVN,ESP,SWE,CHE,MKD,TUR, GBR,USA" +EUR <- "ALB,AUT,BEL,BGR,CYP,CZE,DEU,DNK,ESP,EST,FIN,FRA,FRO, + GBR,GGY,GIB,GRC,HRV,HUN,IMN,IRL,ITA,JEY,LTU,LUX,LVA,MLT, + NLD,POL,PRT,ROU,SVK,SVN,SWE" + + # ***--------------------- 09_drivers ---------------------------------------- # * (aug17): default drivers cfg$gms$drivers <- "aug17" # def = aug17 From 84e7914de3e82e4983d5d54cd3b5f7609378cf70 Mon Sep 17 00:00:00 2001 From: Jan Philipp Dietrich Date: Fri, 14 Jun 2024 20:01:32 +0200 Subject: [PATCH 252/280] moved chooseSubmit function to helper.R:# Please enter the commit message for your changes. Lines starting --- output.R | 6 +++--- scripts/helper.R | 27 +++++++++++++++++++++++++++ start.R | 31 +++---------------------------- 3 files changed, 33 insertions(+), 31 deletions(-) create mode 100644 scripts/helper.R diff --git a/output.R b/output.R index c5e2ac2a43..635e7a3c56 100644 --- a/output.R +++ b/output.R @@ -33,7 +33,7 @@ library(lucode2) library(gms) runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { - choose_folder <- function(title="Please choose a folder") { + chooseFolder <- function(title="Please choose a folder") { dirs <- c(Sys.glob("./output/*/full.gms"), Sys.glob("./output/HR*/*/full.gms")) dirs <- sub("^\\./output/", "", dirs) dirs <- sub("/full\\.gms$", "", dirs) @@ -66,7 +66,7 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { if(answer=="y"){ return(paste0("./output/",dirs[id+1])) } else { - choose_folder(title) + chooseFolder(title) } } else if(any(dirs[identifier] == "all")){ identifier <- 2:length(dirs) @@ -172,7 +172,7 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { } } - if (is.null(outputdir)) outputdir <- choose_folder("Choose runs") + if (is.null(outputdir)) outputdir <- chooseFolder("Choose runs") if (is.null(output)) output <- gms::selectScript("./scripts/output") if (is.null(submit)) submit <- choose_submit("Choose submission type") if (is.null(output)) { diff --git a/scripts/helper.R b/scripts/helper.R new file mode 100644 index 0000000000..2802987cf8 --- /dev/null +++ b/scripts/helper.R @@ -0,0 +1,27 @@ +# Collection of helper functions + +chooseSubmit <- function(title, slurmModes) { + modes <- c("Direct execution", + "Background execution", + "Debug mode") + + #Is SLURM available? + slurm <- lucode2::SystemCommandAvailable("srun") + if(slurm) { + slurmModes <- yaml::read_yaml(slurmModes)$slurmjobs + modes <- c(names(slurmModes), modes) + if(lucode2::SystemCommandAvailable("sclass")) { + cat("\nCurrent cluster utilization:\n") + system("sclass") + cat("\n") + } + } + cat("\n",title,":\n", sep="") + cat(paste(seq_along(modes), modes, sep=": " ),sep="\n") + cat("Number: ") + identifier <- gms::getLine() + identifier <- as.integer(strsplit(identifier,",")[[1]]) + comp <- modes[identifier] + if(is.null(comp) || is.na(comp)) stop("This type is invalid. Please choose a valid type") + return(comp) +} diff --git a/start.R b/start.R index f76a471c9e..4ce27528d9 100644 --- a/start.R +++ b/start.R @@ -32,35 +32,9 @@ if (!is.null(renv::project())) { library(lucode2) library(gms) library(yaml) +source("scripts/helper.R") runOutputs <- function(runscripts=NULL, submit=NULL) { - chooseSubmit <- function(title="Please choose run submission type", - slurmModes="scripts/slurmStart.yml") { - modes <- c("Direct execution", - "Background execution", - "Debug mode") - - #Is SLURM available? - slurm <- lucode2::SystemCommandAvailable("srun") - if(slurm) { - slurmModes <- yaml::read_yaml(slurmModes)$slurmjobs - modes <- c(names(slurmModes), modes) - if(lucode2::SystemCommandAvailable("sclass")) { - cat("\nCurrent cluster utilization:\n") - system("sclass") - cat("\n") - } - } - - cat("\n",title,":\n", sep="") - cat(paste(seq_along(modes), modes, sep=": " ),sep="\n") - cat("Number: ") - identifier <- gms::getLine() - identifier <- as.integer(strsplit(identifier,",")[[1]]) - comp <- modes[identifier] - if(is.null(comp) || is.na(comp)) stop("This type is invalid. Please choose a valid type") - return(comp) - } runSubmit <- function(runscripts, submit, slurmModes="scripts/slurmStart.yml") { @@ -110,7 +84,8 @@ runOutputs <- function(runscripts=NULL, submit=NULL) { message("No start script selected! Stop here.") return(invisible(NULL)) } - if(is.null(submit)) submit <- chooseSubmit("Choose submission type") + if(is.null(submit)) submit <- chooseSubmit("Choose submission type", + slurmModes = "scripts/slurmStart.yml") runSubmit(runscripts, submit) } From b66d867da558e64f13a8c1fa8cb068e29b74fb3f Mon Sep 17 00:00:00 2001 From: Jan Philipp Dietrich Date: Fri, 14 Jun 2024 20:24:10 +0200 Subject: [PATCH 253/280] adjusted output.R to new logic --- output.R | 94 ++++++++++++----------------------------- scripts/slurmOutput.yml | 5 +++ 2 files changed, 32 insertions(+), 67 deletions(-) create mode 100644 scripts/slurmOutput.yml diff --git a/output.R b/output.R index 635e7a3c56..0a3b390ca3 100644 --- a/output.R +++ b/output.R @@ -31,6 +31,8 @@ if (!is.null(renv::project()) && !exists("source_include") && Sys.getenv("SLURM_ library(lucode2) library(gms) +library(yaml) +source("scripts/helper.R") runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { chooseFolder <- function(title="Please choose a folder") { @@ -76,52 +78,15 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { } } - choose_submit <- function(title="Please choose run submission type") { - #Is SLURM available? - slurm <- lucode2::SystemCommandAvailable("srun") - modes <- c("SLURM standby", "SLURM standby maxMem", "SLURM priority", "SLURM priority maxMem","Direct execution", "Background execution", "Debug mode") - if(slurm) { - cat("\nCurrent cluster utilization:\n") - system("sclass") - cat("\n") - } else { - modes <- grep("^SLURM", modes, invert = TRUE, value = TRUE) - } - cat("\n",title,":\n",sep="") - cat(paste(seq_along(modes), modes, sep=": " ),sep="\n") - cat("Number: ") - identifier <- gms::getLine() - identifier <- as.numeric(strsplit(identifier,",")[[1]]) - if(slurm) { - system("sclass") - comp <- switch(identifier, - "1" = "slurm standby", - "2" = "slurm standby maxMem", - "3" = "slurm priority", - "4" = "slurm priority maxMem", - "5" = "direct", - "6" = "background", - "7" = "debug") - - } else { - comp <- switch(identifier, - "1" = "direct", - "2" = "background", - "3" = "debug") - } - if(is.null(comp)) stop("This type is invalid. Please choose a valid type") - return(comp) - } - - runsubmit <- function(output, alloutputdirs, submit, script_path) { + runsubmit <- function(output, alloutputdirs, submit, scriptPath, slurmModes) { if(!dir.exists("logs")) dir.create("logs") #Set value source_include so that loaded scripts know, that they are #included as source (instead of a load from command line) source_include <- TRUE # nolint # run output scripts over all choosen folders for(rout in output){ - name <- ifelse(file.exists(paste0(script_path,rout)), rout, paste0(rout,".R")) - script <- paste0(script_path,name) + name <- ifelse(file.exists(paste0(scriptPath, rout)), rout, paste0(rout, ".R")) + script <- paste0(scriptPath, name) if(!file.exists(script)) { warning("Script ",name, " could not be found. Skip execution!") next @@ -136,37 +101,29 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { rout_name <- sub("\\.R$","",sub("/","_",rout)) for(outputdir in loop) { message("\n# ",name, " -> ", outputdir) - r_command <- paste0("output.R outputdir=",paste(outputdir,collapse=",")," output=",rout," submit=direct") - sbatch_command <- paste0("sbatch ", - "--job-name=scripts-output ", - "--output=logs/out-", rout_name, "-%j.out ", - "--error=logs/out-", rout_name, "-%j.err ", - "--mail-type=END ", - "--time=200 ", - "--mem-per-cpu=8000 ", - "--wrap=\"Rscript ", r_command, "\"") - if(submit=="direct") { + rCommand <- paste0("output.R outputdir=",paste(outputdir,collapse=",")," output=",rout," submit=direct") + if(submit %in% c("Direct execution", "direct")) { tmp.env <- new.env() tmp.error <- try(sys.source(script,envir=tmp.env)) if(!is.null(tmp.error)) warning("Script ",name," was stopped by an error and not executed properly!") rm(tmp.env) - } else if(submit=="background") { + } else if(submit %in% c("Background execution", "background")) { log <- format(Sys.time(), paste0("logs/out-",rout_name,"-%Y-%H-%M-%S-%OS3.log")) - system2("Rscript", r_command, stderr = log, stdout = log, wait=FALSE) - } else if(submit=="slurm standby") { - system(paste(sbatch_command, "--qos=standby --time=24:00:00")) - } else if(submit=="slurm standby maxMem") { - system(paste(sbatch_command, "--qos=standby --time=24:00:00 --mem-per-cpu=0 --cpus-per-task=16")) - } else if(submit=="slurm priority") { - system(paste(sbatch_command, "--qos=priority")) - } else if(submit=="slurm priority maxMem") { - system(paste(sbatch_command, "--qos=priority --mem-per-cpu=0 --cpus-per-task=16")) - } else if(submit=="debug") { + system2("Rscript", rCommand, stderr = log, stdout = log, wait=FALSE) + } else if(submit %in% c("Debug mode", "debug")) { tmp.env <- new.env() sys.source(script,envir=tmp.env) rm(tmp.env) } else { - stop("Unknown submission type") + slurmModes <- yaml::read_yaml(slurmModes)$slurmjobs + if(submit %in% names(slurmModes)) { + command <- slurmModes[submit] + command <- gsub("%NAME", rout_name, command) + command <- gsub("%SCRIPT", rCommand, command) + system(command) + } else { + stop("Unknown submission type") + } } } } @@ -174,7 +131,8 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { if (is.null(outputdir)) outputdir <- chooseFolder("Choose runs") if (is.null(output)) output <- gms::selectScript("./scripts/output") - if (is.null(submit)) submit <- choose_submit("Choose submission type") + if (is.null(submit)) submit <- chooseSubmit("Choose submission type", + slurmModes = "scripts/slurmOutput.yml") if (is.null(output)) { message("No output script selected! Stop here.") return(invisible(NULL)) @@ -222,13 +180,15 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { } } - runsubmit(output, alloutputdirs = outputdir, submit, "scripts/output/") + runsubmit(output = output, alloutputdirs = outputdir, + submit = submit, scriptPath = "scripts/output/", + slurmModes = "scripts/slurmOutput.yml") message("") } -if(!exists("source_include")) { +if (!exists("source_include")) { output <- outputdir <- submit <- NULL - lucode2::readArgs("output","outputdir","submit", .silent=TRUE) + lucode2::readArgs("output", "outputdir", "submit", .silent = TRUE) } -runOutputs(output=output, outputdir = outputdir, submit=submit) +runOutputs(output = output, outputdir = outputdir, submit = submit) diff --git a/scripts/slurmOutput.yml b/scripts/slurmOutput.yml new file mode 100644 index 0000000000..229e5a43fb --- /dev/null +++ b/scripts/slurmOutput.yml @@ -0,0 +1,5 @@ +slurmjobs: + SLURM standby: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --time=24:00:00" + SLURM standby maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --time=24:00:00 --mem-per-cpu=0 --cpus-per-task=16" + SLURM priority: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority" + SLURM priority maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority --mem-per-cpu=0 --cpus-per-task=16" \ No newline at end of file From 8582e3ae4593307b09e8bd1f76f7c3e7621b5b82 Mon Sep 17 00:00:00 2001 From: Jan Philipp Dietrich Date: Fri, 14 Jun 2024 20:33:29 +0200 Subject: [PATCH 254/280] further tweaks --- output.R | 1 + scripts/helper.R | 2 +- scripts/slurmOutput.yml | 3 ++- start.R | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/output.R b/output.R index 0a3b390ca3..f81f232b1e 100644 --- a/output.R +++ b/output.R @@ -120,6 +120,7 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { command <- slurmModes[submit] command <- gsub("%NAME", rout_name, command) command <- gsub("%SCRIPT", rCommand, command) + message(command) system(command) } else { stop("Unknown submission type") diff --git a/scripts/helper.R b/scripts/helper.R index 2802987cf8..82c086f2c3 100644 --- a/scripts/helper.R +++ b/scripts/helper.R @@ -9,7 +9,7 @@ chooseSubmit <- function(title, slurmModes) { slurm <- lucode2::SystemCommandAvailable("srun") if(slurm) { slurmModes <- yaml::read_yaml(slurmModes)$slurmjobs - modes <- c(names(slurmModes), modes) + modes <- c(modes, names(slurmModes)) if(lucode2::SystemCommandAvailable("sclass")) { cat("\nCurrent cluster utilization:\n") system("sclass") diff --git a/scripts/slurmOutput.yml b/scripts/slurmOutput.yml index 229e5a43fb..a0d12e8df5 100644 --- a/scripts/slurmOutput.yml +++ b/scripts/slurmOutput.yml @@ -2,4 +2,5 @@ slurmjobs: SLURM standby: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --time=24:00:00" SLURM standby maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --time=24:00:00 --mem-per-cpu=0 --cpus-per-task=16" SLURM priority: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority" - SLURM priority maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority --mem-per-cpu=0 --cpus-per-task=16" \ No newline at end of file + SLURM priority maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority --mem-per-cpu=0 --cpus-per-task=16" + \ No newline at end of file diff --git a/start.R b/start.R index 4ce27528d9..60221c39a7 100644 --- a/start.R +++ b/start.R @@ -70,6 +70,7 @@ runOutputs <- function(runscripts=NULL, submit=NULL) { command <- slurmModes[submit] command <- gsub("%NAME", name, command) command <- gsub("%SCRIPT", script, command) + message(command) system(command) Sys.sleep(1) } else { From 67a227177186c9d1ea8a351fcaabef985fcf4a8b Mon Sep 17 00:00:00 2001 From: Jan Philipp Dietrich Date: Fri, 14 Jun 2024 20:38:34 +0200 Subject: [PATCH 255/280] updated CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 168f84389e..4b5c6ad4e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### changed -- +- **scripts** adjusted SLURM job handling ### added - From 560138b6024990adb9d3dcd15b3692cf21cd97ab Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 15 Jun 2024 13:10:01 +0200 Subject: [PATCH 256/280] magpie4 version + peatland input files --- DESCRIPTION | 2 +- modules/58_peatland/input/files | 5 +---- modules/58_peatland/v2/input.gms | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0b44903520..ba76854991 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,7 +22,7 @@ Imports: m4fsdp, madrat, magclass (>= 6.14.0), - magpie4, + magpie4 (>= 2.3.10), MagpieNCGains, magpiesets, mip, diff --git a/modules/58_peatland/input/files b/modules/58_peatland/input/files index 3509c27c10..09985440b4 100644 --- a/modules/58_peatland/input/files +++ b/modules/58_peatland/input/files @@ -1,6 +1,3 @@ * list of files that are required here -f58_peatland_degrad.cs2 -f58_peatland_intact.cs2 -f58_ipcc_wetland_ef.cs3 f58_ipcc_wetland_ef2.cs3 -f58_peatland_area.cs2 +f58_peatland_area.cs3 diff --git a/modules/58_peatland/v2/input.gms b/modules/58_peatland/v2/input.gms index 12007a7e7c..99c9207abf 100644 --- a/modules/58_peatland/v2/input.gms +++ b/modules/58_peatland/v2/input.gms @@ -19,7 +19,7 @@ scalars *Peatland area based on Global Peatland Map 2.0 and Global Peatland Database table f58_peatland_area(j,land58) Peatland area (mio. ha) $ondelim -$include "./modules/58_peatland/input/f58_peatland_area.cs2" +$include "./modules/58_peatland/input/f58_peatland_area.cs3" $offdelim ; From 4ac78c6372f37c8edbd4083c52d97fef67630549 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 15 Jun 2024 13:17:20 +0200 Subject: [PATCH 257/280] Changelog --- CHANGELOG.md | 6 +++--- config/default.cfg | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99fe45d58d..50992afad8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,13 +17,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### added - **29_cropland** new module `29_cropland` accounting for crop area, fallow cropland and tree cover on cropland with two realizations: `detail_apr24` and `simple_apr24` (default). - **10_land** added interface `pm_land_hist` with historic land use patterns -- **32_forestry** added technical balance term `v32_land_missing_ndc` ### removed -- +- **32_forestry** removed technical balance term `v32_land_missing_ndc` ### fixed -- +- **22_land_conservation** avoid infeasibilities due to very small numbers, account for cropland tree cover and lower bound of cropland + ## [4.8.0] - 2024-06-10 diff --git a/config/default.cfg b/config/default.cfg index 73aac6eb88..9593e25f2c 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -175,7 +175,7 @@ oecd90andEU <- "ALB,AUS,AUT,BEL,BIH,BGR,CAN,CYP,CZE,DNK,EST,FIN,FRA, NLD,NOR,NZL,POL,PRT,ROU,SRB,SVK,SVN,ESP,SWE,CHE,MKD,TUR, GBR,USA" -EUR <- "ALB,AUT,BEL,BGR,CYP,CZE,DEU,DNK,ESP,EST,FIN,FRA,FRO, +isoCountriesEUR <- "ALB,AUT,BEL,BGR,CYP,CZE,DEU,DNK,ESP,EST,FIN,FRA,FRO, GBR,GGY,GIB,GRC,HRV,HUN,IMN,IRL,ITA,JEY,LTU,LUX,LVA,MLT, NLD,POL,PRT,ROU,SVK,SVN,SWE" From 105068168dde1eae359bad2aa1593f6c3eee78be Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 15 Jun 2024 13:23:54 +0200 Subject: [PATCH 258/280] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50992afad8..b0126a0c46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### fixed - **22_land_conservation** avoid infeasibilities due to very small numbers, account for cropland tree cover and lower bound of cropland +- **32_forestry** avoid infeasibilities due to very small numbers +- **35_natveg** avoid infeasibilities due to very small numbers From 7c470239d66408ab94cec21bea47db3709370134 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 15 Jun 2024 13:58:56 +0200 Subject: [PATCH 259/280] bugfix --- modules/30_croparea/detail_apr24/presolve.gms | 8 ++++---- modules/30_croparea/simple_apr24/presolve.gms | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/modules/30_croparea/detail_apr24/presolve.gms b/modules/30_croparea/detail_apr24/presolve.gms index fb18d303f3..c110499ec6 100644 --- a/modules/30_croparea/detail_apr24/presolve.gms +++ b/modules/30_croparea/detail_apr24/presolve.gms @@ -34,11 +34,11 @@ else * create betr target and penalty scenario i30_betr_target(t,j) = (1-i30_betr_scenario_fader(t)) * - (s30_betr_start * sum(cell(i,j), p29_country_weight(i)) - + s30_betr_start_noselect * sum(cell(i,j), 1-p29_country_weight(i))) + (s30_betr_start * sum(cell(i,j), p30_country_weight(i)) + + s30_betr_start_noselect * sum(cell(i,j), 1-p30_country_weight(i))) + i30_betr_scenario_fader(t) * - (s30_betr_target * sum(cell(i,j), p29_country_weight(i)) - + s30_betr_target_noselect * sum(cell(i,j), 1-p29_country_weight(i))); + (s30_betr_target * sum(cell(i,j), p30_country_weight(i)) + + s30_betr_target_noselect * sum(cell(i,j), 1-p30_country_weight(i))); if (m_year(t) <= s30_betr_scenario_start, i30_betr_penalty(t) = 0; diff --git a/modules/30_croparea/simple_apr24/presolve.gms b/modules/30_croparea/simple_apr24/presolve.gms index 2f23d5fb7f..adc5cba7e2 100644 --- a/modules/30_croparea/simple_apr24/presolve.gms +++ b/modules/30_croparea/simple_apr24/presolve.gms @@ -25,11 +25,11 @@ crpmin30(crp30) = yes$(f30_rotation_min_shr(crp30) > 0); * create betr target and penalty scenario i30_betr_target(t,j) = (1-i30_betr_scenario_fader(t)) * - (s30_betr_start * sum(cell(i,j), p29_country_weight(i)) - + s30_betr_start_noselect * sum(cell(i,j), 1-p29_country_weight(i))) + (s30_betr_start * sum(cell(i,j), p30_country_weight(i)) + + s30_betr_start_noselect * sum(cell(i,j), 1-p30_country_weight(i))) + i30_betr_scenario_fader(t) * - (s30_betr_target * sum(cell(i,j), p29_country_weight(i)) - + s30_betr_target_noselect * sum(cell(i,j), 1-p29_country_weight(i))); + (s30_betr_target * sum(cell(i,j), p30_country_weight(i)) + + s30_betr_target_noselect * sum(cell(i,j), 1-p30_country_weight(i))); if (m_year(t) <= s30_betr_scenario_start, i30_betr_penalty(t) = 0; From d789ea6856dceebb339014b381238b07435bb795 Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 15 Jun 2024 14:00:08 +0200 Subject: [PATCH 260/280] update main.gms --- main.gms | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/main.gms b/main.gms index 50882b629f..db00b06172 100644 --- a/main.gms +++ b/main.gms @@ -147,44 +147,44 @@ $title magpie *' * Always try to access model outputs through the corresponding magpie package instead of accessing them directly with readGDX. It cannot be guaranteed that your script will work in the future if you do otherwise (as only the corresponding magpie package will be continuously adapted to changes in the GAMS code). *##################### R SECTION START (VERSION INFO) ########################## -* -* Used data set: rev4.106_h12_magpie.tgz +* +* Used data set: rev4.108_h12_magpie.tgz * md5sum: NA -* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* -* Used data set: rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz +* Repository: https://rse.pik-potsdam.de/data/magpie/public +* +* Used data set: rev4.108_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz * md5sum: NA -* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* -* Used data set: rev4.106_h12_validation.tgz +* Repository: https://rse.pik-potsdam.de/data/magpie/public +* +* Used data set: rev4.108_h12_validation.tgz * md5sum: NA -* Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* -* Used data set: additional_data_rev4.50.tgz +* Repository: https://rse.pik-potsdam.de/data/magpie/public +* +* Used data set: additional_data_rev4.51.tgz * md5sum: NA * Repository: scp://cluster.pik-potsdam.de/p/projects/landuse/data/input/archive -* +* * Used data set: calibration_H12_26Mar24.tgz * md5sum: NA * Repository: https://rse.pik-potsdam.de/data/magpie/public -* +* * Low resolution: c200 * High resolution: 0.5 -* +* * Total number of cells: 200 -* +* * Number of cells per region: * CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA * 14 23 10 7 4 26 21 9 16 23 32 15 -* +* * Regionscode: 62eff8f7 -* -* Regions data revision: 4.106 -* +* +* Regions data revision: 4.108 +* * lpj2magpie settings: * * LPJmL data: MRI-ESM2-0:ssp370 -* * Revision: 4.106 -* +* * Revision: 4.108 +* * aggregation settings: * * Input resolution: 0.5 * * Output resolution: c200 @@ -193,10 +193,10 @@ $title magpie * CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA * 14 23 10 7 4 26 21 9 16 23 32 15 * * Call: withCallingHandlers(expr, message = messageHandler, warning = warningHandler, error = errorHandler) -* -* -* Last modification (input data): Thu May 23 11:16:51 2024 -* +* +* +* Last modification (input data): Sat Jun 15 13:10:19 2024 +* *###################### R SECTION END (VERSION INFO) ########################### $offupper From e807eb57c7123a0a15ed3b6b6205d77ce7a4eac4 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 17 Jun 2024 09:47:19 +0200 Subject: [PATCH 261/280] update default.cfg --- config/default.cfg | 4 ++-- modules/29_cropland/detail_apr24/input.gms | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 9593e25f2c..f2a7d0d6ed 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -754,9 +754,9 @@ cfg$gms$s29_treecover_scenario_start <- 2025 # def = 2025 # * Target year of fader (year when full implementation is reached) cfg$gms$s29_treecover_scenario_target <- 2050 # def = 2050 # * Penalty for violation of treecover target before scenario start (USD05MER per ha) -cfg$gms$s29_treecover_penalty_before <- 2000 # def = 2000 +cfg$gms$s29_treecover_penalty_before <- 5000 # def = 5000 # * Penalty for violation of treecover target after scenario start (USD05MER per ha) -cfg$gms$s29_treecover_penalty <- 2000 # def = 2000 +cfg$gms$s29_treecover_penalty <- 5000 # def = 5000 # * Tree cover establishment cost (USD05MER per ha) cfg$gms$s29_cost_treecover_est <- 2000 # def = 2000 # * Tree cover recurring cost (USD05MER per ha) diff --git a/modules/29_cropland/detail_apr24/input.gms b/modules/29_cropland/detail_apr24/input.gms index f974d223f1..163dc134e1 100644 --- a/modules/29_cropland/detail_apr24/input.gms +++ b/modules/29_cropland/detail_apr24/input.gms @@ -25,8 +25,8 @@ scalars s29_treecover_target_noselect Minimum share of treecover on total cropland in target year (1) / 0 / s29_treecover_keep Avoid loss of existing treecover (1=yes 0=no) / 1 / s29_treecover_max Maximum share of treecover on total cropland (1) / 0.4 / - s29_treecover_penalty_before Penalty for violation of treecover target before scenario start (USD05MER per ha) / 2000 / - s29_treecover_penalty Penalty for violation of treecover target after sceanrio start (USD05MER per ha) / 2000 / + s29_treecover_penalty_before Penalty for violation of treecover target before scenario start (USD05MER per ha) / 5000 / + s29_treecover_penalty Penalty for violation of treecover target after sceanrio start (USD05MER per ha) / 5000 / s29_fallow_scenario_start Fallow land scenario start year / 2025 / s29_fallow_scenario_target Fallow land scenario target year / 2050 / s29_fallow_target Minimum share of fallow land on total cropland in target year (1) / 0 / From 6f55c1d810bf0eb7262a85baaed6485c94160432 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 17 Jun 2024 10:35:42 +0200 Subject: [PATCH 262/280] code cleanup --- config/scenario_fsec.csv | 2 +- modules/30_croparea/detail_apr24/input.gms | 5 ++--- modules/30_croparea/detail_apr24/sets.gms | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/config/scenario_fsec.csv b/config/scenario_fsec.csv index c97584e0fd..d07aabcc7d 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -52,7 +52,7 @@ gms$c38_fac_req;reg;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s38_target_labor_share;0;;;;;0.8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s42_watdem_nonagr_scenario;;;;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c42_env_flow_policy;off;;;;;;;;;;;;;;;;;;;;;;;;;;;;;on;;;;;;;;;;;;;;;;;;;;; -gms$s42_efp_startyear;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2020;;;;;;;;;;;;;;;;;;;;; +gms$s42_efp_startyear;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2025;;;;;;;;;;;;;;;;;;;;; gms$s42_efp_targetyear;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2050;;;;;;;;;;;;;;;;;;;;; gms$s44_bii_lower_bound;;;;;;;;;;;;;;;;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c44_bii_decrease;;;;;;;;;;;;;;;;;;;;;;0;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/modules/30_croparea/detail_apr24/input.gms b/modules/30_croparea/detail_apr24/input.gms index 68b3a60d11..47c979fc0e 100644 --- a/modules/30_croparea/detail_apr24/input.gms +++ b/modules/30_croparea/detail_apr24/input.gms @@ -12,11 +12,10 @@ $setglobal c30_bioen_water rainfed * options: rainfed, irrigated, all $setglobal c30_rotation_rules default -*options: min, default, good, good_20div, setaside, legumes, sixfoldrotation, agroecology, -* betr0, betr10, betr20, betr25, betr30, betr40, betr50, FSEC +*options: min, default, good, good_20div, setaside, legumes, sixfoldrotation, agroecology, FSEC $setglobal c30_rotation_incentives none -*options: none, default, legumes, betr500, betr1000, agroecology +*options: none, default, legumes, agroecology scalars diff --git a/modules/30_croparea/detail_apr24/sets.gms b/modules/30_croparea/detail_apr24/sets.gms index 579e1f82b3..ff7210ef89 100644 --- a/modules/30_croparea/detail_apr24/sets.gms +++ b/modules/30_croparea/detail_apr24/sets.gms @@ -10,7 +10,7 @@ sets / none, default, legumes, agroecology / rotascen30 rotation constraint scenarios - / min, default, good,good_20div, setaside, legumes, sixfoldrotation, agroecology, FSEC / + / min, default, good, good_20div, setaside, legumes, sixfoldrotation, agroecology, FSEC / rota30 rotational rules / cereals1_max, cereals2_max, cereals_excl_rice_max, stalk_max, From c8933af394fd3d825f9b6886ab36b225169194d6 Mon Sep 17 00:00:00 2001 From: Pascal Sauer Date: Mon, 17 Jun 2024 12:29:03 +0200 Subject: [PATCH 263/280] warn instead stop when renv::snapshot fails --- output.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/output.R b/output.R index a439f41537..94ad9c62ed 100644 --- a/output.R +++ b/output.R @@ -198,7 +198,7 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { }, type = "message") }) if (!snapshotSuccess) { - stop(paste(errorMessage1, collapse = "\n"), paste(errorMessage2, collapse = "\n")) + warning(paste(errorMessage1, collapse = "\n"), paste(errorMessage2, collapse = "\n")) } message("done.") @@ -213,6 +213,8 @@ runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { if (!file.exists(file.path(runFolder, "renv.lock"))) { warning(normalizePath(runFolder), "/renv.lock does not exist.") message("Lockfile written to ", newLockfile) + } else if (!file.exists(newLockfile)) { + message("Could not write lockfile, see warning thrown earlier.") } else if (identical(readLines(file.path(runFolder, "renv.lock")), readLines(newLockfile))) { file.remove(newLockfile) } else { From a8ab9a48158013d3ff26aac76001eca9f3d4d0fe Mon Sep 17 00:00:00 2001 From: Pascal Sauer Date: Mon, 17 Jun 2024 12:33:56 +0200 Subject: [PATCH 264/280] Revert "Delete renv/settings.dcf" This reverts commit 00d08cf1a0f2701293df75dce187bb1eaba26cb2. --- renv/settings.dcf | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 renv/settings.dcf diff --git a/renv/settings.dcf b/renv/settings.dcf new file mode 100644 index 0000000000..169d82f1bc --- /dev/null +++ b/renv/settings.dcf @@ -0,0 +1,10 @@ +bioconductor.version: +external.libraries: +ignored.packages: +package.dependency.fields: Imports, Depends, LinkingTo +r.version: +snapshot.type: implicit +use.cache: TRUE +vcs.ignore.cellar: TRUE +vcs.ignore.library: TRUE +vcs.ignore.local: TRUE From 2924193c8dafd4bd7e6ca3c7992142e323b03eb3 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 17 Jun 2024 13:45:21 +0200 Subject: [PATCH 265/280] bugfix fixing 2025 44_biodiverstiy --- CHANGELOG.md | 1 + modules/44_biodiversity/bii_target/presolve.gms | 11 ++++++----- modules/44_biodiversity/bii_target_apr24/presolve.gms | 11 ++++++----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0126a0c46..82ff4e80a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **22_land_conservation** avoid infeasibilities due to very small numbers, account for cropland tree cover and lower bound of cropland - **32_forestry** avoid infeasibilities due to very small numbers - **35_natveg** avoid infeasibilities due to very small numbers +- **44_biodiversity** Fixing to SSP2 parameters until 2025 was not working diff --git a/modules/44_biodiversity/bii_target/presolve.gms b/modules/44_biodiversity/bii_target/presolve.gms index f1bb9c25f4..de414061ef 100644 --- a/modules/44_biodiversity/bii_target/presolve.gms +++ b/modules/44_biodiversity/bii_target/presolve.gms @@ -5,12 +5,14 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -if(m_year(t) = s44_start_year, * The start value for the linear interpolation is the BII at biome level in the start year. - p44_start_value(i,biome44) = v44_bii.l(i,biome44); +p44_start_value(i,biome44)$(m_year(t) = s44_start_year) = v44_bii.l(i,biome44); * The target value for the linear interpolation is the lower bound defined in `s44_bii_lower_bound`. - p44_target_value(i,biome44) = s44_bii_lower_bound; - +p44_target_value(i,biome44) = s44_bii_lower_bound; + +if (m_year(t) <= sm_fix_SSP2, + v44_bii.lo(i,biome44) = 0; +else * Linear increase of BII target values at biome level from start year to target year, and constant values thereafter. p44_bii_lower_bound(t2,i,biome44) = p44_start_value(i,biome44) + ((m_year(t2) - s44_start_year) / (s44_target_year - s44_start_year)) * (p44_target_value(i,biome44) - p44_start_value(i,biome44)); p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) > s44_target_year) = p44_target_value(i,biome44); @@ -26,4 +28,3 @@ if(m_year(t) = s44_start_year, v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); display p44_bii_lower_bound; ); - diff --git a/modules/44_biodiversity/bii_target_apr24/presolve.gms b/modules/44_biodiversity/bii_target_apr24/presolve.gms index 7f9ba294f7..0a45321b2a 100644 --- a/modules/44_biodiversity/bii_target_apr24/presolve.gms +++ b/modules/44_biodiversity/bii_target_apr24/presolve.gms @@ -5,12 +5,14 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -if(m_year(t) = s44_start_year, * The start value for the linear interpolation is the BII at biome level in the start year. - p44_start_value(i,biome44) = v44_bii.l(i,biome44); +p44_start_value(i,biome44)$(m_year(t) = s44_start_year) = v44_bii.l(i,biome44); * The target value for the linear interpolation is the lower bound defined in `s44_bii_lower_bound`. - p44_target_value(i,biome44) = s44_bii_lower_bound; - +p44_target_value(i,biome44) = s44_bii_lower_bound; + +if (m_year(t) <= sm_fix_SSP2, + v44_bii.lo(i,biome44) = 0; +else * Linear increase of BII target values at biome level from start year to target year, and constant values thereafter. p44_bii_lower_bound(t2,i,biome44) = p44_start_value(i,biome44) + ((m_year(t2) - s44_start_year) / (s44_target_year - s44_start_year)) * (p44_target_value(i,biome44) - p44_start_value(i,biome44)); p44_bii_lower_bound(t2,i,biome44)$(m_year(t2) > s44_target_year) = p44_target_value(i,biome44); @@ -26,4 +28,3 @@ if(m_year(t) = s44_start_year, v44_bii.lo(i,biome44) = p44_bii_lower_bound(t,i,biome44); display p44_bii_lower_bound; ); - From 9f3309bd5310e96182a6c366a5e4e445211c4930 Mon Sep 17 00:00:00 2001 From: Jan Dietrich Date: Mon, 17 Jun 2024 15:01:14 +0200 Subject: [PATCH 266/280] Apply suggestions from code review Co-authored-by: Pascal Sauer <156898545+pascal-sauer@users.noreply.github.com> --- output.R | 1 - scripts/slurmOutput.yml | 3 +-- start.R | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/output.R b/output.R index f81f232b1e..6137a519a7 100644 --- a/output.R +++ b/output.R @@ -31,7 +31,6 @@ if (!is.null(renv::project()) && !exists("source_include") && Sys.getenv("SLURM_ library(lucode2) library(gms) -library(yaml) source("scripts/helper.R") runOutputs <- function(comp=NULL, output=NULL, outputdir=NULL, submit=NULL) { diff --git a/scripts/slurmOutput.yml b/scripts/slurmOutput.yml index a0d12e8df5..229e5a43fb 100644 --- a/scripts/slurmOutput.yml +++ b/scripts/slurmOutput.yml @@ -2,5 +2,4 @@ slurmjobs: SLURM standby: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --time=24:00:00" SLURM standby maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --time=24:00:00 --mem-per-cpu=0 --cpus-per-task=16" SLURM priority: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority" - SLURM priority maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority --mem-per-cpu=0 --cpus-per-task=16" - \ No newline at end of file + SLURM priority maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority --mem-per-cpu=0 --cpus-per-task=16" \ No newline at end of file diff --git a/start.R b/start.R index 60221c39a7..bb80b4c220 100644 --- a/start.R +++ b/start.R @@ -31,7 +31,6 @@ if (!is.null(renv::project())) { library(lucode2) library(gms) -library(yaml) source("scripts/helper.R") runOutputs <- function(runscripts=NULL, submit=NULL) { From 25cbd4f574b9570086a8cb27bfdb8945e26fe324 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 17 Jun 2024 20:25:53 +0200 Subject: [PATCH 267/280] update input data --- config/default.cfg | 6 +- config/scenario_config.csv | 2 +- scripts/start/projects/paper_peatlandTax.R | 186 ++++++++++----------- scripts/start/projects/project_ABCDR.R | 84 ++++++++++ 4 files changed, 172 insertions(+), 106 deletions(-) create mode 100644 scripts/start/projects/project_ABCDR.R diff --git a/config/default.cfg b/config/default.cfg index f2a7d0d6ed..d01a222b1b 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -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.108_h12_magpie.tgz", - cellular = "rev4.108_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.108_h12_validation.tgz", +cfg$input <- c(regional = "rev4.109_h12_magpie.tgz", + cellular = "rev4.109_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.109_h12_validation.tgz", additional = "additional_data_rev4.51.tgz", calibration = "calibration_H12_26Mar24.tgz") diff --git a/config/scenario_config.csv b/config/scenario_config.csv index 3a11b77af6..8a2870327f 100755 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -101,5 +101,5 @@ gms$c60_bioenergy_subsidy;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c60_res_2ndgenBE_dem;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;sdp;ssp2;sdp;sdp;;;;;;;sdp;;;;;ssp4;sdp;ssp4;ssp4;sdp;;;;;;;;;;;;;;;;;;;; gms$c70_feed_scen;;;;ssp1;ssp2;ssp2;ssp3;ssp4;ssp5;ssp1;ssp5;ssp1;ssp1;;;;;;;ssp1;;ssp1;;;ssp4;ssp1;ssp4;ssp4;ssp1;;;;;;;;;;;;;;;;;;;; gms$s73_timber_demand_switch;;;;;;;;;;;;;;;;;;;;;;;;;1;1;1;1;1;;;;;1;1;0;;;;;;;;;;;;; -input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.108_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.108_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.108_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.108_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.108_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.108_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;; +input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.109_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.109_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.109_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.109_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.109_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.109_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;; magicc_emis_scen;;;;;;;;;;;;;;;;;;;;;;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/scripts/start/projects/paper_peatlandTax.R b/scripts/start/projects/paper_peatlandTax.R index c81b4ac47b..15d7f39958 100644 --- a/scripts/start/projects/paper_peatlandTax.R +++ b/scripts/start/projects/paper_peatlandTax.R @@ -23,126 +23,108 @@ source("scripts/start_functions.R") source("config/default.cfg") # create additional information to describe the runs -cfg$info$flag <- "V14LRc500" +cfg$info$flag <- "PTax02H16" cfg$results_folder <- "output/:title:" cfg$results_folder_highres <- "output" cfg$force_replace <- TRUE -cfg$qos <- "priority_maxMem" -#cfg$qos <- "standby_maxMem_dayMax" +#cfg$qos <- "priority_maxMem" +cfg$qos <- "standby_maxMem_dayMax" # support function to create standardized title .title <- function(cfg, ...) return(paste(cfg$info$flag, sep="_",...)) +cfg$repositories <- append(list("https://rse.pik-potsdam.de/data/magpie/public"=NULL, + "./patch_inputdata"=NULL), + getOption("magpie_repos")) -# EUR <- "ALB,AUT,BEL,BGR,CYP,CZE,DEU,DNK,ESP,EST,FIN,FRA,FRO, -# GBR,GGY,GIB,GRC,HRV,HUN,IMN,IRL,ITA,JEY,LTU,LUX,LVA,MLT, -# NLD,POL,PRT,ROU,SVK,SVN,SWE" +cfg$input['regional'] <- "rev4.108_36f73207_magpie.tgz" +cfg$input['validation'] <- "rev4.108_36f73207_validation.tgz" +cfg$input['calibration'] <- "calibration_H16_14Jun24.tgz" +cfg$input['zzzpatchGHGprices'] <- "patchGHGprices.tgz" -ssp <- "SSP2" -#cfg$input['calibration'] <- "calibration_H12c400_16Apr24.tgz" -cfg$input['calibration'] <- "calibration_H12c500_15Apr24.tgz" cfg$gms$c_timesteps <- "5year" -limitAff <- function(cfg,gdx) { - #download input files with high resolution - download_and_update(cfg) - - # #get tau from low resolution run - # ov_tau <- readGDX(gdx, "ov_tau",select=list(type="level")) - # write.magpie(ov_tau,"modules/13_tc/input/f13_tau_scenario.csv") - # cfg$gms$tc <- "exo" - - #get regional afforestation patterns from low resolution run with c200 - aff <- dimSums(landForestry(gdx)[,,c("aff","ndc")],dim=3) - #Take away initial NDC area for consistency with global afforestation limit - aff <- aff-setYears(aff[,1,],NULL) - #calculate maximum regional afforestation over time - aff_max <- setYears(aff[,1,],NULL) - for (r in getRegions(aff)) { - aff_max[r,,] <- max(aff[r,,]) - } - aff_max[aff_max < 0] <- 0 - write.magpie(aff_max,"modules/32_forestry/input/f32_max_aff_area.cs4") - cfg$gms$s32_max_aff_area_glo <- 0 - #check - if(cfg$gms$s32_max_aff_area < Inf) { - indicator <- abs(sum(aff_max)-cfg$gms$s32_max_aff_area) - if(indicator > 1e-06) warning(paste("Global and regional afforestation limit differ by",indicator,"Mha")) - } - return(cfg) +cfg$output <- c(cfg$output, "extra/highres") +ssp <- "SSP2" +cfg <- setScenario(cfg,c(ssp,"NPI","rcp7p0")) +cfg$input['cellular'] <- "rev4.108_36f73207_2ca80312_cellularmagpie_c400_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" +cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NPi") +cfg$gms$c56_pollutant_prices_noselect <- "T0-CO2" +cfg$gms$policy_countries56 <- isoCountriesEUR + +calc_ghgprice <- function() { + T0 <- read.magpie("modules/56_ghg_policy/input/f56_pollutant_prices.cs3") + T0 <- collapseNames(T0[,,getNames(T0,dim=2)[1]]) + T0[,,] <- 0 + + #T200 200 USD/tCO2 in 2050 + T200 <- new.magpie(getRegions(T0),c(seq(1995,2025,by=5),2050,2100,2150),getNames(T0),fill = 0) + T200[,"y2025","co2_c"] <- 0 + T200[,"y2050","co2_c"] <- 200 + T200[,"y2100","co2_c"] <- 200 + T200[,"y2150","co2_c"] <- 200 + T200 <- time_interpolate(T200,seq(2015,2100,by=5),TRUE) + T200 <- time_interpolate(T200,seq(2100,2150,by=5),TRUE) + T200[,,"ch4"] <- T200[,,"co2_c"]*28 + T200[,,"n2o_n_direct"] <- T200[,,"co2_c"]*265*44/28 + T200[,,"n2o_n_indirect"] <- T200[,,"co2_c"]*265*44/28 + T200[,,"co2_c"] <- T200[,,"co2_c"]*44/12 + + T50 <- T200 * 0.25 + T100 <- T200 * 0.5 + + GHG <- mbind(add_dimension(T0, dim = 3.2, add = "scen", nm = "T0-GHG"), + add_dimension(T50, dim = 3.2, add = "scen", nm = "T50-GHG"), + add_dimension(T100, dim = 3.2, add = "scen", nm = "T100-GHG"), + add_dimension(T200, dim = 3.2, add = "scen", nm = "T200-GHG")) + + CO2 <- GHG + CO2[,,c("ch4", "n2o_n_direct", "n2o_n_indirect")] <- 0 + getNames(CO2,dim=2) <- gsub("GHG","CO2", getNames(CO2,dim=2)) + + GHGCH4GWP20 <- GHG + GHGCH4GWP20[,,"ch4"] <- GHGCH4GWP20[,,"ch4"]/28*84 + getNames(GHGCH4GWP20,dim=2) <- gsub("GHG","GHG-CH4GWP20", getNames(GHGCH4GWP20,dim=2)) + + GHG <- mbind(CO2, GHG, GHGCH4GWP20) + if (!dir.exists("./patch_inputdata")) dir.create("./patch_inputdata") + if (dir.exists("./patch_inputdata/patchGHGprices")) unlink("./patch_inputdata/patchGHGprices", recursive = TRUE) + dir.create("./patch_inputdata/patchGHGprices") + write.magpie(GHG,file_name = "patch_inputdata/patchGHGprices/f56_pollutant_prices.cs3") + tardir("patch_inputdata/patchGHGprices", "patch_inputdata/patchGHGprices.tgz") + + # scen56 <- magclass::read.magpie("modules/56_ghg_policy/input/f56_emis_policy.csv",file_type = "cs3") + # scen56 <- magclass::getNames(scen56,dim=1) + # + # sets <- list(list(name = "ghgscen56", + # desc = "ghg price scenarios", + # items = ghgscen56), + # list(name = "scen56", + # desc = "emission policy scenarios", + # items = scen56)) + # gms::writeSets(sets, "modules/56_ghg_policy/price_aug22/sets.gms") + unlink("patch_inputdata/patchGHGprices", recursive=TRUE) + return(getNames(GHG, dim = 2)) } +ghgscen56 <- calc_ghgprice() -cfg$output <- c("rds_report") -cfg$sequential <- TRUE -cfg$title <- .title(cfg, paste(ssp,"1p5deg","PricePeatOff","AffEndo",sep="-")) -cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9","ForestryEndo")) -#cfg$input['cellular'] <- "rev4.104_h12_6aa915b6_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" -cfg$input['cellular'] <- "rev4.104_h12_4c83b5e5_cellularmagpie_c500_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" -cfg$gms$c56_mute_ghgprices_until <- "y2030" -cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") -cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") -cfg$gms$c56_emis_policy <- "reddnatveg_nosoil_nopeat" -start_run(cfg, codeCheck = FALSE) -cfg$sequential <- FALSE - -PricePeatOff <- .title(cfg, paste(ssp,"1p5deg","PricePeatOff","AffEndo",sep="-")) - -#limitAff runs -cfg$output <- c("extra/highres", "extra/disaggregation", "rds_report", "rds_report_iso") - -cfg$title <- .title(cfg, paste(ssp,"NDC",sep="-")) -cfg <- setScenario(cfg,c(ssp,"NDC","rcp4p5","ForestryEndo")) -#cfg$input['cellular'] <- "rev4.104_h12_3d941455_cellularmagpie_c400_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz" -cfg$input['cellular'] <- "rev4.104_h12_9ab12c13_cellularmagpie_c500_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz" -cfg <- limitAff(cfg,file.path("output",PricePeatOff,"fulldata.gdx")) +cfg$title <- .title(cfg, paste(ssp,"Ref",sep="-")) cfg$gms$c56_mute_ghgprices_until <- "y2150" -cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-NDC") -cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-NDC") +cfg$gms$c56_pollutant_prices <- "T0-CO2" cfg$gms$c56_emis_policy <- "reddnatveg_nosoil_nopeat" +download_and_update(cfg) start_run(cfg, codeCheck = FALSE) -cfg$title <- .title(cfg, paste(ssp,"1p5deg","PricePeatOff",sep="-")) -cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9","ForestryEndo")) -#cfg$input['cellular'] <- "rev4.104_h12_6aa915b6_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" -cfg$input['cellular'] <- "rev4.104_h12_4c83b5e5_cellularmagpie_c500_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" -cfg <- limitAff(cfg,file.path("output",PricePeatOff,"fulldata.gdx")) -cfg$gms$c56_mute_ghgprices_until <- "y2030" -cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") -cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") -cfg$gms$c56_emis_policy <- "reddnatveg_nosoil_nopeat" -start_run(cfg, codeCheck = FALSE) - -cfg$title <- .title(cfg, paste(ssp,"1p5deg","PricePeatCO2",sep="-")) -cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9","ForestryEndo")) -#cfg$input['cellular'] <- "rev4.104_h12_6aa915b6_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" -cfg$input['cellular'] <- "rev4.104_h12_4c83b5e5_cellularmagpie_c500_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" -cfg <- limitAff(cfg,file.path("output",PricePeatOff,"fulldata.gdx")) -cfg$gms$c56_mute_ghgprices_until <- "y2030" -cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") -cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") -cfg$gms$c56_emis_policy <- "reddnatveg_nosoil_peatCO2only" -start_run(cfg, codeCheck = FALSE) -cfg$title <- .title(cfg, paste(ssp,"1p5deg","PricePeatGHG",sep="-")) -cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9","ForestryEndo")) -#cfg$input['cellular'] <- "rev4.104_h12_6aa915b6_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" -cfg$input['cellular'] <- "rev4.104_h12_4c83b5e5_cellularmagpie_c500_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" -cfg <- limitAff(cfg,file.path("output",PricePeatOff,"fulldata.gdx")) -cfg$gms$c56_mute_ghgprices_until <- "y2030" -cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") -cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") -cfg$gms$c56_emis_policy <- "reddnatveg_nosoil" -start_run(cfg, codeCheck = FALSE) +cfg$gms$c56_mute_ghgprices_until <- "y2025" -cfg$title <- .title(cfg, paste(ssp,"1p5deg","PricePeatGHG_CH4GWP20",sep="-")) -cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9","ForestryEndo")) -#cfg$input['cellular'] <- "rev4.104_h12_6aa915b6_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" -cfg$input['cellular'] <- "rev4.104_h12_4c83b5e5_cellularmagpie_c500_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" -cfg <- limitAff(cfg,file.path("output",PricePeatOff,"fulldata.gdx")) -cfg$gms$c56_mute_ghgprices_until <- "y2030" -cfg$gms$c56_pollutant_prices <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") -cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-",ifelse(ssp=="SSP2",paste0(ssp,"EU"),ssp),"-PkBudg650") -cfg$gms$c56_emis_policy <- "reddnatveg_nosoil_CH4GWP20" -start_run(cfg, codeCheck = FALSE) +for (tax in ghgscen56) { + for (peat in c("peatOff", "peatOn")) { + cfg$title <- .title(cfg, paste(ssp,tax,peat,sep="-")) + cfg$gms$c56_pollutant_prices <- tax + cfg$gms$c56_emis_policy <- if (peat=="peatOff") "reddnatveg_nosoil_nopeat" else "reddnatveg_nosoil" + start_run(cfg, codeCheck = FALSE) + } +} diff --git a/scripts/start/projects/project_ABCDR.R b/scripts/start/projects/project_ABCDR.R new file mode 100644 index 0000000000..861376cf02 --- /dev/null +++ b/scripts/start/projects/project_ABCDR.R @@ -0,0 +1,84 @@ +# ---------------------------------------------------------- +# description: ABCDR Project runs +# position: 5 +# ---------------------------------------------------------- + +## Load lucode2 and gms to use setScenario later +library(lucode2) +library(gms) +library(magclass) +library(gdx) + +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") + +# Source default cfg. This loads the object "cfg" in R environment +source("config/default.cfg") + +#download default input data +#download_and_update(cfg) + +# create additional information to describe the runs +cfg$info$flag <- "ABCDR04" + +cfg$output <- c("rds_report") # Only run rds_report after model run +cfg$results_folder <- "output/:title:" +cfg$force_replace <- TRUE +cfg$force_download <- FALSE + +cfg$qos <- "standby_maxMem_dayMax" +#cfg$qos <- "priority" + +# support function to create standardized title +.title <- function(cfg, ...) return(paste(cfg$info$flag, sep="_",...)) + + +cfg$input['regional'] <- "rev4.108_36f73207_magpie.tgz" +cfg$input['validation'] <- "rev4.108_36f73207_validation.tgz" +cfg$input['calibration'] <- "calibration_H16_14Jun24.tgz" +cfg$input['cellular'] <- "rev4.108_36f73207_2ca80312_cellularmagpie_c400_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" + +ssp <- "SSP2" + +cfg$gms$cropland <- "detail_apr24" +# cfg$gms$croparea <- "detail_apr24" + + +cfg$gms$scen_countries15 <- isoCountriesEUR +cfg$gms$policy_countries29 <- isoCountriesEUR +cfg$gms$policy_countries30 <- isoCountriesEUR + +cfg$gms$s29_treecover_penalty <- 5000 +cfg$gms$s30_betr_penalty <- 5000 + +for (pol in c("NDC","1p5deg")) { + for (diet in c("dietDefault","dietShift")) { + for (AFS in c("SRC","treeCover")) { + for (shr in c(0, 0.01, 0.05, 0.1, 0.2)) { + cfg$title <- .title(cfg, paste(ssp,pol,diet,paste0(AFS,sprintf("%02d",shr*100)),sep="-")) + if (pol == "NDC") { + cfg <- setScenario(cfg,c(ssp,"NDC","rcp4p5")) + cfg$input['cellular'] <- "rev4.108_36f73207_3d941455_cellularmagpie_c400_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz" + cfg$gms$c56_mute_ghgprices_until <- "y2150" + cfg$gms$c56_pollutant_prices <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NDC") + cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NDC") + } else if (pol == "1p5deg") { + cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9")) + cfg$input['cellular'] <- "rev4.108_36f73207_6aa915b6_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" + cfg$gms$c56_mute_ghgprices_until <- "y2030" + cfg$gms$c56_pollutant_prices <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-PkBudg650") + cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-PkBudg650") + } + if (diet == "dietShift") cfg <- setScenario(cfg,"eat_lancet_diet") + if (AFS == "SRC") { + cfg$gms$s29_treecover_target <- 0 + cfg$gms$s30_betr_target <- shr + } else if (AFS == "treeCover") { + cfg$gms$s29_treecover_target <- shr + cfg$gms$s30_betr_target <- 0 + } + start_run(cfg, codeCheck = FALSE) + } + } + } +} From 96b833e8620db83769343076a7e38a4c33aba9b6 Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 17 Jun 2024 23:09:48 +0200 Subject: [PATCH 268/280] update input data revision --- CHANGELOG.md | 1 + config/scenario_fsec.csv | 6 +++--- scripts/start/projects/paper_peatlandTax.R | 6 +++--- scripts/start/projects/project_ABCDR.R | 10 +++++----- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82ff4e80a6..b7a0b5915f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **32_forestry** avoid infeasibilities due to very small numbers - **35_natveg** avoid infeasibilities due to very small numbers - **44_biodiversity** Fixing to SSP2 parameters until 2025 was not working +- **config** update to input data rev4.109. In the previous rev4.108, GDP had a wrong unit. diff --git a/config/scenario_fsec.csv b/config/scenario_fsec.csv index d07aabcc7d..9bf407fa60 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -76,9 +76,9 @@ gms$s62_max_dem_bioplastic;0;;;;400;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c70_fac_req_regr;reg;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c70_feed_scen;;;;;;;;;;;;;;;;;;ssp1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$c73_build_demand;;;;;;;;;;;;;;;;;;;;;;;;50pc;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['cellular'];rev4.108_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.108_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.108_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.108_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.108_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.108_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.108_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;; -input['regional'];rev4.108_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['validation'];rev4.108_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['cellular'];rev4.109_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.109_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.109_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.109_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.109_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.109_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.109_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz;;; +input['regional'];rev4.109_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['validation'];rev4.109_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['additional'];additional_data_rev4.51.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['calibration'];calibration_FSEC_26Mar24.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; magicc_emis_scen;bjoernAR6_C_SSP2-NDC.mif;;;bjoernAR6_C_SSP2-PkBudg900.mif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bjoernAR6_C_SSP1-NDC.mif;;;;;;;;;;;;bjoernAR6_C_RemSDP-900-MagSSP1.mif;; diff --git a/scripts/start/projects/paper_peatlandTax.R b/scripts/start/projects/paper_peatlandTax.R index 15d7f39958..ad4e0209b4 100644 --- a/scripts/start/projects/paper_peatlandTax.R +++ b/scripts/start/projects/paper_peatlandTax.R @@ -38,8 +38,8 @@ cfg$repositories <- append(list("https://rse.pik-potsdam.de/data/magpie/public"= "./patch_inputdata"=NULL), getOption("magpie_repos")) -cfg$input['regional'] <- "rev4.108_36f73207_magpie.tgz" -cfg$input['validation'] <- "rev4.108_36f73207_validation.tgz" +cfg$input['regional'] <- "rev4.109_36f73207_magpie.tgz" +cfg$input['validation'] <- "rev4.109_36f73207_validation.tgz" cfg$input['calibration'] <- "calibration_H16_14Jun24.tgz" cfg$input['zzzpatchGHGprices'] <- "patchGHGprices.tgz" @@ -48,7 +48,7 @@ cfg$gms$c_timesteps <- "5year" cfg$output <- c(cfg$output, "extra/highres") ssp <- "SSP2" cfg <- setScenario(cfg,c(ssp,"NPI","rcp7p0")) -cfg$input['cellular'] <- "rev4.108_36f73207_2ca80312_cellularmagpie_c400_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" +cfg$input['cellular'] <- "rev4.109_36f73207_2ca80312_cellularmagpie_c400_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NPi") cfg$gms$c56_pollutant_prices_noselect <- "T0-CO2" cfg$gms$policy_countries56 <- isoCountriesEUR diff --git a/scripts/start/projects/project_ABCDR.R b/scripts/start/projects/project_ABCDR.R index 861376cf02..fab4fde8b5 100644 --- a/scripts/start/projects/project_ABCDR.R +++ b/scripts/start/projects/project_ABCDR.R @@ -33,10 +33,10 @@ cfg$qos <- "standby_maxMem_dayMax" .title <- function(cfg, ...) return(paste(cfg$info$flag, sep="_",...)) -cfg$input['regional'] <- "rev4.108_36f73207_magpie.tgz" -cfg$input['validation'] <- "rev4.108_36f73207_validation.tgz" +cfg$input['regional'] <- "rev4.109_36f73207_magpie.tgz" +cfg$input['validation'] <- "rev4.109_36f73207_validation.tgz" cfg$input['calibration'] <- "calibration_H16_14Jun24.tgz" -cfg$input['cellular'] <- "rev4.108_36f73207_2ca80312_cellularmagpie_c400_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" +cfg$input['cellular'] <- "rev4.109_36f73207_2ca80312_cellularmagpie_c400_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" ssp <- "SSP2" @@ -58,13 +58,13 @@ for (pol in c("NDC","1p5deg")) { cfg$title <- .title(cfg, paste(ssp,pol,diet,paste0(AFS,sprintf("%02d",shr*100)),sep="-")) if (pol == "NDC") { cfg <- setScenario(cfg,c(ssp,"NDC","rcp4p5")) - cfg$input['cellular'] <- "rev4.108_36f73207_3d941455_cellularmagpie_c400_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz" + cfg$input['cellular'] <- "rev4.109_36f73207_3d941455_cellularmagpie_c400_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz" cfg$gms$c56_mute_ghgprices_until <- "y2150" cfg$gms$c56_pollutant_prices <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NDC") cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NDC") } else if (pol == "1p5deg") { cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9")) - cfg$input['cellular'] <- "rev4.108_36f73207_6aa915b6_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" + cfg$input['cellular'] <- "rev4.109_36f73207_6aa915b6_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" cfg$gms$c56_mute_ghgprices_until <- "y2030" cfg$gms$c56_pollutant_prices <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-PkBudg650") cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-PkBudg650") From 38d34ea17667a00d35111583770280d4f4f28d7f Mon Sep 17 00:00:00 2001 From: florianh Date: Mon, 17 Jun 2024 23:45:34 +0200 Subject: [PATCH 269/280] update input data --- scripts/start/projects/paper_peatlandTax.R | 4 ++-- scripts/start/projects/project_ABCDR.R | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/start/projects/paper_peatlandTax.R b/scripts/start/projects/paper_peatlandTax.R index ad4e0209b4..984c321eb5 100644 --- a/scripts/start/projects/paper_peatlandTax.R +++ b/scripts/start/projects/paper_peatlandTax.R @@ -23,7 +23,7 @@ source("scripts/start_functions.R") source("config/default.cfg") # create additional information to describe the runs -cfg$info$flag <- "PTax02H16" +cfg$info$flag <- "PTax03H16" cfg$results_folder <- "output/:title:" cfg$results_folder_highres <- "output" @@ -48,7 +48,7 @@ cfg$gms$c_timesteps <- "5year" cfg$output <- c(cfg$output, "extra/highres") ssp <- "SSP2" cfg <- setScenario(cfg,c(ssp,"NPI","rcp7p0")) -cfg$input['cellular'] <- "rev4.109_36f73207_2ca80312_cellularmagpie_c400_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" +cfg$input['cellular'] <- "rev4.109_36f73207_44a213b6_cellularmagpie_c400_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1_clusterweight-ba4466a8.tgz" cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NPi") cfg$gms$c56_pollutant_prices_noselect <- "T0-CO2" cfg$gms$policy_countries56 <- isoCountriesEUR diff --git a/scripts/start/projects/project_ABCDR.R b/scripts/start/projects/project_ABCDR.R index fab4fde8b5..b21af3cdf6 100644 --- a/scripts/start/projects/project_ABCDR.R +++ b/scripts/start/projects/project_ABCDR.R @@ -19,7 +19,7 @@ source("config/default.cfg") #download_and_update(cfg) # create additional information to describe the runs -cfg$info$flag <- "ABCDR04" +cfg$info$flag <- "ABCDR05" cfg$output <- c("rds_report") # Only run rds_report after model run cfg$results_folder <- "output/:title:" @@ -36,7 +36,7 @@ cfg$qos <- "standby_maxMem_dayMax" cfg$input['regional'] <- "rev4.109_36f73207_magpie.tgz" cfg$input['validation'] <- "rev4.109_36f73207_validation.tgz" cfg$input['calibration'] <- "calibration_H16_14Jun24.tgz" -cfg$input['cellular'] <- "rev4.109_36f73207_2ca80312_cellularmagpie_c400_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz" +cfg$input['cellular'] <- "rev4.109_36f73207_44a213b6_cellularmagpie_c400_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1_clusterweight-ba4466a8.tgz" ssp <- "SSP2" @@ -58,13 +58,13 @@ for (pol in c("NDC","1p5deg")) { cfg$title <- .title(cfg, paste(ssp,pol,diet,paste0(AFS,sprintf("%02d",shr*100)),sep="-")) if (pol == "NDC") { cfg <- setScenario(cfg,c(ssp,"NDC","rcp4p5")) - cfg$input['cellular'] <- "rev4.109_36f73207_3d941455_cellularmagpie_c400_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz" + cfg$input['cellular'] <- "rev4.109_36f73207_30c9dc61_cellularmagpie_c400_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1_clusterweight-ba4466a8.tgz" cfg$gms$c56_mute_ghgprices_until <- "y2150" cfg$gms$c56_pollutant_prices <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NDC") cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-NDC") } else if (pol == "1p5deg") { cfg <- setScenario(cfg,c(ssp,"NDC","rcp1p9")) - cfg$input['cellular'] <- "rev4.109_36f73207_6aa915b6_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz" + cfg$input['cellular'] <- "rev4.109_36f73207_bc624950_cellularmagpie_c400_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1_clusterweight-ba4466a8.tgz" cfg$gms$c56_mute_ghgprices_until <- "y2030" cfg$gms$c56_pollutant_prices <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-PkBudg650") cfg$gms$c60_2ndgen_biodem <- paste0("R32M46-", if (ssp=="SSP2") "SSP2EU" else ssp,"-PkBudg650") From 57638fca458f6291cf0181b95eb195479dcd2664 Mon Sep 17 00:00:00 2001 From: florianh Date: Tue, 18 Jun 2024 09:39:39 +0200 Subject: [PATCH 270/280] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7a0b5915f..20324851e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **32_forestry** avoid infeasibilities due to very small numbers - **35_natveg** avoid infeasibilities due to very small numbers - **44_biodiversity** Fixing to SSP2 parameters until 2025 was not working -- **config** update to input data rev4.109. In the previous rev4.108, GDP had a wrong unit. +- **config** update to input data rev4.109. In the previous rev4.108, MER GDP was wrong and was identical to PPP GDP From 675a093123e9c3b512a70f0cfbbb35092a12b4e2 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 18 Jun 2024 10:18:17 +0200 Subject: [PATCH 271/280] added entire-year non-ag water demand for PB postprocessing --- config/default.cfg | 6 +-- main.gms | 44 +++++++++---------- .../agr_sector_aug13/declarations.gms | 25 ++++++----- .../agr_sector_aug13/presolve.gms | 4 ++ .../42_water_demand/agr_sector_aug13/sets.gms | 3 ++ .../all_sectors_aug13/declarations.gms | 27 ++++++------ .../all_sectors_aug13/input.gms | 10 ++++- .../all_sectors_aug13/presolve.gms | 8 +++- modules/42_water_demand/input/files | 1 + scripts/start/projects/project_EAT2p0.R | 2 +- 10 files changed, 76 insertions(+), 54 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 2dec6eef9a..7969a2c91e 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -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.108_h12_magpie.tgz", - cellular = "rev4.108_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.108_h12_validation.tgz", +cfg$input <- c(regional = "rev4.109_h12_magpie.tgz", + cellular = "rev4.109_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.109_h12_validation.tgz", additional = "additional_data_rev4.50.tgz", calibration = "calibration_H12_26Mar24.tgz") diff --git a/main.gms b/main.gms index 5a585545d1..4292d8bb54 100644 --- a/main.gms +++ b/main.gms @@ -147,44 +147,44 @@ $title magpie *' * Always try to access model outputs through the corresponding magpie package instead of accessing them directly with readGDX. It cannot be guaranteed that your script will work in the future if you do otherwise (as only the corresponding magpie package will be continuously adapted to changes in the GAMS code). *##################### R SECTION START (VERSION INFO) ########################## -* -* Used data set: rev4.106_h12_magpie.tgz +* +* Used data set: rev4.109_h12_magpie.tgz * md5sum: NA * Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* -* Used data set: rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz +* +* Used data set: rev4.109_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz * md5sum: NA * Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* -* Used data set: rev4.106_h12_validation.tgz +* +* Used data set: rev4.109_h12_validation.tgz * md5sum: NA * Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* +* * Used data set: additional_data_rev4.50.tgz * md5sum: NA -* Repository: scp://cluster.pik-potsdam.de/p/projects/landuse/data/input/archive -* +* Repository: https://rse.pik-potsdam.de/data/magpie/public +* * Used data set: calibration_H12_26Mar24.tgz * md5sum: NA * Repository: https://rse.pik-potsdam.de/data/magpie/public -* +* * Low resolution: c200 * High resolution: 0.5 -* +* * Total number of cells: 200 -* +* * Number of cells per region: * CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA * 14 23 10 7 4 26 21 9 16 23 32 15 -* +* * Regionscode: 62eff8f7 -* -* Regions data revision: 4.106 -* +* +* Regions data revision: 4.109 +* * lpj2magpie settings: * * LPJmL data: MRI-ESM2-0:ssp370 -* * Revision: 4.106 -* +* * Revision: 4.109 +* * aggregation settings: * * Input resolution: 0.5 * * Output resolution: c200 @@ -193,10 +193,10 @@ $title magpie * CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA * 14 23 10 7 4 26 21 9 16 23 32 15 * * Call: withCallingHandlers(expr, message = messageHandler, warning = warningHandler, error = errorHandler) -* -* -* Last modification (input data): Thu May 23 11:16:51 2024 -* +* +* +* Last modification (input data): Tue Jun 18 09:52:31 2024 +* *###################### R SECTION END (VERSION INFO) ########################### $offupper diff --git a/modules/42_water_demand/agr_sector_aug13/declarations.gms b/modules/42_water_demand/agr_sector_aug13/declarations.gms index 67feae3dbb..c441331c0a 100644 --- a/modules/42_water_demand/agr_sector_aug13/declarations.gms +++ b/modules/42_water_demand/agr_sector_aug13/declarations.gms @@ -6,22 +6,23 @@ *** | Contact: magpie@pik-potsdam.de parameters - i42_wat_req_k(t,j,k) LPJmL annual water demand for irrigation per ha per year (m^3) + Livestock demand per ton (m^3) - ic42_wat_req_k(j,k) LPJmL annual water demand for irrigation per ha per year (m^3) + Livestock demand per ton (m^3) - i42_env_flows(t,j) Environmental flow requirements if a protection policy is in place (mio. m^3) - i42_env_flows_base(t,j) Environmental flow requirements if no protection policy is in place (mio. m^3) - ic42_env_flow_policy(i) Determines whether environmental flow protection is enforced in the current time step (1) - i42_env_flow_policy(t,i) Determines whether environmental flow protection is enforced (1) - p42_efp(t_all,scen42) Determines whether environmental flow protection is enforced and its fading in of environmental flow policy (1) - p42_efp_fader(t_all) Determines the fading in of environmental flow policy (1) - p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1) - p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1) - ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD05MER per m^3) + i42_wat_req_k(t,j,k) LPJmL annual water demand for irrigation per ha per year (m^3) + Livestock demand per ton (m^3) + ic42_wat_req_k(j,k) LPJmL annual water demand for irrigation per ha per year (m^3) + Livestock demand per ton (m^3) + i42_env_flows(t,j) Environmental flow requirements if a protection policy is in place (mio. m^3) + i42_env_flows_base(t,j) Environmental flow requirements if no protection policy is in place (mio. m^3) + ic42_env_flow_policy(i) Determines whether environmental flow protection is enforced in the current time step (1) + i42_env_flow_policy(t,i) Determines whether environmental flow protection is enforced (1) + p42_efp(t_all,scen42) Determines whether environmental flow protection is enforced and its fading in of environmental flow policy (1) + p42_efp_fader(t_all) Determines the fading in of environmental flow policy (1) + p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1) + p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1) + ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD05MER per m^3) + i42_watdem_total(t,j,watdem_ineldo) Non-agricultural water demand for entire year used in post-processing (m^3) ; equations q42_water_demand(wat_dem,j) Water withdrawals of different sectors (mio. m^3 per yr) - q42_water_cost(i) Total cost of pumping irrigation water (USD05MER per yr) + q42_water_cost(i) Total cost of pumping irrigation water (USD05MER per yr) ; positive variables diff --git a/modules/42_water_demand/agr_sector_aug13/presolve.gms b/modules/42_water_demand/agr_sector_aug13/presolve.gms index 6fa1cb23d3..91107677f3 100644 --- a/modules/42_water_demand/agr_sector_aug13/presolve.gms +++ b/modules/42_water_demand/agr_sector_aug13/presolve.gms @@ -39,6 +39,10 @@ vm_watdem.fx("manufacturing",j) = sum(wat_src, im_wat_avail(t,wat_src,j)) * s42_ vm_watdem.fx("electricity",j) = 0; vm_watdem.fx("domestic",j) = 0; +* Fill non-agricultural water demand parameter of entire year for post-processing +i42_watdem_total(t,j,watdem_ineldo) = 0; +i42_watdem_total(t,j,"manufacturing") = sum(wat_src, im_wat_avail(t,wat_src,j)) * s42_reserved_fraction; + * Country switch to determine countries for which EFP holds. * In the default case, the EFP affects all countries when activated. p42_country_dummy(iso) = 0; diff --git a/modules/42_water_demand/agr_sector_aug13/sets.gms b/modules/42_water_demand/agr_sector_aug13/sets.gms index 03ca251782..78f20947c5 100644 --- a/modules/42_water_demand/agr_sector_aug13/sets.gms +++ b/modules/42_water_demand/agr_sector_aug13/sets.gms @@ -9,6 +9,9 @@ sets watdem_exo(wat_dem) Exogenous water demands / manufacturing, electricity, domestic, ecosystem / + watdem_ineldo(wat_dem) Exogenous water demand subset covering humanly induced demands + / domestic, manufacturing, electricity / + scen42 Environmental Flow Policy (EFP) / off, on / diff --git a/modules/42_water_demand/all_sectors_aug13/declarations.gms b/modules/42_water_demand/all_sectors_aug13/declarations.gms index 81503a7f78..29ca8e4849 100644 --- a/modules/42_water_demand/all_sectors_aug13/declarations.gms +++ b/modules/42_water_demand/all_sectors_aug13/declarations.gms @@ -6,22 +6,23 @@ *** | Contact: magpie@pik-potsdam.de parameters - i42_wat_req_k(t_all,j,k) LPJmL annual water demand for irrigation per ha per yr and livestock demand per ton per yr (m^3) - ic42_wat_req_k(j,k) LPJmL annual water demand for irrigation per ha per yr and livestock demand per ton per yr (m^3) - i42_env_flows(t,j) Environmental flow requirements in case of policy (mio m^3) - i42_env_flows_base(t,j) Environmental flow requirements in case of no policy (mio m^3) - ic42_env_flow_policy(i) Determines whether environmental flow protection is enforced in the current time step (1) - i42_env_flow_policy(t,i) Determines whether environmental flow protection is enforced (1) - p42_efp(t_all,scen42) Determines whether environmental flow protection is enforced and its fading in of environmental flow policy (1) - p42_efp_fader(t_all) Determines the fading in of environmental flow policy (1) - p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1) - p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1) - ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD05MER per m^3) + i42_wat_req_k(t_all,j,k) LPJmL annual water demand for irrigation per ha per yr and livestock demand per ton per yr (m^3) + ic42_wat_req_k(j,k) LPJmL annual water demand for irrigation per ha per yr and livestock demand per ton per yr (m^3) + i42_env_flows(t,j) Environmental flow requirements in case of policy (mio m^3) + i42_env_flows_base(t,j) Environmental flow requirements in case of no policy (mio m^3) + ic42_env_flow_policy(i) Determines whether environmental flow protection is enforced in the current time step (1) + i42_env_flow_policy(t,i) Determines whether environmental flow protection is enforced (1) + p42_efp(t_all,scen42) Determines whether environmental flow protection is enforced and its fading in of environmental flow policy (1) + p42_efp_fader(t_all) Determines the fading in of environmental flow policy (1) + p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1) + p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1) + ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD05MER per m^3) + i42_watdem_total(t,j,watdem_ineldo) Non-agricultural water demand for entire year used in post-processing (m^3) ; equations - q42_water_demand(wat_dem,j) Water withdrawals of different sectors (mio. m^3 per yr) - q42_water_cost(i) Total cost of pumping irrigation water (USD05MER per yr) + q42_water_demand(wat_dem,j) Water withdrawals of different sectors (mio. m^3 per yr) + q42_water_cost(i) Total cost of pumping irrigation water (USD05MER per yr) ; positive variables diff --git a/modules/42_water_demand/all_sectors_aug13/input.gms b/modules/42_water_demand/all_sectors_aug13/input.gms index a725f58cff..b21d8d90cc 100644 --- a/modules/42_water_demand/all_sectors_aug13/input.gms +++ b/modules/42_water_demand/all_sectors_aug13/input.gms @@ -92,13 +92,21 @@ $include "./modules/42_water_demand/input/f42_wat_req_fao.csv" $offdelim /; -table f42_watdem_ineldo(t_all,j,scen_watdem_nonagr,watdem_ineldo) Manufacturing electricity and domestic water demand under different socioeconomic scenarios (mio. m^3) +table f42_watdem_ineldo(t_all,j,scen_watdem_nonagr,watdem_ineldo) Manufacturing electricity and domestic water demand under different socioeconomic scenarios in the growing period (mio. m^3) $ondelim $include "./modules/42_water_demand/input/watdem_nonagr_grper.cs3" $offdelim ; m_fillmissingyears(f42_watdem_ineldo,"j,scen_watdem_nonagr,watdem_ineldo"); +* This input is not used within MAgPIE, but necessary for the postprocessing +table f42_watdem_ineldo_total(t_all,j,scen_watdem_nonagr,watdem_ineldo) Manufacturing electricity and domestic water demand under different socioeconomic scenarios in the entire year (mio. m^3) +$ondelim +$include "./modules/42_water_demand/input/watdem_nonagr_total.cs3" +$offdelim +; +m_fillmissingyears(f42_watdem_ineldo_total,"j,scen_watdem_nonagr,watdem_ineldo"); + parameter f42_env_flows(t_all,j) Environmental flow requirements from LPJ and Smakhtin algorithm (mio. m^3) / diff --git a/modules/42_water_demand/all_sectors_aug13/presolve.gms b/modules/42_water_demand/all_sectors_aug13/presolve.gms index e3c7a4f9f7..baa83ee407 100644 --- a/modules/42_water_demand/all_sectors_aug13/presolve.gms +++ b/modules/42_water_demand/all_sectors_aug13/presolve.gms @@ -39,13 +39,17 @@ if ((s42_pumping = 1), * depends on the socioeconomic scenario if (m_year(t) <= sm_fix_SSP2, vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp2",watdem_ineldo); + i42_watdem_total(t,j,watdem_ineldo) = f42_watdem_ineldo_total(t,j,"ssp2",watdem_ineldo); else if ((s42_watdem_nonagr_scenario = 1), vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp1",watdem_ineldo); - Elseif(s42_watdem_nonagr_scenario = 2), + i42_watdem_total(t,j,watdem_ineldo) = f42_watdem_ineldo_total(t,j,"ssp1",watdem_ineldo); + Elseif (s42_watdem_nonagr_scenario = 2), vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp2",watdem_ineldo); - Elseif(s42_watdem_nonagr_scenario = 3), + i42_watdem_total(t,j,watdem_ineldo) = f42_watdem_ineldo_total(t,j,"ssp2",watdem_ineldo); + Elseif (s42_watdem_nonagr_scenario = 3), vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp3",watdem_ineldo); + i42_watdem_total(t,j,watdem_ineldo) = f42_watdem_ineldo_total(t,j,"ssp3",watdem_ineldo); ); ); diff --git a/modules/42_water_demand/input/files b/modules/42_water_demand/input/files index f9df64edc4..26723d5a30 100644 --- a/modules/42_water_demand/input/files +++ b/modules/42_water_demand/input/files @@ -2,5 +2,6 @@ lpj_airrig.cs2 lpj_envflow_grper.cs2 watdem_nonagr_grper.cs3 +watdem_nonagr_total.cs3 f42_wat_req_fao.csv f42_pumping_cost.cs4 diff --git a/scripts/start/projects/project_EAT2p0.R b/scripts/start/projects/project_EAT2p0.R index 6bd47137e0..1c4aadc720 100644 --- a/scripts/start/projects/project_EAT2p0.R +++ b/scripts/start/projects/project_EAT2p0.R @@ -82,7 +82,7 @@ bau <- function(cfg) { cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi" # default # Climate Change - cfg$input['cellular'] <- "rev4.99_h12_c6a7458f_cellularmagpie_c200_IPSL-CM6A-LR-ssp370_lpjml-8e6c5eb1.tgz" + cfg$input['cellular'] <- "rev4.109_h12_c6a7458f_cellularmagpie_c200_IPSL-CM6A-LR-ssp370_lpjml-8e6c5eb1.tgz" return(cfg) } From 730138e914799d4a050f3956de2d32177732dcc7 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 18 Jun 2024 10:37:25 +0200 Subject: [PATCH 272/280] adjusted changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b5c6ad4e4..f07b1bed5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### changed - **scripts** adjusted SLURM job handling +- **scripts** updated EL2p0 start scripts ### added -- +- **42_water_demand** added non-agricultural water demand for entire year ### removed - From e9d39a559c70f17ec608928396d474192340c3ca Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 18 Jun 2024 10:39:10 +0200 Subject: [PATCH 273/280] fixed incomplete final line warning in checkSummation.R --- scripts/output/extra/checkSummation.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/output/extra/checkSummation.R b/scripts/output/extra/checkSummation.R index 12e524568b..0c0e01816c 100644 --- a/scripts/output/extra/checkSummation.R +++ b/scripts/output/extra/checkSummation.R @@ -16,16 +16,16 @@ library(piamInterfaces) options(width = 180) ## Check outputdir -if(!exists("source_include")) { +if (!exists("source_include")) { outputdir <- "." } f <- file.path(outputdir, "report.mif") -if(!file.exists(f)) { +if (!file.exists(f)) { warning("report.mif missing, cannot check anything. Please create report first!") } else { failvar <- checkSummations(f, outputDirectory = NULL, absDiff = 0.001, summationsFile = "extractVariableGroups") - if(nrow(failvars) > 0) saveRDS(failvar, file.path(outputdir, "summationCheck.rds")) -} \ No newline at end of file + if (nrow(failvars) > 0) saveRDS(failvar, file.path(outputdir, "summationCheck.rds")) +} From aebfa7b7a2cccb3d83b09e30ec385583358fac71 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 18 Jun 2024 12:11:59 +0200 Subject: [PATCH 274/280] included an ifinclude for backwards compatibiltiy --- modules/42_water_demand/all_sectors_aug13/input.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/42_water_demand/all_sectors_aug13/input.gms b/modules/42_water_demand/all_sectors_aug13/input.gms index b21d8d90cc..e5823ca67f 100644 --- a/modules/42_water_demand/all_sectors_aug13/input.gms +++ b/modules/42_water_demand/all_sectors_aug13/input.gms @@ -102,7 +102,7 @@ m_fillmissingyears(f42_watdem_ineldo,"j,scen_watdem_nonagr,watdem_ineldo"); * This input is not used within MAgPIE, but necessary for the postprocessing table f42_watdem_ineldo_total(t_all,j,scen_watdem_nonagr,watdem_ineldo) Manufacturing electricity and domestic water demand under different socioeconomic scenarios in the entire year (mio. m^3) $ondelim -$include "./modules/42_water_demand/input/watdem_nonagr_total.cs3" +$if exist "./modules/42_water_demand/input/watdem_nonagr_total.cs3" $include "./modules/42_water_demand/input/watdem_nonagr_total.cs3" $offdelim ; m_fillmissingyears(f42_watdem_ineldo_total,"j,scen_watdem_nonagr,watdem_ineldo"); From 0678ddbe0f4750290754cf30bc75436e5e599bd7 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 18 Jun 2024 16:03:27 +0200 Subject: [PATCH 275/280] corrected legacy bug: added sm_fix_SSP2 to not used --- modules/44_biodiversity/bv_btc_mar21/not_used.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/44_biodiversity/bv_btc_mar21/not_used.txt b/modules/44_biodiversity/bv_btc_mar21/not_used.txt index bf287154ed..2430a1919c 100644 --- a/modules/44_biodiversity/bv_btc_mar21/not_used.txt +++ b/modules/44_biodiversity/bv_btc_mar21/not_used.txt @@ -1,2 +1,3 @@ name,type,reason pcm_land, input, not used +sm_fix_SSP2, input, not used From c4671781890a020f8325615e90f661ff1cb65981 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 18 Jun 2024 16:11:09 +0200 Subject: [PATCH 276/280] corrected typo in unit --- modules/42_water_demand/agr_sector_aug13/declarations.gms | 2 +- modules/42_water_demand/all_sectors_aug13/declarations.gms | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/42_water_demand/agr_sector_aug13/declarations.gms b/modules/42_water_demand/agr_sector_aug13/declarations.gms index c441331c0a..b719d383f0 100644 --- a/modules/42_water_demand/agr_sector_aug13/declarations.gms +++ b/modules/42_water_demand/agr_sector_aug13/declarations.gms @@ -17,7 +17,7 @@ parameters p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1) p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1) ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD05MER per m^3) - i42_watdem_total(t,j,watdem_ineldo) Non-agricultural water demand for entire year used in post-processing (m^3) + i42_watdem_total(t,j,watdem_ineldo) Non-agricultural water demand for entire year used in post-processing (mio. m^3 per yr) ; equations diff --git a/modules/42_water_demand/all_sectors_aug13/declarations.gms b/modules/42_water_demand/all_sectors_aug13/declarations.gms index 29ca8e4849..42c836dfc6 100644 --- a/modules/42_water_demand/all_sectors_aug13/declarations.gms +++ b/modules/42_water_demand/all_sectors_aug13/declarations.gms @@ -17,7 +17,7 @@ parameters p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1) p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1) ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD05MER per m^3) - i42_watdem_total(t,j,watdem_ineldo) Non-agricultural water demand for entire year used in post-processing (m^3) + i42_watdem_total(t,j,watdem_ineldo) Non-agricultural water demand for entire year used in post-processing (mio. m^3 per yr) ; equations From fd2a170cb09deac9608b8fb7a723595c2cd23d05 Mon Sep 17 00:00:00 2001 From: Jake Tommey Date: Wed, 19 Jun 2024 14:00:10 +0200 Subject: [PATCH 277/280] MAgPIE 4.8.1 --- .zenodo.json | 4 ++-- CHANGELOG.md | 11 ++++++----- CITATION.cff | 4 ++-- README.md | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index 9497ab145e..da8ee56059 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "MAgPIE - An Open Source land-use modeling framework", - "version": "4.8.0dev", + "version": "4.8.1", "creators": [ { "name": "Dietrich, Jan Philipp", @@ -119,5 +119,5 @@ "license": { "id": "AGPL-3.0-or-later" }, - "publication_date": "2024-06-10" + "publication_date": "2024-06-19" } diff --git a/CHANGELOG.md b/CHANGELOG.md index aeb59f1998..d13f633d75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,22 +4,22 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). -## [Unreleased] +## [4.8.1] - 2024-06-19 ### changed - **29_ageclass** module 29_ageclass has been renamed to 28_ageclass to make space for `29_cropland` just before `30_croparea` - **30_crop** module `30_crop` renamed to `30_croparea`, which now only accounts for crop area. - **30_crop** Semi-Natural Vegetation (SNV) implementation has been moved from `30_crop` to `29_cropland` -- **30_crop** the two realizations `penalty_apr22` and `rotation_apr22` have been merged into a single `30_croparea/detail_apr24` realization - **30_crop** the previous `30_crop/endo_apr21` realization has been moved to `30_croparea/simple_apr24` +- **30_crop** the two realizations `penalty_apr22` and `rotation_apr22` have been merged into a single `30_croparea/detail_apr24` realization - **default.cfg** update additional data to rev4.51 - **scripts** adjusted SLURM job handling - **scripts** updated EL2p0 start scripts ### added -- **42_water_demand** added non-agricultural water demand for entire year -- **29_cropland** new module `29_cropland` accounting for crop area, fallow cropland and tree cover on cropland with two realizations: `detail_apr24` and `simple_apr24` (default). - **10_land** added interface `pm_land_hist` with historic land use patterns +- **29_cropland** new module `29_cropland` accounting for crop area, fallow cropland and tree cover on cropland with two realizations: `detail_apr24` and `simple_apr24` (default). +- **42_water_demand** added non-agricultural water demand for entire year ### removed - **32_forestry** removed technical balance term `v32_land_missing_ndc` @@ -962,7 +962,8 @@ This release version is focussed on consistency between the MAgPIE setup and the First open source release of the framework. See [MAgPIE 4.0 paper](https://doi.org/10.5194/gmd-12-1299-2019) for more information. -[Unreleased]: https://github.com/magpiemodel/magpie/compare/v4.8.0...develop +[Unreleased]: https://github.com/magpiemodel/magpie/compare/v4.8.1...develop +[4.8.1]: https://github.com/magpiemodel/magpie/compare/v4.8.0...v4.8.1 [4.8.0]: https://github.com/magpiemodel/magpie/compare/v4.7.3...v4.8.0 [4.7.3]: https://github.com/magpiemodel/magpie/compare/v4.7.2...v4.7.3 [4.7.2]: https://github.com/magpiemodel/magpie/compare/v4.7.1...v4.7.2 diff --git a/CITATION.cff b/CITATION.cff index d14a599543..0b1d746a7e 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -151,8 +151,8 @@ abstract: The *Model of Agricultural Production and its Impact on the Environmen exogenously given population in 10 food energy categories, based on regional diets. Future trends in food demand are derived from a cross-country regression analysis, based on future scenarios on GDP and population growth. -version: 4.8.0dev -date-released: 2024-06-10 +version: 4.8.1 +date-released: 2024-06-19 repository-code: https://github.com/magpiemodel/magpie keywords: - landuse diff --git a/README.md b/README.md index 175f8dd5b2..4871b882dc 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,8 @@ https://www.pik-potsdam.de/research/projects/activities/land-use-modelling/magpi A framework description paper has been published in Geoscientific Model Development (GMD): https://doi.org/10.5194/gmd-12-1299-2019 -The model documentation for version 4.8.0 can be found at -https://rse.pik-potsdam.de/doc/magpie/4.8.0/ +The model documentation for version 4.8.1 can be found at +https://rse.pik-potsdam.de/doc/magpie/4.8.1/ A most recent version of the documentation can also be extracted from the model source code via the R package goxygen @@ -226,7 +226,7 @@ magpie@pik-potsdam.de Please contact magpie@pik-potsdam.de ## CITATION -See file CITATION.cff or the [How-to-Cite section](https://rse.pik-potsdam.de/doc/magpie/4.8.0/#how-to-cite) in the model documentation for information how to cite the model. +See file CITATION.cff or the [How-to-Cite section](https://rse.pik-potsdam.de/doc/magpie/4.8.1/#how-to-cite) in the model documentation for information how to cite the model. ## AUTHORS See list of authors in CITATION.cff From d6bf5e3837a240484796149763527faad8e7ac7e Mon Sep 17 00:00:00 2001 From: Pascal Sauer <156898545+pascal-sauer@users.noreply.github.com> Date: Thu, 20 Jun 2024 13:50:48 +0200 Subject: [PATCH 278/280] Update scripts/slurmOutput.yml --- scripts/slurmOutput.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/slurmOutput.yml b/scripts/slurmOutput.yml index 229e5a43fb..950328816e 100644 --- a/scripts/slurmOutput.yml +++ b/scripts/slurmOutput.yml @@ -2,4 +2,4 @@ slurmjobs: SLURM standby: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --time=24:00:00" SLURM standby maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=standby --time=24:00:00 --mem-per-cpu=0 --cpus-per-task=16" SLURM priority: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority" - SLURM priority maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority --mem-per-cpu=0 --cpus-per-task=16" \ No newline at end of file + SLURM priority maxMem: "sbatch --job-name=scripts-output --output=logs/out-%NAME-%j.out --error=logs/out-%NAME-%j.err --mail-type=END --time=200 --mem-per-cpu=8000 --wrap=\"Rscript %SCRIPT\" --qos=priority --mem-per-cpu=0 --cpus-per-task=16" From 760397b968e4583e886192e75deb1886b7aed47c Mon Sep 17 00:00:00 2001 From: Jake Tommey Date: Thu, 20 Jun 2024 14:56:29 +0200 Subject: [PATCH 279/280] merge master into develop --- .zenodo.json | 2 +- CHANGELOG.md | 15 +++++++++++++++ CITATION.cff | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index da8ee56059..a721129a86 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "MAgPIE - An Open Source land-use modeling framework", - "version": "4.8.1", + "version": "4.8.1dev", "creators": [ { "name": "Dietrich, Jan Philipp", diff --git a/CHANGELOG.md b/CHANGELOG.md index d13f633d75..d1e6472618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [Unreleased] + +### changed +- + +### added +- + +### removed +- + +### fixed +- + + ## [4.8.1] - 2024-06-19 ### changed diff --git a/CITATION.cff b/CITATION.cff index 0b1d746a7e..bc9e6d709f 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -151,7 +151,7 @@ abstract: The *Model of Agricultural Production and its Impact on the Environmen exogenously given population in 10 food energy categories, based on regional diets. Future trends in food demand are derived from a cross-country regression analysis, based on future scenarios on GDP and population growth. -version: 4.8.1 +version: 4.8.1dev date-released: 2024-06-19 repository-code: https://github.com/magpiemodel/magpie keywords: From 773ace41ed54694d5c6e22a6d557a2463bcf9e5f Mon Sep 17 00:00:00 2001 From: David Hoetten Date: Fri, 21 Jun 2024 10:50:40 +0200 Subject: [PATCH 280/280] removed creation of validation subfolder --- scripts/output/projects/EU_report.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/output/projects/EU_report.R b/scripts/output/projects/EU_report.R index d8b2126a24..0eec8d917d 100644 --- a/scripts/output/projects/EU_report.R +++ b/scripts/output/projects/EU_report.R @@ -1,3 +1,3 @@ readArgs("outputdir") rmarkdown::render("./scripts/output/projects/EU_report.Rmd", - output_dir = paste0(outputdir, "/validation")) + output_dir = outputdir)