From 0553e20abb39b2c2cde603c3ba96bb96830ad306 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 22 May 2025 16:53:20 +0200 Subject: [PATCH 01/18] bugfix s32_max_aff_area --- .../dynamic_may24/declarations.gms | 5 ++-- .../32_forestry/dynamic_may24/equations.gms | 18 ++++++------ modules/32_forestry/dynamic_may24/preloop.gms | 28 +++---------------- .../32_forestry/dynamic_may24/presolve.gms | 28 +++++++++++++++---- 4 files changed, 37 insertions(+), 42 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/declarations.gms b/modules/32_forestry/dynamic_may24/declarations.gms index e04fbb0a4..78d104f04 100644 --- a/modules/32_forestry/dynamic_may24/declarations.gms +++ b/modules/32_forestry/dynamic_may24/declarations.gms @@ -11,12 +11,11 @@ scalars ; parameters - i32_max_aff_area_glo(t) Maximum global endogenous afforestation area (mio. ha) - i32_max_aff_area_reg(t,i) Maximum regional endogenous afforestation area (mio. ha) p32_aff_pol(t,j) NDC forest stock (mio. ha) p32_aff_pol_timestep(t,j) NDC afforestation per time step (mio. ha) p32_aff_pot(t,j) Potential afforestation area (mio. ha) - p32_aff_togo(t,i) Remaining exogenous afforestation wrt to the maximum exogenous target over time (mio. ha) + p32_aff_togo_glo(t) Remaining afforestation area wrt to the maximum exogenous target over time (mio. ha) + p32_aff_togo_reg(t,i) Remaining regional afforestation area wrt to the maximum exogenous target over time (mio. ha) p32_carbon_density_ac(t,j,type32,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) p32_carbon_density_ac_forestry(t_all,j,ac) Above ground carbon density for age classes and carbon pools (tC per ha) p32_carbon_density_ac_marg(t_all,j,ac) Marginal above ground carbon density for age classes and carbon pools (tC per ha) diff --git a/modules/32_forestry/dynamic_may24/equations.gms b/modules/32_forestry/dynamic_may24/equations.gms index 785333b62..20ff03f81 100644 --- a/modules/32_forestry/dynamic_may24/equations.gms +++ b/modules/32_forestry/dynamic_may24/equations.gms @@ -13,10 +13,10 @@ *' The direct costs for timber plantations and re/afforestation `vm_cost_fore` include *' establishment cost for new forests, recurring maintenance and monitoring -*' costs for standing forests as well as harvesting costs for timber plantations. +*' costs for standing forests as well as harvesting costs for timber plantations. *' In addition, this type of forest management *' (including re/afforestation) may cause costs in other parts of the model such as costs -*' for technological change [13_tc] or land expansion [39_landconversion]. +*' for technological change [13_tc] or land expansion [39_landconversion]. q32_cost_total(i2) .. vm_cost_fore(i2) =e= v32_cost_recur(i2) @@ -82,7 +82,7 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( *' The annual upper limit for re-afforestation is based on an annual share (`s32_annual_aff_limit`) of the overall forest establishment potential (`pm_max_forest_est`). q32_co2p_aff_limit(j2) .. - vm_landexpansion_forestry(j2,"aff") / m_timestep_length =l= + vm_landexpansion_forestry(j2,"aff") / m_timestep_length =l= s32_annual_aff_limit * sum(ct, pm_max_forest_est(ct,j2)); *' The constraint `q32_max_aff` accounts for the allowed maximum global endogenous @@ -93,11 +93,11 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( 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)); + =l= sum(ct, p32_aff_togo_glo(ct)) - sum(ac_est, v32_land(j2,"ndc",ac_est)); 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)); + =l= sum(ct, p32_aff_togo_glo(ct,i2)) - sum((ac_est,cell(i2,j2)) v32_land(j2,"ndc",ac_est)); *----------------------------------------------- ************** Carbon stock ******************** @@ -177,18 +177,18 @@ q32_cost_recur(i2) .. v32_cost_recur(i2) =e= *------------------------------ *' New plantations are established in the optimization step based on a certain *' percentage (`p32_plant_contr`) of expected future demand (`p32_demand_forestry_future`). -*' As plantation establishment decisions should +*' 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 (`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. +*' Future expected production is calculated for the establishment decision below and the costs above +*' based on newly established areas and expected future yields. 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)) * sum(ct, p32_yield_forestry_future(ct,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/preloop.gms b/modules/32_forestry/dynamic_may24/preloop.gms index ce3f280a0..36f4a2043 100644 --- a/modules/32_forestry/dynamic_may24/preloop.gms +++ b/modules/32_forestry/dynamic_may24/preloop.gms @@ -174,32 +174,12 @@ loop(j, ); ); -** Initialize forestry land types +** 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); -* Calculate the remaining exogenous afforestation with respect to the maximum exogenous target over time. -* `p32_aff_togo` is used to adjust `s32_max_aff_area` in the constraint `q32_max_aff`. -p32_aff_togo(t,i) = smax(t2, sum(cell(i,j), p32_aff_pol(t2,j))) - sum(cell(i,j), p32_aff_pol(t,j)); - -* Calculate the limit for endogenous afforestation -* The global (`s32_max_aff_area`) and regional limit (`f32_max_aff_area`) for total afforestation (sum of endogenous and exogenous) is reduced by exogenous NPI/NDC afforestation (`p32_aff_pol`). -if(s32_max_aff_area_glo = 1, - i32_max_aff_area_glo(t) = s32_max_aff_area - smax(t2, sum(j, p32_aff_pol(t2,j))); - i32_max_aff_area_glo(t)$(i32_max_aff_area_glo(t) < 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) < 1e-6) = 0; - i32_max_aff_area_reg(t,i)$(m_year(t) <= sm_fix_SSP2) = Inf; - i32_max_aff_area_glo(t) = 0; -); - -*** NPI/NDC policies END *fix bph effect to zero for all age classes except the ac that is chosen for the bph effect to occur after planting (e.g. canopy closure) *fade-in from ac10 to ac30. First effect in ac10 (ord 3), last effect in ac30 (ord 7). @@ -234,14 +214,14 @@ p32_land(t,j,type32,ac) = 0; p32_disturbance_loss_ftype32(t,j,"aff",ac) = 0; * Initialize biodiversity value -vm_bv.l(j,"aff_co2p",potnatveg) = +vm_bv.l(j,"aff_co2p",potnatveg) = sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), pc32_land(j,"aff",ac)) * p32_bii_coeff("aff",bii_class_secd,potnatveg)) * fm_luh2_side_layers(j,potnatveg); -vm_bv.l(j,"aff_ndc",potnatveg) = +vm_bv.l(j,"aff_ndc",potnatveg) = sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), pc32_land(j,"ndc",ac)) * p32_bii_coeff("ndc",bii_class_secd,potnatveg)) * fm_luh2_side_layers(j,potnatveg); -vm_bv.l(j,"plant",potnatveg) = +vm_bv.l(j,"plant",potnatveg) = sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), pc32_land(j,"plant",ac)) * p32_bii_coeff("plant",bii_class_secd,potnatveg)) * fm_luh2_side_layers(j,potnatveg); diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 6725b4fa0..519a10367 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -15,16 +15,32 @@ v32_land_reduction.fx(j,type32,ac_est) = 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) = 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")) + + (vm_fallow.l(j) - vm_fallow.lo(j)) + + (vm_land.l(j,"past") - vm_land.lo(j,"past")) - pm_land_conservation(t,j,"other","restore")); *** NDC/NPI re/afforesation is further constrained by the remaining forest establishment potential - p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pm_max_forest_est(t,j) * s32_annual_aff_limit * m_timestep_length) = + p32_aff_pot(t,j)$(p32_aff_pot(t,j) > pm_max_forest_est(t,j) * s32_annual_aff_limit * m_timestep_length) = pm_max_forest_est(t,j) * s32_annual_aff_limit * m_timestep_length; * 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) < 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); + + +* Calculate the limit for endogenous afforestation +* The global (`s32_max_aff_area`) and regional limit (`f32_max_aff_area`) for total afforestation (sum of endogenous and exogenous) is reduced by exogenous NPI/NDC afforestation through (`p32_aff_pol_timestep(t,j)`). +if(s32_max_aff_area_glo = 1, + p32_aff_togo_glo("y1995") = s32_max_aff_area - sum(j, p32_aff_pol_timestep("y1995",j)); + p32_aff_togo_glo(t)$(ord(t)>1) = p32_aff_togo_glo(t-1) - sum(j, p32_aff_pol_timestep(t,j)); + p32_aff_togo_glo(t)$(p32_aff_togo_glo(t) < sum(j, p32_aff_pol_timestep(t,j))) = sum(j, p32_aff_pol_timestep(t,j)); + p32_aff_togo_reg(t,i) = 0; +elseif s32_max_aff_area_glo = 0, + p32_aff_togo_reg("y1995",i) = f32_max_aff_area(i) - sum(cell(i,j), p32_aff_pol_timestep("y1995",j)); + p32_aff_togo_reg(t,i)$(ord(t)>1) = p32_aff_togo_glo(t-1) - sum(cell(i,j), p32_aff_pol_timestep(t,j)); + p32_aff_togo_reg(t,i)$(p32_aff_togo_reg(t,i) < sum(cell(i,j), p32_aff_pol_timestep(t,j))) = sum(cell(i,j), p32_aff_pol_timestep(t,j)); + i32_max_aff_area_glo(t) = 0; +); + ** END ndc ** *' @code @@ -192,15 +208,15 @@ pm_land_conservation(t,j,"secdforest","restore")$(pm_land_conservation(t,j,"secd 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; * Update biodiversity value -vm_bv.l(j,"aff_co2p",potnatveg) = +vm_bv.l(j,"aff_co2p",potnatveg) = sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), pc32_land(j,"aff",ac)) * p32_bii_coeff("aff",bii_class_secd,potnatveg)) * fm_luh2_side_layers(j,potnatveg); -vm_bv.l(j,"aff_ndc",potnatveg) = +vm_bv.l(j,"aff_ndc",potnatveg) = sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), pc32_land(j,"ndc",ac)) * p32_bii_coeff("ndc",bii_class_secd,potnatveg)) * fm_luh2_side_layers(j,potnatveg); -vm_bv.l(j,"plant",potnatveg) = +vm_bv.l(j,"plant",potnatveg) = sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), pc32_land(j,"plant",ac)) * p32_bii_coeff("plant",bii_class_secd,potnatveg)) * fm_luh2_side_layers(j,potnatveg); From b821e4adaa1db87a11037564e4f78239d8cdd8e1 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 22 May 2025 16:55:00 +0200 Subject: [PATCH 02/18] small fix --- 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 519a10367..60f9bef78 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -36,7 +36,7 @@ if(s32_max_aff_area_glo = 1, p32_aff_togo_reg(t,i) = 0; elseif s32_max_aff_area_glo = 0, p32_aff_togo_reg("y1995",i) = f32_max_aff_area(i) - sum(cell(i,j), p32_aff_pol_timestep("y1995",j)); - p32_aff_togo_reg(t,i)$(ord(t)>1) = p32_aff_togo_glo(t-1) - sum(cell(i,j), p32_aff_pol_timestep(t,j)); + p32_aff_togo_reg(t,i)$(ord(t)>1) = p32_aff_togo_reg(t-1,i) - sum(cell(i,j), p32_aff_pol_timestep(t,j)); p32_aff_togo_reg(t,i)$(p32_aff_togo_reg(t,i) < sum(cell(i,j), p32_aff_pol_timestep(t,j))) = sum(cell(i,j), p32_aff_pol_timestep(t,j)); i32_max_aff_area_glo(t) = 0; ); From a5834a067b7d78df86df414f53c40eb166506707 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 22 May 2025 16:59:49 +0200 Subject: [PATCH 03/18] another fix --- modules/32_forestry/dynamic_may24/presolve.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 60f9bef78..818a75ee4 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -30,12 +30,12 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; * Calculate the limit for endogenous afforestation * The global (`s32_max_aff_area`) and regional limit (`f32_max_aff_area`) for total afforestation (sum of endogenous and exogenous) is reduced by exogenous NPI/NDC afforestation through (`p32_aff_pol_timestep(t,j)`). if(s32_max_aff_area_glo = 1, - p32_aff_togo_glo("y1995") = s32_max_aff_area - sum(j, p32_aff_pol_timestep("y1995",j)); + p32_aff_togo_glo("y1995") = s32_max_aff_area - sum(ac, pc32_land(j,"ndc",ac)) - sum(j, p32_aff_pol_timestep("y1995",j)); p32_aff_togo_glo(t)$(ord(t)>1) = p32_aff_togo_glo(t-1) - sum(j, p32_aff_pol_timestep(t,j)); p32_aff_togo_glo(t)$(p32_aff_togo_glo(t) < sum(j, p32_aff_pol_timestep(t,j))) = sum(j, p32_aff_pol_timestep(t,j)); p32_aff_togo_reg(t,i) = 0; elseif s32_max_aff_area_glo = 0, - p32_aff_togo_reg("y1995",i) = f32_max_aff_area(i) - sum(cell(i,j), p32_aff_pol_timestep("y1995",j)); + p32_aff_togo_reg("y1995",i) = f32_max_aff_area(i) - sum((ac,cell(i,j)), pc32_land(j,"ndc",ac)) - sum(cell(i,j), p32_aff_pol_timestep("y1995",j)); p32_aff_togo_reg(t,i)$(ord(t)>1) = p32_aff_togo_reg(t-1,i) - sum(cell(i,j), p32_aff_pol_timestep(t,j)); p32_aff_togo_reg(t,i)$(p32_aff_togo_reg(t,i) < sum(cell(i,j), p32_aff_pol_timestep(t,j))) = sum(cell(i,j), p32_aff_pol_timestep(t,j)); i32_max_aff_area_glo(t) = 0; From a0dc2d1981f04e1b8cba98142855740cd594c644 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 22 May 2025 17:01:31 +0200 Subject: [PATCH 04/18] correction --- modules/32_forestry/dynamic_may24/presolve.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 818a75ee4..49cd5e095 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -30,12 +30,12 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; * Calculate the limit for endogenous afforestation * The global (`s32_max_aff_area`) and regional limit (`f32_max_aff_area`) for total afforestation (sum of endogenous and exogenous) is reduced by exogenous NPI/NDC afforestation through (`p32_aff_pol_timestep(t,j)`). if(s32_max_aff_area_glo = 1, - p32_aff_togo_glo("y1995") = s32_max_aff_area - sum(ac, pc32_land(j,"ndc",ac)) - sum(j, p32_aff_pol_timestep("y1995",j)); + p32_aff_togo_glo("y1995") = s32_max_aff_area - sum(ac, p32_land_start_ac(j,"ndc",ac)) - sum(j, p32_aff_pol_timestep("y1995",j)); p32_aff_togo_glo(t)$(ord(t)>1) = p32_aff_togo_glo(t-1) - sum(j, p32_aff_pol_timestep(t,j)); p32_aff_togo_glo(t)$(p32_aff_togo_glo(t) < sum(j, p32_aff_pol_timestep(t,j))) = sum(j, p32_aff_pol_timestep(t,j)); p32_aff_togo_reg(t,i) = 0; elseif s32_max_aff_area_glo = 0, - p32_aff_togo_reg("y1995",i) = f32_max_aff_area(i) - sum((ac,cell(i,j)), pc32_land(j,"ndc",ac)) - sum(cell(i,j), p32_aff_pol_timestep("y1995",j)); + p32_aff_togo_reg("y1995",i) = f32_max_aff_area(i) - sum((ac,cell(i,j)), p32_land_start_ac(j,"ndc",ac)) - sum(cell(i,j), p32_aff_pol_timestep("y1995",j)); p32_aff_togo_reg(t,i)$(ord(t)>1) = p32_aff_togo_reg(t-1,i) - sum(cell(i,j), p32_aff_pol_timestep(t,j)); p32_aff_togo_reg(t,i)$(p32_aff_togo_reg(t,i) < sum(cell(i,j), p32_aff_pol_timestep(t,j))) = sum(cell(i,j), p32_aff_pol_timestep(t,j)); i32_max_aff_area_glo(t) = 0; From 84484e8c4b1e0a5abed18e89c187d769a15cf827 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 22 May 2025 17:11:34 +0200 Subject: [PATCH 05/18] bugfixes --- modules/32_forestry/dynamic_may24/equations.gms | 4 ++-- modules/32_forestry/dynamic_may24/presolve.gms | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/equations.gms b/modules/32_forestry/dynamic_may24/equations.gms index 20ff03f81..3bc54c85b 100644 --- a/modules/32_forestry/dynamic_may24/equations.gms +++ b/modules/32_forestry/dynamic_may24/equations.gms @@ -93,11 +93,11 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( q32_max_aff$(s32_max_aff_area_glo=1) .. sum((j2,ac), v32_land(j2,"aff",ac)) - =l= sum(ct, p32_aff_togo_glo(ct)) - sum(ac_est, v32_land(j2,"ndc",ac_est)); + =l= sum(ct, p32_aff_togo_glo(ct)) - sum((ac_est,j2), v32_land(j2,"ndc",ac_est)); q32_max_aff_reg(i2)$(s32_max_aff_area_glo=0) .. sum((cell(i2,j2),ac), v32_land(j2,"aff",ac)) - =l= sum(ct, p32_aff_togo_glo(ct,i2)) - sum((ac_est,cell(i2,j2)) v32_land(j2,"ndc",ac_est)); + =l= sum(ct, p32_aff_togo_reg(ct,i2)) - sum((ac_est,cell(i2,j2)), v32_land(j2,"ndc",ac_est)); *----------------------------------------------- ************** Carbon stock ******************** diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 49cd5e095..bacf06c2d 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -30,7 +30,7 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; * Calculate the limit for endogenous afforestation * The global (`s32_max_aff_area`) and regional limit (`f32_max_aff_area`) for total afforestation (sum of endogenous and exogenous) is reduced by exogenous NPI/NDC afforestation through (`p32_aff_pol_timestep(t,j)`). if(s32_max_aff_area_glo = 1, - p32_aff_togo_glo("y1995") = s32_max_aff_area - sum(ac, p32_land_start_ac(j,"ndc",ac)) - sum(j, p32_aff_pol_timestep("y1995",j)); + p32_aff_togo_glo("y1995") = s32_max_aff_area - sum((ac,j), p32_land_start_ac(j,"ndc",ac)) - sum(j, p32_aff_pol_timestep("y1995",j)); p32_aff_togo_glo(t)$(ord(t)>1) = p32_aff_togo_glo(t-1) - sum(j, p32_aff_pol_timestep(t,j)); p32_aff_togo_glo(t)$(p32_aff_togo_glo(t) < sum(j, p32_aff_pol_timestep(t,j))) = sum(j, p32_aff_pol_timestep(t,j)); p32_aff_togo_reg(t,i) = 0; @@ -38,7 +38,7 @@ elseif s32_max_aff_area_glo = 0, p32_aff_togo_reg("y1995",i) = f32_max_aff_area(i) - sum((ac,cell(i,j)), p32_land_start_ac(j,"ndc",ac)) - sum(cell(i,j), p32_aff_pol_timestep("y1995",j)); p32_aff_togo_reg(t,i)$(ord(t)>1) = p32_aff_togo_reg(t-1,i) - sum(cell(i,j), p32_aff_pol_timestep(t,j)); p32_aff_togo_reg(t,i)$(p32_aff_togo_reg(t,i) < sum(cell(i,j), p32_aff_pol_timestep(t,j))) = sum(cell(i,j), p32_aff_pol_timestep(t,j)); - i32_max_aff_area_glo(t) = 0; + p32_aff_togo_glo(t) = 0; ); ** END ndc ** From 423a31524bc22b419e61e84fe7bb36c626501ab2 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 22 May 2025 17:46:01 +0200 Subject: [PATCH 06/18] logical fix --- .../32_forestry/dynamic_may24/equations.gms | 4 ++-- .../32_forestry/dynamic_may24/presolve.gms | 22 ++++++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/equations.gms b/modules/32_forestry/dynamic_may24/equations.gms index 3bc54c85b..2b8ac889f 100644 --- a/modules/32_forestry/dynamic_may24/equations.gms +++ b/modules/32_forestry/dynamic_may24/equations.gms @@ -93,11 +93,11 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( q32_max_aff$(s32_max_aff_area_glo=1) .. sum((j2,ac), v32_land(j2,"aff",ac)) - =l= sum(ct, p32_aff_togo_glo(ct)) - sum((ac_est,j2), v32_land(j2,"ndc",ac_est)); + =l= sum(ct, p32_aff_togo_glo(ct)); q32_max_aff_reg(i2)$(s32_max_aff_area_glo=0) .. sum((cell(i2,j2),ac), v32_land(j2,"aff",ac)) - =l= sum(ct, p32_aff_togo_reg(ct,i2)) - sum((ac_est,cell(i2,j2)), v32_land(j2,"ndc",ac_est)); + =l= sum(ct, p32_aff_togo_reg(ct,i2)); *----------------------------------------------- ************** Carbon stock ******************** diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index bacf06c2d..d6337d79f 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -30,14 +30,24 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; * Calculate the limit for endogenous afforestation * The global (`s32_max_aff_area`) and regional limit (`f32_max_aff_area`) for total afforestation (sum of endogenous and exogenous) is reduced by exogenous NPI/NDC afforestation through (`p32_aff_pol_timestep(t,j)`). if(s32_max_aff_area_glo = 1, - p32_aff_togo_glo("y1995") = s32_max_aff_area - sum((ac,j), p32_land_start_ac(j,"ndc",ac)) - sum(j, p32_aff_pol_timestep("y1995",j)); - p32_aff_togo_glo(t)$(ord(t)>1) = p32_aff_togo_glo(t-1) - sum(j, p32_aff_pol_timestep(t,j)); - p32_aff_togo_glo(t)$(p32_aff_togo_glo(t) < sum(j, p32_aff_pol_timestep(t,j))) = sum(j, p32_aff_pol_timestep(t,j)); + p32_aff_togo_glo("y1995") = s32_max_aff_area + - sum((ac,j), p32_land_start_ac(j,"ndc",ac)) + - sum(j, p32_aff_pol_timestep("y1995",j)); + p32_aff_togo_glo(t)$(ord(t)>1) = p32_aff_togo_glo(t-1) + - sum((ac,j), pc32_land(j,"ndc",ac)) + - sum((ac,j), pc32_land(j,"aff",ac)) + - sum(j, p32_aff_pol_timestep(t,j)); + p32_aff_togo_glo(t)$(p32_aff_togo_glo(t) < 1e-06) = 0; p32_aff_togo_reg(t,i) = 0; elseif s32_max_aff_area_glo = 0, - p32_aff_togo_reg("y1995",i) = f32_max_aff_area(i) - sum((ac,cell(i,j)), p32_land_start_ac(j,"ndc",ac)) - sum(cell(i,j), p32_aff_pol_timestep("y1995",j)); - p32_aff_togo_reg(t,i)$(ord(t)>1) = p32_aff_togo_reg(t-1,i) - sum(cell(i,j), p32_aff_pol_timestep(t,j)); - p32_aff_togo_reg(t,i)$(p32_aff_togo_reg(t,i) < sum(cell(i,j), p32_aff_pol_timestep(t,j))) = sum(cell(i,j), p32_aff_pol_timestep(t,j)); + p32_aff_togo_reg("y1995",i) = f32_max_aff_area(i) + - sum((ac,cell(i,j)), p32_land_start_ac(j,"ndc",ac)) + - sum(cell(i,j), p32_aff_pol_timestep("y1995",j)); + p32_aff_togo_reg(t,i)$(ord(t)>1) = p32_aff_togo_reg(t-1,i) + - sum((ac,cell(i,j)), pc32_land(j,"ndc",ac)) + - sum((ac,cell(i,j)), pc32_land(j,"aff",ac)) + - sum(cell(i,j), p32_aff_pol_timestep(t,j)); + p32_aff_togo_reg(t,i)$(p32_aff_togo_reg(t,i) < 1e-06) = 0; p32_aff_togo_glo(t) = 0; ); From 111fa9ab619c692d546c2daff010b81d28fb3b1e Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 22 May 2025 17:55:25 +0200 Subject: [PATCH 07/18] change miti consv scenario config csv --- config/projects/scenario_config_miti_consv.csv | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/config/projects/scenario_config_miti_consv.csv b/config/projects/scenario_config_miti_consv.csv index 091d32778..b4dcc4b4c 100644 --- a/config/projects/scenario_config_miti_consv.csv +++ b/config/projects/scenario_config_miti_consv.csv @@ -1,3 +1,6 @@ -;MitiConsv;MitiConsv-NoBuff -gms$s56_buffer_aff;0.2;0 -input['calibration'];calibration_rev17_MitiConsv_19Mar25.tgz;calibration_rev17_MitiConsv_19Mar25.tgz +;MitiConsv;AR0;AR200;AR350;AR500;30by30 +gms$c22_protect_scenario;;;;;;30by30 +gms$s32_max_aff_area;;;382;532;682; +gms$s56_c_price_induced_aff ;;0;1;1;1; +gms$s56_buffer_aff;0;;;;; +input['calibration'];calibration_rev18_MitiConsv_04Apr25.tgz;;;;; From d6e0d06557a694bb1854ef840cfc1da55ff109a1 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 22 May 2025 19:25:56 +0200 Subject: [PATCH 08/18] bugfix --- modules/32_forestry/dynamic_may24/presolve.gms | 4 ---- 1 file changed, 4 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index d6337d79f..21aa990e6 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -34,8 +34,6 @@ if(s32_max_aff_area_glo = 1, - sum((ac,j), p32_land_start_ac(j,"ndc",ac)) - sum(j, p32_aff_pol_timestep("y1995",j)); p32_aff_togo_glo(t)$(ord(t)>1) = p32_aff_togo_glo(t-1) - - sum((ac,j), pc32_land(j,"ndc",ac)) - - sum((ac,j), pc32_land(j,"aff",ac)) - sum(j, p32_aff_pol_timestep(t,j)); p32_aff_togo_glo(t)$(p32_aff_togo_glo(t) < 1e-06) = 0; p32_aff_togo_reg(t,i) = 0; @@ -44,8 +42,6 @@ elseif s32_max_aff_area_glo = 0, - sum((ac,cell(i,j)), p32_land_start_ac(j,"ndc",ac)) - sum(cell(i,j), p32_aff_pol_timestep("y1995",j)); p32_aff_togo_reg(t,i)$(ord(t)>1) = p32_aff_togo_reg(t-1,i) - - sum((ac,cell(i,j)), pc32_land(j,"ndc",ac)) - - sum((ac,cell(i,j)), pc32_land(j,"aff",ac)) - sum(cell(i,j), p32_aff_pol_timestep(t,j)); p32_aff_togo_reg(t,i)$(p32_aff_togo_reg(t,i) < 1e-06) = 0; p32_aff_togo_glo(t) = 0; From 910a0269390f488d4e13296e695dafd53e54b19a Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 22 May 2025 22:01:46 +0200 Subject: [PATCH 09/18] infes fix --- .../dynamic_may24/declarations.gms | 4 +-- .../32_forestry/dynamic_may24/equations.gms | 4 +-- .../32_forestry/dynamic_may24/presolve.gms | 28 +++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/declarations.gms b/modules/32_forestry/dynamic_may24/declarations.gms index 78d104f04..c74b37f12 100644 --- a/modules/32_forestry/dynamic_may24/declarations.gms +++ b/modules/32_forestry/dynamic_may24/declarations.gms @@ -14,8 +14,8 @@ parameters p32_aff_pol(t,j) NDC forest stock (mio. ha) p32_aff_pol_timestep(t,j) NDC afforestation per time step (mio. ha) p32_aff_pot(t,j) Potential afforestation area (mio. ha) - p32_aff_togo_glo(t) Remaining afforestation area wrt to the maximum exogenous target over time (mio. ha) - p32_aff_togo_reg(t,i) Remaining regional afforestation area wrt to the maximum exogenous target over time (mio. ha) + p32_max_aff_area_glo(t) Remaining afforestation area wrt to the maximum exogenous target over time (mio. ha) + p32_max_aff_area_reg(t,i) Remaining regional afforestation area wrt to the maximum exogenous target over time (mio. ha) p32_carbon_density_ac(t,j,type32,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) p32_carbon_density_ac_forestry(t_all,j,ac) Above ground carbon density for age classes and carbon pools (tC per ha) p32_carbon_density_ac_marg(t_all,j,ac) Marginal above ground carbon density for age classes and carbon pools (tC per ha) diff --git a/modules/32_forestry/dynamic_may24/equations.gms b/modules/32_forestry/dynamic_may24/equations.gms index 2b8ac889f..761d07ea6 100644 --- a/modules/32_forestry/dynamic_may24/equations.gms +++ b/modules/32_forestry/dynamic_may24/equations.gms @@ -93,11 +93,11 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( q32_max_aff$(s32_max_aff_area_glo=1) .. sum((j2,ac), v32_land(j2,"aff",ac)) - =l= sum(ct, p32_aff_togo_glo(ct)); + =l= sum(ct, p32_max_aff_area_glo(ct)); q32_max_aff_reg(i2)$(s32_max_aff_area_glo=0) .. sum((cell(i2,j2),ac), v32_land(j2,"aff",ac)) - =l= sum(ct, p32_aff_togo_reg(ct,i2)); + =l= sum(ct, p32_max_aff_area_reg(ct,i2)); *----------------------------------------------- ************** Carbon stock ******************** diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 21aa990e6..5a99992db 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -30,21 +30,21 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; * Calculate the limit for endogenous afforestation * The global (`s32_max_aff_area`) and regional limit (`f32_max_aff_area`) for total afforestation (sum of endogenous and exogenous) is reduced by exogenous NPI/NDC afforestation through (`p32_aff_pol_timestep(t,j)`). if(s32_max_aff_area_glo = 1, - p32_aff_togo_glo("y1995") = s32_max_aff_area - - sum((ac,j), p32_land_start_ac(j,"ndc",ac)) - - sum(j, p32_aff_pol_timestep("y1995",j)); - p32_aff_togo_glo(t)$(ord(t)>1) = p32_aff_togo_glo(t-1) - - sum(j, p32_aff_pol_timestep(t,j)); - p32_aff_togo_glo(t)$(p32_aff_togo_glo(t) < 1e-06) = 0; - p32_aff_togo_reg(t,i) = 0; + p32_max_aff_area_glo(t) = s32_max_aff_area + - sum((ac,j), p32_land_start_ac(j,"ndc",ac)) + - smax(t2, sum(j, p32_aff_pol(t2,j))); + p32_max_aff_area_glo(t)$(sum(j, p32_aff_pol_timestep(t,j)) = 0) + = s32_max_aff_area - sum((ac,j), pc32_land(j,"ndc",ac)); + p32_max_aff_area_glo(t)$(p32_max_aff_area_glo(t) < 1e-06) = 0; + p32_max_aff_area_reg(t,i) = 0; elseif s32_max_aff_area_glo = 0, - p32_aff_togo_reg("y1995",i) = f32_max_aff_area(i) - - sum((ac,cell(i,j)), p32_land_start_ac(j,"ndc",ac)) - - sum(cell(i,j), p32_aff_pol_timestep("y1995",j)); - p32_aff_togo_reg(t,i)$(ord(t)>1) = p32_aff_togo_reg(t-1,i) - - sum(cell(i,j), p32_aff_pol_timestep(t,j)); - p32_aff_togo_reg(t,i)$(p32_aff_togo_reg(t,i) < 1e-06) = 0; - p32_aff_togo_glo(t) = 0; + p32_max_aff_area_reg(t,i) = f32_max_aff_area(i) + - sum((ac,cell(i,j)), p32_land_start_ac(j,"ndc",ac)) + - smax(t2, sum(cell(i,j), p32_aff_pol(t2,j))); + p32_max_aff_area_reg(t,i)$(sum(cell(i,j), p32_aff_pol_timestep(t,j)) = 0) + = s32_max_aff_area - sum((ac,cell(i,j)), pc32_land(j,"ndc",ac)); + p32_max_aff_area_reg(t,i)$(p32_max_aff_area_reg(t,i) < 1e-06) = 0; + p32_max_aff_area_glo(t) = 0; ); ** END ndc ** From 42453a05b241d27f5c33c7afefd88fcc6036c4ee Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 22 May 2025 22:12:37 +0200 Subject: [PATCH 10/18] minor fix --- modules/32_forestry/dynamic_may24/declarations.gms | 4 ++-- modules/32_forestry/dynamic_may24/input.gms | 6 +++--- modules/32_forestry/dynamic_may24/presolve.gms | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/declarations.gms b/modules/32_forestry/dynamic_may24/declarations.gms index c74b37f12..86b337e97 100644 --- a/modules/32_forestry/dynamic_may24/declarations.gms +++ b/modules/32_forestry/dynamic_may24/declarations.gms @@ -14,8 +14,8 @@ parameters p32_aff_pol(t,j) NDC forest stock (mio. ha) p32_aff_pol_timestep(t,j) NDC afforestation per time step (mio. ha) p32_aff_pot(t,j) Potential afforestation area (mio. ha) - p32_max_aff_area_glo(t) Remaining afforestation area wrt to the maximum exogenous target over time (mio. ha) - p32_max_aff_area_reg(t,i) Remaining regional afforestation area wrt to the maximum exogenous target over time (mio. ha) + p32_max_aff_area_glo(t) Remaining afforestation area wrt to the maximum exogenous target over time (mio. ha) + p32_max_aff_area_reg(t,i) Remaining regional afforestation area wrt to the maximum exogenous target over time (mio. ha) p32_carbon_density_ac(t,j,type32,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha) p32_carbon_density_ac_forestry(t_all,j,ac) Above ground carbon density for age classes and carbon pools (tC per ha) p32_carbon_density_ac_marg(t_all,j,ac) Marginal above ground carbon density for age classes and carbon pools (tC per ha) diff --git a/modules/32_forestry/dynamic_may24/input.gms b/modules/32_forestry/dynamic_may24/input.gms index ab2d9da56..508e5b849 100644 --- a/modules/32_forestry/dynamic_may24/input.gms +++ b/modules/32_forestry/dynamic_may24/input.gms @@ -6,7 +6,7 @@ *** | Contact: magpie@pik-potsdam.de $setglobal c32_aff_mask noboreal * options: unrestricted, noboreal, onlytropical -$setglobal c32_aff_policy npi +$setglobal c32_aff_policy ndc * options: none, npi, ndc $setglobal c32_aff_bgp nobgp * options: ann,nobgp @@ -23,7 +23,7 @@ $setglobal c32_shock_scenario none scalars - s32_hvarea Flag for harvested area and establishemt (0=zero 1=exognous 2=endogneous) / 2 / + s32_hvarea Flag for harvested area and establishemt (0=zero 1=exognous 2=endogneous) / 1 / s32_est_cost_plant Establishment cost for plantations (USD17MER per ha) / 2460 / s32_est_cost_natveg Establishment cost for natural vegetation (USD17MER per ha) / 2460 / s32_recurring_cost Recurring costs (USD17MER per ha) / 615 / @@ -34,7 +34,7 @@ scalars s32_initial_distribution Switch to Activate ageclass distribution in plantations 0=off 1=equal distribution / 1 / s32_price Price for timber (USD17MER) / 55 / s32_free_land_cost Penalty for technial area balance term (USD17MER per ha) / 1e+06 / - s32_max_aff_area Maximum total global afforestation (mio. ha) / Inf / + s32_max_aff_area Maximum total global afforestation (mio. ha) / 682 / 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 / s32_forestry_int_rate Global interest rate for plantations (percent) / 0.05 / diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 5a99992db..5960248cb 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -42,7 +42,7 @@ elseif s32_max_aff_area_glo = 0, - sum((ac,cell(i,j)), p32_land_start_ac(j,"ndc",ac)) - smax(t2, sum(cell(i,j), p32_aff_pol(t2,j))); p32_max_aff_area_reg(t,i)$(sum(cell(i,j), p32_aff_pol_timestep(t,j)) = 0) - = s32_max_aff_area - sum((ac,cell(i,j)), pc32_land(j,"ndc",ac)); + = f32_max_aff_area(i) - sum((ac,cell(i,j)), pc32_land(j,"ndc",ac)); p32_max_aff_area_reg(t,i)$(p32_max_aff_area_reg(t,i) < 1e-06) = 0; p32_max_aff_area_glo(t) = 0; ); From 751240707071454f36d8b5c4ab8cc793128dda0f Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 22 May 2025 22:17:50 +0200 Subject: [PATCH 11/18] revert run compilation changes --- modules/32_forestry/dynamic_may24/input.gms | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/input.gms b/modules/32_forestry/dynamic_may24/input.gms index 508e5b849..35114805b 100644 --- a/modules/32_forestry/dynamic_may24/input.gms +++ b/modules/32_forestry/dynamic_may24/input.gms @@ -6,7 +6,7 @@ *** | Contact: magpie@pik-potsdam.de $setglobal c32_aff_mask noboreal * options: unrestricted, noboreal, onlytropical -$setglobal c32_aff_policy ndc +$setglobal c32_aff_policy npi * options: none, npi, ndc $setglobal c32_aff_bgp nobgp * options: ann,nobgp @@ -23,7 +23,7 @@ $setglobal c32_shock_scenario none scalars - s32_hvarea Flag for harvested area and establishemt (0=zero 1=exognous 2=endogneous) / 1 / + s32_hvarea Flag for harvested area and establishemt (0=zero 1=exognous 2=endogneous) / 2 / s32_est_cost_plant Establishment cost for plantations (USD17MER per ha) / 2460 / s32_est_cost_natveg Establishment cost for natural vegetation (USD17MER per ha) / 2460 / s32_recurring_cost Recurring costs (USD17MER per ha) / 615 / @@ -34,7 +34,7 @@ scalars s32_initial_distribution Switch to Activate ageclass distribution in plantations 0=off 1=equal distribution / 1 / s32_price Price for timber (USD17MER) / 55 / s32_free_land_cost Penalty for technial area balance term (USD17MER per ha) / 1e+06 / - s32_max_aff_area Maximum total global afforestation (mio. ha) / 682 / + 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 / s32_forestry_int_rate Global interest rate for plantations (percent) / 0.05 / @@ -50,7 +50,7 @@ scalars s32_demand_establishment Boolean switch for establishment demand assumption 1=forward looking 0=static (1) / 1 / s32_npi_ndc_reversal Year in which NPI NDC reversal should take place (1) / Inf / s32_min_plant_shr Minimum share of plantations in planted forests (1) / 0.05 / - s32_annual_aff_limit Annual upper limit for re-afforestation as share of overall forest establishment potential (1) / 0.03 / + s32_annual_aff_limit Annual upper limit for re-afforestation as share of overall forest establishment potential (1) / 0.03 / ; parameter f32_aff_mask(j) afforestation mask (binary) From 100c4b9f752a5490e1a864516fb2872ee79da9a1 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 22 May 2025 23:38:27 +0200 Subject: [PATCH 12/18] improvement --- modules/32_forestry/dynamic_may24/presolve.gms | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 5960248cb..95d99ae3c 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -31,18 +31,14 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; * 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 through (`p32_aff_pol_timestep(t,j)`). if(s32_max_aff_area_glo = 1, p32_max_aff_area_glo(t) = s32_max_aff_area - - sum((ac,j), p32_land_start_ac(j,"ndc",ac)) - - smax(t2, sum(j, p32_aff_pol(t2,j))); - p32_max_aff_area_glo(t)$(sum(j, p32_aff_pol_timestep(t,j)) = 0) - = s32_max_aff_area - sum((ac,j), pc32_land(j,"ndc",ac)); + - sum((ac,j), pc32_land(j,"ndc",ac)) + - sum(j, p32_aff_pol_timestep(t,j)); p32_max_aff_area_glo(t)$(p32_max_aff_area_glo(t) < 1e-06) = 0; p32_max_aff_area_reg(t,i) = 0; elseif s32_max_aff_area_glo = 0, p32_max_aff_area_reg(t,i) = f32_max_aff_area(i) - - sum((ac,cell(i,j)), p32_land_start_ac(j,"ndc",ac)) - - smax(t2, sum(cell(i,j), p32_aff_pol(t2,j))); - p32_max_aff_area_reg(t,i)$(sum(cell(i,j), p32_aff_pol_timestep(t,j)) = 0) - = f32_max_aff_area(i) - sum((ac,cell(i,j)), pc32_land(j,"ndc",ac)); + - sum((ac,cell(i,j)), pc32_land(j,"ndc",ac)) + - sum(cell(i,j), p32_aff_pol_timestep(t,j)); p32_max_aff_area_reg(t,i)$(p32_max_aff_area_reg(t,i) < 1e-06) = 0; p32_max_aff_area_glo(t) = 0; ); From 78208d882eda813c5545bb4f0b7246fa92768ac3 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Fri, 23 May 2025 07:28:07 +0200 Subject: [PATCH 13/18] better infes fix --- modules/32_forestry/dynamic_may24/presolve.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index 95d99ae3c..bccc2250c 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -33,13 +33,13 @@ if(s32_max_aff_area_glo = 1, p32_max_aff_area_glo(t) = s32_max_aff_area - sum((ac,j), pc32_land(j,"ndc",ac)) - sum(j, p32_aff_pol_timestep(t,j)); - p32_max_aff_area_glo(t)$(p32_max_aff_area_glo(t) < 1e-06) = 0; + p32_max_aff_area_glo(t)$(p32_max_aff_area_glo(t) < sum((ac,j), pc32_land(j,"aff",ac))) = sum((ac,j), pc32_land(j,"aff",ac)); p32_max_aff_area_reg(t,i) = 0; elseif s32_max_aff_area_glo = 0, p32_max_aff_area_reg(t,i) = f32_max_aff_area(i) - sum((ac,cell(i,j)), pc32_land(j,"ndc",ac)) - sum(cell(i,j), p32_aff_pol_timestep(t,j)); - p32_max_aff_area_reg(t,i)$(p32_max_aff_area_reg(t,i) < 1e-06) = 0; + p32_max_aff_area_reg(t,i)$(p32_max_aff_area_reg(t,i) < sum((ac,cell(i,j)), pc32_land(j,"aff",ac))) = sum((ac,cell(i,j)), pc32_land(j,"aff",ac)); p32_max_aff_area_glo(t) = 0; ); From b8bf685cbc5ab36c1bd146a6deadc5b71bc12876 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Fri, 23 May 2025 09:55:36 +0200 Subject: [PATCH 14/18] changelog and other fixes --- CHANGELOG.md | 5 +++-- modules/32_forestry/dynamic_may24/presolve.gms | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index febce8449..be634fec1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,19 +10,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **21_trade** changed export share calculation to be done at region level in the model - **default.cfg** input data upgraded from rev4.117 to rev4.118, default for bioenergy demand and GHG prices changed from R32M46 to R34M410, `rcp4p5` used for SSP2-NPi2025 in line with MAGICC climate outcome and REMIND assumptions. - **default.cfg** changed running magpie by default with optfile for specified solver settings (Tol_Optimality) -- **script/start/test_runs.R** Test runs adjusted based on availability from coupled runs for R34M410. +- **script/start/test_runs.R** Test runs adjusted based on availability from coupled runs for R34M410. - **scenario_config.csv** SSP2 food system assumptions for ScenarioMIP VLLO to avoid sudden jump of calorie intake after 2025 - **scripts** request 24h for SLURM jobs (except for medium which still requests 7 days) - **scripts** disaggregation.R moved disaggregateLandConservation function to magpie4 ### added - **default.cfg** added option to set Tol_Optimality (GAMS solver setting) to a certain value (GAMS-default 1e-7, new MAgPIE-default 1e-8) -- **80_optimization** added writing of conopt opt files with using scalars from input +- **80_optimization** added writing of conopt opt files with using scalars from input ### removed - **80_optimization** removed older optfile, that should be tried if no optimal solution can be found ### fixed +- **32_forestry** fixed inconsistency in the application of `s32_max_aff_area` - **18_residues** fixed equation for cluster level production of crop residues in flexreg_apr16 realization - **44_biodiversity** expanded age-classes from 150 to 300 years in line with `ac` set. This bugfix is crucial for the BII indicator. diff --git a/modules/32_forestry/dynamic_may24/presolve.gms b/modules/32_forestry/dynamic_may24/presolve.gms index bccc2250c..7f3a67e01 100644 --- a/modules/32_forestry/dynamic_may24/presolve.gms +++ b/modules/32_forestry/dynamic_may24/presolve.gms @@ -32,14 +32,14 @@ v32_land_reduction.fx(j,type32,ac_est) = 0; if(s32_max_aff_area_glo = 1, p32_max_aff_area_glo(t) = s32_max_aff_area - sum((ac,j), pc32_land(j,"ndc",ac)) - - sum(j, p32_aff_pol_timestep(t,j)); - p32_max_aff_area_glo(t)$(p32_max_aff_area_glo(t) < sum((ac,j), pc32_land(j,"aff",ac))) = sum((ac,j), pc32_land(j,"aff",ac)); + - (smax(t2, sum(j, p32_aff_pol(t2,j))) - sum(j, p32_aff_pol(t-1,j))); + p32_max_aff_area_glo(t)$(p32_max_aff_area_glo(t) < 1e-06) = 0; p32_max_aff_area_reg(t,i) = 0; elseif s32_max_aff_area_glo = 0, p32_max_aff_area_reg(t,i) = f32_max_aff_area(i) - sum((ac,cell(i,j)), pc32_land(j,"ndc",ac)) - - sum(cell(i,j), p32_aff_pol_timestep(t,j)); - p32_max_aff_area_reg(t,i)$(p32_max_aff_area_reg(t,i) < sum((ac,cell(i,j)), pc32_land(j,"aff",ac))) = sum((ac,cell(i,j)), pc32_land(j,"aff",ac)); + - (smax(t2, sum(cell(i,j), p32_aff_pol(t2,j))) - sum(cell(i,j), p32_aff_pol(t-1,j))); + p32_max_aff_area_reg(t,i)$(p32_max_aff_area_reg(t,i) < 1e-06) = 0; p32_max_aff_area_glo(t) = 0; ); From 13cc367a53a82a48178852da2023be7a8042b7c6 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Mon, 26 May 2025 11:43:09 +0200 Subject: [PATCH 15/18] updated miti consv start script --- scripts/start/projects/paper_MitiConsv.R | 114 +++++++++++++---------- 1 file changed, 67 insertions(+), 47 deletions(-) diff --git a/scripts/start/projects/paper_MitiConsv.R b/scripts/start/projects/paper_MitiConsv.R index 37415f2a9..d30a6a832 100644 --- a/scripts/start/projects/paper_MitiConsv.R +++ b/scripts/start/projects/paper_MitiConsv.R @@ -9,7 +9,7 @@ # description: Land-based mitigation and habitat conservation # ------------------------------------------------------------- -rev <- "rev18" +rev <- "rev19" cres <- "c200" @@ -25,34 +25,34 @@ library(gdx2) # Load start functions source("scripts/start_functions.R") -# ==================== -# Calibration -# ==================== +# # ==================== +# # Calibration +# # ==================== -source("config/default.cfg") +# source("config/default.cfg") -cfg$title <- paste0(rev, "_calib_MitiConsv") -cfg$output <- c("rds_report", "validation_short") -cfg$force_replace <- TRUE +# cfg$title <- paste0(rev, "_calib_MitiConsv") +# cfg$output <- c("rds_report", "validation_short") +# cfg$force_replace <- TRUE -# land conversion cost calibration settings -cfg$recalibrate_landconversion_cost <- TRUE +# # land conversion cost calibration settings +# cfg$recalibrate_landconversion_cost <- TRUE -# cc is new default -cfg <- setScenario(cfg, c("SSP2", "nocc_hist", "NPI", "ForestryExo")) -cfg <- setScenario(cfg, c("MitiConsv"), scenario_config = "config/projects/scenario_config_miti_consv.csv") +# # cc is new default +# cfg <- setScenario(cfg, c("SSP2", "nocc_hist", "NPI", "ForestryExo")) +# cfg <- setScenario(cfg, c("MitiConsv"), scenario_config = "config/projects/scenario_config_miti_consv.csv") -# sticky -cfg$gms$factor_costs <- "sticky_feb18" +# # sticky +# cfg$gms$factor_costs <- "sticky_feb18" -# SNV habitat defintion -cfg$gms$land_snv <- "secdforest, other" +# # SNV habitat defintion +# cfg$gms$land_snv <- "secdforest, other" -# marginal land scenario -cfg$gms$c29_marginal_land <- "q33_marginal" +# # marginal land scenario +# cfg$gms$c29_marginal_land <- "q33_marginal" -start_run(cfg = cfg) -calib_tgz <- magpie4::submitCalibration(paste(rev, "MitiConsv", sep = "_")) +# start_run(cfg = cfg) +# calib_tgz <- magpie4::submitCalibration(paste(rev, "MitiConsv", sep = "_")) # ==================== # Scenario runs @@ -60,15 +60,17 @@ calib_tgz <- magpie4::submitCalibration(paste(rev, "MitiConsv", sep = "_")) prefix <- paste(rev, "MitiConsv", cres, sep = "_") + scenarios <- c( - "SSP2-REF", "SSP2-PB650-AR", "SSP2-PB650-AvC", - "SSP2-PB1000-AR", "SSP2-PB1000-AvC", - "SSP2-PB650-AR-BH", "SSP2-PB650-AvC-BH", - "SSP2-PB1000-AR-BH", "SSP2-PB1000-AvC-BH", - "SSP2-PB650-AR-KBA", "SSP2-PB650-AvC-KBA", - "SSP2-PB1000-AR-KBA", "SSP2-PB1000-AvC-KBA" + # "SSP2-PB650-NPi", "SSP2-PB650-NDC", + # "SSP2-PB650-NPi-30by30", "SSP2-PB650-NDC-30by30", + "SSP2-PB650-AR200", + "SSP2-PB650-AR350", + "SSP2-PB650-AR500" + # "SSP2-REF" ) + for (scen in scenarios) { scen <- unlist(strsplit(scen, "-")) ssp <- scen[grepl("SSP", scen)] @@ -85,10 +87,10 @@ for (scen in scenarios) { # Climate change switched off for these runs cfg <- setScenario(cfg, c(ssp, "nocc_hist", "NPI", "ForestryExo")) - cfg <- setScenario(cfg, c("MitiConsv"), scenario_config = "config/projects/scenario_config_miti_consv.csv") + cfg <- setScenario(cfg, "MitiConsv", scenario_config = "config/projects/scenario_config_miti_consv.csv") # Calibration settings - cfg$input["calibration"] <- calib_tgz + # cfg$input["calibration"] <- calib_tgz # sticky cfg$gms$factor_costs <- "sticky_feb18" @@ -97,40 +99,58 @@ for (scen in scenarios) { cfg$gms$land_snv <- "secdforest, other" # Set path to coupled output - pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_Mar25/remind/output/C_rev8_MitiConsv_SSP2-NPi-rem-12/REMIND_generic_C_rev8_MitiConsv_SSP2-NPi-rem-12.mif" + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_Apr25/remind/output/C_rev8_MitiConsv_SSP2-NPi-rem-12/REMIND_generic_C_rev8_MitiConsv_SSP2-NPi-rem-12.mif" # No ghg price in NPI run cfg$gms$c56_mute_ghgprices_until <- "y2100" - if ("PB650" %in% scen) { + if (any(c("NPi", "NDC") %in% scen)) { cfg <- setScenario(cfg, "NDC") # Update path to coupled output - pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_Mar25/remind/output/C_rev8_MitiConsv_SSP2-PkBudg650-rem-12/REMIND_generic_C_rev8_MitiConsv_SSP2-PkBudg650-rem-12.mif" + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-NDC-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-NDC-rem-9.mif" + if ("30by30" %in% scen) { + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-NDC-30by30-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-NDC-30by30-rem-9.mif" + } + if ("NPi" %in% scen) { + cfg <- setScenario(cfg, "NPI") + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-NPi-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-NPi-rem-9.mif" + if ("30by30" %in% scen) { + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-NPi-30by30-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-NPi-30by30-rem-9.mif" + } + } cfg$gms$c56_mute_ghgprices_until <- "y2030" + cfg <- setScenario(cfg, "AR0", scenario_config = "config/projects/scenario_config_miti_consv.csv") } - if ("PB1000" %in% scen) { - cfg <- setScenario(cfg, "NDC") - # Update path to coupled output - pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_Mar25/remind/output/C_rev8_MitiConsv_SSP2-PkBudg1000-rem-12/REMIND_generic_C_rev8_MitiConsv_SSP2-PkBudg1000-rem-12.mif" + if ("AR200" %in% scen) { + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR200-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR200-rem-9.mif" + if ("30by30" %in% scen) { + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR200-30by30-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR200-30by30-rem-9.mif" + } cfg$gms$c56_mute_ghgprices_until <- "y2030" + cfg <- setScenario(cfg, "AR200", scenario_config = "config/projects/scenario_config_miti_consv.csv") } - if ("AR" %in% scen) { - cfg$gms$c56_emis_policy <- "redd+natveg_nosoil" - } - - if ("AvC" %in% scen) { - cfg$gms$c56_emis_policy <- "redd+natveg_nosoil" - cfg$gms$s56_c_price_induced_aff <- 0 + if ("AR350" %in% scen) { + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR350-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR350-rem-9.mif" + if ("30by30" %in% scen) { + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR350-30by30-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR350-30by30-rem-9.mif" + } + cfg$gms$c56_mute_ghgprices_until <- "y2030" + cfg <- setScenario(cfg, "AR350", scenario_config = "config/projects/scenario_config_miti_consv.csv") } - if ("KBA" %in% scen) { - cfg$gms$c22_protect_scenario <- "KBA" + if ("AR500" %in% scen) { + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR500-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR500-rem-9.mif" + if ("30by30" %in% scen) { + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR500-30by30-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR500-30by30-rem-9.mif" + } + cfg$gms$c56_mute_ghgprices_until <- "y2030" + cfg <- setScenario(cfg, "AR500", scenario_config = "config/projects/scenario_config_miti_consv.csv") } - if ("BH" %in% scen) { - cfg$gms$c22_protect_scenario <- "BH" + if ("30by30" %in% scen) { + cfg <- setScenario(cfg, "30by30", scenario_config = "config/projects/scenario_config_miti_consv.csv") } # Settings taken from coupled runs From 380fec9f634168e27b8b48300642bb2422cf170f Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Mon, 26 May 2025 11:44:31 +0200 Subject: [PATCH 16/18] rem-7 --- scripts/start/projects/paper_MitiConsv.R | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/start/projects/paper_MitiConsv.R b/scripts/start/projects/paper_MitiConsv.R index d30a6a832..78054676a 100644 --- a/scripts/start/projects/paper_MitiConsv.R +++ b/scripts/start/projects/paper_MitiConsv.R @@ -107,15 +107,15 @@ for (scen in scenarios) { if (any(c("NPi", "NDC") %in% scen)) { cfg <- setScenario(cfg, "NDC") # Update path to coupled output - pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-NDC-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-NDC-rem-9.mif" + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-NDC-rem-7/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-NDC-rem-7.mif" if ("30by30" %in% scen) { - pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-NDC-30by30-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-NDC-30by30-rem-9.mif" + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-NDC-30by30-rem-7/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-NDC-30by30-rem-7.mif" } if ("NPi" %in% scen) { cfg <- setScenario(cfg, "NPI") - pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-NPi-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-NPi-rem-9.mif" + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-NPi-rem-7/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-NPi-rem-7.mif" if ("30by30" %in% scen) { - pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-NPi-30by30-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-NPi-30by30-rem-9.mif" + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-NPi-30by30-rem-7/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-NPi-30by30-rem-7.mif" } } cfg$gms$c56_mute_ghgprices_until <- "y2030" @@ -123,27 +123,27 @@ for (scen in scenarios) { } if ("AR200" %in% scen) { - pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR200-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR200-rem-9.mif" + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR200-rem-7/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR200-rem-7.mif" if ("30by30" %in% scen) { - pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR200-30by30-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR200-30by30-rem-9.mif" + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR200-30by30-rem-7/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR200-30by30-rem-7.mif" } cfg$gms$c56_mute_ghgprices_until <- "y2030" cfg <- setScenario(cfg, "AR200", scenario_config = "config/projects/scenario_config_miti_consv.csv") } if ("AR350" %in% scen) { - pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR350-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR350-rem-9.mif" + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR350-rem-7/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR350-rem-7.mif" if ("30by30" %in% scen) { - pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR350-30by30-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR350-30by30-rem-9.mif" + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR350-30by30-rem-7/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR350-30by30-rem-7.mif" } cfg$gms$c56_mute_ghgprices_until <- "y2030" cfg <- setScenario(cfg, "AR350", scenario_config = "config/projects/scenario_config_miti_consv.csv") } if ("AR500" %in% scen) { - pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR500-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR500-rem-9.mif" + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR500-rem-7/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR500-rem-7.mif" if ("30by30" %in% scen) { - pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR500-30by30-rem-9/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR500-30by30-rem-9.mif" + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-PB650-AR500-30by30-rem-7/REMIND_generic_C_rev9_MitiConsv_SSP2-PB650-AR500-30by30-rem-7.mif" } cfg$gms$c56_mute_ghgprices_until <- "y2030" cfg <- setScenario(cfg, "AR500", scenario_config = "config/projects/scenario_config_miti_consv.csv") From dbe4c210ab3fb1957e105e929ef3d79159218b14 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Mon, 26 May 2025 11:47:29 +0200 Subject: [PATCH 17/18] coupled May25 --- scripts/start/projects/paper_MitiConsv.R | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/start/projects/paper_MitiConsv.R b/scripts/start/projects/paper_MitiConsv.R index 78054676a..3baab8f5c 100644 --- a/scripts/start/projects/paper_MitiConsv.R +++ b/scripts/start/projects/paper_MitiConsv.R @@ -62,12 +62,12 @@ prefix <- paste(rev, "MitiConsv", cres, sep = "_") scenarios <- c( - # "SSP2-PB650-NPi", "SSP2-PB650-NDC", - # "SSP2-PB650-NPi-30by30", "SSP2-PB650-NDC-30by30", - "SSP2-PB650-AR200", - "SSP2-PB650-AR350", - "SSP2-PB650-AR500" - # "SSP2-REF" + "SSP2-PB650-NPi", "SSP2-PB650-NDC", + "SSP2-PB650-NPi-30by30", "SSP2-PB650-NDC-30by30", + "SSP2-PB650-AR200", "SSP2-PB650-AR200-30by30", + "SSP2-PB650-AR350", "SSP2-PB650-AR350-30by30", + "SSP2-PB650-AR500", "SSP2-PB650-AR500-30by30", + "SSP2-REF" ) @@ -99,7 +99,7 @@ for (scen in scenarios) { cfg$gms$land_snv <- "secdforest, other" # Set path to coupled output - pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_Apr25/remind/output/C_rev8_MitiConsv_SSP2-NPi-rem-12/REMIND_generic_C_rev8_MitiConsv_SSP2-NPi-rem-12.mif" + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_May25/remind/output/C_rev9_MitiConsv_SSP2-NPi-rem-7/REMIND_generic_C_rev9_MitiConsv_SSP2-NPi-rem-7.mif" # No ghg price in NPI run cfg$gms$c56_mute_ghgprices_until <- "y2100" From 70fea35662e2525d84e2ff5d9e80847e4eacdf64 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Mon, 26 May 2025 11:51:02 +0200 Subject: [PATCH 18/18] uncomment calibration --- scripts/start/projects/paper_MitiConsv.R | 42 ++++++++++++------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/scripts/start/projects/paper_MitiConsv.R b/scripts/start/projects/paper_MitiConsv.R index 3baab8f5c..ea93fce8b 100644 --- a/scripts/start/projects/paper_MitiConsv.R +++ b/scripts/start/projects/paper_MitiConsv.R @@ -25,34 +25,34 @@ library(gdx2) # Load start functions source("scripts/start_functions.R") -# # ==================== -# # Calibration -# # ==================== +# ==================== +# Calibration +# ==================== -# source("config/default.cfg") +source("config/default.cfg") -# cfg$title <- paste0(rev, "_calib_MitiConsv") -# cfg$output <- c("rds_report", "validation_short") -# cfg$force_replace <- TRUE +cfg$title <- paste0(rev, "_calib_MitiConsv") +cfg$output <- c("rds_report", "validation_short") +cfg$force_replace <- TRUE -# # land conversion cost calibration settings -# cfg$recalibrate_landconversion_cost <- TRUE +# land conversion cost calibration settings +cfg$recalibrate_landconversion_cost <- TRUE -# # cc is new default -# cfg <- setScenario(cfg, c("SSP2", "nocc_hist", "NPI", "ForestryExo")) -# cfg <- setScenario(cfg, c("MitiConsv"), scenario_config = "config/projects/scenario_config_miti_consv.csv") +# cc is new default +cfg <- setScenario(cfg, c("SSP2", "nocc_hist", "NPI", "ForestryExo")) +cfg <- setScenario(cfg, c("MitiConsv"), scenario_config = "config/projects/scenario_config_miti_consv.csv") -# # sticky -# cfg$gms$factor_costs <- "sticky_feb18" +# sticky +cfg$gms$factor_costs <- "sticky_feb18" -# # SNV habitat defintion -# cfg$gms$land_snv <- "secdforest, other" +# SNV habitat defintion +cfg$gms$land_snv <- "secdforest, other" -# # marginal land scenario -# cfg$gms$c29_marginal_land <- "q33_marginal" +# marginal land scenario +cfg$gms$c29_marginal_land <- "q33_marginal" -# start_run(cfg = cfg) -# calib_tgz <- magpie4::submitCalibration(paste(rev, "MitiConsv", sep = "_")) +start_run(cfg = cfg) +calib_tgz <- magpie4::submitCalibration(paste(rev, "MitiConsv", sep = "_")) # ==================== # Scenario runs @@ -90,7 +90,7 @@ for (scen in scenarios) { cfg <- setScenario(cfg, "MitiConsv", scenario_config = "config/projects/scenario_config_miti_consv.csv") # Calibration settings - # cfg$input["calibration"] <- calib_tgz + cfg$input["calibration"] <- calib_tgz # sticky cfg$gms$factor_costs <- "sticky_feb18"