From 0bfa83e539b8f4ce2ac5c397352cef15ccda6c3a Mon Sep 17 00:00:00 2001 From: florianh Date: Sat, 17 Jun 2023 16:00:04 +0200 Subject: [PATCH 01/68] peatland module 2023 --- modules/58_peatland/module.gms | 1 + modules/58_peatland/on_2023/declarations.gms | 83 +++++++++++++ modules/58_peatland/on_2023/equations.gms | 114 ++++++++++++++++++ modules/58_peatland/on_2023/input.gms | 40 +++++++ modules/58_peatland/on_2023/postsolve.gms | 115 +++++++++++++++++++ modules/58_peatland/on_2023/preloop.gms | 43 +++++++ modules/58_peatland/on_2023/presolve.gms | 57 +++++++++ modules/58_peatland/on_2023/realization.gms | 29 +++++ modules/58_peatland/on_2023/scaling.gms | 9 ++ modules/58_peatland/on_2023/sets.gms | 94 +++++++++++++++ 10 files changed, 585 insertions(+) create mode 100644 modules/58_peatland/on_2023/declarations.gms create mode 100644 modules/58_peatland/on_2023/equations.gms create mode 100644 modules/58_peatland/on_2023/input.gms create mode 100644 modules/58_peatland/on_2023/postsolve.gms create mode 100644 modules/58_peatland/on_2023/preloop.gms create mode 100644 modules/58_peatland/on_2023/presolve.gms create mode 100644 modules/58_peatland/on_2023/realization.gms create mode 100644 modules/58_peatland/on_2023/scaling.gms create mode 100644 modules/58_peatland/on_2023/sets.gms diff --git a/modules/58_peatland/module.gms b/modules/58_peatland/module.gms index 66a828b7bf..4304ec38f9 100644 --- a/modules/58_peatland/module.gms +++ b/modules/58_peatland/module.gms @@ -14,4 +14,5 @@ *###################### R SECTION START (MODULETYPES) ########################## $Ifi "%peatland%" == "off" $include "./modules/58_peatland/off/realization.gms" $Ifi "%peatland%" == "on" $include "./modules/58_peatland/on/realization.gms" +$Ifi "%peatland%" == "on_2023" $include "./modules/58_peatland/on_2023/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/58_peatland/on_2023/declarations.gms b/modules/58_peatland/on_2023/declarations.gms new file mode 100644 index 0000000000..0effd7a210 --- /dev/null +++ b/modules/58_peatland/on_2023/declarations.gms @@ -0,0 +1,83 @@ +*** | (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 + +parameters + p58_scaling_factor(j) Scaling factor for managed peatland (1) + p58_calib_factor(j,land58) Calibration factor for managed peatland (1) + p58_peatland_degrad(j) Intermediate calculation in peatland initialization (mio. ha) + p58_ipcc_wetland_ef(clcl58,land58,emis58,man58) Wetland GWP100 emission factors (t CO2eq per ha) + p58_man_land_area(j) Total managed land (mio. ha) + pc58_peatland_man(j,man58,land58) Managed peatland (mio. ha) + pc58_peatland_intact(j) Intact peatland (mio. ha) + p58_mapping_cell_climate(j,clcl58) Mapping between cells and climate regions (binary) + p58_peatland_degrad_weight(j,land58) Weight for peatland distribution to land58 (1) + i58_cost_rewet_recur(t) Recurring costs for rewetted peatland (USD05MER per ha) + i58_cost_rewet_onetime(t) One-time costs for peatland restoration (USD05MER per ha) + i58_cost_degrad_recur(t) Recurring costs for degraded peatland (USD05MER per ha) + i58_cost_degrad_onetime(t) One-time costs for peatland degradation (USD05MER per ha) + p58_conversion_factor(emisSub58) Conversion factor from GWP100 GHG emissions to element (1) +; + +equations + q58_transition_matrix(j) Peatland transitions (mio. ha) + q58_transition_to(j,to58) Peatland transitions to (mio. ha) + q58_transition_from(j,from58) Peatland transitions from (mio. ha) + q58_expansion(j,to58) Peatland expansion (mio. ha) + q58_reduction(j,from58) Peatland reduction (mio. ha) + q58_peatland_degrad(j,land58) Constraint for peatland degradation (mio. ha) + q58_peatland_rewet(j) Constraint for peatland rewetting (mio. ha) + q58_peatland_cost_full(j) One-time and recurring cost of peatland conversion and management including artifical balance cost (mio. USD05MER per yr) + q58_peatland_cost(j) One-time and recurring cost of peatland conversion and management (mio. USD05MER per yr) + q58_peatland_cost_annuity(j) Annuity costs of peatland conversion in the current timestep (mio. USD05MER per yr) + q58_peatland_emis_detail(j,emis58) Detailed GHG emissions from managed peatland (t CO2eq per year) + q58_peatland_emis(i,poll58) GHG emissions from managed peatland (Tg per yr) +; + +variables + vm_peatland_cost(j) One-time and recurring cost of managed peatland including artifical balance cost (mio. USD05MER per yr) + v58_peatland_cost(j) One-time and recurring cost of managed peatland (mio. USD05MER per yr) + v58_peatland_cost_annuity(j) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) + v58_peatland_emis(j,emis58) Detailed GHG emissions from managed peatland (t CO2eq per year) +; + +positive variables + v58_lu_transitions(j,from58,to58) Peatland transitions (mio. ha) + v58_expansion(j,stat58) Peatland expansion (mio. ha) + v58_reduction(j,stat58) Peatland reduction (mio. ha) + v58_peatland_man(j,man58,land58) Managed peatland (mio. ha) + v58_peatland_intact(j) Intact peatland (mio. ha) + v58_balance_positive(j) Balance variable for peatland transitions (mio. ha) + v58_balance_negative(j) Balance variable for peatland transitions (mio. ha) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov_peatland_cost(t,j,type) One-time and recurring cost of managed peatland including artifical balance cost (mio. USD05MER per yr) + ov58_peatland_cost(t,j,type) One-time and recurring cost of managed peatland (mio. USD05MER per yr) + ov58_peatland_cost_annuity(t,j,type) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) + ov58_peatland_emis(t,j,emis58,type) Detailed GHG emissions from managed peatland (t CO2eq per year) + ov58_lu_transitions(t,j,from58,to58,type) Peatland transitions (mio. ha) + ov58_expansion(t,j,stat58,type) Peatland expansion (mio. ha) + ov58_reduction(t,j,stat58,type) Peatland reduction (mio. ha) + ov58_peatland_man(t,j,man58,land58,type) Managed peatland (mio. ha) + ov58_peatland_intact(t,j,type) Intact peatland (mio. ha) + ov58_balance_positive(t,j,type) Balance variable for peatland transitions (mio. ha) + ov58_balance_negative(t,j,type) Balance variable for peatland transitions (mio. ha) + oq58_transition_matrix(t,j,type) Peatland transitions (mio. ha) + oq58_transition_to(t,j,to58,type) Peatland transitions to (mio. ha) + oq58_transition_from(t,j,from58,type) Peatland transitions from (mio. ha) + oq58_expansion(t,j,to58,type) Peatland expansion (mio. ha) + oq58_reduction(t,j,from58,type) Peatland reduction (mio. ha) + oq58_peatland_degrad(t,j,land58,type) Constraint for peatland degradation (mio. ha) + oq58_peatland_rewet(t,j,type) Constraint for peatland rewetting (mio. ha) + oq58_peatland_cost_full(t,j,type) One-time and recurring cost of peatland conversion and management including artifical balance cost (mio. USD05MER per yr) + oq58_peatland_cost(t,j,type) One-time and recurring cost of peatland conversion and management (mio. USD05MER per yr) + oq58_peatland_cost_annuity(t,j,type) Annuity costs of peatland conversion in the current timestep (mio. USD05MER per yr) + oq58_peatland_emis_detail(t,j,emis58,type) Detailed GHG emissions from managed peatland (t CO2eq per year) + oq58_peatland_emis(t,i,poll58,type) GHG emissions from managed peatland (Tg per yr) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/58_peatland/on_2023/equations.gms b/modules/58_peatland/on_2023/equations.gms new file mode 100644 index 0000000000..b2214146eb --- /dev/null +++ b/modules/58_peatland/on_2023/equations.gms @@ -0,0 +1,114 @@ +*** | (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 + +*' Land transition matrix for peatland area. +*' The sum of current peatland area defined in `v58_lu_transitions` has to equal the sum of +*' peatland area in the previous time step (`pc58_peatland_man` + `pc58_peatland_intact`). +*' The two balancing variables `v58_balance_positive` and `v58_balance_negative` are needed +*' to avoid technical infeasibilities due to small differences in accuracy between +*' variables and parameters in GAMS. The use of `v58_balance_positive` and +*' `v58_balance_negative` is minimized by putting a high cost factor on these variables +*' (`q58_peatland_cost_full`). In practice, `v58_balance_positive` and +*' `v58_balance_negative`should deviate from zero only in exceptional cases. + + q58_transition_matrix(j2) .. + sum((from58,to58), v58_lu_transitions(j2,from58,to58)) + + v58_balance_positive(j2) - v58_balance_negative(j2) =e= + sum((man58,land58), pc58_peatland_man(j2,man58,land58)) + pc58_peatland_intact(j2); + + q58_transition_to(j2,to58) .. + sum(from58, v58_lu_transitions(j2,from58,to58)) =e= + v58_peatland_man(j2,"degrad","crop")$(sameas(to58,"degrad_crop")) + + v58_peatland_man(j2,"degrad","past")$(sameas(to58,"degrad_past")) + + v58_peatland_man(j2,"degrad","forestry")$(sameas(to58,"degrad_forestry")) + + v58_peatland_man(j2,"unused","crop")$(sameas(to58,"unused_crop")) + + v58_peatland_man(j2,"unused","past")$(sameas(to58,"unused_past")) + + v58_peatland_man(j2,"unused","forestry")$(sameas(to58,"unused_forestry")) + + v58_peatland_man(j2,"rewet","crop")$(sameas(to58,"rewet_crop")) + + v58_peatland_man(j2,"rewet","past")$(sameas(to58,"rewet_past")) + + v58_peatland_man(j2,"rewet","forestry")$(sameas(to58,"rewet_forestry")) + + v58_peatland_intact(j2)$(sameas(to58,"intact")); + + q58_transition_from(j2,from58) .. + sum(to58, v58_lu_transitions(j2,from58,to58)) =e= + pc58_peatland_man(j2,"degrad","crop")$(sameas(from58,"degrad_crop")) + + pc58_peatland_man(j2,"degrad","past")$(sameas(from58,"degrad_past")) + + pc58_peatland_man(j2,"degrad","forestry")$(sameas(from58,"degrad_forestry")) + + pc58_peatland_man(j2,"unused","crop")$(sameas(from58,"unused_crop")) + + pc58_peatland_man(j2,"unused","past")$(sameas(from58,"unused_past")) + + pc58_peatland_man(j2,"unused","forestry")$(sameas(from58,"unused_forestry")) + + pc58_peatland_man(j2,"rewet","crop")$(sameas(from58,"rewet_crop")) + + pc58_peatland_man(j2,"rewet","past")$(sameas(from58,"rewet_past")) + + pc58_peatland_man(j2,"rewet","forestry")$(sameas(from58,"rewet_forestry")) + + pc58_peatland_intact(j2)$(sameas(from58,"intact")); + +*' The following two equations calculate land expansion and land contraction based +*' on the above land transition matrix. + + q58_expansion(j2,to58) .. + v58_expansion(j2,to58) =e= + sum(from58$(not sameas(from58,to58)), + v58_lu_transitions(j2,from58,to58)); + + q58_reduction(j2,from58) .. + v58_reduction(j2,from58) =e= + sum(to58$(not sameas(from58,to58)), + v58_lu_transitions(j2,from58,to58)); + +*' Future peatland degradation (`v58_peatland_man`) depends on managed land (`vm_land`), +*' scaled with the ratio of total peatland area and total land area (`p58_scaling_factor`) +*' and a calibration factor (`p58_calib_factor`) for alignment with historic levels of degraded peatland. +*' By multiplying changes in managed land (`vm_land`) with the scaling factor we implicitly assume +*' that intact peatlands are distributed equally within a grid cell. +*' The following example illustrates the mechanism used for projecting peatland dynamics: +*' In a given grid cell, the total land area is 50 Mha and the total peatland area is 10 Mha. +*' Therefore, the scaling factor is 0.2 (10 Mha divided by 50 Mha). +*' If cropland expands by 5 Mha, 1 Mha of intact peatland is converted to degraded peatland (5 Mha*0.2). +*' If the total cell would become cropland, degraded peatland would equal to the total peatland area (50 Mha * 0.2 = 10 Mha). + + q58_peatland_degrad(j2,land58)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. + v58_peatland_man(j2,"degrad",land58) =e= + vm_land(j2,land58)*p58_scaling_factor(j2)*p58_calib_factor(j2,land58); + +*' This constraint avoids the conversion of intact peatland into rewetted peatland. + + q58_peatland_rewet(j2) .. + sum(stat_rewet58, v58_expansion(j2,stat_rewet58)) =l= + sum(stat_degrad58, v58_reduction(j2,stat_degrad58) + v58_expansion(j2,stat_degrad58)) - v58_reduction(j2,"intact"); + +*' Costs for peatland degradation and rewetting + + q58_peatland_cost_full(j2) .. + vm_peatland_cost(j2) =e= v58_peatland_cost(j2) + (v58_balance_positive(j2) + v58_balance_negative(j2)) * s58_cost_balance; + + q58_peatland_cost(j2) .. + v58_peatland_cost(j2) =e= v58_peatland_cost_annuity(j2) + + sum(land58, v58_peatland_man(j2,"rewet",land58)) * sum(ct, i58_cost_rewet_recur(ct)) + + sum((degrad58,land58), v58_peatland_man(j2,degrad58,land58)) * sum(ct, i58_cost_degrad_recur(ct)); + + q58_peatland_cost_annuity(j2) .. + v58_peatland_cost_annuity(j2) =e= + (sum(stat_rewet58, v58_expansion(j2,stat_rewet58)) * sum(ct, i58_cost_rewet_onetime(ct)) + + (v58_reduction(j2,"intact") + sum(stat_rewet58, v58_reduction(j2,stat_rewet58))) * sum(ct, i58_cost_degrad_onetime(ct))) + * sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); + +*' GHG emissions from managed peatlands (degraded and rewetted) + + q58_peatland_emis_detail(j2,emis58) .. + v58_peatland_emis(j2,emis58) =e= + sum((man58,land58,clcl58), v58_peatland_man(j2,man58,land58) * + p58_mapping_cell_climate(j2,clcl58) * p58_ipcc_wetland_ef(clcl58,land58,emis58,man58)); + +*' Conversion from CO2 equivalent to element unit for interface `vm_emissions_reg` +*' using GWP100 conversion factors from AR5 (same as in @wilson_2016). + + q58_peatland_emis(i2,poll58) .. + vm_emissions_reg(i2,"peatland",poll58) =e= + sum((cell(i2,j2),emisSub58_to_poll58(emisSub58,poll58)), + v58_peatland_emis(j2,emisSub58) * p58_conversion_factor(emisSub58)); diff --git a/modules/58_peatland/on_2023/input.gms b/modules/58_peatland/on_2023/input.gms new file mode 100644 index 0000000000..2a9a73cc03 --- /dev/null +++ b/modules/58_peatland/on_2023/input.gms @@ -0,0 +1,40 @@ +*** | (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 + s58_cost_rewet_recur Recurring costs for rewetted peatland (USD05MER per ha) / 200 / + s58_cost_rewet_onetime One-time costs for peatland restoration (USD05MER per ha) / 7000 / + s58_cost_degrad_recur Recurring costs for degraded peatland (USD05MER per ha) / 0 / + s58_cost_degrad_onetime One-time costs for peatland degradation (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 to 2015 levels (year) / 2015 / + s58_cost_balance Artificial cost for balance variable (USD05MER per ha) / 1e+06 / +; + +parameters +f58_peatland_degrad(j) Degrading peatland area (mio. ha) +/ +$ondelim +$include "./modules/58_peatland/input/f58_peatland_degrad.cs2" +$offdelim +/ +; + +parameters +f58_peatland_intact(j) Intact peatland area (mio. ha) +/ +$ondelim +$include "./modules/58_peatland/input/f58_peatland_intact.cs2" +$offdelim +/ +; + +table f58_ipcc_wetland_ef(clcl58,land58,emis58,ef58) Wetland GWP100 emission factors (t CO2eq per ha) +$ondelim +$include "./modules/58_peatland/input/f58_ipcc_wetland_ef.cs3" +$offdelim +; diff --git a/modules/58_peatland/on_2023/postsolve.gms b/modules/58_peatland/on_2023/postsolve.gms new file mode 100644 index 0000000000..0c9b5643f0 --- /dev/null +++ b/modules/58_peatland/on_2023/postsolve.gms @@ -0,0 +1,115 @@ +*** | (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 + +* Update of degraded peatland based on current managed land in the last time steps of fixed peatland area. +if (m_year(t) = s58_fix_peatland, + p58_scaling_factor(j)$(sum(land, vm_land.l(j,land)) > 1e-20) = (sum((man58,land58), v58_peatland_man.l(j,man58,land58)) + v58_peatland_intact.l(j)) / sum(land, vm_land.l(j,land)); + p58_calib_factor(j,land58) = 1; + p58_calib_factor(j,land58)$(vm_land.l(j,land58) * p58_scaling_factor(j) > 1e-20) = (p58_peatland_degrad(j) * p58_peatland_degrad_weight(j,land58)) / (vm_land.l(j,land58) * p58_scaling_factor(j)); + p58_calib_factor(j,land58)$(p58_calib_factor(j,land58) > 1) = 1; + pc58_peatland_man(j,"degrad",land58) = vm_land.l(j,land58) * p58_scaling_factor(j) * p58_calib_factor(j,land58); + pc58_peatland_man(j,"unused",land58) = p58_peatland_degrad(j) * p58_peatland_degrad_weight(j,land58) - pc58_peatland_man(j,"degrad",land58); +else + pc58_peatland_man(j,man58,land58) = v58_peatland_man.l(j,man58,land58); +); + +pc58_peatland_intact(j) = v58_peatland_intact.l(j); + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov_peatland_cost(t,j,"marginal") = vm_peatland_cost.m(j); + ov58_peatland_cost(t,j,"marginal") = v58_peatland_cost.m(j); + ov58_peatland_cost_annuity(t,j,"marginal") = v58_peatland_cost_annuity.m(j); + ov58_peatland_emis(t,j,emis58,"marginal") = v58_peatland_emis.m(j,emis58); + ov58_lu_transitions(t,j,from58,to58,"marginal") = v58_lu_transitions.m(j,from58,to58); + ov58_expansion(t,j,stat58,"marginal") = v58_expansion.m(j,stat58); + ov58_reduction(t,j,stat58,"marginal") = v58_reduction.m(j,stat58); + ov58_peatland_man(t,j,man58,land58,"marginal") = v58_peatland_man.m(j,man58,land58); + ov58_peatland_intact(t,j,"marginal") = v58_peatland_intact.m(j); + ov58_balance_positive(t,j,"marginal") = v58_balance_positive.m(j); + ov58_balance_negative(t,j,"marginal") = v58_balance_negative.m(j); + oq58_transition_matrix(t,j,"marginal") = q58_transition_matrix.m(j); + oq58_transition_to(t,j,to58,"marginal") = q58_transition_to.m(j,to58); + oq58_transition_from(t,j,from58,"marginal") = q58_transition_from.m(j,from58); + oq58_expansion(t,j,to58,"marginal") = q58_expansion.m(j,to58); + oq58_reduction(t,j,from58,"marginal") = q58_reduction.m(j,from58); + oq58_peatland_degrad(t,j,land58,"marginal") = q58_peatland_degrad.m(j,land58); + oq58_peatland_rewet(t,j,"marginal") = q58_peatland_rewet.m(j); + oq58_peatland_cost_full(t,j,"marginal") = q58_peatland_cost_full.m(j); + oq58_peatland_cost(t,j,"marginal") = q58_peatland_cost.m(j); + oq58_peatland_cost_annuity(t,j,"marginal") = q58_peatland_cost_annuity.m(j); + oq58_peatland_emis_detail(t,j,emis58,"marginal") = q58_peatland_emis_detail.m(j,emis58); + oq58_peatland_emis(t,i,poll58,"marginal") = q58_peatland_emis.m(i,poll58); + ov_peatland_cost(t,j,"level") = vm_peatland_cost.l(j); + ov58_peatland_cost(t,j,"level") = v58_peatland_cost.l(j); + ov58_peatland_cost_annuity(t,j,"level") = v58_peatland_cost_annuity.l(j); + ov58_peatland_emis(t,j,emis58,"level") = v58_peatland_emis.l(j,emis58); + ov58_lu_transitions(t,j,from58,to58,"level") = v58_lu_transitions.l(j,from58,to58); + ov58_expansion(t,j,stat58,"level") = v58_expansion.l(j,stat58); + ov58_reduction(t,j,stat58,"level") = v58_reduction.l(j,stat58); + ov58_peatland_man(t,j,man58,land58,"level") = v58_peatland_man.l(j,man58,land58); + ov58_peatland_intact(t,j,"level") = v58_peatland_intact.l(j); + ov58_balance_positive(t,j,"level") = v58_balance_positive.l(j); + ov58_balance_negative(t,j,"level") = v58_balance_negative.l(j); + oq58_transition_matrix(t,j,"level") = q58_transition_matrix.l(j); + oq58_transition_to(t,j,to58,"level") = q58_transition_to.l(j,to58); + oq58_transition_from(t,j,from58,"level") = q58_transition_from.l(j,from58); + oq58_expansion(t,j,to58,"level") = q58_expansion.l(j,to58); + oq58_reduction(t,j,from58,"level") = q58_reduction.l(j,from58); + oq58_peatland_degrad(t,j,land58,"level") = q58_peatland_degrad.l(j,land58); + oq58_peatland_rewet(t,j,"level") = q58_peatland_rewet.l(j); + oq58_peatland_cost_full(t,j,"level") = q58_peatland_cost_full.l(j); + oq58_peatland_cost(t,j,"level") = q58_peatland_cost.l(j); + oq58_peatland_cost_annuity(t,j,"level") = q58_peatland_cost_annuity.l(j); + oq58_peatland_emis_detail(t,j,emis58,"level") = q58_peatland_emis_detail.l(j,emis58); + oq58_peatland_emis(t,i,poll58,"level") = q58_peatland_emis.l(i,poll58); + ov_peatland_cost(t,j,"upper") = vm_peatland_cost.up(j); + ov58_peatland_cost(t,j,"upper") = v58_peatland_cost.up(j); + ov58_peatland_cost_annuity(t,j,"upper") = v58_peatland_cost_annuity.up(j); + ov58_peatland_emis(t,j,emis58,"upper") = v58_peatland_emis.up(j,emis58); + ov58_lu_transitions(t,j,from58,to58,"upper") = v58_lu_transitions.up(j,from58,to58); + ov58_expansion(t,j,stat58,"upper") = v58_expansion.up(j,stat58); + ov58_reduction(t,j,stat58,"upper") = v58_reduction.up(j,stat58); + ov58_peatland_man(t,j,man58,land58,"upper") = v58_peatland_man.up(j,man58,land58); + ov58_peatland_intact(t,j,"upper") = v58_peatland_intact.up(j); + ov58_balance_positive(t,j,"upper") = v58_balance_positive.up(j); + ov58_balance_negative(t,j,"upper") = v58_balance_negative.up(j); + oq58_transition_matrix(t,j,"upper") = q58_transition_matrix.up(j); + oq58_transition_to(t,j,to58,"upper") = q58_transition_to.up(j,to58); + oq58_transition_from(t,j,from58,"upper") = q58_transition_from.up(j,from58); + oq58_expansion(t,j,to58,"upper") = q58_expansion.up(j,to58); + oq58_reduction(t,j,from58,"upper") = q58_reduction.up(j,from58); + oq58_peatland_degrad(t,j,land58,"upper") = q58_peatland_degrad.up(j,land58); + oq58_peatland_rewet(t,j,"upper") = q58_peatland_rewet.up(j); + oq58_peatland_cost_full(t,j,"upper") = q58_peatland_cost_full.up(j); + oq58_peatland_cost(t,j,"upper") = q58_peatland_cost.up(j); + oq58_peatland_cost_annuity(t,j,"upper") = q58_peatland_cost_annuity.up(j); + oq58_peatland_emis_detail(t,j,emis58,"upper") = q58_peatland_emis_detail.up(j,emis58); + oq58_peatland_emis(t,i,poll58,"upper") = q58_peatland_emis.up(i,poll58); + ov_peatland_cost(t,j,"lower") = vm_peatland_cost.lo(j); + ov58_peatland_cost(t,j,"lower") = v58_peatland_cost.lo(j); + ov58_peatland_cost_annuity(t,j,"lower") = v58_peatland_cost_annuity.lo(j); + ov58_peatland_emis(t,j,emis58,"lower") = v58_peatland_emis.lo(j,emis58); + ov58_lu_transitions(t,j,from58,to58,"lower") = v58_lu_transitions.lo(j,from58,to58); + ov58_expansion(t,j,stat58,"lower") = v58_expansion.lo(j,stat58); + ov58_reduction(t,j,stat58,"lower") = v58_reduction.lo(j,stat58); + ov58_peatland_man(t,j,man58,land58,"lower") = v58_peatland_man.lo(j,man58,land58); + ov58_peatland_intact(t,j,"lower") = v58_peatland_intact.lo(j); + ov58_balance_positive(t,j,"lower") = v58_balance_positive.lo(j); + ov58_balance_negative(t,j,"lower") = v58_balance_negative.lo(j); + oq58_transition_matrix(t,j,"lower") = q58_transition_matrix.lo(j); + oq58_transition_to(t,j,to58,"lower") = q58_transition_to.lo(j,to58); + oq58_transition_from(t,j,from58,"lower") = q58_transition_from.lo(j,from58); + oq58_expansion(t,j,to58,"lower") = q58_expansion.lo(j,to58); + oq58_reduction(t,j,from58,"lower") = q58_reduction.lo(j,from58); + oq58_peatland_degrad(t,j,land58,"lower") = q58_peatland_degrad.lo(j,land58); + oq58_peatland_rewet(t,j,"lower") = q58_peatland_rewet.lo(j); + oq58_peatland_cost_full(t,j,"lower") = q58_peatland_cost_full.lo(j); + oq58_peatland_cost(t,j,"lower") = q58_peatland_cost.lo(j); + oq58_peatland_cost_annuity(t,j,"lower") = q58_peatland_cost_annuity.lo(j); + oq58_peatland_emis_detail(t,j,emis58,"lower") = q58_peatland_emis_detail.lo(j,emis58); + oq58_peatland_emis(t,i,poll58,"lower") = q58_peatland_emis.lo(i,poll58); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/58_peatland/on_2023/preloop.gms b/modules/58_peatland/on_2023/preloop.gms new file mode 100644 index 0000000000..c679acaa1d --- /dev/null +++ b/modules/58_peatland/on_2023/preloop.gms @@ -0,0 +1,43 @@ +*** | (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_emissions_reg.fx(i,"peatland",pollutants) = 0; +vm_emissions_reg.lo(i,"peatland",poll58) = -Inf; +vm_emissions_reg.up(i,"peatland",poll58) = Inf; + +* GHG emission conversion factors from GWP100 to element unit. +p58_conversion_factor("co2") = 12/44; +p58_conversion_factor("ch4") = 1/34; +p58_conversion_factor("n2o") = 1/298*28/44; + +p58_mapping_cell_climate(j,clcl58) = sum(clcl_mapping(clcl,clcl58),pm_climate_class(j,clcl)); + +p58_ipcc_wetland_ef(clcl58,land58,emis58,ef58) = f58_ipcc_wetland_ef(clcl58,land58,emis58,ef58); +p58_ipcc_wetland_ef(clcl58,land58,emis58,"unused") = f58_ipcc_wetland_ef(clcl58,land58,emis58,"degrad"); + +* Peatland scaling factor: ratio of total peatland area and total land area +p58_scaling_factor(j) = (f58_peatland_degrad(j) + f58_peatland_intact(j)) / sum(land, pcm_land(j,land)); +* Intact peatland area +pc58_peatland_intact(j) = f58_peatland_intact(j); +* Share of cropland, pasture and forestry in total managed land, used for distribution of degraded peatland (f58_peatland_degrad) to managed land. +p58_man_land_area(j) = sum(land58, pcm_land(j,land58)); +p58_peatland_degrad_weight(j,land58) = 1/card(land58); +p58_peatland_degrad_weight(j,land58)$(p58_man_land_area(j) > 0) = pcm_land(j,land58) / p58_man_land_area(j); +* Calibration factor for alignment with historic levels of degraded peatland +p58_calib_factor(j,land58) = 1; +p58_calib_factor(j,land58)$(pcm_land(j,land58) * p58_scaling_factor(j) > 1e-20) = (f58_peatland_degrad(j) * p58_peatland_degrad_weight(j,land58)) / (pcm_land(j,land58)*p58_scaling_factor(j)); +p58_calib_factor(j,land58)$(p58_calib_factor(j,land58) > 1) = 1; + +* Initialization of peatland +pc58_peatland_man(j,man58,land58) = 0; +* Degraded peatland is estimated by multiplication of managed land (pcm_land) with the peatland scaling factor (p58_scaling_factor). +* The calibration factor (p58_calib_factor) reduces this estimate to historic levels of degraded peatland. p58_calib_factor is 1 for most cases. +pc58_peatland_man(j,"degrad",land58) = pcm_land(j,land58) * p58_scaling_factor(j) * p58_calib_factor(j,land58); +* The residual is added to an "unused" category, which represents degraded but unused peatland. +pc58_peatland_man(j,"unused",land58) = f58_peatland_degrad(j) * p58_peatland_degrad_weight(j,land58) - pc58_peatland_man(j,"degrad",land58); +pc58_peatland_man(j,"unused",land58)$(pc58_peatland_man(j,"unused",land58) < 0) = 0; +p58_peatland_degrad(j) = sum((man58,land58), pc58_peatland_man(j,man58,land58)); diff --git a/modules/58_peatland/on_2023/presolve.gms b/modules/58_peatland/on_2023/presolve.gms new file mode 100644 index 0000000000..ce77e7f904 --- /dev/null +++ b/modules/58_peatland/on_2023/presolve.gms @@ -0,0 +1,57 @@ +*** | (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 bound for peatland area + v58_peatland_man.lo(j,man58,land58) = 0; + v58_peatland_man.up(j,"degrad",land58) = Inf; + v58_peatland_man.up(j,"unused",land58) = Inf; + v58_peatland_man.l(j,man58,land58) = pc58_peatland_man(j,man58,land58); + +*define allowed transitions within peatland area + v58_lu_transitions.fx(j,from58,to58)$(not sameas(from58,to58)) = 0; + v58_lu_transitions.up(j,"intact","degrad_crop") = Inf; + v58_lu_transitions.up(j,"intact","degrad_past") = Inf; + v58_lu_transitions.up(j,"intact","degrad_forestry") = Inf; + v58_lu_transitions.up(j,"degrad_crop","unused_crop") = Inf; + v58_lu_transitions.up(j,"degrad_past","unused_past") = Inf; + v58_lu_transitions.up(j,"degrad_forestry","unused_forestry") = Inf; + v58_lu_transitions.up(j,"degrad_crop","rewet_crop") = Inf; + v58_lu_transitions.up(j,"degrad_past","rewet_past") = Inf; + v58_lu_transitions.up(j,"degrad_forestry","rewet_forestry") = Inf; + v58_lu_transitions.up(j,"unused_crop","degrad_crop") = Inf; + v58_lu_transitions.up(j,"unused_crop","degrad_past") = Inf; + v58_lu_transitions.up(j,"unused_crop","degrad_forestry") = Inf; + v58_lu_transitions.up(j,"unused_past","degrad_crop") = Inf; + v58_lu_transitions.up(j,"unused_past","degrad_past") = Inf; + v58_lu_transitions.up(j,"unused_past","degrad_forestry") = Inf; + v58_lu_transitions.up(j,"unused_forestry","degrad_crop") = Inf; + v58_lu_transitions.up(j,"unused_forestry","degrad_past") = Inf; + v58_lu_transitions.up(j,"unused_forestry","degrad_forestry") = Inf; + v58_lu_transitions.up(j,"unused_crop","rewet_crop") = Inf; + v58_lu_transitions.up(j,"unused_past","rewet_past") = Inf; + v58_lu_transitions.up(j,"unused_forestry","rewet_forestry") = Inf; + v58_lu_transitions.up(j,"rewet_crop","degrad_crop") = Inf; + v58_lu_transitions.up(j,"rewet_past","degrad_past") = Inf; + v58_lu_transitions.up(j,"rewet_forestry","degrad_forestry") = Inf; + +if (m_year(t) <= s58_fix_peatland, + v58_peatland_man.fx(j,man58,land58) = pc58_peatland_man(j,man58,land58); + v58_peatland_intact.fx(j) = pc58_peatland_intact(j); + i58_cost_rewet_recur(t) = 0; + i58_cost_rewet_onetime(t) = 0; + i58_cost_degrad_recur(t) = 0; + i58_cost_degrad_onetime(t) = 0; +else + v58_peatland_man.up(j,"rewet",land58) = s58_rewetting_switch; + v58_peatland_intact.lo(j) = 0; + v58_peatland_intact.up(j) = pc58_peatland_intact(j); + v58_peatland_intact.l(j) = pc58_peatland_intact(j); + i58_cost_rewet_recur(t) = s58_cost_rewet_recur; + i58_cost_rewet_onetime(t) = s58_cost_rewet_onetime; + i58_cost_degrad_recur(t) = s58_cost_degrad_recur; + i58_cost_degrad_onetime(t) = s58_cost_degrad_onetime; +); diff --git a/modules/58_peatland/on_2023/realization.gms b/modules/58_peatland/on_2023/realization.gms new file mode 100644 index 0000000000..587ab2868f --- /dev/null +++ b/modules/58_peatland/on_2023/realization.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 + +*' @description In this realization, the state of peatlands is modelled as described in @humpenoder_peatland_2020. +*' The initial map of peatland area consists of intact and degraded peatland area for the year 2015. +*' Future peatland dynamics depend on the ratio of total peatland area and total land area. +*' GHG emissions from degraded and rewetted peatlands as are calculated based on GHG emission factors from the +*' "2013 Supplement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories: Wetlands". +*' @stop + + +*' +*' @limitations Peatland area and GHG emissions are fixed to 2015 levels for the historic period, +*' depending on `s58_fix_peatland`. Organic carbon stocks in peatlands are not accounted for. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/58_peatland/on_2023/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/58_peatland/on_2023/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/58_peatland/on_2023/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/58_peatland/on_2023/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/58_peatland/on_2023/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/58_peatland/on_2023/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/58_peatland/on_2023/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/58_peatland/on_2023/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/58_peatland/on_2023/scaling.gms b/modules/58_peatland/on_2023/scaling.gms new file mode 100644 index 0000000000..0d3b287285 --- /dev/null +++ b/modules/58_peatland/on_2023/scaling.gms @@ -0,0 +1,9 @@ +*** | (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 + +v58_expansion.scale(j,stat58) = 10e-3; +v58_reduction.scale(j,stat58) = 10e-3; diff --git a/modules/58_peatland/on_2023/sets.gms b/modules/58_peatland/on_2023/sets.gms new file mode 100644 index 0000000000..a9bfd548b5 --- /dev/null +++ b/modules/58_peatland/on_2023/sets.gms @@ -0,0 +1,94 @@ +*** | (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 + +sets + + man58 State of managed peatland + / degrad, unused, rewet / + + degrad58(man58) State of degraded peatland + / degrad, unused / + + ef58(man58) Peatland emissions factors + / degrad, rewet / + + land58(land) Managed land types + / crop, past, forestry / + + stat58 Peatland status + / intact, + degrad_crop, degrad_past, degrad_forestry, + unused_crop, unused_past, unused_forestry, + rewet_crop, rewet_past, rewet_forestry / + + stat_man58(stat58) Peatland status managed land + / degrad_crop, degrad_past, degrad_forestry, + unused_crop, unused_past, unused_forestry, + rewet_crop, rewet_past, rewet_forestry / + + stat_degrad58(stat58) Peatland status degrad + / degrad_crop, degrad_past, degrad_forestry, + unused_crop, unused_past, unused_forestry / + + stat_rewet58(stat58) Peatland status rewet + / rewet_crop, rewet_past, rewet_forestry / + + emis58 Wetland emission types + / co2, doc, ch4, n2o / + + emisSub58(emis58) Wetland emission types + / co2, ch4, n2o / + + poll58(pollutants) Wetland emissions that can be taxed + / co2_c, ch4, n2o_n_direct / + + emisSub58_to_poll58(emisSub58,poll58) Mapping + / co2 .(co2_c) + ch4 .(ch4) + n2o .(n2o_n_direct) / + + clcl58 simple climate classes + / tropical, temperate, boreal / + + clcl_mapping(clcl,clcl58) Mapping between detailed and simple climate classes + / + Af .(tropical) "Tropical rainforest climate" + Am .(tropical) "Tropical monsoon climate" + As .(tropical) "Tropical dry savanna climate" + Aw .(tropical) "Tropical savanna, wet" + BSh .(tropical) "Hot semi-arid (steppe) climate" + BSk .(tropical) "Cold semi-arid (steppe) climate" + BWh .(tropical) "Hot deserts climate" + BWk .(tropical) "Cold desert climate" + Cfa .(tropical) "Humid subtropical climate" + Cfb .(temperate) "Temperate oceanic climate" + Cfc .(boreal) "Subpolar oceanic climate" + Csa .(temperate) "Hot-summer Mediterranean climate" + Csb .(temperate) "Warm-summer Mediterranean climate" + Csc .(temperate) "Cool-summer Mediterranean climate" + Cwa .(tropical) "Monsoon-influenced humid subtropical climate" + Cwb .(tropical) "Dry-winter subtropical highland climate" + Cwc .(boreal) "Dry-winter subpolar oceanic climate" + Dfa .(temperate) "Hot-summer humid continental climate" + Dfb .(boreal) "Warm-summer humid continental climate" + Dfc .(boreal) "Subarctic climate" + Dfd .(boreal) "Extremely cold subarctic climate" + Dsa .(temperate) "Hot, dry-summer continental climate" + Dsb .(boreal) "Warm, dry-summer continental climate" + Dsc .(boreal) "Dry-summer subarctic climate" + Dsd .(boreal) "snow summer dry extremely continental" + Dwa .(temperate) "Monsoon-influenced hot-summer humid continental climate" + Dwb .(boreal) "Monsoon-influenced warm-summer humid continental climate" + Dwc .(boreal) "Monsoon-influenced subarctic climate" + Dwd .(boreal) "Monsoon-influenced extremely cold subarctic climate" + EF .(boreal) "Ice cap climate" + ET .(boreal) "Tundra" + / + +; + +alias (stat58, from58, to58); From abdcb8034ac6ca9e09ccf4670e0cb05052597d4c Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 14 Jul 2023 15:06:36 +0200 Subject: [PATCH 02/68] update --- modules/58_peatland/on_2023/declarations.gms | 72 ++++---- modules/58_peatland/on_2023/equations.gms | 109 ++++------- modules/58_peatland/on_2023/input.gms | 30 +--- modules/58_peatland/on_2023/postsolve.gms | 180 ++++++++----------- modules/58_peatland/on_2023/preloop.gms | 39 ++-- modules/58_peatland/on_2023/presolve.gms | 48 ++--- modules/58_peatland/on_2023/scaling.gms | 2 - modules/58_peatland/on_2023/sets.gms | 7 +- 8 files changed, 188 insertions(+), 299 deletions(-) diff --git a/modules/58_peatland/on_2023/declarations.gms b/modules/58_peatland/on_2023/declarations.gms index 0effd7a210..31fbaba15b 100644 --- a/modules/58_peatland/on_2023/declarations.gms +++ b/modules/58_peatland/on_2023/declarations.gms @@ -9,9 +9,9 @@ parameters p58_scaling_factor(j) Scaling factor for managed peatland (1) p58_calib_factor(j,land58) Calibration factor for managed peatland (1) p58_peatland_degrad(j) Intermediate calculation in peatland initialization (mio. ha) - p58_ipcc_wetland_ef(clcl58,land58,emis58,man58) Wetland GWP100 emission factors (t CO2eq per ha) + p58_ipcc_wetland_ef(clcl58,land58,emis58) Wetland GWP100 emission factors (t CO2eq per ha) p58_man_land_area(j) Total managed land (mio. ha) - pc58_peatland_man(j,man58,land58) Managed peatland (mio. ha) + pc58_peatland(j,land58) Managed peatland (mio. ha) pc58_peatland_intact(j) Intact peatland (mio. ha) p58_mapping_cell_climate(j,clcl58) Mapping between cells and climate regions (binary) p58_peatland_degrad_weight(j,land58) Weight for peatland distribution to land58 (1) @@ -23,17 +23,16 @@ parameters ; equations - q58_transition_matrix(j) Peatland transitions (mio. ha) - q58_transition_to(j,to58) Peatland transitions to (mio. ha) - q58_transition_from(j,from58) Peatland transitions from (mio. ha) - q58_expansion(j,to58) Peatland expansion (mio. ha) - q58_reduction(j,from58) Peatland reduction (mio. ha) - q58_peatland_degrad(j,land58) Constraint for peatland degradation (mio. ha) - q58_peatland_rewet(j) Constraint for peatland rewetting (mio. ha) + q58_peatland(j) Constraint for peatland area (mio. ha) + q58_expansion(j,land58) Peatland expansion (mio. ha) + q58_reduction(j,land58) Peatland reduction (mio. ha) + q58_peatland_crop(j) Constraint for peatland degradation (mio. ha) + q58_peatland_past(j) Constraint for peatland degradation (mio. ha) + q58_peatland_forestry(j) Constraint for peatland degradation (mio. ha) q58_peatland_cost_full(j) One-time and recurring cost of peatland conversion and management including artifical balance cost (mio. USD05MER per yr) q58_peatland_cost(j) One-time and recurring cost of peatland conversion and management (mio. USD05MER per yr) q58_peatland_cost_annuity(j) Annuity costs of peatland conversion in the current timestep (mio. USD05MER per yr) - q58_peatland_emis_detail(j,emis58) Detailed GHG emissions from managed peatland (t CO2eq per year) + q58_peatland_emis_detail(j,land58,emis58) Detailed GHG emissions from managed peatland (t CO2eq per year) q58_peatland_emis(i,poll58) GHG emissions from managed peatland (Tg per yr) ; @@ -41,43 +40,34 @@ variables vm_peatland_cost(j) One-time and recurring cost of managed peatland including artifical balance cost (mio. USD05MER per yr) v58_peatland_cost(j) One-time and recurring cost of managed peatland (mio. USD05MER per yr) v58_peatland_cost_annuity(j) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) - v58_peatland_emis(j,emis58) Detailed GHG emissions from managed peatland (t CO2eq per year) + v58_peatland_emis(j,land58,emis58) Detailed GHG emissions from managed peatland (t CO2eq per year) ; positive variables - v58_lu_transitions(j,from58,to58) Peatland transitions (mio. ha) - v58_expansion(j,stat58) Peatland expansion (mio. ha) - v58_reduction(j,stat58) Peatland reduction (mio. ha) - v58_peatland_man(j,man58,land58) Managed peatland (mio. ha) - v58_peatland_intact(j) Intact peatland (mio. ha) - v58_balance_positive(j) Balance variable for peatland transitions (mio. ha) - v58_balance_negative(j) Balance variable for peatland transitions (mio. ha) + v58_expansion(j,land58) Peatland expansion (mio. ha) + v58_reduction(j,land58) Peatland reduction (mio. ha) + v58_peatland(j,land58) Managed peatland (mio. ha) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_peatland_cost(t,j,type) One-time and recurring cost of managed peatland including artifical balance cost (mio. USD05MER per yr) - ov58_peatland_cost(t,j,type) One-time and recurring cost of managed peatland (mio. USD05MER per yr) - ov58_peatland_cost_annuity(t,j,type) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) - ov58_peatland_emis(t,j,emis58,type) Detailed GHG emissions from managed peatland (t CO2eq per year) - ov58_lu_transitions(t,j,from58,to58,type) Peatland transitions (mio. ha) - ov58_expansion(t,j,stat58,type) Peatland expansion (mio. ha) - ov58_reduction(t,j,stat58,type) Peatland reduction (mio. ha) - ov58_peatland_man(t,j,man58,land58,type) Managed peatland (mio. ha) - ov58_peatland_intact(t,j,type) Intact peatland (mio. ha) - ov58_balance_positive(t,j,type) Balance variable for peatland transitions (mio. ha) - ov58_balance_negative(t,j,type) Balance variable for peatland transitions (mio. ha) - oq58_transition_matrix(t,j,type) Peatland transitions (mio. ha) - oq58_transition_to(t,j,to58,type) Peatland transitions to (mio. ha) - oq58_transition_from(t,j,from58,type) Peatland transitions from (mio. ha) - oq58_expansion(t,j,to58,type) Peatland expansion (mio. ha) - oq58_reduction(t,j,from58,type) Peatland reduction (mio. ha) - oq58_peatland_degrad(t,j,land58,type) Constraint for peatland degradation (mio. ha) - oq58_peatland_rewet(t,j,type) Constraint for peatland rewetting (mio. ha) - oq58_peatland_cost_full(t,j,type) One-time and recurring cost of peatland conversion and management including artifical balance cost (mio. USD05MER per yr) - oq58_peatland_cost(t,j,type) One-time and recurring cost of peatland conversion and management (mio. USD05MER per yr) - oq58_peatland_cost_annuity(t,j,type) Annuity costs of peatland conversion in the current timestep (mio. USD05MER per yr) - oq58_peatland_emis_detail(t,j,emis58,type) Detailed GHG emissions from managed peatland (t CO2eq per year) - oq58_peatland_emis(t,i,poll58,type) GHG emissions from managed peatland (Tg per yr) + ov_peatland_cost(t,j,type) One-time and recurring cost of managed peatland including artifical balance cost (mio. USD05MER per yr) + ov58_peatland_cost(t,j,type) One-time and recurring cost of managed peatland (mio. USD05MER per yr) + ov58_peatland_cost_annuity(t,j,type) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) + ov58_peatland_emis(t,j,land58,emis58,type) Detailed GHG emissions from managed peatland (t CO2eq per year) + ov58_expansion(t,j,land58,type) Peatland expansion (mio. ha) + ov58_reduction(t,j,land58,type) Peatland reduction (mio. ha) + ov58_peatland(t,j,land58,type) Managed peatland (mio. ha) + oq58_peatland(t,j,type) Constraint for peatland area (mio. ha) + oq58_expansion(t,j,land58,type) Peatland expansion (mio. ha) + oq58_reduction(t,j,land58,type) Peatland reduction (mio. ha) + oq58_peatland_crop(t,j,type) Constraint for peatland degradation (mio. ha) + oq58_peatland_past(t,j,type) Constraint for peatland degradation (mio. ha) + oq58_peatland_forestry(t,j,type) Constraint for peatland degradation (mio. ha) + oq58_peatland_cost_full(t,j,type) One-time and recurring cost of peatland conversion and management including artifical balance cost (mio. USD05MER per yr) + oq58_peatland_cost(t,j,type) One-time and recurring cost of peatland conversion and management (mio. USD05MER per yr) + oq58_peatland_cost_annuity(t,j,type) Annuity costs of peatland conversion in the current timestep (mio. USD05MER per yr) + oq58_peatland_emis_detail(t,j,land58,emis58,type) Detailed GHG emissions from managed peatland (t CO2eq per year) + oq58_peatland_emis(t,i,poll58,type) GHG emissions from managed peatland (Tg per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/58_peatland/on_2023/equations.gms b/modules/58_peatland/on_2023/equations.gms index b2214146eb..bbee85e65f 100644 --- a/modules/58_peatland/on_2023/equations.gms +++ b/modules/58_peatland/on_2023/equations.gms @@ -7,59 +7,15 @@ *' @equations -*' Land transition matrix for peatland area. -*' The sum of current peatland area defined in `v58_lu_transitions` has to equal the sum of -*' peatland area in the previous time step (`pc58_peatland_man` + `pc58_peatland_intact`). -*' The two balancing variables `v58_balance_positive` and `v58_balance_negative` are needed -*' to avoid technical infeasibilities due to small differences in accuracy between -*' variables and parameters in GAMS. The use of `v58_balance_positive` and -*' `v58_balance_negative` is minimized by putting a high cost factor on these variables -*' (`q58_peatland_cost_full`). In practice, `v58_balance_positive` and -*' `v58_balance_negative`should deviate from zero only in exceptional cases. - - q58_transition_matrix(j2) .. - sum((from58,to58), v58_lu_transitions(j2,from58,to58)) - + v58_balance_positive(j2) - v58_balance_negative(j2) =e= - sum((man58,land58), pc58_peatland_man(j2,man58,land58)) + pc58_peatland_intact(j2); - - q58_transition_to(j2,to58) .. - sum(from58, v58_lu_transitions(j2,from58,to58)) =e= - v58_peatland_man(j2,"degrad","crop")$(sameas(to58,"degrad_crop")) - + v58_peatland_man(j2,"degrad","past")$(sameas(to58,"degrad_past")) - + v58_peatland_man(j2,"degrad","forestry")$(sameas(to58,"degrad_forestry")) - + v58_peatland_man(j2,"unused","crop")$(sameas(to58,"unused_crop")) - + v58_peatland_man(j2,"unused","past")$(sameas(to58,"unused_past")) - + v58_peatland_man(j2,"unused","forestry")$(sameas(to58,"unused_forestry")) - + v58_peatland_man(j2,"rewet","crop")$(sameas(to58,"rewet_crop")) - + v58_peatland_man(j2,"rewet","past")$(sameas(to58,"rewet_past")) - + v58_peatland_man(j2,"rewet","forestry")$(sameas(to58,"rewet_forestry")) - + v58_peatland_intact(j2)$(sameas(to58,"intact")); - - q58_transition_from(j2,from58) .. - sum(to58, v58_lu_transitions(j2,from58,to58)) =e= - pc58_peatland_man(j2,"degrad","crop")$(sameas(from58,"degrad_crop")) - + pc58_peatland_man(j2,"degrad","past")$(sameas(from58,"degrad_past")) - + pc58_peatland_man(j2,"degrad","forestry")$(sameas(from58,"degrad_forestry")) - + pc58_peatland_man(j2,"unused","crop")$(sameas(from58,"unused_crop")) - + pc58_peatland_man(j2,"unused","past")$(sameas(from58,"unused_past")) - + pc58_peatland_man(j2,"unused","forestry")$(sameas(from58,"unused_forestry")) - + pc58_peatland_man(j2,"rewet","crop")$(sameas(from58,"rewet_crop")) - + pc58_peatland_man(j2,"rewet","past")$(sameas(from58,"rewet_past")) - + pc58_peatland_man(j2,"rewet","forestry")$(sameas(from58,"rewet_forestry")) - + pc58_peatland_intact(j2)$(sameas(from58,"intact")); - -*' The following two equations calculate land expansion and land contraction based -*' on the above land transition matrix. - - q58_expansion(j2,to58) .. - v58_expansion(j2,to58) =e= - sum(from58$(not sameas(from58,to58)), - v58_lu_transitions(j2,from58,to58)); - - q58_reduction(j2,from58) .. - v58_reduction(j2,from58) =e= - sum(to58$(not sameas(from58,to58)), - v58_lu_transitions(j2,from58,to58)); + q58_peatland(j2)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. + sum(land58, v58_peatland(j2,land58)) =e= sum(land58, pc58_peatland(j2,land58)); + + q58_expansion(j2,land58) .. + v58_expansion(j2,land58) =g= v58_peatland(j2,land58)-pc58_peatland(j2,land58); + + q58_reduction(j2,land58) .. + v58_reduction(j2,land58) =g= pc58_peatland(j2,land58)-v58_peatland(j2,land58); + *' Future peatland degradation (`v58_peatland_man`) depends on managed land (`vm_land`), *' scaled with the ratio of total peatland area and total land area (`p58_scaling_factor`) @@ -72,43 +28,54 @@ *' If cropland expands by 5 Mha, 1 Mha of intact peatland is converted to degraded peatland (5 Mha*0.2). *' If the total cell would become cropland, degraded peatland would equal to the total peatland area (50 Mha * 0.2 = 10 Mha). - q58_peatland_degrad(j2,land58)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. - v58_peatland_man(j2,"degrad",land58) =e= - vm_land(j2,land58)*p58_scaling_factor(j2)*p58_calib_factor(j2,land58); + q58_peatland_crop(j2)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. + v58_peatland(j2,"crop") =e= + pc58_peatland(j2,"crop") + + ((vm_land(j2,"crop")-pcm_land(j2,"crop"))*p58_scaling_factor(j2)); + + q58_peatland_past(j2)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. + v58_peatland(j2,"past") =e= + pc58_peatland(j2,"past") + + ((vm_land(j2,"past")-pcm_land(j2,"past"))*p58_scaling_factor(j2)); + + q58_peatland_forestry(j2)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. + v58_peatland(j2,"forestry") =e= + pc58_peatland(j2,"forestry") + + ((vm_land(j2,"forestry")-pcm_land(j2,"forestry"))*p58_scaling_factor(j2)); -*' This constraint avoids the conversion of intact peatland into rewetted peatland. +*crop, past, forestry. +*intact no increase +*unused decrase and incrase +*rewetted incrase at cost. - q58_peatland_rewet(j2) .. - sum(stat_rewet58, v58_expansion(j2,stat_rewet58)) =l= - sum(stat_degrad58, v58_reduction(j2,stat_degrad58) + v58_expansion(j2,stat_degrad58)) - v58_reduction(j2,"intact"); *' Costs for peatland degradation and rewetting q58_peatland_cost_full(j2) .. - vm_peatland_cost(j2) =e= v58_peatland_cost(j2) + (v58_balance_positive(j2) + v58_balance_negative(j2)) * s58_cost_balance; + vm_peatland_cost(j2) =e= v58_peatland_cost(j2); q58_peatland_cost(j2) .. v58_peatland_cost(j2) =e= v58_peatland_cost_annuity(j2) - + sum(land58, v58_peatland_man(j2,"rewet",land58)) * sum(ct, i58_cost_rewet_recur(ct)) - + sum((degrad58,land58), v58_peatland_man(j2,degrad58,land58)) * sum(ct, i58_cost_degrad_recur(ct)); + + (v58_peatland(j2,"rewetted") + v58_peatland(j2,"intact")) * sum(ct, i58_cost_rewet_recur(ct)) + + sum(landMan58, v58_peatland(j2,landMan58)) * sum(ct, i58_cost_degrad_recur(ct)); q58_peatland_cost_annuity(j2) .. v58_peatland_cost_annuity(j2) =e= - (sum(stat_rewet58, v58_expansion(j2,stat_rewet58)) * sum(ct, i58_cost_rewet_onetime(ct)) - + (v58_reduction(j2,"intact") + sum(stat_rewet58, v58_reduction(j2,stat_rewet58))) * sum(ct, i58_cost_degrad_onetime(ct))) + (v58_expansion(j2,"rewetted") * sum(ct, i58_cost_rewet_onetime(ct)) + + v58_reduction(j2,"intact") * sum(ct, i58_cost_degrad_onetime(ct))) * sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); *' GHG emissions from managed peatlands (degraded and rewetted) - q58_peatland_emis_detail(j2,emis58) .. - v58_peatland_emis(j2,emis58) =e= - sum((man58,land58,clcl58), v58_peatland_man(j2,man58,land58) * - p58_mapping_cell_climate(j2,clcl58) * p58_ipcc_wetland_ef(clcl58,land58,emis58,man58)); + q58_peatland_emis_detail(j2,land58,emis58) .. + v58_peatland_emis(j2,land58,emis58) =e= + sum(clcl58, v58_peatland(j2,land58) * + p58_mapping_cell_climate(j2,clcl58) * p58_ipcc_wetland_ef(clcl58,land58,emis58)); *' Conversion from CO2 equivalent to element unit for interface `vm_emissions_reg` *' using GWP100 conversion factors from AR5 (same as in @wilson_2016). q58_peatland_emis(i2,poll58) .. vm_emissions_reg(i2,"peatland",poll58) =e= - sum((cell(i2,j2),emisSub58_to_poll58(emisSub58,poll58)), - v58_peatland_emis(j2,emisSub58) * p58_conversion_factor(emisSub58)); + sum((cell(i2,j2),land58,emisSub58_to_poll58(emisSub58,poll58)), + v58_peatland_emis(j2,land58,emisSub58)); diff --git a/modules/58_peatland/on_2023/input.gms b/modules/58_peatland/on_2023/input.gms index 2a9a73cc03..ab4eb109bb 100644 --- a/modules/58_peatland/on_2023/input.gms +++ b/modules/58_peatland/on_2023/input.gms @@ -6,35 +6,23 @@ *** | Contact: magpie@pik-potsdam.de scalars - s58_cost_rewet_recur Recurring costs for rewetted peatland (USD05MER per ha) / 200 / - s58_cost_rewet_onetime One-time costs for peatland restoration (USD05MER per ha) / 7000 / - s58_cost_degrad_recur Recurring costs for degraded peatland (USD05MER per ha) / 0 / - s58_cost_degrad_onetime One-time costs for peatland degradation (USD05MER per ha) / 0 / + s58_cost_rewet_recur Recurring costs for rewetted peatland (USD05MER per ha) / -4000 / + s58_cost_rewet_onetime One-time costs for peatland restoration (USD05MER per ha) / 4000 / + s58_cost_degrad_recur Recurring costs for degraded peatland (USD05MER per ha) / 200 / + s58_cost_degrad_onetime One-time costs for peatland degradation (USD05MER per ha) / 10000 / s58_rewetting_switch Peatland rewetting on (Inf) or off (0) / Inf / - s58_fix_peatland Year indicating until when peatland area should be fixed to 2015 levels (year) / 2015 / + s58_fix_peatland Year indicating until when peatland area should be fixed to 2015 levels (year) / 2020 / s58_cost_balance Artificial cost for balance variable (USD05MER per ha) / 1e+06 / ; -parameters -f58_peatland_degrad(j) Degrading peatland area (mio. ha) -/ +table f58_peatlandArea(j,land58) Peatland area (mio. ha) $ondelim -$include "./modules/58_peatland/input/f58_peatland_degrad.cs2" +$include "./modules/58_peatland/input/peatlandArea.cs3" $offdelim -/ ; -parameters -f58_peatland_intact(j) Intact peatland area (mio. ha) -/ +table f58_ipcc_wetland_ef(clcl58,land58,emis58) Wetland emission factors (t CO2-C N2O-N CH4 per ha) $ondelim -$include "./modules/58_peatland/input/f58_peatland_intact.cs2" -$offdelim -/ -; - -table f58_ipcc_wetland_ef(clcl58,land58,emis58,ef58) Wetland GWP100 emission factors (t CO2eq per ha) -$ondelim -$include "./modules/58_peatland/input/f58_ipcc_wetland_ef.cs3" +$include "./modules/58_peatland/input/f58_ipcc_wetland_ef2.cs3" $offdelim ; diff --git a/modules/58_peatland/on_2023/postsolve.gms b/modules/58_peatland/on_2023/postsolve.gms index 0c9b5643f0..ed3a3ccd89 100644 --- a/modules/58_peatland/on_2023/postsolve.gms +++ b/modules/58_peatland/on_2023/postsolve.gms @@ -7,109 +7,87 @@ * Update of degraded peatland based on current managed land in the last time steps of fixed peatland area. if (m_year(t) = s58_fix_peatland, - p58_scaling_factor(j)$(sum(land, vm_land.l(j,land)) > 1e-20) = (sum((man58,land58), v58_peatland_man.l(j,man58,land58)) + v58_peatland_intact.l(j)) / sum(land, vm_land.l(j,land)); - p58_calib_factor(j,land58) = 1; - p58_calib_factor(j,land58)$(vm_land.l(j,land58) * p58_scaling_factor(j) > 1e-20) = (p58_peatland_degrad(j) * p58_peatland_degrad_weight(j,land58)) / (vm_land.l(j,land58) * p58_scaling_factor(j)); - p58_calib_factor(j,land58)$(p58_calib_factor(j,land58) > 1) = 1; - pc58_peatland_man(j,"degrad",land58) = vm_land.l(j,land58) * p58_scaling_factor(j) * p58_calib_factor(j,land58); - pc58_peatland_man(j,"unused",land58) = p58_peatland_degrad(j) * p58_peatland_degrad_weight(j,land58) - pc58_peatland_man(j,"degrad",land58); + p58_scaling_factor(j)$(sum(land, vm_land.l(j,land)) > 1e-20) = sum(land58, f58_peatlandArea(j,land58)) / sum(land, vm_land.l(j,land)); + pc58_peatland(j,"crop") = min(f58_peatlandArea(j,"crop"),vm_land.l(j,"crop") * p58_scaling_factor(j)); + pc58_peatland(j,"past") = min(f58_peatlandArea(j,"past"), vm_land.l(j,"past") * p58_scaling_factor(j)); + pc58_peatland(j,"forestry") = min(f58_peatlandArea(j,"forestry"), vm_land.l(j,"forestry") * p58_scaling_factor(j)); + pc58_peatland(j,"unused") = sum(landMan58, f58_peatlandArea(j,landMan58) - pc58_peatland(j,landMan58)); + pc58_peatland(j,"peatExtract") = f58_peatlandArea(j,"peatExtract"); else - pc58_peatland_man(j,man58,land58) = v58_peatland_man.l(j,man58,land58); + pc58_peatland(j,land58) = v58_peatland.l(j,land58); ); -pc58_peatland_intact(j) = v58_peatland_intact.l(j); - *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_peatland_cost(t,j,"marginal") = vm_peatland_cost.m(j); - ov58_peatland_cost(t,j,"marginal") = v58_peatland_cost.m(j); - ov58_peatland_cost_annuity(t,j,"marginal") = v58_peatland_cost_annuity.m(j); - ov58_peatland_emis(t,j,emis58,"marginal") = v58_peatland_emis.m(j,emis58); - ov58_lu_transitions(t,j,from58,to58,"marginal") = v58_lu_transitions.m(j,from58,to58); - ov58_expansion(t,j,stat58,"marginal") = v58_expansion.m(j,stat58); - ov58_reduction(t,j,stat58,"marginal") = v58_reduction.m(j,stat58); - ov58_peatland_man(t,j,man58,land58,"marginal") = v58_peatland_man.m(j,man58,land58); - ov58_peatland_intact(t,j,"marginal") = v58_peatland_intact.m(j); - ov58_balance_positive(t,j,"marginal") = v58_balance_positive.m(j); - ov58_balance_negative(t,j,"marginal") = v58_balance_negative.m(j); - oq58_transition_matrix(t,j,"marginal") = q58_transition_matrix.m(j); - oq58_transition_to(t,j,to58,"marginal") = q58_transition_to.m(j,to58); - oq58_transition_from(t,j,from58,"marginal") = q58_transition_from.m(j,from58); - oq58_expansion(t,j,to58,"marginal") = q58_expansion.m(j,to58); - oq58_reduction(t,j,from58,"marginal") = q58_reduction.m(j,from58); - oq58_peatland_degrad(t,j,land58,"marginal") = q58_peatland_degrad.m(j,land58); - oq58_peatland_rewet(t,j,"marginal") = q58_peatland_rewet.m(j); - oq58_peatland_cost_full(t,j,"marginal") = q58_peatland_cost_full.m(j); - oq58_peatland_cost(t,j,"marginal") = q58_peatland_cost.m(j); - oq58_peatland_cost_annuity(t,j,"marginal") = q58_peatland_cost_annuity.m(j); - oq58_peatland_emis_detail(t,j,emis58,"marginal") = q58_peatland_emis_detail.m(j,emis58); - oq58_peatland_emis(t,i,poll58,"marginal") = q58_peatland_emis.m(i,poll58); - ov_peatland_cost(t,j,"level") = vm_peatland_cost.l(j); - ov58_peatland_cost(t,j,"level") = v58_peatland_cost.l(j); - ov58_peatland_cost_annuity(t,j,"level") = v58_peatland_cost_annuity.l(j); - ov58_peatland_emis(t,j,emis58,"level") = v58_peatland_emis.l(j,emis58); - ov58_lu_transitions(t,j,from58,to58,"level") = v58_lu_transitions.l(j,from58,to58); - ov58_expansion(t,j,stat58,"level") = v58_expansion.l(j,stat58); - ov58_reduction(t,j,stat58,"level") = v58_reduction.l(j,stat58); - ov58_peatland_man(t,j,man58,land58,"level") = v58_peatland_man.l(j,man58,land58); - ov58_peatland_intact(t,j,"level") = v58_peatland_intact.l(j); - ov58_balance_positive(t,j,"level") = v58_balance_positive.l(j); - ov58_balance_negative(t,j,"level") = v58_balance_negative.l(j); - oq58_transition_matrix(t,j,"level") = q58_transition_matrix.l(j); - oq58_transition_to(t,j,to58,"level") = q58_transition_to.l(j,to58); - oq58_transition_from(t,j,from58,"level") = q58_transition_from.l(j,from58); - oq58_expansion(t,j,to58,"level") = q58_expansion.l(j,to58); - oq58_reduction(t,j,from58,"level") = q58_reduction.l(j,from58); - oq58_peatland_degrad(t,j,land58,"level") = q58_peatland_degrad.l(j,land58); - oq58_peatland_rewet(t,j,"level") = q58_peatland_rewet.l(j); - oq58_peatland_cost_full(t,j,"level") = q58_peatland_cost_full.l(j); - oq58_peatland_cost(t,j,"level") = q58_peatland_cost.l(j); - oq58_peatland_cost_annuity(t,j,"level") = q58_peatland_cost_annuity.l(j); - oq58_peatland_emis_detail(t,j,emis58,"level") = q58_peatland_emis_detail.l(j,emis58); - oq58_peatland_emis(t,i,poll58,"level") = q58_peatland_emis.l(i,poll58); - ov_peatland_cost(t,j,"upper") = vm_peatland_cost.up(j); - ov58_peatland_cost(t,j,"upper") = v58_peatland_cost.up(j); - ov58_peatland_cost_annuity(t,j,"upper") = v58_peatland_cost_annuity.up(j); - ov58_peatland_emis(t,j,emis58,"upper") = v58_peatland_emis.up(j,emis58); - ov58_lu_transitions(t,j,from58,to58,"upper") = v58_lu_transitions.up(j,from58,to58); - ov58_expansion(t,j,stat58,"upper") = v58_expansion.up(j,stat58); - ov58_reduction(t,j,stat58,"upper") = v58_reduction.up(j,stat58); - ov58_peatland_man(t,j,man58,land58,"upper") = v58_peatland_man.up(j,man58,land58); - ov58_peatland_intact(t,j,"upper") = v58_peatland_intact.up(j); - ov58_balance_positive(t,j,"upper") = v58_balance_positive.up(j); - ov58_balance_negative(t,j,"upper") = v58_balance_negative.up(j); - oq58_transition_matrix(t,j,"upper") = q58_transition_matrix.up(j); - oq58_transition_to(t,j,to58,"upper") = q58_transition_to.up(j,to58); - oq58_transition_from(t,j,from58,"upper") = q58_transition_from.up(j,from58); - oq58_expansion(t,j,to58,"upper") = q58_expansion.up(j,to58); - oq58_reduction(t,j,from58,"upper") = q58_reduction.up(j,from58); - oq58_peatland_degrad(t,j,land58,"upper") = q58_peatland_degrad.up(j,land58); - oq58_peatland_rewet(t,j,"upper") = q58_peatland_rewet.up(j); - oq58_peatland_cost_full(t,j,"upper") = q58_peatland_cost_full.up(j); - oq58_peatland_cost(t,j,"upper") = q58_peatland_cost.up(j); - oq58_peatland_cost_annuity(t,j,"upper") = q58_peatland_cost_annuity.up(j); - oq58_peatland_emis_detail(t,j,emis58,"upper") = q58_peatland_emis_detail.up(j,emis58); - oq58_peatland_emis(t,i,poll58,"upper") = q58_peatland_emis.up(i,poll58); - ov_peatland_cost(t,j,"lower") = vm_peatland_cost.lo(j); - ov58_peatland_cost(t,j,"lower") = v58_peatland_cost.lo(j); - ov58_peatland_cost_annuity(t,j,"lower") = v58_peatland_cost_annuity.lo(j); - ov58_peatland_emis(t,j,emis58,"lower") = v58_peatland_emis.lo(j,emis58); - ov58_lu_transitions(t,j,from58,to58,"lower") = v58_lu_transitions.lo(j,from58,to58); - ov58_expansion(t,j,stat58,"lower") = v58_expansion.lo(j,stat58); - ov58_reduction(t,j,stat58,"lower") = v58_reduction.lo(j,stat58); - ov58_peatland_man(t,j,man58,land58,"lower") = v58_peatland_man.lo(j,man58,land58); - ov58_peatland_intact(t,j,"lower") = v58_peatland_intact.lo(j); - ov58_balance_positive(t,j,"lower") = v58_balance_positive.lo(j); - ov58_balance_negative(t,j,"lower") = v58_balance_negative.lo(j); - oq58_transition_matrix(t,j,"lower") = q58_transition_matrix.lo(j); - oq58_transition_to(t,j,to58,"lower") = q58_transition_to.lo(j,to58); - oq58_transition_from(t,j,from58,"lower") = q58_transition_from.lo(j,from58); - oq58_expansion(t,j,to58,"lower") = q58_expansion.lo(j,to58); - oq58_reduction(t,j,from58,"lower") = q58_reduction.lo(j,from58); - oq58_peatland_degrad(t,j,land58,"lower") = q58_peatland_degrad.lo(j,land58); - oq58_peatland_rewet(t,j,"lower") = q58_peatland_rewet.lo(j); - oq58_peatland_cost_full(t,j,"lower") = q58_peatland_cost_full.lo(j); - oq58_peatland_cost(t,j,"lower") = q58_peatland_cost.lo(j); - oq58_peatland_cost_annuity(t,j,"lower") = q58_peatland_cost_annuity.lo(j); - oq58_peatland_emis_detail(t,j,emis58,"lower") = q58_peatland_emis_detail.lo(j,emis58); - oq58_peatland_emis(t,i,poll58,"lower") = q58_peatland_emis.lo(i,poll58); + ov_peatland_cost(t,j,"marginal") = vm_peatland_cost.m(j); + ov58_peatland_cost(t,j,"marginal") = v58_peatland_cost.m(j); + ov58_peatland_cost_annuity(t,j,"marginal") = v58_peatland_cost_annuity.m(j); + ov58_peatland_emis(t,j,land58,emis58,"marginal") = v58_peatland_emis.m(j,land58,emis58); + ov58_expansion(t,j,land58,"marginal") = v58_expansion.m(j,land58); + ov58_reduction(t,j,land58,"marginal") = v58_reduction.m(j,land58); + ov58_peatland(t,j,land58,"marginal") = v58_peatland.m(j,land58); + oq58_peatland(t,j,"marginal") = q58_peatland.m(j); + oq58_expansion(t,j,land58,"marginal") = q58_expansion.m(j,land58); + oq58_reduction(t,j,land58,"marginal") = q58_reduction.m(j,land58); + oq58_peatland_crop(t,j,"marginal") = q58_peatland_crop.m(j); + oq58_peatland_past(t,j,"marginal") = q58_peatland_past.m(j); + oq58_peatland_forestry(t,j,"marginal") = q58_peatland_forestry.m(j); + oq58_peatland_cost_full(t,j,"marginal") = q58_peatland_cost_full.m(j); + oq58_peatland_cost(t,j,"marginal") = q58_peatland_cost.m(j); + oq58_peatland_cost_annuity(t,j,"marginal") = q58_peatland_cost_annuity.m(j); + oq58_peatland_emis_detail(t,j,land58,emis58,"marginal") = q58_peatland_emis_detail.m(j,land58,emis58); + oq58_peatland_emis(t,i,poll58,"marginal") = q58_peatland_emis.m(i,poll58); + ov_peatland_cost(t,j,"level") = vm_peatland_cost.l(j); + ov58_peatland_cost(t,j,"level") = v58_peatland_cost.l(j); + ov58_peatland_cost_annuity(t,j,"level") = v58_peatland_cost_annuity.l(j); + ov58_peatland_emis(t,j,land58,emis58,"level") = v58_peatland_emis.l(j,land58,emis58); + ov58_expansion(t,j,land58,"level") = v58_expansion.l(j,land58); + ov58_reduction(t,j,land58,"level") = v58_reduction.l(j,land58); + ov58_peatland(t,j,land58,"level") = v58_peatland.l(j,land58); + oq58_peatland(t,j,"level") = q58_peatland.l(j); + oq58_expansion(t,j,land58,"level") = q58_expansion.l(j,land58); + oq58_reduction(t,j,land58,"level") = q58_reduction.l(j,land58); + oq58_peatland_crop(t,j,"level") = q58_peatland_crop.l(j); + oq58_peatland_past(t,j,"level") = q58_peatland_past.l(j); + oq58_peatland_forestry(t,j,"level") = q58_peatland_forestry.l(j); + oq58_peatland_cost_full(t,j,"level") = q58_peatland_cost_full.l(j); + oq58_peatland_cost(t,j,"level") = q58_peatland_cost.l(j); + oq58_peatland_cost_annuity(t,j,"level") = q58_peatland_cost_annuity.l(j); + oq58_peatland_emis_detail(t,j,land58,emis58,"level") = q58_peatland_emis_detail.l(j,land58,emis58); + oq58_peatland_emis(t,i,poll58,"level") = q58_peatland_emis.l(i,poll58); + ov_peatland_cost(t,j,"upper") = vm_peatland_cost.up(j); + ov58_peatland_cost(t,j,"upper") = v58_peatland_cost.up(j); + ov58_peatland_cost_annuity(t,j,"upper") = v58_peatland_cost_annuity.up(j); + ov58_peatland_emis(t,j,land58,emis58,"upper") = v58_peatland_emis.up(j,land58,emis58); + ov58_expansion(t,j,land58,"upper") = v58_expansion.up(j,land58); + ov58_reduction(t,j,land58,"upper") = v58_reduction.up(j,land58); + ov58_peatland(t,j,land58,"upper") = v58_peatland.up(j,land58); + oq58_peatland(t,j,"upper") = q58_peatland.up(j); + oq58_expansion(t,j,land58,"upper") = q58_expansion.up(j,land58); + oq58_reduction(t,j,land58,"upper") = q58_reduction.up(j,land58); + oq58_peatland_crop(t,j,"upper") = q58_peatland_crop.up(j); + oq58_peatland_past(t,j,"upper") = q58_peatland_past.up(j); + oq58_peatland_forestry(t,j,"upper") = q58_peatland_forestry.up(j); + oq58_peatland_cost_full(t,j,"upper") = q58_peatland_cost_full.up(j); + oq58_peatland_cost(t,j,"upper") = q58_peatland_cost.up(j); + oq58_peatland_cost_annuity(t,j,"upper") = q58_peatland_cost_annuity.up(j); + oq58_peatland_emis_detail(t,j,land58,emis58,"upper") = q58_peatland_emis_detail.up(j,land58,emis58); + oq58_peatland_emis(t,i,poll58,"upper") = q58_peatland_emis.up(i,poll58); + ov_peatland_cost(t,j,"lower") = vm_peatland_cost.lo(j); + ov58_peatland_cost(t,j,"lower") = v58_peatland_cost.lo(j); + ov58_peatland_cost_annuity(t,j,"lower") = v58_peatland_cost_annuity.lo(j); + ov58_peatland_emis(t,j,land58,emis58,"lower") = v58_peatland_emis.lo(j,land58,emis58); + ov58_expansion(t,j,land58,"lower") = v58_expansion.lo(j,land58); + ov58_reduction(t,j,land58,"lower") = v58_reduction.lo(j,land58); + ov58_peatland(t,j,land58,"lower") = v58_peatland.lo(j,land58); + oq58_peatland(t,j,"lower") = q58_peatland.lo(j); + oq58_expansion(t,j,land58,"lower") = q58_expansion.lo(j,land58); + oq58_reduction(t,j,land58,"lower") = q58_reduction.lo(j,land58); + oq58_peatland_crop(t,j,"lower") = q58_peatland_crop.lo(j); + oq58_peatland_past(t,j,"lower") = q58_peatland_past.lo(j); + oq58_peatland_forestry(t,j,"lower") = q58_peatland_forestry.lo(j); + oq58_peatland_cost_full(t,j,"lower") = q58_peatland_cost_full.lo(j); + oq58_peatland_cost(t,j,"lower") = q58_peatland_cost.lo(j); + oq58_peatland_cost_annuity(t,j,"lower") = q58_peatland_cost_annuity.lo(j); + oq58_peatland_emis_detail(t,j,land58,emis58,"lower") = q58_peatland_emis_detail.lo(j,land58,emis58); + oq58_peatland_emis(t,i,poll58,"lower") = q58_peatland_emis.lo(i,poll58); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/58_peatland/on_2023/preloop.gms b/modules/58_peatland/on_2023/preloop.gms index c679acaa1d..8d91f63d60 100644 --- a/modules/58_peatland/on_2023/preloop.gms +++ b/modules/58_peatland/on_2023/preloop.gms @@ -9,35 +9,26 @@ vm_emissions_reg.fx(i,"peatland",pollutants) = 0; vm_emissions_reg.lo(i,"peatland",poll58) = -Inf; vm_emissions_reg.up(i,"peatland",poll58) = Inf; -* GHG emission conversion factors from GWP100 to element unit. -p58_conversion_factor("co2") = 12/44; -p58_conversion_factor("ch4") = 1/34; -p58_conversion_factor("n2o") = 1/298*28/44; - p58_mapping_cell_climate(j,clcl58) = sum(clcl_mapping(clcl,clcl58),pm_climate_class(j,clcl)); -p58_ipcc_wetland_ef(clcl58,land58,emis58,ef58) = f58_ipcc_wetland_ef(clcl58,land58,emis58,ef58); -p58_ipcc_wetland_ef(clcl58,land58,emis58,"unused") = f58_ipcc_wetland_ef(clcl58,land58,emis58,"degrad"); +p58_ipcc_wetland_ef(clcl58,land58,emis58) = f58_ipcc_wetland_ef(clcl58,land58,emis58); * Peatland scaling factor: ratio of total peatland area and total land area -p58_scaling_factor(j) = (f58_peatland_degrad(j) + f58_peatland_intact(j)) / sum(land, pcm_land(j,land)); -* Intact peatland area -pc58_peatland_intact(j) = f58_peatland_intact(j); -* Share of cropland, pasture and forestry in total managed land, used for distribution of degraded peatland (f58_peatland_degrad) to managed land. -p58_man_land_area(j) = sum(land58, pcm_land(j,land58)); -p58_peatland_degrad_weight(j,land58) = 1/card(land58); -p58_peatland_degrad_weight(j,land58)$(p58_man_land_area(j) > 0) = pcm_land(j,land58) / p58_man_land_area(j); -* Calibration factor for alignment with historic levels of degraded peatland -p58_calib_factor(j,land58) = 1; -p58_calib_factor(j,land58)$(pcm_land(j,land58) * p58_scaling_factor(j) > 1e-20) = (f58_peatland_degrad(j) * p58_peatland_degrad_weight(j,land58)) / (pcm_land(j,land58)*p58_scaling_factor(j)); -p58_calib_factor(j,land58)$(p58_calib_factor(j,land58) > 1) = 1; +p58_scaling_factor(j)$(sum(land, pcm_land(j,land)) > 1e-20) = sum(land58, f58_peatlandArea(j,land58)) / sum(land, pcm_land(j,land)); + * Initialization of peatland -pc58_peatland_man(j,man58,land58) = 0; +pc58_peatland(j,land58) = 0; * Degraded peatland is estimated by multiplication of managed land (pcm_land) with the peatland scaling factor (p58_scaling_factor). -* The calibration factor (p58_calib_factor) reduces this estimate to historic levels of degraded peatland. p58_calib_factor is 1 for most cases. -pc58_peatland_man(j,"degrad",land58) = pcm_land(j,land58) * p58_scaling_factor(j) * p58_calib_factor(j,land58); +pc58_peatland(j,"crop") = min(f58_peatlandArea(j,"crop"),pcm_land(j,"crop") * p58_scaling_factor(j)); +pc58_peatland(j,"past") = min(f58_peatlandArea(j,"past"),pcm_land(j,"past") * p58_scaling_factor(j)); +pc58_peatland(j,"forestry") = min(f58_peatlandArea(j,"forestry"),pcm_land(j,"forestry") * p58_scaling_factor(j)); + * The residual is added to an "unused" category, which represents degraded but unused peatland. -pc58_peatland_man(j,"unused",land58) = f58_peatland_degrad(j) * p58_peatland_degrad_weight(j,land58) - pc58_peatland_man(j,"degrad",land58); -pc58_peatland_man(j,"unused",land58)$(pc58_peatland_man(j,"unused",land58) < 0) = 0; -p58_peatland_degrad(j) = sum((man58,land58), pc58_peatland_man(j,man58,land58)); +pc58_peatland(j,"unused") = sum(landMan58, f58_peatlandArea(j,landMan58) - pc58_peatland(j,landMan58)); +*pc58_peatland(j,"unused")$(pc58_peatland(j,"unused") < 0) = 0; +*p58_peatland_degrad(j) = sum((man58,land58), pc58_peatland_man(j,man58,land58)); +pc58_peatland(j,"peatExtract") = f58_peatlandArea(j,"peatExtract"); + +pc58_peatland(j,"intact") = f58_peatlandArea(j,"intact"); + diff --git a/modules/58_peatland/on_2023/presolve.gms b/modules/58_peatland/on_2023/presolve.gms index ce77e7f904..0975025517 100644 --- a/modules/58_peatland/on_2023/presolve.gms +++ b/modules/58_peatland/on_2023/presolve.gms @@ -5,51 +5,23 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*define bound for peatland area - v58_peatland_man.lo(j,man58,land58) = 0; - v58_peatland_man.up(j,"degrad",land58) = Inf; - v58_peatland_man.up(j,"unused",land58) = Inf; - v58_peatland_man.l(j,man58,land58) = pc58_peatland_man(j,man58,land58); -*define allowed transitions within peatland area - v58_lu_transitions.fx(j,from58,to58)$(not sameas(from58,to58)) = 0; - v58_lu_transitions.up(j,"intact","degrad_crop") = Inf; - v58_lu_transitions.up(j,"intact","degrad_past") = Inf; - v58_lu_transitions.up(j,"intact","degrad_forestry") = Inf; - v58_lu_transitions.up(j,"degrad_crop","unused_crop") = Inf; - v58_lu_transitions.up(j,"degrad_past","unused_past") = Inf; - v58_lu_transitions.up(j,"degrad_forestry","unused_forestry") = Inf; - v58_lu_transitions.up(j,"degrad_crop","rewet_crop") = Inf; - v58_lu_transitions.up(j,"degrad_past","rewet_past") = Inf; - v58_lu_transitions.up(j,"degrad_forestry","rewet_forestry") = Inf; - v58_lu_transitions.up(j,"unused_crop","degrad_crop") = Inf; - v58_lu_transitions.up(j,"unused_crop","degrad_past") = Inf; - v58_lu_transitions.up(j,"unused_crop","degrad_forestry") = Inf; - v58_lu_transitions.up(j,"unused_past","degrad_crop") = Inf; - v58_lu_transitions.up(j,"unused_past","degrad_past") = Inf; - v58_lu_transitions.up(j,"unused_past","degrad_forestry") = Inf; - v58_lu_transitions.up(j,"unused_forestry","degrad_crop") = Inf; - v58_lu_transitions.up(j,"unused_forestry","degrad_past") = Inf; - v58_lu_transitions.up(j,"unused_forestry","degrad_forestry") = Inf; - v58_lu_transitions.up(j,"unused_crop","rewet_crop") = Inf; - v58_lu_transitions.up(j,"unused_past","rewet_past") = Inf; - v58_lu_transitions.up(j,"unused_forestry","rewet_forestry") = Inf; - v58_lu_transitions.up(j,"rewet_crop","degrad_crop") = Inf; - v58_lu_transitions.up(j,"rewet_past","degrad_past") = Inf; - v58_lu_transitions.up(j,"rewet_forestry","degrad_forestry") = Inf; -if (m_year(t) <= s58_fix_peatland, - v58_peatland_man.fx(j,man58,land58) = pc58_peatland_man(j,man58,land58); - v58_peatland_intact.fx(j) = pc58_peatland_intact(j); +*define bound for peatland area +if (m_year(t) <= s58_fix_peatland, + v58_peatland.fx(j,land58) = pc58_peatland(j,land58); i58_cost_rewet_recur(t) = 0; i58_cost_rewet_onetime(t) = 0; i58_cost_degrad_recur(t) = 0; i58_cost_degrad_onetime(t) = 0; else - v58_peatland_man.up(j,"rewet",land58) = s58_rewetting_switch; - v58_peatland_intact.lo(j) = 0; - v58_peatland_intact.up(j) = pc58_peatland_intact(j); - v58_peatland_intact.l(j) = pc58_peatland_intact(j); + v58_peatland.lo(j,land58) = 0; + v58_peatland.l(j,land58) = pc58_peatland(j,land58); + v58_peatland.up(j,landMan58) = Inf; + v58_peatland.up(j,"unused") = Inf; + v58_peatland.up(j,"rewetted") = s58_rewetting_switch; + v58_peatland.up(j,"intact") = pc58_peatland(j,"intact"); + v58_peatland.fx(j,"peatExtract") = pc58_peatland(j,"peatExtract"); i58_cost_rewet_recur(t) = s58_cost_rewet_recur; i58_cost_rewet_onetime(t) = s58_cost_rewet_onetime; i58_cost_degrad_recur(t) = s58_cost_degrad_recur; diff --git a/modules/58_peatland/on_2023/scaling.gms b/modules/58_peatland/on_2023/scaling.gms index 0d3b287285..c10a69cca2 100644 --- a/modules/58_peatland/on_2023/scaling.gms +++ b/modules/58_peatland/on_2023/scaling.gms @@ -5,5 +5,3 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -v58_expansion.scale(j,stat58) = 10e-3; -v58_reduction.scale(j,stat58) = 10e-3; diff --git a/modules/58_peatland/on_2023/sets.gms b/modules/58_peatland/on_2023/sets.gms index a9bfd548b5..9bcca82dd9 100644 --- a/modules/58_peatland/on_2023/sets.gms +++ b/modules/58_peatland/on_2023/sets.gms @@ -16,9 +16,14 @@ sets ef58(man58) Peatland emissions factors / degrad, rewet / - land58(land) Managed land types + + land58 Peatland land types + / intact, crop, past, forestry, peatExtract, unused, rewetted / + + landMan58(land58) Peatland land types / crop, past, forestry / + stat58 Peatland status / intact, degrad_crop, degrad_past, degrad_forestry, From 0c4745f2accf76499c8ca5072c870dac9d482cdd Mon Sep 17 00:00:00 2001 From: caviddhen Date: Tue, 25 Jul 2023 13:18:16 +0200 Subject: [PATCH 03/68] add flex cell realization --- main.gms | 20 +-- .../flexcell_july23/declarations.gms | 72 +++++++++ .../18_residues/flexcell_july23/equations.gms | 140 ++++++++++++++++++ modules/18_residues/flexcell_july23/input.gms | 51 +++++++ .../18_residues/flexcell_july23/input/files | 4 + .../18_residues/flexcell_july23/postsolve.gms | 94 ++++++++++++ .../18_residues/flexcell_july23/preloop.gms | 9 ++ .../18_residues/flexcell_july23/presolve.gms | 10 ++ .../flexcell_july23/realization.gms | 37 +++++ .../18_residues/flexcell_july23/scaling.gms | 8 + modules/18_residues/flexcell_july23/sets.gms | 40 +++++ .../flexreg_apr16/declarations.gms | 8 +- .../18_residues/flexreg_apr16/equations.gms | 7 + .../18_residues/flexreg_apr16/not_used.txt | 2 + .../18_residues/flexreg_apr16/postsolve.gms | 8 + modules/18_residues/module.gms | 1 + modules/18_residues/off/not_used.txt | 1 + scripts/start/testCellRes.R | 35 +++++ 18 files changed, 535 insertions(+), 12 deletions(-) create mode 100644 modules/18_residues/flexcell_july23/declarations.gms create mode 100644 modules/18_residues/flexcell_july23/equations.gms create mode 100644 modules/18_residues/flexcell_july23/input.gms create mode 100644 modules/18_residues/flexcell_july23/input/files create mode 100644 modules/18_residues/flexcell_july23/postsolve.gms create mode 100644 modules/18_residues/flexcell_july23/preloop.gms create mode 100644 modules/18_residues/flexcell_july23/presolve.gms create mode 100644 modules/18_residues/flexcell_july23/realization.gms create mode 100644 modules/18_residues/flexcell_july23/scaling.gms create mode 100644 modules/18_residues/flexcell_july23/sets.gms create mode 100644 modules/18_residues/flexreg_apr16/not_used.txt create mode 100644 scripts/start/testCellRes.R diff --git a/main.gms b/main.gms index 3595e9c073..5d76f64f31 100644 --- a/main.gms +++ b/main.gms @@ -150,22 +150,22 @@ $title magpie * * Used data set: rev4.87_h12_magpie.tgz * md5sum: 658398f1dcbef89198bd85d61b1db9ad -* Repository: /p/projects/rd3mod/inputdata/output +* Repository: /p/projects/rd3mod/mirror/rse.pik-potsdam.de/data/magpie/public * * Used data set: rev4.87_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz * md5sum: 8a1d668acfe66a700eb5da2143b31cb2 -* Repository: /p/projects/rd3mod/inputdata/output +* Repository: /p/projects/rd3mod/mirror/rse.pik-potsdam.de/data/magpie/public * * Used data set: rev4.87_h12_validation.tgz * md5sum: d02217d791b58400e6e3be7186527ed5 -* Repository: /p/projects/rd3mod/inputdata/output +* Repository: /p/projects/rd3mod/mirror/rse.pik-potsdam.de/data/magpie/public * * Used data set: additional_data_rev4.43.tgz -* md5sum: NA -* Repository: https://rse.pik-potsdam.de/data/magpie/public +* md5sum: 7f537e5df805af11f0e67e84e6010290 +* Repository: /p/projects/rd3mod/mirror/rse.pik-potsdam.de/data/magpie/public * -* Used data set: calibration_H12_per_ton_fao_may22_glo_08Jul23.tgz -* md5sum: 7315d0f268d6225805a4c1f1c3c05b13 +* Used data set: calibration_H12_per_ton_fao_may22_glo_14Jul23.tgz +* md5sum: e64650408fd8790f9883e2fd5e372b5e * Repository: /p/projects/landuse/data/input/calibration * * Low resolution: c200 @@ -195,7 +195,7 @@ $title magpie * * Call: withCallingHandlers(expr, message = messageHandler, warning = warningHandler, error = errorHandler) * * -* Last modification (input data): Thu Jul 13 10:36:10 2023 +* Last modification (input data): Tue Jul 25 13:17:09 2023 * *###################### R SECTION END (VERSION INFO) ########################### @@ -221,7 +221,7 @@ $offlisting $setglobal c_timesteps coup2100 $setglobal c_past till_2010 -$setglobal c_title default +$setglobal c_title testCellRes2_default scalars s_use_gdx use of gdx files / 0 / @@ -284,7 +284,7 @@ $setglobal bioenergy 1stgen_priced_dec18 $setglobal material exo_flexreg_apr16 $setglobal livestock fbask_jan16 -$setglobal disagg_lvst foragebased_aug18 +$setglobal disagg_lvst foragebased_jul23 $setglobal timber default diff --git a/modules/18_residues/flexcell_july23/declarations.gms b/modules/18_residues/flexcell_july23/declarations.gms new file mode 100644 index 0000000000..e2c398bbea --- /dev/null +++ b/modules/18_residues/flexcell_july23/declarations.gms @@ -0,0 +1,72 @@ +*** | (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 + + +positive variables + v18_prod_res(j,kres) Cellular production of residues (mio. tDM) + v18_res_biomass_ag_cell(j,kcr,attributes) Production of aboveground residues in each cell (mio. tDM) + vm_res_biomass_ag(i,kcr,attributes) Production of aboveground residues in each region (mio. tDM) + vm_res_biomass_bg(i,kcr,dm_nr) Production of belowground residues in each region (mio. tDM) + + v18_res_ag_removal(j,kcr,attributes) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) + v18_res_ag_recycling(i,kcr,attributes) Recylcing of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) + vm_res_ag_burn(i,kcr,attributes) Regional residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) + + vm_res_recycling(i,npk) Residues recycled to croplands in respective nutrients Nr P K units (mio. tX) + vm_cost_prod_kres(i,kres) Production costs of harvesting crop residues (mio. USD05MER per yr) +; + +equations + + q18_prod_res_ag_cell(j,kcr,attributes) Cellular production constraint of aboveground residues (mio. tDM) + q18_prod_res_ag_reg(i,kcr,attributes) Regional production constraint of aboveground residues (mio. tDM) + + q18_prod_res_bg_cell(i,kcr,dm_nr) Cellular production constraint of belowground residues (mio. tDM) + + q18_res_field_balance(i,kcr,attributes) Calculation of the residues amount recycled to soils (mio. tDM) + q18_cell_field_constraint(j,kcr,attributes) Make sure the amount removed in any cell does not exceet the amoutn available + q18_res_field_burn(i,kcr,attributes) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) + q18_translate(j,kres,attributes) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) + + q18_res_recycling_nr(i) Nutrient recycling of reaactive nitrogen (mio. tNr) + q18_res_recycling_pk(i,pk18) Nutrient recycling of phosphorus and potash (mio. tX) + q18_cost_prod_res(i,kres) Production costs of harvesting crop residues (mio. USD05MER) + + q18_prod_res_reg(i,kall) Regional production of residues (mio. tDM) + +; + +parameters + i18_res_use_burn(t_all,dev18,kcr) Share of residues burned on field (1) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov18_prod_res(t,j,kres,type) Cellular production of residues (mio. tDM) + ov18_res_biomass_ag_cell(t,j,kcr,attributes,type) Production of aboveground residues in each cell (mio. tDM) + ov_res_biomass_ag(t,i,kcr,attributes,type) Production of aboveground residues in each region (mio. tDM) + ov_res_biomass_bg(t,i,kcr,dm_nr,type) Production of belowground residues in each region (mio. tDM) + ov18_res_ag_removal(t,j,kcr,attributes,type) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov18_res_ag_recycling(t,i,kcr,attributes,type) Recylcing of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov_res_ag_burn(t,i,kcr,attributes,type) Regional residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov_res_recycling(t,i,npk,type) Residues recycled to croplands in respective nutrients Nr P K units (mio. tX) + ov_cost_prod_kres(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER per yr) + oq18_prod_res_ag_cell(t,j,kcr,attributes,type) Cellular production constraint of aboveground residues (mio. tDM) + oq18_prod_res_ag_reg(t,i,kcr,attributes,type) Regional production constraint of aboveground residues (mio. tDM) + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,type) Cellular production constraint of belowground residues (mio. tDM) + oq18_res_field_balance(t,i,kcr,attributes,type) Calculation of the residues amount recycled to soils (mio. tDM) + oq18_cell_field_constraint(t,j,kcr,attributes,type) Make sure the amount removed in any cell does not exceet the amoutn available + oq18_res_field_burn(t,i,kcr,attributes,type) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) + oq18_translate(t,j,kres,attributes,type) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) + oq18_res_recycling_nr(t,i,type) Nutrient recycling of reaactive nitrogen (mio. tNr) + oq18_res_recycling_pk(t,i,pk18,type) Nutrient recycling of phosphorus and potash (mio. tX) + oq18_cost_prod_res(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER) + oq18_prod_res_reg(t,i,kall,type) Regional production of residues (mio. tDM) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + +*** EOF declarations.gms *** diff --git a/modules/18_residues/flexcell_july23/equations.gms b/modules/18_residues/flexcell_july23/equations.gms new file mode 100644 index 0000000000..51d2826633 --- /dev/null +++ b/modules/18_residues/flexcell_july23/equations.gms @@ -0,0 +1,140 @@ +*** | (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 + +*' The AG crop residue biomass `vm_res_biomass_ag` is calculated as a function +*' of harvested area `vm_area` and production `vm_prod_reg`. `f18_cgf` contains +*' slope and intercept parameters of the CGFs. + + q18_prod_res_ag_cell(j2,kcr,attributes) .. + v18_res_biomass_ag_cell(j2,kcr,attributes) + =e= + (sum(w, vm_area(j2,kcr,w)) * sum((ct, cell(i2,j2)), f18_multicropping(ct,i2)) * f18_cgf("intercept",kcr) + + vm_prod(j2,kcr) * f18_cgf("slope",kcr)) + * f18_attributes_residue_ag(attributes,kcr); + + q18_prod_res_ag_reg(i2,kcr,attributes) .. + vm_res_biomass_ag(i2,kcr,attributes) + =e= + sum(cell(i2,j2), v18_res_biomass_ag_cell(j2,kcr,attributes)); + +*' The BG crop residue biomass `vm_res_biomass_bg` is calculated as a function of +*' total aboveground biomass. + + q18_prod_res_bg_cell(i2,kcr,dm_nr) .. + vm_res_biomass_bg(i2,kcr,dm_nr) + =e= + (vm_prod_reg(i2,kcr) + vm_res_biomass_ag(i2,kcr,"dm")) * f18_cgf("bg_to_ag",kcr) + * f18_attributes_residue_bg(dm_nr,kcr); + +*' In contrast to AG biomass, AG production `vm_res_biomass_ag(i,kcr,attributes)` +*' is defined as the part of residues which is removed from the field. The +*' difference between biomass and production is either burned on field or +*' remains on the fields (either incorporated in soils or not) and decays. +*' The field balance equations ensures that the production of AG residues +*' `vm_res_biomass_ag(i,kcr,attributes)` is properly assigned to different uses: +*' removal, on-field burning and recycling of AG residues. + + q18_res_field_balance(i2,kcr,attributes) .. + vm_res_biomass_ag(i2,kcr,attributes) + =e= + sum(cell(i2,j2), v18_res_ag_removal(j2,kcr,attributes)) + + vm_res_ag_burn(i2,kcr,attributes) + + v18_res_ag_recycling(i2,kcr,attributes); + +*' make sure removal is less than biomass produced in each cell + q18_cell_field_constraint(j2,kcr,attributes) .. + sum(cell(i2,j2), vm_res_biomass_ag(i2,kcr,attributes)) + =g= + v18_res_ag_removal(j2,kcr,attributes); + + +*' The amount of residues burned on fields in a region `vm_res_ag_burn` is +*' determined by the share (ic18_res_use_min_shr) of AG residue biomass. +*' Based on @smil_nitrogen_1999, residue burning is fixed to 15% of total AG +*' crop residue dry matter in developed and 25% in developing regions for each +*' crop. For future time steps, these rates are scenario dependent, and either +*' kept constant or reduced to 10% and 0% in 2050. + + q18_res_field_burn(i2,kcr,attributes) .. + vm_res_ag_burn(i2,kcr,attributes) + =e= + sum(ct, im_development_state(ct,i2) * i18_res_use_burn(ct,"high_income",kcr) + + (1-im_development_state(ct,i2)) * i18_res_use_burn(ct,"low_income",kcr)) + * vm_res_biomass_ag(i2,kcr,attributes); + + +*' While the residue biomass is estiamted with a crop-specific nutrient +*' composition (which is required for consistent nutrient budgets), the +*' removed residues are assumed to have homogeneous properties +*' (to reduce the number of commodities in MAgPIE) within three crop residue +*' groups (cereal straw, fibrous residues that cannot be digested +*' by monogastrics, and non-fibrous residues that can be digested). +*' The following constraint, in combination with the field balance equation, +*' guarantees that mass balances are not violated while a homogeneous +*' good is extracted from heterogeneous goods. + + q18_translate(j2,kres,attributes).. + sum(kres_kcr(kres,kcr), v18_res_ag_removal(j2,kcr,attributes)) + =e= + v18_prod_res(j2,kres) * fm_attributes(attributes,kres); + +*' sum to the regional amount of residues produced for the regional interface + q18_prod_res_reg(i2,kres).. + vm_prod_reg(i2,kres) + =e= + sum(cell(i2,j2), v18_prod_res(j2,kres)) ; + + +*' Residues recycled to croplands in nutrients `vm_res_recycling(i2,"nr")` are +*' calculated based on the amount of AG residues left on field for recycling, the +*' nutrients coming from burned residues, and on biomass that is left in +*' BG residues. They are calculated to be transmitted to the nitrogen budget +*' module [50_nr_soil_budget]. + + q18_res_recycling_nr(i2) .. + vm_res_recycling(i2,"nr") + =e= + sum(kcr, v18_res_ag_recycling(i2,kcr,"nr") + + vm_res_ag_burn(i2,kcr,"nr")*(1-f18_res_combust_eff(kcr)) + + vm_res_biomass_bg(i2,kcr,"nr") + ); + +*' Similar to the recycled nutrients, the potash recycling is determined by the +*' amount of AG residues with the potash content and the amounts of potash from +*' burning residues. As P and K are not volatile and hardly water soluble, only +*' removed aboveground crop residues have to be considered, while nutrients from +*' burned AG as well as BG stay on the field. + + q18_res_recycling_pk(i2,pk18) .. + vm_res_recycling(i2,pk18) + =e= + sum(kcr, + v18_res_ag_recycling(i2,kcr,pk18) + + vm_res_ag_burn(i2,kcr,pk18) + ); + +*' Costs of residues production are determined as factor costs per ton +*' assuming 15 USD per ton, using the lower range from +*' [this source](hwww1.agric.gov.ab.ca/$Department/deptdocs.nsf/All/faq7514), +*' 10USD baling costs per large round bale plus 2USD pro bale stocking and hauling, +*' 1 large round bale is approximately 500 kg, resulting in 24USD per ton, +*' for developing prices see [here](citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.557.5823&rep=rep1&type=pdf). +*' Tha calcuated factor costs per ton are therefore 24 for `res_cereals`, `res_fibrous` +*' and `res_nonfibrous`. + + q18_cost_prod_res(i2,kres) .. + vm_cost_prod_kres(i2,kres) + =e= + vm_prod_reg(i2,kres) * fm_attributes("wm",kres) * f18_fac_req_kres(kres); + +*' Trade of AG residues is not considered, so that all produced AG residues have +*' to be assigned to uses within the respective world region. + + +*** EOF constraints.gms *** diff --git a/modules/18_residues/flexcell_july23/input.gms b/modules/18_residues/flexcell_july23/input.gms new file mode 100644 index 0000000000..1b91afa613 --- /dev/null +++ b/modules/18_residues/flexcell_july23/input.gms @@ -0,0 +1,51 @@ +*** | (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 + +$setglobal c18_burn_scen phaseout +* options: phaseout,constant + +table f18_multicropping(t_all,i) Multicropping indicator as ratio of area harvested by physical area (1) +$ondelim +$include "./modules/18_residues/input/f18_multicropping.csv" +$offdelim; + +table f18_attributes_residue_ag(attributes,kve) Nutrient content of aboveground crop residues in respective attribute units DM GJ Nr P K WM C (X per DM) +$ondelim +$include "./modules/18_residues/input/f18_attributes_residue_ag.csv" +$offdelim; + + +table f18_attributes_residue_bg(dm_nr,kve) Nutrient content of belowground crop residues in reactive nitorgen and carbon units Nr C (X per DM) +$ondelim +$include "./modules/18_residues/input/f18_attributes_residue_bg.csv" +$offdelim; + +table f18_cgf(cgf,kve) Crop growth functions for all vegetation types containing slope intercept and belowground to aboveground ratio (1) +$ondelim +$include "./modules/18_residues/flexcell_july23/input/f18_cgf.csv" +$offdelim; + +table f18_res_use_burn(t_all,burn_scen18,dev18,kcr) Minimum and maximum burn share use for residues developing over time (1) +$ondelim +$include "./modules/18_residues/flexcell_july23/input/f18_res_use_burn.cs3" +$offdelim; + +parameter f18_res_combust_eff(kve) Combustion efficiency of residue burning (1) +/ +$ondelim +$include "./modules/18_residues/input/f18_res_combust_eff.cs4" +$offdelim +/; + +parameter f18_fac_req_kres(kres) Factor requirements (USD05MER per tDM) +/ +$ondelim +$include "./modules/18_residues/flexcell_july23/input/f18_fac_req_kres.csv" +$offdelim +/; + +*** EOF input.gms *** diff --git a/modules/18_residues/flexcell_july23/input/files b/modules/18_residues/flexcell_july23/input/files new file mode 100644 index 0000000000..45135c7cef --- /dev/null +++ b/modules/18_residues/flexcell_july23/input/files @@ -0,0 +1,4 @@ +* list of files that are required here +f18_cgf.csv +f18_res_use_burn.cs3 +f18_fac_req_kres.csv diff --git a/modules/18_residues/flexcell_july23/postsolve.gms b/modules/18_residues/flexcell_july23/postsolve.gms new file mode 100644 index 0000000000..fe2fe3d87d --- /dev/null +++ b/modules/18_residues/flexcell_july23/postsolve.gms @@ -0,0 +1,94 @@ +*** | (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 + +****** Residues + +*** EOF postsolve.gms *** + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov18_prod_res(t,j,kres,"marginal") = v18_prod_res.m(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,attributes,"marginal") = v18_res_biomass_ag_cell.m(j,kcr,attributes); + ov_res_biomass_ag(t,i,kcr,attributes,"marginal") = vm_res_biomass_ag.m(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"marginal") = vm_res_biomass_bg.m(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"marginal") = v18_res_ag_removal.m(j,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"marginal") = v18_res_ag_recycling.m(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"marginal") = vm_res_ag_burn.m(i,kcr,attributes); + ov_res_recycling(t,i,npk,"marginal") = vm_res_recycling.m(i,npk); + ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,attributes,"marginal") = q18_prod_res_ag_cell.m(j,kcr,attributes); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"marginal") = q18_prod_res_ag_reg.m(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"marginal") = q18_prod_res_bg_cell.m(i,kcr,dm_nr); + oq18_res_field_balance(t,i,kcr,attributes,"marginal") = q18_res_field_balance.m(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kcr,attributes,"marginal") = q18_cell_field_constraint.m(j,kcr,attributes); + oq18_res_field_burn(t,i,kcr,attributes,"marginal") = q18_res_field_burn.m(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"marginal") = q18_translate.m(j,kres,attributes); + oq18_res_recycling_nr(t,i,"marginal") = q18_res_recycling_nr.m(i); + oq18_res_recycling_pk(t,i,pk18,"marginal") = q18_res_recycling_pk.m(i,pk18); + oq18_cost_prod_res(t,i,kres,"marginal") = q18_cost_prod_res.m(i,kres); + oq18_prod_res_reg(t,i,kall,"marginal") = q18_prod_res_reg.m(i,kall); + ov18_prod_res(t,j,kres,"level") = v18_prod_res.l(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,attributes,"level") = v18_res_biomass_ag_cell.l(j,kcr,attributes); + ov_res_biomass_ag(t,i,kcr,attributes,"level") = vm_res_biomass_ag.l(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"level") = vm_res_biomass_bg.l(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"level") = v18_res_ag_removal.l(j,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"level") = v18_res_ag_recycling.l(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"level") = vm_res_ag_burn.l(i,kcr,attributes); + ov_res_recycling(t,i,npk,"level") = vm_res_recycling.l(i,npk); + ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,attributes,"level") = q18_prod_res_ag_cell.l(j,kcr,attributes); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"level") = q18_prod_res_ag_reg.l(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"level") = q18_prod_res_bg_cell.l(i,kcr,dm_nr); + oq18_res_field_balance(t,i,kcr,attributes,"level") = q18_res_field_balance.l(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kcr,attributes,"level") = q18_cell_field_constraint.l(j,kcr,attributes); + oq18_res_field_burn(t,i,kcr,attributes,"level") = q18_res_field_burn.l(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"level") = q18_translate.l(j,kres,attributes); + oq18_res_recycling_nr(t,i,"level") = q18_res_recycling_nr.l(i); + oq18_res_recycling_pk(t,i,pk18,"level") = q18_res_recycling_pk.l(i,pk18); + oq18_cost_prod_res(t,i,kres,"level") = q18_cost_prod_res.l(i,kres); + oq18_prod_res_reg(t,i,kall,"level") = q18_prod_res_reg.l(i,kall); + ov18_prod_res(t,j,kres,"upper") = v18_prod_res.up(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,attributes,"upper") = v18_res_biomass_ag_cell.up(j,kcr,attributes); + ov_res_biomass_ag(t,i,kcr,attributes,"upper") = vm_res_biomass_ag.up(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"upper") = vm_res_biomass_bg.up(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"upper") = v18_res_ag_removal.up(j,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"upper") = v18_res_ag_recycling.up(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"upper") = vm_res_ag_burn.up(i,kcr,attributes); + ov_res_recycling(t,i,npk,"upper") = vm_res_recycling.up(i,npk); + ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,attributes,"upper") = q18_prod_res_ag_cell.up(j,kcr,attributes); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"upper") = q18_prod_res_ag_reg.up(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"upper") = q18_prod_res_bg_cell.up(i,kcr,dm_nr); + oq18_res_field_balance(t,i,kcr,attributes,"upper") = q18_res_field_balance.up(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kcr,attributes,"upper") = q18_cell_field_constraint.up(j,kcr,attributes); + oq18_res_field_burn(t,i,kcr,attributes,"upper") = q18_res_field_burn.up(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"upper") = q18_translate.up(j,kres,attributes); + oq18_res_recycling_nr(t,i,"upper") = q18_res_recycling_nr.up(i); + oq18_res_recycling_pk(t,i,pk18,"upper") = q18_res_recycling_pk.up(i,pk18); + oq18_cost_prod_res(t,i,kres,"upper") = q18_cost_prod_res.up(i,kres); + oq18_prod_res_reg(t,i,kall,"upper") = q18_prod_res_reg.up(i,kall); + ov18_prod_res(t,j,kres,"lower") = v18_prod_res.lo(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,attributes,"lower") = v18_res_biomass_ag_cell.lo(j,kcr,attributes); + ov_res_biomass_ag(t,i,kcr,attributes,"lower") = vm_res_biomass_ag.lo(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"lower") = vm_res_biomass_bg.lo(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"lower") = v18_res_ag_removal.lo(j,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"lower") = v18_res_ag_recycling.lo(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"lower") = vm_res_ag_burn.lo(i,kcr,attributes); + ov_res_recycling(t,i,npk,"lower") = vm_res_recycling.lo(i,npk); + ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,attributes,"lower") = q18_prod_res_ag_cell.lo(j,kcr,attributes); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"lower") = q18_prod_res_ag_reg.lo(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"lower") = q18_prod_res_bg_cell.lo(i,kcr,dm_nr); + oq18_res_field_balance(t,i,kcr,attributes,"lower") = q18_res_field_balance.lo(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kcr,attributes,"lower") = q18_cell_field_constraint.lo(j,kcr,attributes); + oq18_res_field_burn(t,i,kcr,attributes,"lower") = q18_res_field_burn.lo(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"lower") = q18_translate.lo(j,kres,attributes); + oq18_res_recycling_nr(t,i,"lower") = q18_res_recycling_nr.lo(i); + oq18_res_recycling_pk(t,i,pk18,"lower") = q18_res_recycling_pk.lo(i,pk18); + oq18_cost_prod_res(t,i,kres,"lower") = q18_cost_prod_res.lo(i,kres); + oq18_prod_res_reg(t,i,kall,"lower") = q18_prod_res_reg.lo(i,kall); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + diff --git a/modules/18_residues/flexcell_july23/preloop.gms b/modules/18_residues/flexcell_july23/preloop.gms new file mode 100644 index 0000000000..dd1bb671f2 --- /dev/null +++ b/modules/18_residues/flexcell_july23/preloop.gms @@ -0,0 +1,9 @@ +*** | (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 + + +i18_res_use_burn(t_all,dev18,kcr) = f18_res_use_burn(t_all,"%c18_burn_scen%",dev18,kcr); diff --git a/modules/18_residues/flexcell_july23/presolve.gms b/modules/18_residues/flexcell_july23/presolve.gms new file mode 100644 index 0000000000..df3fd6721f --- /dev/null +++ b/modules/18_residues/flexcell_july23/presolve.gms @@ -0,0 +1,10 @@ +*** | (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 + +v18_res_ag_removal.fx(j,nonused18,attributes)=0; + +*** EOF solve.gms *** diff --git a/modules/18_residues/flexcell_july23/realization.gms b/modules/18_residues/flexcell_july23/realization.gms new file mode 100644 index 0000000000..020f8c994b --- /dev/null +++ b/modules/18_residues/flexcell_july23/realization.gms @@ -0,0 +1,37 @@ +*** | (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 As official global statistics exist only for crop production and not for crop +*' residue production, the biomass of residues is obtained in MAgPIE by using +*' crop-type specific plant growth functions based on crop production and area harvested. +*' Plant biomass is divided into three components: the harvested organ as listed +*' in FAO, the aboveground (AG) and the belowground (BG) residues. +*' +*' @ipcc_2006_2006 offers one of the few consistent datasets to estimate +*' both AG and BG residues. Also, by providing crop-growth functions (CGF, `f18_cgf`) +*' instead of fixed harvest indices, it can be used to depict current +*' international differences of harvest indices and their development in the future. +*' The methodology is thus well eligible for global long-term modelling. +*' @ipcc_2006_2006 provides linear CGFs with positive slope and intercept +*' for cereals, leguminous crops, potatoes and grasses. As no values are +*' available for the oilcrops rapeseed, sunflower, oilpalms as well as +*' sugar crops, tropical roots, cotton and others, we use fixed harvest-indices +*' (positive slope without intercept) for these crops based +*' on @wirsenius_human_2000, @lal_world_2005 and @feller_dungung_2007. If different CGFs are available +*' for crops within a crop group, we build a weighted average based on the +*' production in 1995. + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/18_residues/flexcell_july23/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/18_residues/flexcell_july23/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/18_residues/flexcell_july23/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/18_residues/flexcell_july23/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/18_residues/flexcell_july23/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/18_residues/flexcell_july23/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/18_residues/flexcell_july23/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/18_residues/flexcell_july23/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/18_residues/flexcell_july23/scaling.gms b/modules/18_residues/flexcell_july23/scaling.gms new file mode 100644 index 0000000000..2e8ecb4d44 --- /dev/null +++ b/modules/18_residues/flexcell_july23/scaling.gms @@ -0,0 +1,8 @@ +*** | (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_prod_kres.scale(i,kres) = 10e3; diff --git a/modules/18_residues/flexcell_july23/sets.gms b/modules/18_residues/flexcell_july23/sets.gms new file mode 100644 index 0000000000..428ccd5dbf --- /dev/null +++ b/modules/18_residues/flexcell_july23/sets.gms @@ -0,0 +1,40 @@ +*** | (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 + + +sets + +dm_nr(attributes) dry matter and nr +/dm, nr, c/ + +pk18(npk) subset of npk containing P and K nutrients +/p, k/ + +dev18 country develoment indicator +/high_income,low_income/ + +burn_scen18 scenario for burning residues on field +/constant,phaseout/ + +nonused18(kcr) crops that are not used as residues +/sunflower, oilpalm, foddr, begr, betr/ + +***Feeding groups*** + + kres_kcr(kres,kcr) mapping of crops to different residue types + / res_cereals .(tece,maiz,trce,rice_pro) + res_fibrous .(soybean,rapeseed,groundnut, + puls_pro,sugr_beet,sugr_cane, + cottn_pro) + res_nonfibrous .(potato,cassav_sp,others) + / + + + +; + +*** EOF sets.gms *** diff --git a/modules/18_residues/flexreg_apr16/declarations.gms b/modules/18_residues/flexreg_apr16/declarations.gms index 426853f7bd..b48e0fe658 100644 --- a/modules/18_residues/flexreg_apr16/declarations.gms +++ b/modules/18_residues/flexreg_apr16/declarations.gms @@ -7,6 +7,7 @@ positive variables + v18_prod_res(j,kres) Cellular production of residues (mio. tDM) vm_res_biomass_ag(i,kcr,attributes) Production of aboveground residues in each region (mio. tDM) vm_res_biomass_bg(i,kcr,dm_nr) Production of belowground residues in each region (mio. tDM) v18_res_ag_removal(i,kcr,attributes) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) @@ -24,8 +25,9 @@ equations q18_res_field_balance(i,kcr,attributes) Calculation of the residues amount recycled to soils (mio. tDM) q18_res_field_burn(i,kcr,attributes) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) q18_translate(i,kres,attributes) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) + q18_prod_res_cell(j,kres) Allows for distribution of residues to cellular level (mio. tDM) - q18_res_recycling_nr(i) Nutrient recycling of reaactive nitrogen (mio. tNr) + q18_res_recycling_nr(i) Nutrient recycling of reactive nitrogen (mio. tNr) q18_res_recycling_pk(i,pk18) Nutrient recycling of phosphorus and potash (mio. tX) q18_cost_prod_res(i,kres) Production costs of harvesting crop residues (mio. USD05MER) @@ -37,6 +39,7 @@ parameters *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters + ov18_prod_res(t,j,kres,type) Cellular production of residues (mio. tDM) ov_res_biomass_ag(t,i,kcr,attributes,type) Production of aboveground residues in each region (mio. tDM) ov_res_biomass_bg(t,i,kcr,dm_nr,type) Production of belowground residues in each region (mio. tDM) ov18_res_ag_removal(t,i,kcr,attributes,type) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) @@ -49,7 +52,8 @@ parameters oq18_res_field_balance(t,i,kcr,attributes,type) Calculation of the residues amount recycled to soils (mio. tDM) oq18_res_field_burn(t,i,kcr,attributes,type) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) oq18_translate(t,i,kres,attributes,type) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) - oq18_res_recycling_nr(t,i,type) Nutrient recycling of reaactive nitrogen (mio. tNr) + oq18_prod_res_cell(t,j,kres,type) Allows for distribution of residues to cellular level (mio. tDM) + oq18_res_recycling_nr(t,i,type) Nutrient recycling of reactive nitrogen (mio. tNr) oq18_res_recycling_pk(t,i,pk18,type) Nutrient recycling of phosphorus and potash (mio. tX) oq18_cost_prod_res(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER) ; diff --git a/modules/18_residues/flexreg_apr16/equations.gms b/modules/18_residues/flexreg_apr16/equations.gms index 2384a6976d..daf7e3c797 100644 --- a/modules/18_residues/flexreg_apr16/equations.gms +++ b/modules/18_residues/flexreg_apr16/equations.gms @@ -72,6 +72,13 @@ =e= vm_prod_reg(i2,kres) * fm_attributes(attributes,kres); +*' Amount produced at cellular level is flexible, can be distributed as it wants + q18_prod_res_cell(j2,kres).. + sum(cell(i2,j2), vm_prod_reg(i2,kres)) + =e= + v18_prod_res(j2,kres) ; + + *' Residues recycled to croplands in nutrients `vm_res_recycling(i2,"nr")` are *' calcualted based on the amount of AG residues left on field for recycling, the *' nutrients coming from burned residues, and on biomass that is left in diff --git a/modules/18_residues/flexreg_apr16/not_used.txt b/modules/18_residues/flexreg_apr16/not_used.txt new file mode 100644 index 0000000000..c83b6031e2 --- /dev/null +++ b/modules/18_residues/flexreg_apr16/not_used.txt @@ -0,0 +1,2 @@ +name,type,reason +vm_prod,input,questionnaire \ No newline at end of file diff --git a/modules/18_residues/flexreg_apr16/postsolve.gms b/modules/18_residues/flexreg_apr16/postsolve.gms index 31c4585f65..8512944ed4 100644 --- a/modules/18_residues/flexreg_apr16/postsolve.gms +++ b/modules/18_residues/flexreg_apr16/postsolve.gms @@ -10,6 +10,7 @@ *** EOF postsolve.gms *** *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov18_prod_res(t,j,kres,"marginal") = v18_prod_res.m(j,kres); ov_res_biomass_ag(t,i,kcr,attributes,"marginal") = vm_res_biomass_ag.m(i,kcr,attributes); ov_res_biomass_bg(t,i,kcr,dm_nr,"marginal") = vm_res_biomass_bg.m(i,kcr,dm_nr); ov18_res_ag_removal(t,i,kcr,attributes,"marginal") = v18_res_ag_removal.m(i,kcr,attributes); @@ -22,9 +23,11 @@ oq18_res_field_balance(t,i,kcr,attributes,"marginal") = q18_res_field_balance.m(i,kcr,attributes); oq18_res_field_burn(t,i,kcr,attributes,"marginal") = q18_res_field_burn.m(i,kcr,attributes); oq18_translate(t,i,kres,attributes,"marginal") = q18_translate.m(i,kres,attributes); + oq18_prod_res_cell(t,j,kres,"marginal") = q18_prod_res_cell.m(j,kres); oq18_res_recycling_nr(t,i,"marginal") = q18_res_recycling_nr.m(i); oq18_res_recycling_pk(t,i,pk18,"marginal") = q18_res_recycling_pk.m(i,pk18); oq18_cost_prod_res(t,i,kres,"marginal") = q18_cost_prod_res.m(i,kres); + ov18_prod_res(t,j,kres,"level") = v18_prod_res.l(j,kres); ov_res_biomass_ag(t,i,kcr,attributes,"level") = vm_res_biomass_ag.l(i,kcr,attributes); ov_res_biomass_bg(t,i,kcr,dm_nr,"level") = vm_res_biomass_bg.l(i,kcr,dm_nr); ov18_res_ag_removal(t,i,kcr,attributes,"level") = v18_res_ag_removal.l(i,kcr,attributes); @@ -37,9 +40,11 @@ oq18_res_field_balance(t,i,kcr,attributes,"level") = q18_res_field_balance.l(i,kcr,attributes); oq18_res_field_burn(t,i,kcr,attributes,"level") = q18_res_field_burn.l(i,kcr,attributes); oq18_translate(t,i,kres,attributes,"level") = q18_translate.l(i,kres,attributes); + oq18_prod_res_cell(t,j,kres,"level") = q18_prod_res_cell.l(j,kres); oq18_res_recycling_nr(t,i,"level") = q18_res_recycling_nr.l(i); oq18_res_recycling_pk(t,i,pk18,"level") = q18_res_recycling_pk.l(i,pk18); oq18_cost_prod_res(t,i,kres,"level") = q18_cost_prod_res.l(i,kres); + ov18_prod_res(t,j,kres,"upper") = v18_prod_res.up(j,kres); ov_res_biomass_ag(t,i,kcr,attributes,"upper") = vm_res_biomass_ag.up(i,kcr,attributes); ov_res_biomass_bg(t,i,kcr,dm_nr,"upper") = vm_res_biomass_bg.up(i,kcr,dm_nr); ov18_res_ag_removal(t,i,kcr,attributes,"upper") = v18_res_ag_removal.up(i,kcr,attributes); @@ -52,9 +57,11 @@ oq18_res_field_balance(t,i,kcr,attributes,"upper") = q18_res_field_balance.up(i,kcr,attributes); oq18_res_field_burn(t,i,kcr,attributes,"upper") = q18_res_field_burn.up(i,kcr,attributes); oq18_translate(t,i,kres,attributes,"upper") = q18_translate.up(i,kres,attributes); + oq18_prod_res_cell(t,j,kres,"upper") = q18_prod_res_cell.up(j,kres); oq18_res_recycling_nr(t,i,"upper") = q18_res_recycling_nr.up(i); oq18_res_recycling_pk(t,i,pk18,"upper") = q18_res_recycling_pk.up(i,pk18); oq18_cost_prod_res(t,i,kres,"upper") = q18_cost_prod_res.up(i,kres); + ov18_prod_res(t,j,kres,"lower") = v18_prod_res.lo(j,kres); ov_res_biomass_ag(t,i,kcr,attributes,"lower") = vm_res_biomass_ag.lo(i,kcr,attributes); ov_res_biomass_bg(t,i,kcr,dm_nr,"lower") = vm_res_biomass_bg.lo(i,kcr,dm_nr); ov18_res_ag_removal(t,i,kcr,attributes,"lower") = v18_res_ag_removal.lo(i,kcr,attributes); @@ -67,6 +74,7 @@ oq18_res_field_balance(t,i,kcr,attributes,"lower") = q18_res_field_balance.lo(i,kcr,attributes); oq18_res_field_burn(t,i,kcr,attributes,"lower") = q18_res_field_burn.lo(i,kcr,attributes); oq18_translate(t,i,kres,attributes,"lower") = q18_translate.lo(i,kres,attributes); + oq18_prod_res_cell(t,j,kres,"lower") = q18_prod_res_cell.lo(j,kres); oq18_res_recycling_nr(t,i,"lower") = q18_res_recycling_nr.lo(i); oq18_res_recycling_pk(t,i,pk18,"lower") = q18_res_recycling_pk.lo(i,pk18); oq18_cost_prod_res(t,i,kres,"lower") = q18_cost_prod_res.lo(i,kres); diff --git a/modules/18_residues/module.gms b/modules/18_residues/module.gms index 3ef463f67b..c4fc9387b5 100644 --- a/modules/18_residues/module.gms +++ b/modules/18_residues/module.gms @@ -17,6 +17,7 @@ *' @authors Benjamin Leon Bodirsky *###################### R SECTION START (MODULETYPES) ########################## +$Ifi "%residues%" == "flexcell_july23" $include "./modules/18_residues/flexcell_july23/realization.gms" $Ifi "%residues%" == "flexreg_apr16" $include "./modules/18_residues/flexreg_apr16/realization.gms" $Ifi "%residues%" == "off" $include "./modules/18_residues/off/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/18_residues/off/not_used.txt b/modules/18_residues/off/not_used.txt index 90acf4b328..85051d6636 100644 --- a/modules/18_residues/off/not_used.txt +++ b/modules/18_residues/off/not_used.txt @@ -3,3 +3,4 @@ im_development_state,input,questionnaire fm_attributes,input,questionnaire vm_prod_reg,input,questionnaire vm_area,input,questionnaire +vm_prod,input,questionnaire \ No newline at end of file diff --git a/scripts/start/testCellRes.R b/scripts/start/testCellRes.R new file mode 100644 index 0000000000..8a913167b2 --- /dev/null +++ b/scripts/start/testCellRes.R @@ -0,0 +1,35 @@ + +# | (C) 2008-2021 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: start run with default.cfg settings +# position: 8 +# ------------------------------------------------ + +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") + + +library(lucode2) +library(gms) + +# Source default cfg. This loads the object "cfg" in R environment +source("config/default.cfg") + +#start MAgPIE run +cfg$title <- "testCellRes2_default" + +#start MAgPIE run + +cfg$gms$residues <- "flexreg_apr16" +start_run(cfg, codeCheck = TRUE) + +cfg$title <- "testCellRes2_flexcell" +cfg$gms$residues <- "flexcell_july23" +start_run(cfg, codeCheck = TRUE) + From 409fef2840e8cd13a800a317779ce3e8eeebd28f Mon Sep 17 00:00:00 2001 From: caviddhen Date: Wed, 26 Jul 2023 08:58:26 +0200 Subject: [PATCH 04/68] update equations --- main.gms | 4 ++-- modules/18_residues/flexcell_july23/equations.gms | 3 +-- modules/18_residues/flexreg_apr16/declarations.gms | 4 ++-- scripts/start/testCellRes.R | 6 +++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/main.gms b/main.gms index 5d76f64f31..9786b52169 100644 --- a/main.gms +++ b/main.gms @@ -221,7 +221,7 @@ $offlisting $setglobal c_timesteps coup2100 $setglobal c_past till_2010 -$setglobal c_title testCellRes2_default +$setglobal c_title testCellRes3_flexcell scalars s_use_gdx use of gdx files / 0 / @@ -241,7 +241,7 @@ $setglobal food anthro_iso_jun22 $setglobal demand sector_may15 $setglobal production flexreg_apr16 -$setglobal residues flexreg_apr16 +$setglobal residues flexcell_july23 $setglobal processing substitution_may21 $setglobal trade selfsuff_reduced diff --git a/modules/18_residues/flexcell_july23/equations.gms b/modules/18_residues/flexcell_july23/equations.gms index 51d2826633..b0a6f0eb83 100644 --- a/modules/18_residues/flexcell_july23/equations.gms +++ b/modules/18_residues/flexcell_july23/equations.gms @@ -49,11 +49,10 @@ *' make sure removal is less than biomass produced in each cell q18_cell_field_constraint(j2,kcr,attributes) .. - sum(cell(i2,j2), vm_res_biomass_ag(i2,kcr,attributes)) + v18_res_biomass_ag_cell(j2,kcr,attributes) =g= v18_res_ag_removal(j2,kcr,attributes); - *' The amount of residues burned on fields in a region `vm_res_ag_burn` is *' determined by the share (ic18_res_use_min_shr) of AG residue biomass. *' Based on @smil_nitrogen_1999, residue burning is fixed to 15% of total AG diff --git a/modules/18_residues/flexreg_apr16/declarations.gms b/modules/18_residues/flexreg_apr16/declarations.gms index b48e0fe658..f5ecba6dc3 100644 --- a/modules/18_residues/flexreg_apr16/declarations.gms +++ b/modules/18_residues/flexreg_apr16/declarations.gms @@ -27,7 +27,7 @@ equations q18_translate(i,kres,attributes) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) q18_prod_res_cell(j,kres) Allows for distribution of residues to cellular level (mio. tDM) - q18_res_recycling_nr(i) Nutrient recycling of reactive nitrogen (mio. tNr) + q18_res_recycling_nr(i) Nutrient recycling of reaactive nitrogen (mio. tNr) q18_res_recycling_pk(i,pk18) Nutrient recycling of phosphorus and potash (mio. tX) q18_cost_prod_res(i,kres) Production costs of harvesting crop residues (mio. USD05MER) @@ -53,7 +53,7 @@ parameters oq18_res_field_burn(t,i,kcr,attributes,type) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) oq18_translate(t,i,kres,attributes,type) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) oq18_prod_res_cell(t,j,kres,type) Allows for distribution of residues to cellular level (mio. tDM) - oq18_res_recycling_nr(t,i,type) Nutrient recycling of reactive nitrogen (mio. tNr) + oq18_res_recycling_nr(t,i,type) Nutrient recycling of reaactive nitrogen (mio. tNr) oq18_res_recycling_pk(t,i,pk18,type) Nutrient recycling of phosphorus and potash (mio. tX) oq18_cost_prod_res(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER) ; diff --git a/scripts/start/testCellRes.R b/scripts/start/testCellRes.R index 8a913167b2..0f13946f59 100644 --- a/scripts/start/testCellRes.R +++ b/scripts/start/testCellRes.R @@ -22,14 +22,14 @@ library(gms) source("config/default.cfg") #start MAgPIE run -cfg$title <- "testCellRes2_default" +cfg$title <- "testCellRes2_default_noNewEquation" #start MAgPIE run cfg$gms$residues <- "flexreg_apr16" -start_run(cfg, codeCheck = TRUE) +#start_run(cfg, codeCheck = TRUE) -cfg$title <- "testCellRes2_flexcell" +cfg$title <- "testCellRes3_flexcell" cfg$gms$residues <- "flexcell_july23" start_run(cfg, codeCheck = TRUE) From 29f127be09585cb704c43c6cd4d37b62d2670c83 Mon Sep 17 00:00:00 2001 From: caviddhen Date: Wed, 2 Aug 2023 14:37:08 +0200 Subject: [PATCH 05/68] update equations --- main.gms | 2 +- .../flexcell_july23/declarations.gms | 46 ++--- .../18_residues/flexcell_july23/equations.gms | 13 +- .../18_residues/flexcell_july23/postsolve.gms | 168 +++++++++--------- scripts/start/testCellRes.R | 2 +- 5 files changed, 124 insertions(+), 107 deletions(-) diff --git a/main.gms b/main.gms index 9786b52169..577a4a27b9 100644 --- a/main.gms +++ b/main.gms @@ -221,7 +221,7 @@ $offlisting $setglobal c_timesteps coup2100 $setglobal c_past till_2010 -$setglobal c_title testCellRes3_flexcell +$setglobal c_title testCellRes6_flexcell scalars s_use_gdx use of gdx files / 0 / diff --git a/modules/18_residues/flexcell_july23/declarations.gms b/modules/18_residues/flexcell_july23/declarations.gms index e2c398bbea..93a26c5100 100644 --- a/modules/18_residues/flexcell_july23/declarations.gms +++ b/modules/18_residues/flexcell_july23/declarations.gms @@ -13,6 +13,7 @@ positive variables vm_res_biomass_bg(i,kcr,dm_nr) Production of belowground residues in each region (mio. tDM) v18_res_ag_removal(j,kcr,attributes) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) + v18_res_ag_removal_reg(i,kcr,attributes) Regional removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) v18_res_ag_recycling(i,kcr,attributes) Recylcing of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) vm_res_ag_burn(i,kcr,attributes) Regional residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) @@ -27,8 +28,9 @@ equations q18_prod_res_bg_cell(i,kcr,dm_nr) Cellular production constraint of belowground residues (mio. tDM) + q18_regional_removals(i,kcr,attributes) Calculation of regional level removals (mio. tX) q18_res_field_balance(i,kcr,attributes) Calculation of the residues amount recycled to soils (mio. tDM) - q18_cell_field_constraint(j,kcr,attributes) Make sure the amount removed in any cell does not exceet the amoutn available + q18_cell_field_constraint(j,kres) Make sure the amount removed in any cell does not exceet the amoutn available q18_res_field_burn(i,kcr,attributes) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) q18_translate(j,kres,attributes) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) @@ -46,26 +48,28 @@ parameters *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov18_prod_res(t,j,kres,type) Cellular production of residues (mio. tDM) - ov18_res_biomass_ag_cell(t,j,kcr,attributes,type) Production of aboveground residues in each cell (mio. tDM) - ov_res_biomass_ag(t,i,kcr,attributes,type) Production of aboveground residues in each region (mio. tDM) - ov_res_biomass_bg(t,i,kcr,dm_nr,type) Production of belowground residues in each region (mio. tDM) - ov18_res_ag_removal(t,j,kcr,attributes,type) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov18_res_ag_recycling(t,i,kcr,attributes,type) Recylcing of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov_res_ag_burn(t,i,kcr,attributes,type) Regional residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov_res_recycling(t,i,npk,type) Residues recycled to croplands in respective nutrients Nr P K units (mio. tX) - ov_cost_prod_kres(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER per yr) - oq18_prod_res_ag_cell(t,j,kcr,attributes,type) Cellular production constraint of aboveground residues (mio. tDM) - oq18_prod_res_ag_reg(t,i,kcr,attributes,type) Regional production constraint of aboveground residues (mio. tDM) - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,type) Cellular production constraint of belowground residues (mio. tDM) - oq18_res_field_balance(t,i,kcr,attributes,type) Calculation of the residues amount recycled to soils (mio. tDM) - oq18_cell_field_constraint(t,j,kcr,attributes,type) Make sure the amount removed in any cell does not exceet the amoutn available - oq18_res_field_burn(t,i,kcr,attributes,type) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) - oq18_translate(t,j,kres,attributes,type) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) - oq18_res_recycling_nr(t,i,type) Nutrient recycling of reaactive nitrogen (mio. tNr) - oq18_res_recycling_pk(t,i,pk18,type) Nutrient recycling of phosphorus and potash (mio. tX) - oq18_cost_prod_res(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER) - oq18_prod_res_reg(t,i,kall,type) Regional production of residues (mio. tDM) + ov18_prod_res(t,j,kres,type) Cellular production of residues (mio. tDM) + ov18_res_biomass_ag_cell(t,j,kcr,attributes,type) Production of aboveground residues in each cell (mio. tDM) + ov_res_biomass_ag(t,i,kcr,attributes,type) Production of aboveground residues in each region (mio. tDM) + ov_res_biomass_bg(t,i,kcr,dm_nr,type) Production of belowground residues in each region (mio. tDM) + ov18_res_ag_removal(t,j,kcr,attributes,type) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov18_res_ag_removal_reg(t,i,kcr,attributes,type) Regional removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov18_res_ag_recycling(t,i,kcr,attributes,type) Recylcing of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov_res_ag_burn(t,i,kcr,attributes,type) Regional residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov_res_recycling(t,i,npk,type) Residues recycled to croplands in respective nutrients Nr P K units (mio. tX) + ov_cost_prod_kres(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER per yr) + oq18_prod_res_ag_cell(t,j,kcr,attributes,type) Cellular production constraint of aboveground residues (mio. tDM) + oq18_prod_res_ag_reg(t,i,kcr,attributes,type) Regional production constraint of aboveground residues (mio. tDM) + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,type) Cellular production constraint of belowground residues (mio. tDM) + oq18_regional_removals(t,i,kcr,attributes,type) Calculation of regional level removals (mio. tX) + oq18_res_field_balance(t,i,kcr,attributes,type) Calculation of the residues amount recycled to soils (mio. tDM) + oq18_cell_field_constraint(t,j,kres,type) Make sure the amount removed in any cell does not exceet the amoutn available + oq18_res_field_burn(t,i,kcr,attributes,type) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) + oq18_translate(t,j,kres,attributes,type) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) + oq18_res_recycling_nr(t,i,type) Nutrient recycling of reaactive nitrogen (mio. tNr) + oq18_res_recycling_pk(t,i,pk18,type) Nutrient recycling of phosphorus and potash (mio. tX) + oq18_cost_prod_res(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER) + oq18_prod_res_reg(t,i,kall,type) Regional production of residues (mio. tDM) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/18_residues/flexcell_july23/equations.gms b/modules/18_residues/flexcell_july23/equations.gms index b0a6f0eb83..9f4f1f84e3 100644 --- a/modules/18_residues/flexcell_july23/equations.gms +++ b/modules/18_residues/flexcell_july23/equations.gms @@ -40,18 +40,23 @@ *' `vm_res_biomass_ag(i,kcr,attributes)` is properly assigned to different uses: *' removal, on-field burning and recycling of AG residues. +q18_regional_removals(i2,kcr,attributes) .. + sum(cell(i2,j2), v18_res_ag_removal(j2,kcr,attributes)) + =l= + v18_res_ag_removal_reg(i2,kcr,attributes); + q18_res_field_balance(i2,kcr,attributes) .. vm_res_biomass_ag(i2,kcr,attributes) =e= - sum(cell(i2,j2), v18_res_ag_removal(j2,kcr,attributes)) + v18_res_ag_removal_reg(i2,kcr,attributes) + vm_res_ag_burn(i2,kcr,attributes) + v18_res_ag_recycling(i2,kcr,attributes); *' make sure removal is less than biomass produced in each cell - q18_cell_field_constraint(j2,kcr,attributes) .. - v18_res_biomass_ag_cell(j2,kcr,attributes) + q18_cell_field_constraint(j2,kres) .. + sum(kres_kcr(kres,kcr), v18_res_biomass_ag_cell(j2,kcr,"dm")) =g= - v18_res_ag_removal(j2,kcr,attributes); + v18_prod_res(j2, kres); *' The amount of residues burned on fields in a region `vm_res_ag_burn` is *' determined by the share (ic18_res_use_min_shr) of AG residue biomass. diff --git a/modules/18_residues/flexcell_july23/postsolve.gms b/modules/18_residues/flexcell_july23/postsolve.gms index fe2fe3d87d..02ec370626 100644 --- a/modules/18_residues/flexcell_july23/postsolve.gms +++ b/modules/18_residues/flexcell_july23/postsolve.gms @@ -10,85 +10,93 @@ *** EOF postsolve.gms *** *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov18_prod_res(t,j,kres,"marginal") = v18_prod_res.m(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,attributes,"marginal") = v18_res_biomass_ag_cell.m(j,kcr,attributes); - ov_res_biomass_ag(t,i,kcr,attributes,"marginal") = vm_res_biomass_ag.m(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"marginal") = vm_res_biomass_bg.m(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"marginal") = v18_res_ag_removal.m(j,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"marginal") = v18_res_ag_recycling.m(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"marginal") = vm_res_ag_burn.m(i,kcr,attributes); - ov_res_recycling(t,i,npk,"marginal") = vm_res_recycling.m(i,npk); - ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,attributes,"marginal") = q18_prod_res_ag_cell.m(j,kcr,attributes); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"marginal") = q18_prod_res_ag_reg.m(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"marginal") = q18_prod_res_bg_cell.m(i,kcr,dm_nr); - oq18_res_field_balance(t,i,kcr,attributes,"marginal") = q18_res_field_balance.m(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kcr,attributes,"marginal") = q18_cell_field_constraint.m(j,kcr,attributes); - oq18_res_field_burn(t,i,kcr,attributes,"marginal") = q18_res_field_burn.m(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"marginal") = q18_translate.m(j,kres,attributes); - oq18_res_recycling_nr(t,i,"marginal") = q18_res_recycling_nr.m(i); - oq18_res_recycling_pk(t,i,pk18,"marginal") = q18_res_recycling_pk.m(i,pk18); - oq18_cost_prod_res(t,i,kres,"marginal") = q18_cost_prod_res.m(i,kres); - oq18_prod_res_reg(t,i,kall,"marginal") = q18_prod_res_reg.m(i,kall); - ov18_prod_res(t,j,kres,"level") = v18_prod_res.l(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,attributes,"level") = v18_res_biomass_ag_cell.l(j,kcr,attributes); - ov_res_biomass_ag(t,i,kcr,attributes,"level") = vm_res_biomass_ag.l(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"level") = vm_res_biomass_bg.l(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"level") = v18_res_ag_removal.l(j,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"level") = v18_res_ag_recycling.l(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"level") = vm_res_ag_burn.l(i,kcr,attributes); - ov_res_recycling(t,i,npk,"level") = vm_res_recycling.l(i,npk); - ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,attributes,"level") = q18_prod_res_ag_cell.l(j,kcr,attributes); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"level") = q18_prod_res_ag_reg.l(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"level") = q18_prod_res_bg_cell.l(i,kcr,dm_nr); - oq18_res_field_balance(t,i,kcr,attributes,"level") = q18_res_field_balance.l(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kcr,attributes,"level") = q18_cell_field_constraint.l(j,kcr,attributes); - oq18_res_field_burn(t,i,kcr,attributes,"level") = q18_res_field_burn.l(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"level") = q18_translate.l(j,kres,attributes); - oq18_res_recycling_nr(t,i,"level") = q18_res_recycling_nr.l(i); - oq18_res_recycling_pk(t,i,pk18,"level") = q18_res_recycling_pk.l(i,pk18); - oq18_cost_prod_res(t,i,kres,"level") = q18_cost_prod_res.l(i,kres); - oq18_prod_res_reg(t,i,kall,"level") = q18_prod_res_reg.l(i,kall); - ov18_prod_res(t,j,kres,"upper") = v18_prod_res.up(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,attributes,"upper") = v18_res_biomass_ag_cell.up(j,kcr,attributes); - ov_res_biomass_ag(t,i,kcr,attributes,"upper") = vm_res_biomass_ag.up(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"upper") = vm_res_biomass_bg.up(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"upper") = v18_res_ag_removal.up(j,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"upper") = v18_res_ag_recycling.up(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"upper") = vm_res_ag_burn.up(i,kcr,attributes); - ov_res_recycling(t,i,npk,"upper") = vm_res_recycling.up(i,npk); - ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,attributes,"upper") = q18_prod_res_ag_cell.up(j,kcr,attributes); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"upper") = q18_prod_res_ag_reg.up(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"upper") = q18_prod_res_bg_cell.up(i,kcr,dm_nr); - oq18_res_field_balance(t,i,kcr,attributes,"upper") = q18_res_field_balance.up(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kcr,attributes,"upper") = q18_cell_field_constraint.up(j,kcr,attributes); - oq18_res_field_burn(t,i,kcr,attributes,"upper") = q18_res_field_burn.up(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"upper") = q18_translate.up(j,kres,attributes); - oq18_res_recycling_nr(t,i,"upper") = q18_res_recycling_nr.up(i); - oq18_res_recycling_pk(t,i,pk18,"upper") = q18_res_recycling_pk.up(i,pk18); - oq18_cost_prod_res(t,i,kres,"upper") = q18_cost_prod_res.up(i,kres); - oq18_prod_res_reg(t,i,kall,"upper") = q18_prod_res_reg.up(i,kall); - ov18_prod_res(t,j,kres,"lower") = v18_prod_res.lo(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,attributes,"lower") = v18_res_biomass_ag_cell.lo(j,kcr,attributes); - ov_res_biomass_ag(t,i,kcr,attributes,"lower") = vm_res_biomass_ag.lo(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"lower") = vm_res_biomass_bg.lo(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"lower") = v18_res_ag_removal.lo(j,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"lower") = v18_res_ag_recycling.lo(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"lower") = vm_res_ag_burn.lo(i,kcr,attributes); - ov_res_recycling(t,i,npk,"lower") = vm_res_recycling.lo(i,npk); - ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,attributes,"lower") = q18_prod_res_ag_cell.lo(j,kcr,attributes); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"lower") = q18_prod_res_ag_reg.lo(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"lower") = q18_prod_res_bg_cell.lo(i,kcr,dm_nr); - oq18_res_field_balance(t,i,kcr,attributes,"lower") = q18_res_field_balance.lo(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kcr,attributes,"lower") = q18_cell_field_constraint.lo(j,kcr,attributes); - oq18_res_field_burn(t,i,kcr,attributes,"lower") = q18_res_field_burn.lo(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"lower") = q18_translate.lo(j,kres,attributes); - oq18_res_recycling_nr(t,i,"lower") = q18_res_recycling_nr.lo(i); - oq18_res_recycling_pk(t,i,pk18,"lower") = q18_res_recycling_pk.lo(i,pk18); - oq18_cost_prod_res(t,i,kres,"lower") = q18_cost_prod_res.lo(i,kres); - oq18_prod_res_reg(t,i,kall,"lower") = q18_prod_res_reg.lo(i,kall); + ov18_prod_res(t,j,kres,"marginal") = v18_prod_res.m(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,attributes,"marginal") = v18_res_biomass_ag_cell.m(j,kcr,attributes); + ov_res_biomass_ag(t,i,kcr,attributes,"marginal") = vm_res_biomass_ag.m(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"marginal") = vm_res_biomass_bg.m(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"marginal") = v18_res_ag_removal.m(j,kcr,attributes); + ov18_res_ag_removal_reg(t,i,kcr,attributes,"marginal") = v18_res_ag_removal_reg.m(i,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"marginal") = v18_res_ag_recycling.m(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"marginal") = vm_res_ag_burn.m(i,kcr,attributes); + ov_res_recycling(t,i,npk,"marginal") = vm_res_recycling.m(i,npk); + ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,attributes,"marginal") = q18_prod_res_ag_cell.m(j,kcr,attributes); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"marginal") = q18_prod_res_ag_reg.m(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"marginal") = q18_prod_res_bg_cell.m(i,kcr,dm_nr); + oq18_regional_removals(t,i,kcr,attributes,"marginal") = q18_regional_removals.m(i,kcr,attributes); + oq18_res_field_balance(t,i,kcr,attributes,"marginal") = q18_res_field_balance.m(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kres,"marginal") = q18_cell_field_constraint.m(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"marginal") = q18_res_field_burn.m(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"marginal") = q18_translate.m(j,kres,attributes); + oq18_res_recycling_nr(t,i,"marginal") = q18_res_recycling_nr.m(i); + oq18_res_recycling_pk(t,i,pk18,"marginal") = q18_res_recycling_pk.m(i,pk18); + oq18_cost_prod_res(t,i,kres,"marginal") = q18_cost_prod_res.m(i,kres); + oq18_prod_res_reg(t,i,kall,"marginal") = q18_prod_res_reg.m(i,kall); + ov18_prod_res(t,j,kres,"level") = v18_prod_res.l(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,attributes,"level") = v18_res_biomass_ag_cell.l(j,kcr,attributes); + ov_res_biomass_ag(t,i,kcr,attributes,"level") = vm_res_biomass_ag.l(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"level") = vm_res_biomass_bg.l(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"level") = v18_res_ag_removal.l(j,kcr,attributes); + ov18_res_ag_removal_reg(t,i,kcr,attributes,"level") = v18_res_ag_removal_reg.l(i,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"level") = v18_res_ag_recycling.l(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"level") = vm_res_ag_burn.l(i,kcr,attributes); + ov_res_recycling(t,i,npk,"level") = vm_res_recycling.l(i,npk); + ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,attributes,"level") = q18_prod_res_ag_cell.l(j,kcr,attributes); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"level") = q18_prod_res_ag_reg.l(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"level") = q18_prod_res_bg_cell.l(i,kcr,dm_nr); + oq18_regional_removals(t,i,kcr,attributes,"level") = q18_regional_removals.l(i,kcr,attributes); + oq18_res_field_balance(t,i,kcr,attributes,"level") = q18_res_field_balance.l(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kres,"level") = q18_cell_field_constraint.l(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"level") = q18_res_field_burn.l(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"level") = q18_translate.l(j,kres,attributes); + oq18_res_recycling_nr(t,i,"level") = q18_res_recycling_nr.l(i); + oq18_res_recycling_pk(t,i,pk18,"level") = q18_res_recycling_pk.l(i,pk18); + oq18_cost_prod_res(t,i,kres,"level") = q18_cost_prod_res.l(i,kres); + oq18_prod_res_reg(t,i,kall,"level") = q18_prod_res_reg.l(i,kall); + ov18_prod_res(t,j,kres,"upper") = v18_prod_res.up(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,attributes,"upper") = v18_res_biomass_ag_cell.up(j,kcr,attributes); + ov_res_biomass_ag(t,i,kcr,attributes,"upper") = vm_res_biomass_ag.up(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"upper") = vm_res_biomass_bg.up(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"upper") = v18_res_ag_removal.up(j,kcr,attributes); + ov18_res_ag_removal_reg(t,i,kcr,attributes,"upper") = v18_res_ag_removal_reg.up(i,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"upper") = v18_res_ag_recycling.up(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"upper") = vm_res_ag_burn.up(i,kcr,attributes); + ov_res_recycling(t,i,npk,"upper") = vm_res_recycling.up(i,npk); + ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,attributes,"upper") = q18_prod_res_ag_cell.up(j,kcr,attributes); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"upper") = q18_prod_res_ag_reg.up(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"upper") = q18_prod_res_bg_cell.up(i,kcr,dm_nr); + oq18_regional_removals(t,i,kcr,attributes,"upper") = q18_regional_removals.up(i,kcr,attributes); + oq18_res_field_balance(t,i,kcr,attributes,"upper") = q18_res_field_balance.up(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kres,"upper") = q18_cell_field_constraint.up(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"upper") = q18_res_field_burn.up(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"upper") = q18_translate.up(j,kres,attributes); + oq18_res_recycling_nr(t,i,"upper") = q18_res_recycling_nr.up(i); + oq18_res_recycling_pk(t,i,pk18,"upper") = q18_res_recycling_pk.up(i,pk18); + oq18_cost_prod_res(t,i,kres,"upper") = q18_cost_prod_res.up(i,kres); + oq18_prod_res_reg(t,i,kall,"upper") = q18_prod_res_reg.up(i,kall); + ov18_prod_res(t,j,kres,"lower") = v18_prod_res.lo(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,attributes,"lower") = v18_res_biomass_ag_cell.lo(j,kcr,attributes); + ov_res_biomass_ag(t,i,kcr,attributes,"lower") = vm_res_biomass_ag.lo(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"lower") = vm_res_biomass_bg.lo(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"lower") = v18_res_ag_removal.lo(j,kcr,attributes); + ov18_res_ag_removal_reg(t,i,kcr,attributes,"lower") = v18_res_ag_removal_reg.lo(i,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"lower") = v18_res_ag_recycling.lo(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"lower") = vm_res_ag_burn.lo(i,kcr,attributes); + ov_res_recycling(t,i,npk,"lower") = vm_res_recycling.lo(i,npk); + ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,attributes,"lower") = q18_prod_res_ag_cell.lo(j,kcr,attributes); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"lower") = q18_prod_res_ag_reg.lo(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"lower") = q18_prod_res_bg_cell.lo(i,kcr,dm_nr); + oq18_regional_removals(t,i,kcr,attributes,"lower") = q18_regional_removals.lo(i,kcr,attributes); + oq18_res_field_balance(t,i,kcr,attributes,"lower") = q18_res_field_balance.lo(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kres,"lower") = q18_cell_field_constraint.lo(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"lower") = q18_res_field_burn.lo(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"lower") = q18_translate.lo(j,kres,attributes); + oq18_res_recycling_nr(t,i,"lower") = q18_res_recycling_nr.lo(i); + oq18_res_recycling_pk(t,i,pk18,"lower") = q18_res_recycling_pk.lo(i,pk18); + oq18_cost_prod_res(t,i,kres,"lower") = q18_cost_prod_res.lo(i,kres); + oq18_prod_res_reg(t,i,kall,"lower") = q18_prod_res_reg.lo(i,kall); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/scripts/start/testCellRes.R b/scripts/start/testCellRes.R index 0f13946f59..6aa870f9ca 100644 --- a/scripts/start/testCellRes.R +++ b/scripts/start/testCellRes.R @@ -29,7 +29,7 @@ cfg$title <- "testCellRes2_default_noNewEquation" cfg$gms$residues <- "flexreg_apr16" #start_run(cfg, codeCheck = TRUE) -cfg$title <- "testCellRes3_flexcell" +cfg$title <- "testCellRes6_flexcell" cfg$gms$residues <- "flexcell_july23" start_run(cfg, codeCheck = TRUE) From 975899285e5de228cff0ef3061f10627360b6836 Mon Sep 17 00:00:00 2001 From: caviddhen Date: Mon, 7 Aug 2023 18:10:25 +0200 Subject: [PATCH 06/68] reduce complexity --- main.gms | 2 +- .../flexcell_july23/declarations.gms | 48 ++--- .../18_residues/flexcell_july23/equations.gms | 12 +- .../18_residues/flexcell_july23/postsolve.gms | 176 +++++++++--------- scripts/start/testCellRes.R | 2 +- 5 files changed, 120 insertions(+), 120 deletions(-) diff --git a/main.gms b/main.gms index 577a4a27b9..bef783cabd 100644 --- a/main.gms +++ b/main.gms @@ -221,7 +221,7 @@ $offlisting $setglobal c_timesteps coup2100 $setglobal c_past till_2010 -$setglobal c_title testCellRes6_flexcell +$setglobal c_title testCellRes7_flexcell scalars s_use_gdx use of gdx files / 0 / diff --git a/modules/18_residues/flexcell_july23/declarations.gms b/modules/18_residues/flexcell_july23/declarations.gms index 93a26c5100..aca2d9c3fd 100644 --- a/modules/18_residues/flexcell_july23/declarations.gms +++ b/modules/18_residues/flexcell_july23/declarations.gms @@ -8,7 +8,7 @@ positive variables v18_prod_res(j,kres) Cellular production of residues (mio. tDM) - v18_res_biomass_ag_cell(j,kcr,attributes) Production of aboveground residues in each cell (mio. tDM) + v18_res_biomass_ag_cell(j,kcr) Production of aboveground residues in each cell (mio. tDM) vm_res_biomass_ag(i,kcr,attributes) Production of aboveground residues in each region (mio. tDM) vm_res_biomass_bg(i,kcr,dm_nr) Production of belowground residues in each region (mio. tDM) @@ -23,7 +23,7 @@ positive variables equations - q18_prod_res_ag_cell(j,kcr,attributes) Cellular production constraint of aboveground residues (mio. tDM) + q18_prod_res_ag_cell(j,kcr) Cellular production constraint of aboveground residues (mio. tDM) q18_prod_res_ag_reg(i,kcr,attributes) Regional production constraint of aboveground residues (mio. tDM) q18_prod_res_bg_cell(i,kcr,dm_nr) Cellular production constraint of belowground residues (mio. tDM) @@ -48,28 +48,28 @@ parameters *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov18_prod_res(t,j,kres,type) Cellular production of residues (mio. tDM) - ov18_res_biomass_ag_cell(t,j,kcr,attributes,type) Production of aboveground residues in each cell (mio. tDM) - ov_res_biomass_ag(t,i,kcr,attributes,type) Production of aboveground residues in each region (mio. tDM) - ov_res_biomass_bg(t,i,kcr,dm_nr,type) Production of belowground residues in each region (mio. tDM) - ov18_res_ag_removal(t,j,kcr,attributes,type) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov18_res_ag_removal_reg(t,i,kcr,attributes,type) Regional removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov18_res_ag_recycling(t,i,kcr,attributes,type) Recylcing of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov_res_ag_burn(t,i,kcr,attributes,type) Regional residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov_res_recycling(t,i,npk,type) Residues recycled to croplands in respective nutrients Nr P K units (mio. tX) - ov_cost_prod_kres(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER per yr) - oq18_prod_res_ag_cell(t,j,kcr,attributes,type) Cellular production constraint of aboveground residues (mio. tDM) - oq18_prod_res_ag_reg(t,i,kcr,attributes,type) Regional production constraint of aboveground residues (mio. tDM) - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,type) Cellular production constraint of belowground residues (mio. tDM) - oq18_regional_removals(t,i,kcr,attributes,type) Calculation of regional level removals (mio. tX) - oq18_res_field_balance(t,i,kcr,attributes,type) Calculation of the residues amount recycled to soils (mio. tDM) - oq18_cell_field_constraint(t,j,kres,type) Make sure the amount removed in any cell does not exceet the amoutn available - oq18_res_field_burn(t,i,kcr,attributes,type) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) - oq18_translate(t,j,kres,attributes,type) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) - oq18_res_recycling_nr(t,i,type) Nutrient recycling of reaactive nitrogen (mio. tNr) - oq18_res_recycling_pk(t,i,pk18,type) Nutrient recycling of phosphorus and potash (mio. tX) - oq18_cost_prod_res(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER) - oq18_prod_res_reg(t,i,kall,type) Regional production of residues (mio. tDM) + ov18_prod_res(t,j,kres,type) Cellular production of residues (mio. tDM) + ov18_res_biomass_ag_cell(t,j,kcr,type) Production of aboveground residues in each cell (mio. tDM) + ov_res_biomass_ag(t,i,kcr,attributes,type) Production of aboveground residues in each region (mio. tDM) + ov_res_biomass_bg(t,i,kcr,dm_nr,type) Production of belowground residues in each region (mio. tDM) + ov18_res_ag_removal(t,j,kcr,attributes,type) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov18_res_ag_removal_reg(t,i,kcr,attributes,type) Regional removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov18_res_ag_recycling(t,i,kcr,attributes,type) Recylcing of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov_res_ag_burn(t,i,kcr,attributes,type) Regional residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov_res_recycling(t,i,npk,type) Residues recycled to croplands in respective nutrients Nr P K units (mio. tX) + ov_cost_prod_kres(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER per yr) + oq18_prod_res_ag_cell(t,j,kcr,type) Cellular production constraint of aboveground residues (mio. tDM) + oq18_prod_res_ag_reg(t,i,kcr,attributes,type) Regional production constraint of aboveground residues (mio. tDM) + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,type) Cellular production constraint of belowground residues (mio. tDM) + oq18_regional_removals(t,i,kcr,attributes,type) Calculation of regional level removals (mio. tX) + oq18_res_field_balance(t,i,kcr,attributes,type) Calculation of the residues amount recycled to soils (mio. tDM) + oq18_cell_field_constraint(t,j,kres,type) Make sure the amount removed in any cell does not exceet the amoutn available + oq18_res_field_burn(t,i,kcr,attributes,type) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) + oq18_translate(t,j,kres,attributes,type) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) + oq18_res_recycling_nr(t,i,type) Nutrient recycling of reaactive nitrogen (mio. tNr) + oq18_res_recycling_pk(t,i,pk18,type) Nutrient recycling of phosphorus and potash (mio. tX) + oq18_cost_prod_res(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER) + oq18_prod_res_reg(t,i,kall,type) Regional production of residues (mio. tDM) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/18_residues/flexcell_july23/equations.gms b/modules/18_residues/flexcell_july23/equations.gms index 9f4f1f84e3..e2deeb9d77 100644 --- a/modules/18_residues/flexcell_july23/equations.gms +++ b/modules/18_residues/flexcell_july23/equations.gms @@ -11,17 +11,17 @@ *' of harvested area `vm_area` and production `vm_prod_reg`. `f18_cgf` contains *' slope and intercept parameters of the CGFs. - q18_prod_res_ag_cell(j2,kcr,attributes) .. - v18_res_biomass_ag_cell(j2,kcr,attributes) + q18_prod_res_ag_cell(j2,kcr) .. + v18_res_biomass_ag_cell(j2,kcr) =e= (sum(w, vm_area(j2,kcr,w)) * sum((ct, cell(i2,j2)), f18_multicropping(ct,i2)) * f18_cgf("intercept",kcr) - + vm_prod(j2,kcr) * f18_cgf("slope",kcr)) - * f18_attributes_residue_ag(attributes,kcr); + + vm_prod(j2,kcr) * f18_cgf("slope",kcr)); q18_prod_res_ag_reg(i2,kcr,attributes) .. vm_res_biomass_ag(i2,kcr,attributes) =e= - sum(cell(i2,j2), v18_res_biomass_ag_cell(j2,kcr,attributes)); + sum(cell(i2,j2), v18_res_biomass_ag_cell(j2,kcr)) + * f18_attributes_residue_ag(attributes,kcr); *' The BG crop residue biomass `vm_res_biomass_bg` is calculated as a function of *' total aboveground biomass. @@ -54,7 +54,7 @@ q18_regional_removals(i2,kcr,attributes) .. *' make sure removal is less than biomass produced in each cell q18_cell_field_constraint(j2,kres) .. - sum(kres_kcr(kres,kcr), v18_res_biomass_ag_cell(j2,kcr,"dm")) + sum(kres_kcr(kres,kcr), v18_res_biomass_ag_cell(j2,kcr)) =g= v18_prod_res(j2, kres); diff --git a/modules/18_residues/flexcell_july23/postsolve.gms b/modules/18_residues/flexcell_july23/postsolve.gms index 02ec370626..fa251d7265 100644 --- a/modules/18_residues/flexcell_july23/postsolve.gms +++ b/modules/18_residues/flexcell_july23/postsolve.gms @@ -10,93 +10,93 @@ *** EOF postsolve.gms *** *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov18_prod_res(t,j,kres,"marginal") = v18_prod_res.m(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,attributes,"marginal") = v18_res_biomass_ag_cell.m(j,kcr,attributes); - ov_res_biomass_ag(t,i,kcr,attributes,"marginal") = vm_res_biomass_ag.m(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"marginal") = vm_res_biomass_bg.m(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"marginal") = v18_res_ag_removal.m(j,kcr,attributes); - ov18_res_ag_removal_reg(t,i,kcr,attributes,"marginal") = v18_res_ag_removal_reg.m(i,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"marginal") = v18_res_ag_recycling.m(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"marginal") = vm_res_ag_burn.m(i,kcr,attributes); - ov_res_recycling(t,i,npk,"marginal") = vm_res_recycling.m(i,npk); - ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,attributes,"marginal") = q18_prod_res_ag_cell.m(j,kcr,attributes); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"marginal") = q18_prod_res_ag_reg.m(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"marginal") = q18_prod_res_bg_cell.m(i,kcr,dm_nr); - oq18_regional_removals(t,i,kcr,attributes,"marginal") = q18_regional_removals.m(i,kcr,attributes); - oq18_res_field_balance(t,i,kcr,attributes,"marginal") = q18_res_field_balance.m(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kres,"marginal") = q18_cell_field_constraint.m(j,kres); - oq18_res_field_burn(t,i,kcr,attributes,"marginal") = q18_res_field_burn.m(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"marginal") = q18_translate.m(j,kres,attributes); - oq18_res_recycling_nr(t,i,"marginal") = q18_res_recycling_nr.m(i); - oq18_res_recycling_pk(t,i,pk18,"marginal") = q18_res_recycling_pk.m(i,pk18); - oq18_cost_prod_res(t,i,kres,"marginal") = q18_cost_prod_res.m(i,kres); - oq18_prod_res_reg(t,i,kall,"marginal") = q18_prod_res_reg.m(i,kall); - ov18_prod_res(t,j,kres,"level") = v18_prod_res.l(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,attributes,"level") = v18_res_biomass_ag_cell.l(j,kcr,attributes); - ov_res_biomass_ag(t,i,kcr,attributes,"level") = vm_res_biomass_ag.l(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"level") = vm_res_biomass_bg.l(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"level") = v18_res_ag_removal.l(j,kcr,attributes); - ov18_res_ag_removal_reg(t,i,kcr,attributes,"level") = v18_res_ag_removal_reg.l(i,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"level") = v18_res_ag_recycling.l(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"level") = vm_res_ag_burn.l(i,kcr,attributes); - ov_res_recycling(t,i,npk,"level") = vm_res_recycling.l(i,npk); - ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,attributes,"level") = q18_prod_res_ag_cell.l(j,kcr,attributes); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"level") = q18_prod_res_ag_reg.l(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"level") = q18_prod_res_bg_cell.l(i,kcr,dm_nr); - oq18_regional_removals(t,i,kcr,attributes,"level") = q18_regional_removals.l(i,kcr,attributes); - oq18_res_field_balance(t,i,kcr,attributes,"level") = q18_res_field_balance.l(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kres,"level") = q18_cell_field_constraint.l(j,kres); - oq18_res_field_burn(t,i,kcr,attributes,"level") = q18_res_field_burn.l(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"level") = q18_translate.l(j,kres,attributes); - oq18_res_recycling_nr(t,i,"level") = q18_res_recycling_nr.l(i); - oq18_res_recycling_pk(t,i,pk18,"level") = q18_res_recycling_pk.l(i,pk18); - oq18_cost_prod_res(t,i,kres,"level") = q18_cost_prod_res.l(i,kres); - oq18_prod_res_reg(t,i,kall,"level") = q18_prod_res_reg.l(i,kall); - ov18_prod_res(t,j,kres,"upper") = v18_prod_res.up(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,attributes,"upper") = v18_res_biomass_ag_cell.up(j,kcr,attributes); - ov_res_biomass_ag(t,i,kcr,attributes,"upper") = vm_res_biomass_ag.up(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"upper") = vm_res_biomass_bg.up(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"upper") = v18_res_ag_removal.up(j,kcr,attributes); - ov18_res_ag_removal_reg(t,i,kcr,attributes,"upper") = v18_res_ag_removal_reg.up(i,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"upper") = v18_res_ag_recycling.up(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"upper") = vm_res_ag_burn.up(i,kcr,attributes); - ov_res_recycling(t,i,npk,"upper") = vm_res_recycling.up(i,npk); - ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,attributes,"upper") = q18_prod_res_ag_cell.up(j,kcr,attributes); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"upper") = q18_prod_res_ag_reg.up(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"upper") = q18_prod_res_bg_cell.up(i,kcr,dm_nr); - oq18_regional_removals(t,i,kcr,attributes,"upper") = q18_regional_removals.up(i,kcr,attributes); - oq18_res_field_balance(t,i,kcr,attributes,"upper") = q18_res_field_balance.up(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kres,"upper") = q18_cell_field_constraint.up(j,kres); - oq18_res_field_burn(t,i,kcr,attributes,"upper") = q18_res_field_burn.up(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"upper") = q18_translate.up(j,kres,attributes); - oq18_res_recycling_nr(t,i,"upper") = q18_res_recycling_nr.up(i); - oq18_res_recycling_pk(t,i,pk18,"upper") = q18_res_recycling_pk.up(i,pk18); - oq18_cost_prod_res(t,i,kres,"upper") = q18_cost_prod_res.up(i,kres); - oq18_prod_res_reg(t,i,kall,"upper") = q18_prod_res_reg.up(i,kall); - ov18_prod_res(t,j,kres,"lower") = v18_prod_res.lo(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,attributes,"lower") = v18_res_biomass_ag_cell.lo(j,kcr,attributes); - ov_res_biomass_ag(t,i,kcr,attributes,"lower") = vm_res_biomass_ag.lo(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"lower") = vm_res_biomass_bg.lo(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"lower") = v18_res_ag_removal.lo(j,kcr,attributes); - ov18_res_ag_removal_reg(t,i,kcr,attributes,"lower") = v18_res_ag_removal_reg.lo(i,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"lower") = v18_res_ag_recycling.lo(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"lower") = vm_res_ag_burn.lo(i,kcr,attributes); - ov_res_recycling(t,i,npk,"lower") = vm_res_recycling.lo(i,npk); - ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,attributes,"lower") = q18_prod_res_ag_cell.lo(j,kcr,attributes); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"lower") = q18_prod_res_ag_reg.lo(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"lower") = q18_prod_res_bg_cell.lo(i,kcr,dm_nr); - oq18_regional_removals(t,i,kcr,attributes,"lower") = q18_regional_removals.lo(i,kcr,attributes); - oq18_res_field_balance(t,i,kcr,attributes,"lower") = q18_res_field_balance.lo(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kres,"lower") = q18_cell_field_constraint.lo(j,kres); - oq18_res_field_burn(t,i,kcr,attributes,"lower") = q18_res_field_burn.lo(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"lower") = q18_translate.lo(j,kres,attributes); - oq18_res_recycling_nr(t,i,"lower") = q18_res_recycling_nr.lo(i); - oq18_res_recycling_pk(t,i,pk18,"lower") = q18_res_recycling_pk.lo(i,pk18); - oq18_cost_prod_res(t,i,kres,"lower") = q18_cost_prod_res.lo(i,kres); - oq18_prod_res_reg(t,i,kall,"lower") = q18_prod_res_reg.lo(i,kall); + ov18_prod_res(t,j,kres,"marginal") = v18_prod_res.m(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,"marginal") = v18_res_biomass_ag_cell.m(j,kcr); + ov_res_biomass_ag(t,i,kcr,attributes,"marginal") = vm_res_biomass_ag.m(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"marginal") = vm_res_biomass_bg.m(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"marginal") = v18_res_ag_removal.m(j,kcr,attributes); + ov18_res_ag_removal_reg(t,i,kcr,attributes,"marginal") = v18_res_ag_removal_reg.m(i,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"marginal") = v18_res_ag_recycling.m(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"marginal") = vm_res_ag_burn.m(i,kcr,attributes); + ov_res_recycling(t,i,npk,"marginal") = vm_res_recycling.m(i,npk); + ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,"marginal") = q18_prod_res_ag_cell.m(j,kcr); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"marginal") = q18_prod_res_ag_reg.m(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"marginal") = q18_prod_res_bg_cell.m(i,kcr,dm_nr); + oq18_regional_removals(t,i,kcr,attributes,"marginal") = q18_regional_removals.m(i,kcr,attributes); + oq18_res_field_balance(t,i,kcr,attributes,"marginal") = q18_res_field_balance.m(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kres,"marginal") = q18_cell_field_constraint.m(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"marginal") = q18_res_field_burn.m(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"marginal") = q18_translate.m(j,kres,attributes); + oq18_res_recycling_nr(t,i,"marginal") = q18_res_recycling_nr.m(i); + oq18_res_recycling_pk(t,i,pk18,"marginal") = q18_res_recycling_pk.m(i,pk18); + oq18_cost_prod_res(t,i,kres,"marginal") = q18_cost_prod_res.m(i,kres); + oq18_prod_res_reg(t,i,kall,"marginal") = q18_prod_res_reg.m(i,kall); + ov18_prod_res(t,j,kres,"level") = v18_prod_res.l(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,"level") = v18_res_biomass_ag_cell.l(j,kcr); + ov_res_biomass_ag(t,i,kcr,attributes,"level") = vm_res_biomass_ag.l(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"level") = vm_res_biomass_bg.l(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"level") = v18_res_ag_removal.l(j,kcr,attributes); + ov18_res_ag_removal_reg(t,i,kcr,attributes,"level") = v18_res_ag_removal_reg.l(i,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"level") = v18_res_ag_recycling.l(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"level") = vm_res_ag_burn.l(i,kcr,attributes); + ov_res_recycling(t,i,npk,"level") = vm_res_recycling.l(i,npk); + ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,"level") = q18_prod_res_ag_cell.l(j,kcr); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"level") = q18_prod_res_ag_reg.l(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"level") = q18_prod_res_bg_cell.l(i,kcr,dm_nr); + oq18_regional_removals(t,i,kcr,attributes,"level") = q18_regional_removals.l(i,kcr,attributes); + oq18_res_field_balance(t,i,kcr,attributes,"level") = q18_res_field_balance.l(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kres,"level") = q18_cell_field_constraint.l(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"level") = q18_res_field_burn.l(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"level") = q18_translate.l(j,kres,attributes); + oq18_res_recycling_nr(t,i,"level") = q18_res_recycling_nr.l(i); + oq18_res_recycling_pk(t,i,pk18,"level") = q18_res_recycling_pk.l(i,pk18); + oq18_cost_prod_res(t,i,kres,"level") = q18_cost_prod_res.l(i,kres); + oq18_prod_res_reg(t,i,kall,"level") = q18_prod_res_reg.l(i,kall); + ov18_prod_res(t,j,kres,"upper") = v18_prod_res.up(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,"upper") = v18_res_biomass_ag_cell.up(j,kcr); + ov_res_biomass_ag(t,i,kcr,attributes,"upper") = vm_res_biomass_ag.up(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"upper") = vm_res_biomass_bg.up(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"upper") = v18_res_ag_removal.up(j,kcr,attributes); + ov18_res_ag_removal_reg(t,i,kcr,attributes,"upper") = v18_res_ag_removal_reg.up(i,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"upper") = v18_res_ag_recycling.up(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"upper") = vm_res_ag_burn.up(i,kcr,attributes); + ov_res_recycling(t,i,npk,"upper") = vm_res_recycling.up(i,npk); + ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,"upper") = q18_prod_res_ag_cell.up(j,kcr); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"upper") = q18_prod_res_ag_reg.up(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"upper") = q18_prod_res_bg_cell.up(i,kcr,dm_nr); + oq18_regional_removals(t,i,kcr,attributes,"upper") = q18_regional_removals.up(i,kcr,attributes); + oq18_res_field_balance(t,i,kcr,attributes,"upper") = q18_res_field_balance.up(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kres,"upper") = q18_cell_field_constraint.up(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"upper") = q18_res_field_burn.up(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"upper") = q18_translate.up(j,kres,attributes); + oq18_res_recycling_nr(t,i,"upper") = q18_res_recycling_nr.up(i); + oq18_res_recycling_pk(t,i,pk18,"upper") = q18_res_recycling_pk.up(i,pk18); + oq18_cost_prod_res(t,i,kres,"upper") = q18_cost_prod_res.up(i,kres); + oq18_prod_res_reg(t,i,kall,"upper") = q18_prod_res_reg.up(i,kall); + ov18_prod_res(t,j,kres,"lower") = v18_prod_res.lo(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,"lower") = v18_res_biomass_ag_cell.lo(j,kcr); + ov_res_biomass_ag(t,i,kcr,attributes,"lower") = vm_res_biomass_ag.lo(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"lower") = vm_res_biomass_bg.lo(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"lower") = v18_res_ag_removal.lo(j,kcr,attributes); + ov18_res_ag_removal_reg(t,i,kcr,attributes,"lower") = v18_res_ag_removal_reg.lo(i,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"lower") = v18_res_ag_recycling.lo(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"lower") = vm_res_ag_burn.lo(i,kcr,attributes); + ov_res_recycling(t,i,npk,"lower") = vm_res_recycling.lo(i,npk); + ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,"lower") = q18_prod_res_ag_cell.lo(j,kcr); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"lower") = q18_prod_res_ag_reg.lo(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"lower") = q18_prod_res_bg_cell.lo(i,kcr,dm_nr); + oq18_regional_removals(t,i,kcr,attributes,"lower") = q18_regional_removals.lo(i,kcr,attributes); + oq18_res_field_balance(t,i,kcr,attributes,"lower") = q18_res_field_balance.lo(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kres,"lower") = q18_cell_field_constraint.lo(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"lower") = q18_res_field_burn.lo(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"lower") = q18_translate.lo(j,kres,attributes); + oq18_res_recycling_nr(t,i,"lower") = q18_res_recycling_nr.lo(i); + oq18_res_recycling_pk(t,i,pk18,"lower") = q18_res_recycling_pk.lo(i,pk18); + oq18_cost_prod_res(t,i,kres,"lower") = q18_cost_prod_res.lo(i,kres); + oq18_prod_res_reg(t,i,kall,"lower") = q18_prod_res_reg.lo(i,kall); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/scripts/start/testCellRes.R b/scripts/start/testCellRes.R index 6aa870f9ca..f5a3c30a7c 100644 --- a/scripts/start/testCellRes.R +++ b/scripts/start/testCellRes.R @@ -29,7 +29,7 @@ cfg$title <- "testCellRes2_default_noNewEquation" cfg$gms$residues <- "flexreg_apr16" #start_run(cfg, codeCheck = TRUE) -cfg$title <- "testCellRes6_flexcell" +cfg$title <- "testCellRes7_flexcell" cfg$gms$residues <- "flexcell_july23" start_run(cfg, codeCheck = TRUE) From a47bf0437382fa155c3c1f6d6259109eae529ca4 Mon Sep 17 00:00:00 2001 From: caviddhen Date: Tue, 8 Aug 2023 18:28:55 +0200 Subject: [PATCH 07/68] update changelog --- CHANGELOG.md | 2 +- .../flexcell_july23/declarations.gms | 28 +++++++++---------- .../18_residues/flexcell_july23/equations.gms | 16 +++++++---- .../flexcell_july23/realization.gms | 5 ++++ 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b301ae8a8..ceeeb2eb9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - ### added -- +- **18_residues** Included cluster-level residue realization ### removed - diff --git a/modules/18_residues/flexcell_july23/declarations.gms b/modules/18_residues/flexcell_july23/declarations.gms index aca2d9c3fd..83952a634d 100644 --- a/modules/18_residues/flexcell_july23/declarations.gms +++ b/modules/18_residues/flexcell_july23/declarations.gms @@ -7,14 +7,14 @@ positive variables - v18_prod_res(j,kres) Cellular production of residues (mio. tDM) - v18_res_biomass_ag_cell(j,kcr) Production of aboveground residues in each cell (mio. tDM) + v18_prod_res(j,kres) Cluster-level production of residues (mio. tDM) + v18_res_biomass_ag_cell(j,kcr) Production of aboveground residues in each cluster (mio. tDM) vm_res_biomass_ag(i,kcr,attributes) Production of aboveground residues in each region (mio. tDM) vm_res_biomass_bg(i,kcr,dm_nr) Production of belowground residues in each region (mio. tDM) v18_res_ag_removal(j,kcr,attributes) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) v18_res_ag_removal_reg(i,kcr,attributes) Regional removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) - v18_res_ag_recycling(i,kcr,attributes) Recylcing of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) + v18_res_ag_recycling(i,kcr,attributes) Recycling of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) vm_res_ag_burn(i,kcr,attributes) Regional residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) vm_res_recycling(i,npk) Residues recycled to croplands in respective nutrients Nr P K units (mio. tX) @@ -23,22 +23,22 @@ positive variables equations - q18_prod_res_ag_cell(j,kcr) Cellular production constraint of aboveground residues (mio. tDM) - q18_prod_res_ag_reg(i,kcr,attributes) Regional production constraint of aboveground residues (mio. tDM) + q18_prod_res_ag_cell(j,kcr) Cluster-level production constraint of aboveground residues (mio. tDM) + q18_prod_res_ag_reg(i,kcr,attributes) Regional production constraint of aboveground residues (mio. tDM) - q18_prod_res_bg_cell(i,kcr,dm_nr) Cellular production constraint of belowground residues (mio. tDM) + q18_prod_res_bg_cell(i,kcr,dm_nr) Cluster-level production constraint of belowground residues (mio. tDM) q18_regional_removals(i,kcr,attributes) Calculation of regional level removals (mio. tX) - q18_res_field_balance(i,kcr,attributes) Calculation of the residues amount recycled to soils (mio. tDM) - q18_cell_field_constraint(j,kres) Make sure the amount removed in any cell does not exceet the amoutn available - q18_res_field_burn(i,kcr,attributes) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) - q18_translate(j,kres,attributes) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) + q18_res_field_balance(i,kcr,attributes) Calculation of the residues amount recycled to soils (mio. tDM) + q18_cell_field_constraint(j,kres) Make sure the amount removed in any cell does not exceet the amoutn available + q18_res_field_burn(i,kcr,attributes) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) + q18_translate(j,kres,attributes) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) - q18_res_recycling_nr(i) Nutrient recycling of reaactive nitrogen (mio. tNr) - q18_res_recycling_pk(i,pk18) Nutrient recycling of phosphorus and potash (mio. tX) - q18_cost_prod_res(i,kres) Production costs of harvesting crop residues (mio. USD05MER) + q18_res_recycling_nr(i) Nutrient recycling of reaactive nitrogen (mio. tNr) + q18_res_recycling_pk(i,pk18) Nutrient recycling of phosphorus and potash (mio. tX) + q18_cost_prod_res(i,kres) Production costs of harvesting crop residues (mio. USD05MER) - q18_prod_res_reg(i,kall) Regional production of residues (mio. tDM) + q18_prod_res_reg(i,kall) Regional production of residues (mio. tDM) ; diff --git a/modules/18_residues/flexcell_july23/equations.gms b/modules/18_residues/flexcell_july23/equations.gms index e2deeb9d77..48983104e0 100644 --- a/modules/18_residues/flexcell_july23/equations.gms +++ b/modules/18_residues/flexcell_july23/equations.gms @@ -32,6 +32,17 @@ (vm_prod_reg(i2,kcr) + vm_res_biomass_ag(i2,kcr,"dm")) * f18_cgf("bg_to_ag",kcr) * f18_attributes_residue_bg(dm_nr,kcr); +*' Variable of removals at regional level needs to be greater than +*' the regionally-summed cluster-level variable. This is not an equal-to +*' for run-time considerations, but should be noted if regional removals +*' vm_res_biomass_ag are to be incentivised. + +q18_regional_removals(i2,kcr,attributes) .. + sum(cell(i2,j2), v18_res_ag_removal(j2,kcr,attributes)) + =l= + v18_res_ag_removal_reg(i2,kcr,attributes); + + *' In contrast to AG biomass, AG production `vm_res_biomass_ag(i,kcr,attributes)` *' is defined as the part of residues which is removed from the field. The *' difference between biomass and production is either burned on field or @@ -40,11 +51,6 @@ *' `vm_res_biomass_ag(i,kcr,attributes)` is properly assigned to different uses: *' removal, on-field burning and recycling of AG residues. -q18_regional_removals(i2,kcr,attributes) .. - sum(cell(i2,j2), v18_res_ag_removal(j2,kcr,attributes)) - =l= - v18_res_ag_removal_reg(i2,kcr,attributes); - q18_res_field_balance(i2,kcr,attributes) .. vm_res_biomass_ag(i2,kcr,attributes) =e= diff --git a/modules/18_residues/flexcell_july23/realization.gms b/modules/18_residues/flexcell_july23/realization.gms index 020f8c994b..3a879c7734 100644 --- a/modules/18_residues/flexcell_july23/realization.gms +++ b/modules/18_residues/flexcell_july23/realization.gms @@ -24,6 +24,11 @@ *' on @wirsenius_human_2000, @lal_world_2005 and @feller_dungung_2007. If different CGFs are available *' for crops within a crop group, we build a weighted average based on the *' production in 1995. +*' +*' This realization enforces cluster-level agricultural residue production, based on agricultural production +*' at the same level. However, other uses such as burning and recycling are allowed to be balanced at the +*' regional level, in order to reduce computational complexity. + *####################### R SECTION START (PHASES) ############################## $Ifi "%phase%" == "sets" $include "./modules/18_residues/flexcell_july23/sets.gms" From 0d94f0acf2dd79f022cb2c827df643e6ce3bc07b Mon Sep 17 00:00:00 2001 From: caviddhen Date: Fri, 18 Aug 2023 10:01:45 +0200 Subject: [PATCH 08/68] update underconstrained equation --- main.gms | 2 +- .../flexcell_july23/declarations.gms | 42 +++-- .../18_residues/flexcell_july23/equations.gms | 8 +- .../18_residues/flexcell_july23/postsolve.gms | 168 +++++++++--------- scripts/start/testCellRes.R | 2 +- 5 files changed, 106 insertions(+), 116 deletions(-) diff --git a/main.gms b/main.gms index bef783cabd..9726e457e3 100644 --- a/main.gms +++ b/main.gms @@ -221,7 +221,7 @@ $offlisting $setglobal c_timesteps coup2100 $setglobal c_past till_2010 -$setglobal c_title testCellRes7_flexcell +$setglobal c_title testCell1608_SUM scalars s_use_gdx use of gdx files / 0 / diff --git a/modules/18_residues/flexcell_july23/declarations.gms b/modules/18_residues/flexcell_july23/declarations.gms index 83952a634d..72a6f79f7a 100644 --- a/modules/18_residues/flexcell_july23/declarations.gms +++ b/modules/18_residues/flexcell_july23/declarations.gms @@ -48,28 +48,26 @@ parameters *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov18_prod_res(t,j,kres,type) Cellular production of residues (mio. tDM) - ov18_res_biomass_ag_cell(t,j,kcr,type) Production of aboveground residues in each cell (mio. tDM) - ov_res_biomass_ag(t,i,kcr,attributes,type) Production of aboveground residues in each region (mio. tDM) - ov_res_biomass_bg(t,i,kcr,dm_nr,type) Production of belowground residues in each region (mio. tDM) - ov18_res_ag_removal(t,j,kcr,attributes,type) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov18_res_ag_removal_reg(t,i,kcr,attributes,type) Regional removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov18_res_ag_recycling(t,i,kcr,attributes,type) Recylcing of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov_res_ag_burn(t,i,kcr,attributes,type) Regional residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov_res_recycling(t,i,npk,type) Residues recycled to croplands in respective nutrients Nr P K units (mio. tX) - ov_cost_prod_kres(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER per yr) - oq18_prod_res_ag_cell(t,j,kcr,type) Cellular production constraint of aboveground residues (mio. tDM) - oq18_prod_res_ag_reg(t,i,kcr,attributes,type) Regional production constraint of aboveground residues (mio. tDM) - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,type) Cellular production constraint of belowground residues (mio. tDM) - oq18_regional_removals(t,i,kcr,attributes,type) Calculation of regional level removals (mio. tX) - oq18_res_field_balance(t,i,kcr,attributes,type) Calculation of the residues amount recycled to soils (mio. tDM) - oq18_cell_field_constraint(t,j,kres,type) Make sure the amount removed in any cell does not exceet the amoutn available - oq18_res_field_burn(t,i,kcr,attributes,type) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) - oq18_translate(t,j,kres,attributes,type) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) - oq18_res_recycling_nr(t,i,type) Nutrient recycling of reaactive nitrogen (mio. tNr) - oq18_res_recycling_pk(t,i,pk18,type) Nutrient recycling of phosphorus and potash (mio. tX) - oq18_cost_prod_res(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER) - oq18_prod_res_reg(t,i,kall,type) Regional production of residues (mio. tDM) + ov18_prod_res(t,j,kres,type) Cluster-level production of residues (mio. tDM) + ov18_res_biomass_ag_cell(t,j,kcr,type) Production of aboveground residues in each cluster (mio. tDM) + ov_res_biomass_ag(t,i,kcr,attributes,type) Production of aboveground residues in each region (mio. tDM) + ov_res_biomass_bg(t,i,kcr,dm_nr,type) Production of belowground residues in each region (mio. tDM) + ov18_res_ag_removal(t,j,kcr,attributes,type) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov18_res_ag_recycling(t,i,kcr,attributes,type) Recycling of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov_res_ag_burn(t,i,kcr,attributes,type) Regional residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov_res_recycling(t,i,npk,type) Residues recycled to croplands in respective nutrients Nr P K units (mio. tX) + ov_cost_prod_kres(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER per yr) + oq18_prod_res_ag_cell(t,j,kcr,type) Cluster-level production constraint of aboveground residues (mio. tDM) + oq18_prod_res_ag_reg(t,i,kcr,attributes,type) Regional production constraint of aboveground residues (mio. tDM) + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,type) Cluster-level production constraint of belowground residues (mio. tDM) + oq18_res_field_balance(t,i,kcr,attributes,type) Calculation of the residues amount recycled to soils (mio. tDM) + oq18_cell_field_constraint(t,j,kres,type) Make sure the amount removed in any cell does not exceet the amoutn available + oq18_res_field_burn(t,i,kcr,attributes,type) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) + oq18_translate(t,j,kres,attributes,type) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) + oq18_res_recycling_nr(t,i,type) Nutrient recycling of reaactive nitrogen (mio. tNr) + oq18_res_recycling_pk(t,i,pk18,type) Nutrient recycling of phosphorus and potash (mio. tX) + oq18_cost_prod_res(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER) + oq18_prod_res_reg(t,i,kall,type) Regional production of residues (mio. tDM) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/18_residues/flexcell_july23/equations.gms b/modules/18_residues/flexcell_july23/equations.gms index 48983104e0..728b9b7097 100644 --- a/modules/18_residues/flexcell_july23/equations.gms +++ b/modules/18_residues/flexcell_july23/equations.gms @@ -37,10 +37,10 @@ *' for run-time considerations, but should be noted if regional removals *' vm_res_biomass_ag are to be incentivised. -q18_regional_removals(i2,kcr,attributes) .. - sum(cell(i2,j2), v18_res_ag_removal(j2,kcr,attributes)) - =l= - v18_res_ag_removal_reg(i2,kcr,attributes); + q18_regional_removals(i2,kcr,attributes) .. + sum(cell(i2,j2), v18_res_ag_removal(j2,kcr,attributes)) + =e= + v18_res_ag_removal_reg(i2,kcr,attributes); *' In contrast to AG biomass, AG production `vm_res_biomass_ag(i,kcr,attributes)` diff --git a/modules/18_residues/flexcell_july23/postsolve.gms b/modules/18_residues/flexcell_july23/postsolve.gms index fa251d7265..58ee960b3a 100644 --- a/modules/18_residues/flexcell_july23/postsolve.gms +++ b/modules/18_residues/flexcell_july23/postsolve.gms @@ -10,93 +10,85 @@ *** EOF postsolve.gms *** *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov18_prod_res(t,j,kres,"marginal") = v18_prod_res.m(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,"marginal") = v18_res_biomass_ag_cell.m(j,kcr); - ov_res_biomass_ag(t,i,kcr,attributes,"marginal") = vm_res_biomass_ag.m(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"marginal") = vm_res_biomass_bg.m(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"marginal") = v18_res_ag_removal.m(j,kcr,attributes); - ov18_res_ag_removal_reg(t,i,kcr,attributes,"marginal") = v18_res_ag_removal_reg.m(i,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"marginal") = v18_res_ag_recycling.m(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"marginal") = vm_res_ag_burn.m(i,kcr,attributes); - ov_res_recycling(t,i,npk,"marginal") = vm_res_recycling.m(i,npk); - ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,"marginal") = q18_prod_res_ag_cell.m(j,kcr); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"marginal") = q18_prod_res_ag_reg.m(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"marginal") = q18_prod_res_bg_cell.m(i,kcr,dm_nr); - oq18_regional_removals(t,i,kcr,attributes,"marginal") = q18_regional_removals.m(i,kcr,attributes); - oq18_res_field_balance(t,i,kcr,attributes,"marginal") = q18_res_field_balance.m(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kres,"marginal") = q18_cell_field_constraint.m(j,kres); - oq18_res_field_burn(t,i,kcr,attributes,"marginal") = q18_res_field_burn.m(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"marginal") = q18_translate.m(j,kres,attributes); - oq18_res_recycling_nr(t,i,"marginal") = q18_res_recycling_nr.m(i); - oq18_res_recycling_pk(t,i,pk18,"marginal") = q18_res_recycling_pk.m(i,pk18); - oq18_cost_prod_res(t,i,kres,"marginal") = q18_cost_prod_res.m(i,kres); - oq18_prod_res_reg(t,i,kall,"marginal") = q18_prod_res_reg.m(i,kall); - ov18_prod_res(t,j,kres,"level") = v18_prod_res.l(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,"level") = v18_res_biomass_ag_cell.l(j,kcr); - ov_res_biomass_ag(t,i,kcr,attributes,"level") = vm_res_biomass_ag.l(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"level") = vm_res_biomass_bg.l(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"level") = v18_res_ag_removal.l(j,kcr,attributes); - ov18_res_ag_removal_reg(t,i,kcr,attributes,"level") = v18_res_ag_removal_reg.l(i,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"level") = v18_res_ag_recycling.l(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"level") = vm_res_ag_burn.l(i,kcr,attributes); - ov_res_recycling(t,i,npk,"level") = vm_res_recycling.l(i,npk); - ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,"level") = q18_prod_res_ag_cell.l(j,kcr); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"level") = q18_prod_res_ag_reg.l(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"level") = q18_prod_res_bg_cell.l(i,kcr,dm_nr); - oq18_regional_removals(t,i,kcr,attributes,"level") = q18_regional_removals.l(i,kcr,attributes); - oq18_res_field_balance(t,i,kcr,attributes,"level") = q18_res_field_balance.l(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kres,"level") = q18_cell_field_constraint.l(j,kres); - oq18_res_field_burn(t,i,kcr,attributes,"level") = q18_res_field_burn.l(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"level") = q18_translate.l(j,kres,attributes); - oq18_res_recycling_nr(t,i,"level") = q18_res_recycling_nr.l(i); - oq18_res_recycling_pk(t,i,pk18,"level") = q18_res_recycling_pk.l(i,pk18); - oq18_cost_prod_res(t,i,kres,"level") = q18_cost_prod_res.l(i,kres); - oq18_prod_res_reg(t,i,kall,"level") = q18_prod_res_reg.l(i,kall); - ov18_prod_res(t,j,kres,"upper") = v18_prod_res.up(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,"upper") = v18_res_biomass_ag_cell.up(j,kcr); - ov_res_biomass_ag(t,i,kcr,attributes,"upper") = vm_res_biomass_ag.up(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"upper") = vm_res_biomass_bg.up(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"upper") = v18_res_ag_removal.up(j,kcr,attributes); - ov18_res_ag_removal_reg(t,i,kcr,attributes,"upper") = v18_res_ag_removal_reg.up(i,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"upper") = v18_res_ag_recycling.up(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"upper") = vm_res_ag_burn.up(i,kcr,attributes); - ov_res_recycling(t,i,npk,"upper") = vm_res_recycling.up(i,npk); - ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,"upper") = q18_prod_res_ag_cell.up(j,kcr); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"upper") = q18_prod_res_ag_reg.up(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"upper") = q18_prod_res_bg_cell.up(i,kcr,dm_nr); - oq18_regional_removals(t,i,kcr,attributes,"upper") = q18_regional_removals.up(i,kcr,attributes); - oq18_res_field_balance(t,i,kcr,attributes,"upper") = q18_res_field_balance.up(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kres,"upper") = q18_cell_field_constraint.up(j,kres); - oq18_res_field_burn(t,i,kcr,attributes,"upper") = q18_res_field_burn.up(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"upper") = q18_translate.up(j,kres,attributes); - oq18_res_recycling_nr(t,i,"upper") = q18_res_recycling_nr.up(i); - oq18_res_recycling_pk(t,i,pk18,"upper") = q18_res_recycling_pk.up(i,pk18); - oq18_cost_prod_res(t,i,kres,"upper") = q18_cost_prod_res.up(i,kres); - oq18_prod_res_reg(t,i,kall,"upper") = q18_prod_res_reg.up(i,kall); - ov18_prod_res(t,j,kres,"lower") = v18_prod_res.lo(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,"lower") = v18_res_biomass_ag_cell.lo(j,kcr); - ov_res_biomass_ag(t,i,kcr,attributes,"lower") = vm_res_biomass_ag.lo(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"lower") = vm_res_biomass_bg.lo(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"lower") = v18_res_ag_removal.lo(j,kcr,attributes); - ov18_res_ag_removal_reg(t,i,kcr,attributes,"lower") = v18_res_ag_removal_reg.lo(i,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"lower") = v18_res_ag_recycling.lo(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"lower") = vm_res_ag_burn.lo(i,kcr,attributes); - ov_res_recycling(t,i,npk,"lower") = vm_res_recycling.lo(i,npk); - ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,"lower") = q18_prod_res_ag_cell.lo(j,kcr); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"lower") = q18_prod_res_ag_reg.lo(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"lower") = q18_prod_res_bg_cell.lo(i,kcr,dm_nr); - oq18_regional_removals(t,i,kcr,attributes,"lower") = q18_regional_removals.lo(i,kcr,attributes); - oq18_res_field_balance(t,i,kcr,attributes,"lower") = q18_res_field_balance.lo(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kres,"lower") = q18_cell_field_constraint.lo(j,kres); - oq18_res_field_burn(t,i,kcr,attributes,"lower") = q18_res_field_burn.lo(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"lower") = q18_translate.lo(j,kres,attributes); - oq18_res_recycling_nr(t,i,"lower") = q18_res_recycling_nr.lo(i); - oq18_res_recycling_pk(t,i,pk18,"lower") = q18_res_recycling_pk.lo(i,pk18); - oq18_cost_prod_res(t,i,kres,"lower") = q18_cost_prod_res.lo(i,kres); - oq18_prod_res_reg(t,i,kall,"lower") = q18_prod_res_reg.lo(i,kall); + ov18_prod_res(t,j,kres,"marginal") = v18_prod_res.m(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,"marginal") = v18_res_biomass_ag_cell.m(j,kcr); + ov_res_biomass_ag(t,i,kcr,attributes,"marginal") = vm_res_biomass_ag.m(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"marginal") = vm_res_biomass_bg.m(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"marginal") = v18_res_ag_removal.m(j,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"marginal") = v18_res_ag_recycling.m(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"marginal") = vm_res_ag_burn.m(i,kcr,attributes); + ov_res_recycling(t,i,npk,"marginal") = vm_res_recycling.m(i,npk); + ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,"marginal") = q18_prod_res_ag_cell.m(j,kcr); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"marginal") = q18_prod_res_ag_reg.m(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"marginal") = q18_prod_res_bg_cell.m(i,kcr,dm_nr); + oq18_res_field_balance(t,i,kcr,attributes,"marginal") = q18_res_field_balance.m(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kres,"marginal") = q18_cell_field_constraint.m(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"marginal") = q18_res_field_burn.m(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"marginal") = q18_translate.m(j,kres,attributes); + oq18_res_recycling_nr(t,i,"marginal") = q18_res_recycling_nr.m(i); + oq18_res_recycling_pk(t,i,pk18,"marginal") = q18_res_recycling_pk.m(i,pk18); + oq18_cost_prod_res(t,i,kres,"marginal") = q18_cost_prod_res.m(i,kres); + oq18_prod_res_reg(t,i,kall,"marginal") = q18_prod_res_reg.m(i,kall); + ov18_prod_res(t,j,kres,"level") = v18_prod_res.l(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,"level") = v18_res_biomass_ag_cell.l(j,kcr); + ov_res_biomass_ag(t,i,kcr,attributes,"level") = vm_res_biomass_ag.l(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"level") = vm_res_biomass_bg.l(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"level") = v18_res_ag_removal.l(j,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"level") = v18_res_ag_recycling.l(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"level") = vm_res_ag_burn.l(i,kcr,attributes); + ov_res_recycling(t,i,npk,"level") = vm_res_recycling.l(i,npk); + ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,"level") = q18_prod_res_ag_cell.l(j,kcr); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"level") = q18_prod_res_ag_reg.l(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"level") = q18_prod_res_bg_cell.l(i,kcr,dm_nr); + oq18_res_field_balance(t,i,kcr,attributes,"level") = q18_res_field_balance.l(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kres,"level") = q18_cell_field_constraint.l(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"level") = q18_res_field_burn.l(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"level") = q18_translate.l(j,kres,attributes); + oq18_res_recycling_nr(t,i,"level") = q18_res_recycling_nr.l(i); + oq18_res_recycling_pk(t,i,pk18,"level") = q18_res_recycling_pk.l(i,pk18); + oq18_cost_prod_res(t,i,kres,"level") = q18_cost_prod_res.l(i,kres); + oq18_prod_res_reg(t,i,kall,"level") = q18_prod_res_reg.l(i,kall); + ov18_prod_res(t,j,kres,"upper") = v18_prod_res.up(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,"upper") = v18_res_biomass_ag_cell.up(j,kcr); + ov_res_biomass_ag(t,i,kcr,attributes,"upper") = vm_res_biomass_ag.up(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"upper") = vm_res_biomass_bg.up(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"upper") = v18_res_ag_removal.up(j,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"upper") = v18_res_ag_recycling.up(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"upper") = vm_res_ag_burn.up(i,kcr,attributes); + ov_res_recycling(t,i,npk,"upper") = vm_res_recycling.up(i,npk); + ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,"upper") = q18_prod_res_ag_cell.up(j,kcr); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"upper") = q18_prod_res_ag_reg.up(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"upper") = q18_prod_res_bg_cell.up(i,kcr,dm_nr); + oq18_res_field_balance(t,i,kcr,attributes,"upper") = q18_res_field_balance.up(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kres,"upper") = q18_cell_field_constraint.up(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"upper") = q18_res_field_burn.up(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"upper") = q18_translate.up(j,kres,attributes); + oq18_res_recycling_nr(t,i,"upper") = q18_res_recycling_nr.up(i); + oq18_res_recycling_pk(t,i,pk18,"upper") = q18_res_recycling_pk.up(i,pk18); + oq18_cost_prod_res(t,i,kres,"upper") = q18_cost_prod_res.up(i,kres); + oq18_prod_res_reg(t,i,kall,"upper") = q18_prod_res_reg.up(i,kall); + ov18_prod_res(t,j,kres,"lower") = v18_prod_res.lo(j,kres); + ov18_res_biomass_ag_cell(t,j,kcr,"lower") = v18_res_biomass_ag_cell.lo(j,kcr); + ov_res_biomass_ag(t,i,kcr,attributes,"lower") = vm_res_biomass_ag.lo(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"lower") = vm_res_biomass_bg.lo(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"lower") = v18_res_ag_removal.lo(j,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"lower") = v18_res_ag_recycling.lo(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"lower") = vm_res_ag_burn.lo(i,kcr,attributes); + ov_res_recycling(t,i,npk,"lower") = vm_res_recycling.lo(i,npk); + ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); + oq18_prod_res_ag_cell(t,j,kcr,"lower") = q18_prod_res_ag_cell.lo(j,kcr); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"lower") = q18_prod_res_ag_reg.lo(i,kcr,attributes); + oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"lower") = q18_prod_res_bg_cell.lo(i,kcr,dm_nr); + oq18_res_field_balance(t,i,kcr,attributes,"lower") = q18_res_field_balance.lo(i,kcr,attributes); + oq18_cell_field_constraint(t,j,kres,"lower") = q18_cell_field_constraint.lo(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"lower") = q18_res_field_burn.lo(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"lower") = q18_translate.lo(j,kres,attributes); + oq18_res_recycling_nr(t,i,"lower") = q18_res_recycling_nr.lo(i); + oq18_res_recycling_pk(t,i,pk18,"lower") = q18_res_recycling_pk.lo(i,pk18); + oq18_cost_prod_res(t,i,kres,"lower") = q18_cost_prod_res.lo(i,kres); + oq18_prod_res_reg(t,i,kall,"lower") = q18_prod_res_reg.lo(i,kall); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/scripts/start/testCellRes.R b/scripts/start/testCellRes.R index f5a3c30a7c..273491a124 100644 --- a/scripts/start/testCellRes.R +++ b/scripts/start/testCellRes.R @@ -29,7 +29,7 @@ cfg$title <- "testCellRes2_default_noNewEquation" cfg$gms$residues <- "flexreg_apr16" #start_run(cfg, codeCheck = TRUE) -cfg$title <- "testCellRes7_flexcell" +cfg$title <- "testCell1608_SUM" cfg$gms$residues <- "flexcell_july23" start_run(cfg, codeCheck = TRUE) From 5df686910ab921382c143117b19968ab2df953bc Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Wed, 23 Aug 2023 15:22:25 +0200 Subject: [PATCH 09/68] added option for including land degradatuion --- config/default.cfg | 17 ++++++++-- main.gms | 34 +++++++++---------- modules/14_yields/input/files | 1 + .../14_yields/managementcalib_aug19/input.gms | 13 +++++++ .../managementcalib_aug19/preloop.gms | 23 +++++++++++-- .../14_yields/managementcalib_aug19/sets.gms | 5 +++ 6 files changed, 71 insertions(+), 22 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 3d0ab80977..edad9d0921 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -307,6 +307,17 @@ cfg$gms$s14_limit_calib <- 1 # def = 1 # NOTE: It is recommended to recalibrate the model when changing this setting! cfg$gms$s14_calib_ir2rf <- 1 # def = 1 +# * Switch to include yield impacts of land degradation +# * Exogeneous yield reduction coefficients need to be provided +# * through f14_degradation_yld_reduc.cs3 +# * options: 1 (yields are reduced based on yield reduction coefficients) +# * 0 (land degradation is switched off) +cfg$gms$s14_degradation <- 0 # def = 0 +# * Types of land degradation considered +# * options: "soil_loss" (soil loss by water erosion) +# * "poll_loss" (insufficient pollination) +cfg$gms$degrad_type <- "soil_loss, poll_loss" #def = "soil_loss, poll_loss" + # ***--------------------- 15_food --------------------------------------- # * (anthropometrics_jan18): estimates food using scenario dependent regression # * and demography drivers @@ -703,7 +714,7 @@ cfg$gms$c31_grassl_yld_scenario <- "cc" # def = "cc" # * SSP scenario switch for pasture suitability areas (only take effect for realization grasslands_apr22) # * options: ssp126, ssp245, ssp370, ssp460, ssp585 -# * nocc (fixed to values from 1995), +# * nocc (fixed to values from 1995), # * nocc_hist (ssp245 until year defined in sm_fix_cc, fixed thereafter) cfg$gms$c31_past_suit_scen <- "ssp370" # def = "ssp370" @@ -1281,8 +1292,8 @@ cfg$gms$nitrogen <- "rescaled_jan21" # def = rescaled_jan21 cfg$gms$carbon <- "normal_dec17" # def = normal_dec17 # * RCP scenario of land carbon sink adjustment factor, from Grassi et al 2021 -# * options: RCP19, RCP26, RCP34, RCP45, RCP60, RCPBU, -# * nocc (fixed to values from 1995), +# * options: RCP19, RCP26, RCP34, RCP45, RCP60, RCPBU, +# * nocc (fixed to values from 1995), # * nocc_hist (RCPBU until year defined in sm_fix_cc, fixed thereafter) cfg$gms$c52_land_carbon_sink_rcp <- "RCPBU" diff --git a/main.gms b/main.gms index 3595e9c073..92c1f0f7ba 100644 --- a/main.gms +++ b/main.gms @@ -148,25 +148,25 @@ $title magpie *##################### R SECTION START (VERSION INFO) ########################## * -* Used data set: rev4.87_h12_magpie.tgz -* md5sum: 658398f1dcbef89198bd85d61b1db9ad -* Repository: /p/projects/rd3mod/inputdata/output +* Used data set: rev4.88_h12_magpie.tgz +* md5sum: 740da40ceda04850eb374df215837c1b +* Repository: /p/projects/rd3mod/mirror/rse.pik-potsdam.de/data/magpie/public * -* Used data set: rev4.87_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz -* md5sum: 8a1d668acfe66a700eb5da2143b31cb2 -* Repository: /p/projects/rd3mod/inputdata/output +* Used data set: rev4.88_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz +* md5sum: 9edbcc62e75b663eada84524402bccbf +* Repository: /p/projects/rd3mod/mirror/rse.pik-potsdam.de/data/magpie/public * -* Used data set: rev4.87_h12_validation.tgz -* md5sum: d02217d791b58400e6e3be7186527ed5 -* Repository: /p/projects/rd3mod/inputdata/output +* Used data set: rev4.88_h12_validation.tgz +* md5sum: d42abd58de683506a807b411d7fe87cb +* Repository: /p/projects/rd3mod/mirror/rse.pik-potsdam.de/data/magpie/public * * Used data set: additional_data_rev4.43.tgz -* md5sum: NA -* Repository: https://rse.pik-potsdam.de/data/magpie/public +* md5sum: 7f537e5df805af11f0e67e84e6010290 +* Repository: /p/projects/rd3mod/mirror/rse.pik-potsdam.de/data/magpie/public * -* Used data set: calibration_H12_per_ton_fao_may22_glo_08Jul23.tgz -* md5sum: 7315d0f268d6225805a4c1f1c3c05b13 -* Repository: /p/projects/landuse/data/input/calibration +* Used data set: calibration_H12_per_ton_fao_may22_glo_08Aug23.tgz +* md5sum: 5d34e4b54112db10f330f1e59dd60cc9 +* Repository: /p/projects/rd3mod/mirror/rse.pik-potsdam.de/data/magpie/public * * Low resolution: c200 * High resolution: 0.5 @@ -179,11 +179,11 @@ $title magpie * * Regionscode: 62eff8f7 * -* Regions data revision: 4.87 +* Regions data revision: 4.88 * * lpj2magpie settings: * * LPJmL data: MRI-ESM2-0:ssp370 -* * Revision: 4.87 +* * Revision: 4.88 * * aggregation settings: * * Input resolution: 0.5 @@ -195,7 +195,7 @@ $title magpie * * Call: withCallingHandlers(expr, message = messageHandler, warning = warningHandler, error = errorHandler) * * -* Last modification (input data): Thu Jul 13 10:36:10 2023 +* Last modification (input data): Wed Aug 23 14:34:40 2023 * *###################### R SECTION END (VERSION INFO) ########################### diff --git a/modules/14_yields/input/files b/modules/14_yields/input/files index 428a25e981..7ab12d5b2b 100644 --- a/modules/14_yields/input/files +++ b/modules/14_yields/input/files @@ -5,3 +5,4 @@ lpj_yields_0.5.mz f14_pasture_yields_hist.csv f14_ipcc_bce.cs3 f14_aboveground_fraction.csv +f14_degradation_yld_reduc.cs3 diff --git a/modules/14_yields/managementcalib_aug19/input.gms b/modules/14_yields/managementcalib_aug19/input.gms index 2eea9d4afb..2deb9bb31e 100644 --- a/modules/14_yields/managementcalib_aug19/input.gms +++ b/modules/14_yields/managementcalib_aug19/input.gms @@ -10,10 +10,17 @@ $setglobal c14_yields_scenario cc * nocc (no climate change) * nocc_hist (no climate change after year defined by sm_fix_cc) +sets + degrad_type(degrad_all) land degradation types considered in yield impacts + / poll_loss, soil_loss / +; + scalar s14_limit_calib Relative managament calibration switch (1=limited 0=pure relative) / 1 /; scalar s14_calib_ir2rf Switch to calibrate rainfed to irrigated yield ratios (1=calib 0=not calib) / 1 /; +scalar s14_degradation Switch to include yield impacts of land degradation(0=no degradation 1=with degradation) / 0 /; + scalars s14_yld_past_switch Spillover parameter for translating technological change in the crop sector into pasture yield increases (1) / 0.25 / ; @@ -77,3 +84,9 @@ $include "./modules/14_yields/input/f14_aboveground_fraction.csv" $offdelim / ; + +table f14_degradation_yld_reduc(t_all,j,degrad_all) Yield reduction factors due to land degradation (1) +$ondelim +$include "./modules/14_yields/input/f14_degradation_yld_reduc.cs3" +$offdelim +; diff --git a/modules/14_yields/managementcalib_aug19/preloop.gms b/modules/14_yields/managementcalib_aug19/preloop.gms index b674237a64..2bc0e576bc 100644 --- a/modules/14_yields/managementcalib_aug19/preloop.gms +++ b/modules/14_yields/managementcalib_aug19/preloop.gms @@ -155,11 +155,30 @@ if(sum((i,ltype14),f14_yld_calib(i,ltype14)) = 0, ); -i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) *sum(cell(i,j),f14_yld_calib(i,"crop")); -i14_yields_calib(t,j,"pasture",w) = i14_yields_calib(t,j,"pasture",w)*sum(cell(i,j),f14_yld_calib(i,"past")); +i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) + * sum(cell(i,j),f14_yld_calib(i,"crop")); +i14_yields_calib(t,j,"pasture",w) = i14_yields_calib(t,j,"pasture",w) + * sum(cell(i,j),f14_yld_calib(i,"past")); *' @stop +*' @code +*' Land degradation can negatively affect yields. Soil loss for example can +*' notably affect land productivity. Similarly, the yield of pollinator-dependent crops +*' is reduced when there is lack of pollinators. To account for the impacts of degradation, +*' calibrated yields are multiplied by a reduction coefficient that signifies the yield loss +*' after degradation. + +if ((s14_degradation = 1), + i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) + * (1 - sum(degrad_type, f14_degradation_yld_reduc(t,j,degrad_type))); + i14_yields_calib(t,j,"pasture",w) = i14_yields_calib(t,j,"pasture",w) + * (1 - sum(degrad_type, f14_degradation_yld_reduc(t,j,degrad_type))); +); + +*' @stop + + **** **** **** diff --git a/modules/14_yields/managementcalib_aug19/sets.gms b/modules/14_yields/managementcalib_aug19/sets.gms index 5fac9eba23..28d69e2587 100644 --- a/modules/14_yields/managementcalib_aug19/sets.gms +++ b/modules/14_yields/managementcalib_aug19/sets.gms @@ -29,4 +29,9 @@ sets / tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, foddr, cottn_pro / + + degrad_all all land degradation types + / poll_loss, soil_loss / + ; + From 2368c76d638bb0cb4181caa41bd343ddc217a178 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Wed, 23 Aug 2023 15:28:44 +0200 Subject: [PATCH 10/68] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e363af8d22..96bb0df98a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **scripts** All time steps between 2015 and 2050 are now reported to SEALS ### added -- +- **14_yields/config** Added option for considering impacts of land degradation on yields. If `s14_degradation` is switched to 1, MAgPIE will include cluster-specific exogeneous yield reduction coefficients that are provided through `./modules/14_yields/input/f14_degradation_yld_reduc.cs3`. The set `degrad_type` provided the choice between different degradation types. ### removed - From 68e9bd71e7fb6d83d1d4461c83b7e98a0a287bff Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Wed, 23 Aug 2023 16:54:02 +0200 Subject: [PATCH 11/68] conditional reading of input data --- modules/14_yields/managementcalib_aug19/input.gms | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/14_yields/managementcalib_aug19/input.gms b/modules/14_yields/managementcalib_aug19/input.gms index 2deb9bb31e..bac4b913c0 100644 --- a/modules/14_yields/managementcalib_aug19/input.gms +++ b/modules/14_yields/managementcalib_aug19/input.gms @@ -85,8 +85,10 @@ $offdelim / ; +$onEmpty table f14_degradation_yld_reduc(t_all,j,degrad_all) Yield reduction factors due to land degradation (1) $ondelim -$include "./modules/14_yields/input/f14_degradation_yld_reduc.cs3" +$if exist "./modules/14_yields/input/f14_degradation_yld_reduc.cs3" $include "./modules/14_yields/input/f14_degradation_yld_reduc.cs3" $offdelim ; +$offEmpty From 06b22ac8b5a1f47865ca0583eb43a8f952c2cc66 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Wed, 23 Aug 2023 17:08:19 +0200 Subject: [PATCH 12/68] changed files file --- modules/14_yields/input/files | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/14_yields/input/files b/modules/14_yields/input/files index 7ab12d5b2b..428a25e981 100644 --- a/modules/14_yields/input/files +++ b/modules/14_yields/input/files @@ -5,4 +5,3 @@ lpj_yields_0.5.mz f14_pasture_yields_hist.csv f14_ipcc_bce.cs3 f14_aboveground_fraction.csv -f14_degradation_yld_reduc.cs3 From 3613e8c34ff8afa599e4f149f435f7f16dee3dfb Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 24 Aug 2023 15:19:18 +0200 Subject: [PATCH 13/68] rewriting of yield impacts --- config/default.cfg | 14 ++++++------- modules/14_yields/input/files | 1 + .../14_yields/managementcalib_aug19/input.gms | 18 ++++++++++------- .../managementcalib_aug19/preloop.gms | 20 ++++++++++++------- .../14_yields/managementcalib_aug19/sets.gms | 6 +++--- 5 files changed, 34 insertions(+), 25 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index edad9d0921..fab0b203fa 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.88_h12_magpie.tgz", cellular = "rev4.88_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", validation = "rev4.88_h12_validation.tgz", - additional = "additional_data_rev4.43.tgz", + additional = "additional_data_rev4.45.tgz", calibration = "calibration_H12_per_ton_fao_may22_glo_08Aug23.tgz") # NOTE: It is recommended to recalibrate the model when changing cellular input data @@ -307,16 +307,14 @@ cfg$gms$s14_limit_calib <- 1 # def = 1 # NOTE: It is recommended to recalibrate the model when changing this setting! cfg$gms$s14_calib_ir2rf <- 1 # def = 1 -# * Switch to include yield impacts of land degradation -# * Exogeneous yield reduction coefficients need to be provided -# * through f14_degradation_yld_reduc.cs3 +# * Switch to include yield impacts of land degradation. +# * The state of yield-relevant nature's contributions to people (NCP) +# * is reported through ./modules/14_yields/input/f14_yld_ncp_report.cs3 +# * based on estimated outcomes for soil loss or pollination sufficiency +# * per cluster from an existing model run. # * options: 1 (yields are reduced based on yield reduction coefficients) # * 0 (land degradation is switched off) cfg$gms$s14_degradation <- 0 # def = 0 -# * Types of land degradation considered -# * options: "soil_loss" (soil loss by water erosion) -# * "poll_loss" (insufficient pollination) -cfg$gms$degrad_type <- "soil_loss, poll_loss" #def = "soil_loss, poll_loss" # ***--------------------- 15_food --------------------------------------- # * (anthropometrics_jan18): estimates food using scenario dependent regression diff --git a/modules/14_yields/input/files b/modules/14_yields/input/files index 428a25e981..984b93ee32 100644 --- a/modules/14_yields/input/files +++ b/modules/14_yields/input/files @@ -5,3 +5,4 @@ lpj_yields_0.5.mz f14_pasture_yields_hist.csv f14_ipcc_bce.cs3 f14_aboveground_fraction.csv +f14_kcr_pollinator_dependence.csv diff --git a/modules/14_yields/managementcalib_aug19/input.gms b/modules/14_yields/managementcalib_aug19/input.gms index bac4b913c0..4dfe3dd9c5 100644 --- a/modules/14_yields/managementcalib_aug19/input.gms +++ b/modules/14_yields/managementcalib_aug19/input.gms @@ -10,11 +10,6 @@ $setglobal c14_yields_scenario cc * nocc (no climate change) * nocc_hist (no climate change after year defined by sm_fix_cc) -sets - degrad_type(degrad_all) land degradation types considered in yield impacts - / poll_loss, soil_loss / -; - scalar s14_limit_calib Relative managament calibration switch (1=limited 0=pure relative) / 1 /; scalar s14_calib_ir2rf Switch to calibrate rainfed to irrigated yield ratios (1=calib 0=not calib) / 1 /; @@ -23,6 +18,7 @@ scalar s14_degradation Switch to include yield impacts of land degradation(0=n scalars s14_yld_past_switch Spillover parameter for translating technological change in the crop sector into pasture yield increases (1) / 0.25 / + s14_yld_reduction_soil_loss Land productivity declines by 8 per cent in areas where erosion rates are higher that 11 tons per hectare (1) / 0.08 / ; scalars @@ -86,9 +82,17 @@ $offdelim ; $onEmpty -table f14_degradation_yld_reduc(t_all,j,degrad_all) Yield reduction factors due to land degradation (1) +table f14_yld_ncp_report(t_all,j,ncp_type14) Share of land with intact natures contributions to people (NCP) (1) $ondelim -$if exist "./modules/14_yields/input/f14_degradation_yld_reduc.cs3" $include "./modules/14_yields/input/f14_degradation_yld_reduc.cs3" +$if exist "./modules/14_yields/input/f14_yld_ncp_report.cs3" $include "./modules/14_yields/input/f14_yld_ncp_report.cs3" $offdelim ; $offEmpty + +parameter f14_kcr_pollinator_dependence(kcr) Share of total yield dependent on crop pollination (1) +/ +$ondelim +$include "./modules/14_yields/input/f14_kcr_pollinator_dependence.csv" +$offdelim +/ +; diff --git a/modules/14_yields/managementcalib_aug19/preloop.gms b/modules/14_yields/managementcalib_aug19/preloop.gms index 2bc0e576bc..b7649dfa3c 100644 --- a/modules/14_yields/managementcalib_aug19/preloop.gms +++ b/modules/14_yields/managementcalib_aug19/preloop.gms @@ -165,15 +165,21 @@ i14_yields_calib(t,j,"pasture",w) = i14_yields_calib(t,j,"pasture",w) *' @code *' Land degradation can negatively affect yields. Soil loss for example can *' notably affect land productivity. Similarly, the yield of pollinator-dependent crops -*' is reduced when there is lack of pollinators. To account for the impacts of degradation, -*' calibrated yields are multiplied by a reduction coefficient that signifies the yield loss -*' after degradation. +*' is reduced when there is a lack of pollinators. To account for the impacts of degradation, +*' calibrated yields are multiplied by the share of land with intact NCP in each cell and specific +*' yield reduction coefficients that represent yield loss due to soil erosion and pollination +*' deficiency on non-intact land. + +* set default values in case of missing input file. +if(sum((t,j,ncp_type14),f14_yld_ncp_report(t,j,ncp_type14)) = 0, + f14_yld_ncp_report(t,j,ncp_type14) = 1; +); if ((s14_degradation = 1), - i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) - * (1 - sum(degrad_type, f14_degradation_yld_reduc(t,j,degrad_type))); - i14_yields_calib(t,j,"pasture",w) = i14_yields_calib(t,j,"pasture",w) - * (1 - sum(degrad_type, f14_degradation_yld_reduc(t,j,degrad_type))); + i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) * (1 - s14_yld_reduction_soil_loss) + + i14_yields_calib(t,j,kcr,w) * s14_yld_reduction_soil_loss * f14_yld_ncp_report(t,j,"soil_intact"); + i14_yields_calib(t,j,kcr,w) = i14_yields_calib(t,j,kcr,w) * (1 - f14_kcr_pollinator_dependence(kcr)) + + i14_yields_calib(t,j,kcr,w) * f14_kcr_pollinator_dependence(kcr) * f14_yld_ncp_report(t,j,"poll_suff"); ); *' @stop diff --git a/modules/14_yields/managementcalib_aug19/sets.gms b/modules/14_yields/managementcalib_aug19/sets.gms index 28d69e2587..350db0d55f 100644 --- a/modules/14_yields/managementcalib_aug19/sets.gms +++ b/modules/14_yields/managementcalib_aug19/sets.gms @@ -25,13 +25,13 @@ sets oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, foddr, cottn_pro, begr, betr / - knbe14(kcr) Cropping activities excluding bioenergy plants + knbe14(kcr) Cropping activities excluding bioenergy plants / tece, maiz, trce, rice_pro, soybean, rapeseed, groundnut, sunflower, oilpalm, puls_pro, potato, cassav_sp, sugr_cane, sugr_beet, others, foddr, cottn_pro / - degrad_all all land degradation types - / poll_loss, soil_loss / + ncp_type14 natures contributions to people (NCP) relevant for agricultural yields + / soil_intact, poll_suff / ; From 102c0650abbb9fd22b838270d745af73778e79b1 Mon Sep 17 00:00:00 2001 From: pvjeetze Date: Thu, 24 Aug 2023 15:22:20 +0200 Subject: [PATCH 14/68] updated changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96bb0df98a..1968c78298 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - **scripts** All time steps between 2015 and 2050 are now reported to SEALS ### added -- **14_yields/config** Added option for considering impacts of land degradation on yields. If `s14_degradation` is switched to 1, MAgPIE will include cluster-specific exogeneous yield reduction coefficients that are provided through `./modules/14_yields/input/f14_degradation_yld_reduc.cs3`. The set `degrad_type` provided the choice between different degradation types. +- **14_yields/config** Added option for considering impacts of land degradation on yields. If `s14_degradation` is switched to 1, MAgPIE will include cluster-specific information on the state of nature's contributions to people relevant for yields `./modules/14_yields/input/f14_yld_ncp_report.cs3`. ### removed - From a6eb073342d6d926e97eb021e1b5b43ecad224a4 Mon Sep 17 00:00:00 2001 From: pvjeetze <50408549+pvjeetze@users.noreply.github.com> Date: Fri, 25 Aug 2023 08:04:54 +0200 Subject: [PATCH 15/68] Update input.gms --- modules/14_yields/managementcalib_aug19/input.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/14_yields/managementcalib_aug19/input.gms b/modules/14_yields/managementcalib_aug19/input.gms index 4dfe3dd9c5..2454bcd7cf 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 scalars s14_yld_past_switch Spillover parameter for translating technological change in the crop sector into pasture yield increases (1) / 0.25 / - s14_yld_reduction_soil_loss Land productivity declines by 8 per cent in areas where erosion rates are higher that 11 tons per hectare (1) / 0.08 / + s14_yld_reduction_soil_loss Land productivity declines by 8 per cent in areas with severe soil loss (>11 tons per hectare) (1) / 0.08 / ; scalars From 98ce9cc40a6e091900164d506c4eb263730c6c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Tue, 5 Sep 2023 12:36:16 +0200 Subject: [PATCH 16/68] 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 151a3f7b0a..7c1affc38f 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "MAgPIE - An Open Source land-use modeling framework", - "version": "4.6.11", + "version": "4.6.11dev", "creators": [ { "name": "Dietrich, Jan Philipp", diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d66df98b4..a4149da638 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,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.6.11] - 2023-09-05 ### changed diff --git a/CITATION.cff b/CITATION.cff index dc43cf0107..414bb68781 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -125,7 +125,7 @@ authors: email: popp@pik-potsdam.de title: MAgPIE - An Open Source land-use modeling framework -version: 4.6.11 +version: 4.6.11dev date-released: 2023-09-05 repository-code: https://github.com/magpiemodel/magpie keywords: From 54974672009647de96efe2f4c19d7231d29cf72e Mon Sep 17 00:00:00 2001 From: pvjeetze <50408549+pvjeetze@users.noreply.github.com> Date: Thu, 14 Sep 2023 14:41:44 +0200 Subject: [PATCH 17/68] Update input.gms --- modules/14_yields/managementcalib_aug19/input.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/14_yields/managementcalib_aug19/input.gms b/modules/14_yields/managementcalib_aug19/input.gms index 2454bcd7cf..5a7428872e 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 scalars s14_yld_past_switch Spillover parameter for translating technological change in the crop sector into pasture yield increases (1) / 0.25 / - s14_yld_reduction_soil_loss Land productivity declines by 8 per cent in areas with severe soil loss (>11 tons per hectare) (1) / 0.08 / + s14_yld_reduction_soil_loss Decline of land productivity in areas with severe soil loss (>11 tons per hectare) (1) / 0.08 / ; scalars From d726b1395a304aa9c64044cc586e7fc643a0e3c8 Mon Sep 17 00:00:00 2001 From: pvjeetze <50408549+pvjeetze@users.noreply.github.com> Date: Thu, 14 Sep 2023 14:50:32 +0200 Subject: [PATCH 18/68] Update input.gms --- modules/14_yields/managementcalib_aug19/input.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/14_yields/managementcalib_aug19/input.gms b/modules/14_yields/managementcalib_aug19/input.gms index 5a7428872e..69f86c0d42 100644 --- a/modules/14_yields/managementcalib_aug19/input.gms +++ b/modules/14_yields/managementcalib_aug19/input.gms @@ -89,7 +89,7 @@ $offdelim ; $offEmpty -parameter f14_kcr_pollinator_dependence(kcr) Share of total yield dependent on crop pollination (1) +parameter f14_kcr_pollinator_dependence(kcr) Share of total yield dependent on biotic pollination (1) / $ondelim $include "./modules/14_yields/input/f14_kcr_pollinator_dependence.csv" From 010d56214b7569e32b301347ccf92693ae7c4890 Mon Sep 17 00:00:00 2001 From: pvjeetze <50408549+pvjeetze@users.noreply.github.com> Date: Thu, 14 Sep 2023 16:00:34 +0200 Subject: [PATCH 19/68] Update input.gms --- modules/14_yields/managementcalib_aug19/input.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/14_yields/managementcalib_aug19/input.gms b/modules/14_yields/managementcalib_aug19/input.gms index 69f86c0d42..62e1a60cb6 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 scalars s14_yld_past_switch Spillover parameter for translating technological change in the crop sector into pasture yield increases (1) / 0.25 / - s14_yld_reduction_soil_loss Decline of land productivity in areas with severe soil loss (>11 tons per hectare) (1) / 0.08 / + s14_yld_reduction_soil_loss Decline of land productivity in areas with severe soil loss (1) / 0.08 / ; scalars From 88b86264af13ff560f8cd6679e426d03db9e5ac6 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Sat, 16 Sep 2023 17:54:54 +0200 Subject: [PATCH 20/68] updated wage regression --- modules/36_employment/exo_may22/preloop.gms | 14 ++++++-------- modules/36_employment/exo_may22/sets.gms | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/modules/36_employment/exo_may22/preloop.gms b/modules/36_employment/exo_may22/preloop.gms index f2fba081bc..428cfe743a 100644 --- a/modules/36_employment/exo_may22/preloop.gms +++ b/modules/36_employment/exo_may22/preloop.gms @@ -6,19 +6,17 @@ *** | Contact: magpie@pik-potsdam.de * get calibration factors and aggregation weight -p36_calibration_hourly_costs(iso) = sum(t_past$(ord(t_past) eq card(t_past)), f36_hist_hourly_costs(t_past,iso)-(im_gdp_pc_mer_iso(t_past,iso) - *f36_regr_hourly_costs("slope")+f36_regr_hourly_costs("intercept"))); +p36_calibration_hourly_costs(iso) = sum(t_past$(ord(t_past) eq card(t_past)), log(f36_hist_hourly_costs(t_past,iso)) - (log(im_gdp_pc_mer_iso(t_past,iso)) + *f36_regr_hourly_costs("slope") + f36_regr_hourly_costs("intercept"))); p36_total_hours_worked(iso) = sum(t_past$(ord(t_past) eq card(t_past)), f36_historic_ag_empl(t_past,iso)*f36_weekly_hours_iso(t_past,iso)*s36_weeks_in_year); *' @code -*' Hourly labor costs are projected into the future by using a linear regression with +*' Hourly labor costs are projected into the future by using a log-log regression with *' GDPpcMER, which is calibrated such that historic values of agricultural employment -*' are met. A threshold is used in the regression to avoid too low or negative hourly -*' labor costs. -p36_hourly_costs_iso(t_all,iso,"baseline") = max((im_gdp_pc_mer_iso(t_all,iso) * f36_regr_hourly_costs("slope") + - f36_regr_hourly_costs("intercept") + p36_calibration_hourly_costs(iso)), - f36_regr_hourly_costs("threshold")); +*' are met. +p36_hourly_costs_iso(t_all,iso,"baseline") = exp(log(im_gdp_pc_mer_iso(t_all,iso)) * f36_regr_hourly_costs("slope") + + f36_regr_hourly_costs("intercept") + p36_calibration_hourly_costs(iso)); *' @stop diff --git a/modules/36_employment/exo_may22/sets.gms b/modules/36_employment/exo_may22/sets.gms index 8e165f7fc9..f31f93993d 100644 --- a/modules/36_employment/exo_may22/sets.gms +++ b/modules/36_employment/exo_may22/sets.gms @@ -7,7 +7,7 @@ sets reg36 regression coefficients - / slope, intercept, threshold / + / slope, intercept / wage_scen version of wages / baseline, scenario / ; From dbd0a4a48a5cf032895f4aeca7e07f9451d488aa Mon Sep 17 00:00:00 2001 From: caviddhen Date: Thu, 21 Sep 2023 17:49:46 +0200 Subject: [PATCH 21/68] update cluster level residue realization naming and cleanup --- CHANGELOG.md | 2 +- main.gms | 2 +- .../declarations.gms | 10 +++--- .../equations.gms | 14 ++++---- .../input.gms | 6 ++-- .../input/files | 0 .../postsolve.gms | 0 .../preloop.gms | 0 .../presolve.gms | 0 .../realization.gms | 0 .../scaling.gms | 0 .../sets.gms | 0 .../18_residues/flexreg_apr16/not_used.txt | 2 +- scripts/start/testCellRes.R | 35 ------------------- 14 files changed, 18 insertions(+), 53 deletions(-) rename modules/18_residues/{flexcell_july23 => flexcluster_july23}/declarations.gms (92%) rename modules/18_residues/{flexcell_july23 => flexcluster_july23}/equations.gms (94%) rename modules/18_residues/{flexcell_july23 => flexcluster_july23}/input.gms (88%) rename modules/18_residues/{flexcell_july23 => flexcluster_july23}/input/files (100%) rename modules/18_residues/{flexcell_july23 => flexcluster_july23}/postsolve.gms (100%) rename modules/18_residues/{flexcell_july23 => flexcluster_july23}/preloop.gms (100%) rename modules/18_residues/{flexcell_july23 => flexcluster_july23}/presolve.gms (100%) rename modules/18_residues/{flexcell_july23 => flexcluster_july23}/realization.gms (100%) rename modules/18_residues/{flexcell_july23 => flexcluster_july23}/scaling.gms (100%) rename modules/18_residues/{flexcell_july23 => flexcluster_july23}/sets.gms (100%) delete mode 100644 scripts/start/testCellRes.R diff --git a/CHANGELOG.md b/CHANGELOG.md index adac50bb09..b43b267f19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - ### added -- **18_residues** Included cluster-level residue realization +- **18_residues** Included cluster-level residue realization, for cluster-level production of residues (but balancing of recycling and burning budgets remains at region-level, for computational lightness) - **14_yields/config** Added option for considering impacts of land degradation on yields. If `s14_degradation` is switched to 1, MAgPIE will include cluster-specific information on the state of nature's contributions to people relevant for yields `./modules/14_yields/input/f14_yld_ncp_report.cs3`. ### removed diff --git a/main.gms b/main.gms index 061b5958bf..bf9d0f1587 100644 --- a/main.gms +++ b/main.gms @@ -221,7 +221,7 @@ $offlisting $setglobal c_timesteps coup2100 $setglobal c_past till_2010 -$setglobal c_title testCell1608_SUM +$setglobal c_title default scalars s_use_gdx use of gdx files / 0 / diff --git a/modules/18_residues/flexcell_july23/declarations.gms b/modules/18_residues/flexcluster_july23/declarations.gms similarity index 92% rename from modules/18_residues/flexcell_july23/declarations.gms rename to modules/18_residues/flexcluster_july23/declarations.gms index 72a6f79f7a..dc98a59c61 100644 --- a/modules/18_residues/flexcell_july23/declarations.gms +++ b/modules/18_residues/flexcluster_july23/declarations.gms @@ -8,7 +8,7 @@ positive variables v18_prod_res(j,kres) Cluster-level production of residues (mio. tDM) - v18_res_biomass_ag_cell(j,kcr) Production of aboveground residues in each cluster (mio. tDM) + v18_res_biomass_ag_clust(j,kcr) Production of aboveground residues in each cluster (mio. tDM) vm_res_biomass_ag(i,kcr,attributes) Production of aboveground residues in each region (mio. tDM) vm_res_biomass_bg(i,kcr,dm_nr) Production of belowground residues in each region (mio. tDM) @@ -23,16 +23,16 @@ positive variables equations - q18_prod_res_ag_cell(j,kcr) Cluster-level production constraint of aboveground residues (mio. tDM) + q18_prod_res_ag_clust(j,kcr) Cluster-level production constraint of aboveground residues (mio. tDM) q18_prod_res_ag_reg(i,kcr,attributes) Regional production constraint of aboveground residues (mio. tDM) - q18_prod_res_bg_cell(i,kcr,dm_nr) Cluster-level production constraint of belowground residues (mio. tDM) + q18_prod_res_bg_clust(i,kcr,dm_nr) Cluster-level production constraint of belowground residues (mio. tDM) q18_regional_removals(i,kcr,attributes) Calculation of regional level removals (mio. tX) q18_res_field_balance(i,kcr,attributes) Calculation of the residues amount recycled to soils (mio. tDM) - q18_cell_field_constraint(j,kres) Make sure the amount removed in any cell does not exceet the amoutn available + q18_clust_field_constraint(j,kres) Make sure the amount removed in any cluster does not exceed the amount available q18_res_field_burn(i,kcr,attributes) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) - q18_translate(j,kres,attributes) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) + q18_translate(j,kres,attributes) Transformation of the multiple crop residues into supply balance crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) q18_res_recycling_nr(i) Nutrient recycling of reaactive nitrogen (mio. tNr) q18_res_recycling_pk(i,pk18) Nutrient recycling of phosphorus and potash (mio. tX) diff --git a/modules/18_residues/flexcell_july23/equations.gms b/modules/18_residues/flexcluster_july23/equations.gms similarity index 94% rename from modules/18_residues/flexcell_july23/equations.gms rename to modules/18_residues/flexcluster_july23/equations.gms index 728b9b7097..22ac9f13a5 100644 --- a/modules/18_residues/flexcell_july23/equations.gms +++ b/modules/18_residues/flexcluster_july23/equations.gms @@ -11,8 +11,8 @@ *' of harvested area `vm_area` and production `vm_prod_reg`. `f18_cgf` contains *' slope and intercept parameters of the CGFs. - q18_prod_res_ag_cell(j2,kcr) .. - v18_res_biomass_ag_cell(j2,kcr) + q18_prod_res_ag_clust(j2,kcr) .. + v18_res_biomass_ag_clust(j2,kcr) =e= (sum(w, vm_area(j2,kcr,w)) * sum((ct, cell(i2,j2)), f18_multicropping(ct,i2)) * f18_cgf("intercept",kcr) + vm_prod(j2,kcr) * f18_cgf("slope",kcr)); @@ -20,13 +20,13 @@ q18_prod_res_ag_reg(i2,kcr,attributes) .. vm_res_biomass_ag(i2,kcr,attributes) =e= - sum(cell(i2,j2), v18_res_biomass_ag_cell(j2,kcr)) + sum(cell(i2,j2), v18_res_biomass_ag_clust(j2,kcr)) * f18_attributes_residue_ag(attributes,kcr); *' The BG crop residue biomass `vm_res_biomass_bg` is calculated as a function of *' total aboveground biomass. - q18_prod_res_bg_cell(i2,kcr,dm_nr) .. + q18_prod_res_bg_clust(i2,kcr,dm_nr) .. vm_res_biomass_bg(i2,kcr,dm_nr) =e= (vm_prod_reg(i2,kcr) + vm_res_biomass_ag(i2,kcr,"dm")) * f18_cgf("bg_to_ag",kcr) @@ -58,9 +58,9 @@ + vm_res_ag_burn(i2,kcr,attributes) + v18_res_ag_recycling(i2,kcr,attributes); -*' make sure removal is less than biomass produced in each cell - q18_cell_field_constraint(j2,kres) .. - sum(kres_kcr(kres,kcr), v18_res_biomass_ag_cell(j2,kcr)) +*' make sure removal is less than biomass produced in each cluster + q18_clust_field_constraint(j2,kres) .. + sum(kres_kcr(kres,kcr), v18_res_biomass_ag_clust(j2,kcr)) =g= v18_prod_res(j2, kres); diff --git a/modules/18_residues/flexcell_july23/input.gms b/modules/18_residues/flexcluster_july23/input.gms similarity index 88% rename from modules/18_residues/flexcell_july23/input.gms rename to modules/18_residues/flexcluster_july23/input.gms index 1b91afa613..80805ed3f8 100644 --- a/modules/18_residues/flexcell_july23/input.gms +++ b/modules/18_residues/flexcluster_july23/input.gms @@ -26,12 +26,12 @@ $offdelim; table f18_cgf(cgf,kve) Crop growth functions for all vegetation types containing slope intercept and belowground to aboveground ratio (1) $ondelim -$include "./modules/18_residues/flexcell_july23/input/f18_cgf.csv" +$include "./modules/18_residues/flexcluster_july23/input/f18_cgf.csv" $offdelim; table f18_res_use_burn(t_all,burn_scen18,dev18,kcr) Minimum and maximum burn share use for residues developing over time (1) $ondelim -$include "./modules/18_residues/flexcell_july23/input/f18_res_use_burn.cs3" +$include "./modules/18_residues/flexcluster_july23/input/f18_res_use_burn.cs3" $offdelim; parameter f18_res_combust_eff(kve) Combustion efficiency of residue burning (1) @@ -44,7 +44,7 @@ $offdelim parameter f18_fac_req_kres(kres) Factor requirements (USD05MER per tDM) / $ondelim -$include "./modules/18_residues/flexcell_july23/input/f18_fac_req_kres.csv" +$include "./modules/18_residues/flexcluster_july23/input/f18_fac_req_kres.csv" $offdelim /; diff --git a/modules/18_residues/flexcell_july23/input/files b/modules/18_residues/flexcluster_july23/input/files similarity index 100% rename from modules/18_residues/flexcell_july23/input/files rename to modules/18_residues/flexcluster_july23/input/files diff --git a/modules/18_residues/flexcell_july23/postsolve.gms b/modules/18_residues/flexcluster_july23/postsolve.gms similarity index 100% rename from modules/18_residues/flexcell_july23/postsolve.gms rename to modules/18_residues/flexcluster_july23/postsolve.gms diff --git a/modules/18_residues/flexcell_july23/preloop.gms b/modules/18_residues/flexcluster_july23/preloop.gms similarity index 100% rename from modules/18_residues/flexcell_july23/preloop.gms rename to modules/18_residues/flexcluster_july23/preloop.gms diff --git a/modules/18_residues/flexcell_july23/presolve.gms b/modules/18_residues/flexcluster_july23/presolve.gms similarity index 100% rename from modules/18_residues/flexcell_july23/presolve.gms rename to modules/18_residues/flexcluster_july23/presolve.gms diff --git a/modules/18_residues/flexcell_july23/realization.gms b/modules/18_residues/flexcluster_july23/realization.gms similarity index 100% rename from modules/18_residues/flexcell_july23/realization.gms rename to modules/18_residues/flexcluster_july23/realization.gms diff --git a/modules/18_residues/flexcell_july23/scaling.gms b/modules/18_residues/flexcluster_july23/scaling.gms similarity index 100% rename from modules/18_residues/flexcell_july23/scaling.gms rename to modules/18_residues/flexcluster_july23/scaling.gms diff --git a/modules/18_residues/flexcell_july23/sets.gms b/modules/18_residues/flexcluster_july23/sets.gms similarity index 100% rename from modules/18_residues/flexcell_july23/sets.gms rename to modules/18_residues/flexcluster_july23/sets.gms diff --git a/modules/18_residues/flexreg_apr16/not_used.txt b/modules/18_residues/flexreg_apr16/not_used.txt index c83b6031e2..07cb618a78 100644 --- a/modules/18_residues/flexreg_apr16/not_used.txt +++ b/modules/18_residues/flexreg_apr16/not_used.txt @@ -1,2 +1,2 @@ name,type,reason -vm_prod,input,questionnaire \ No newline at end of file +vm_prod,input,not needed \ No newline at end of file diff --git a/scripts/start/testCellRes.R b/scripts/start/testCellRes.R deleted file mode 100644 index 273491a124..0000000000 --- a/scripts/start/testCellRes.R +++ /dev/null @@ -1,35 +0,0 @@ - -# | (C) 2008-2021 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: start run with default.cfg settings -# position: 8 -# ------------------------------------------------ - -# Load start_run(cfg) function which is needed to start MAgPIE runs -source("scripts/start_functions.R") - - -library(lucode2) -library(gms) - -# Source default cfg. This loads the object "cfg" in R environment -source("config/default.cfg") - -#start MAgPIE run -cfg$title <- "testCellRes2_default_noNewEquation" - -#start MAgPIE run - -cfg$gms$residues <- "flexreg_apr16" -#start_run(cfg, codeCheck = TRUE) - -cfg$title <- "testCell1608_SUM" -cfg$gms$residues <- "flexcell_july23" -start_run(cfg, codeCheck = TRUE) - From a7c05111357eb0011dbc1c9e2c9ba67dc2e57a91 Mon Sep 17 00:00:00 2001 From: omahs <73983677+omahs@users.noreply.github.com> Date: Fri, 22 Sep 2023 13:54:41 +0200 Subject: [PATCH 22/68] fix typos --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 84a747e145..f94e7d1c09 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Please find a set of tutorials here https://magpiemodel.github.io/tutorials/. This guide will give you a brief technical introduction in how to install, run and use the model and how to analyse the model output. -Please pay attentions to the MAgPIE Coding Etiquette when you modify the code. +Please pay attention to the MAgPIE Coding Etiquette when you modify the code. The Coding Etiquette you find at the beginning of the documentation mentioned above. The Coding Etiquette explains also the naming conventions and other structural characteristics. @@ -150,7 +150,7 @@ following requirements: For other dependencies comparable measures should apply. When a dependency is added this dependency should be added to the *HOW TO INSTALL* section in the -README file of the model framework (mentioning the depencendy and explaining +README file of the model framework (mentioning the dependency and explaining how it can be installed). If not all requirements can be fulfilled by the new dependency this case should be discussed with the model maintainer (magpie@pik-potsdam.de) to find a good solution for it. From 32988be69417bdb510d18015aad82846422b89e1 Mon Sep 17 00:00:00 2001 From: omahs <73983677+omahs@users.noreply.github.com> Date: Fri, 22 Sep 2023 13:55:35 +0200 Subject: [PATCH 23/68] fix typo --- standalone/HOWTO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standalone/HOWTO.md b/standalone/HOWTO.md index 98ec2668e2..6a69274151 100644 --- a/standalone/HOWTO.md +++ b/standalone/HOWTO.md @@ -4,7 +4,7 @@ Standalone models can be used to run simulations which only require a subset of modules coming with the model. It can also be used to run a module isolated from the rest of the code. -A new standalone model is created by copying the template.gms within the standalone folder to a gms file with the name of the new model. The new model file needs to include all modules relevant for the calculation (done by adding a line for each module in the "MODULE SETUP" section) and make sure that all interfaces of the modules are properly adressed. Especially, interfaces to modules not part of that reduced model need to be fed with information coming from that new model file. +A new standalone model is created by copying the template.gms within the standalone folder to a gms file with the name of the new model. The new model file needs to include all modules relevant for the calculation (done by adding a line for each module in the "MODULE SETUP" section) and make sure that all interfaces of the modules are properly addressed. Especially, interfaces to modules not part of that reduced model need to be fed with information coming from that new model file. The standalone model file needs to follow the coding etiquette as any other file, meaning that it is only allowed to interact through interfaces with the modules. This is necessary to allow the reduced model to work with all realizations of a coupled module. From eb39503d1f4a1f4775654ed3450998700035a675 Mon Sep 17 00:00:00 2001 From: caviddhen Date: Fri, 22 Sep 2023 15:45:40 +0200 Subject: [PATCH 24/68] cleanup and rename residues cluster realization --- main.gms | 10 +- .../declarations.gms | 48 +++++---- .../equations.gms | 2 +- .../input.gms | 6 +- .../input/files | 0 .../flexcluster_jul23/postsolve.gms | 102 ++++++++++++++++++ .../preloop.gms | 0 .../presolve.gms | 0 .../realization.gms | 16 +-- .../scaling.gms | 0 .../sets.gms | 2 +- .../flexcluster_july23/postsolve.gms | 94 ---------------- modules/18_residues/module.gms | 2 +- 13 files changed, 146 insertions(+), 136 deletions(-) rename modules/18_residues/{flexcluster_july23 => flexcluster_jul23}/declarations.gms (51%) rename modules/18_residues/{flexcluster_july23 => flexcluster_jul23}/equations.gms (99%) rename modules/18_residues/{flexcluster_july23 => flexcluster_jul23}/input.gms (88%) rename modules/18_residues/{flexcluster_july23 => flexcluster_jul23}/input/files (100%) create mode 100644 modules/18_residues/flexcluster_jul23/postsolve.gms rename modules/18_residues/{flexcluster_july23 => flexcluster_jul23}/preloop.gms (100%) rename modules/18_residues/{flexcluster_july23 => flexcluster_jul23}/presolve.gms (100%) rename modules/18_residues/{flexcluster_july23 => flexcluster_jul23}/realization.gms (87%) rename modules/18_residues/{flexcluster_july23 => flexcluster_jul23}/scaling.gms (100%) rename modules/18_residues/{flexcluster_july23 => flexcluster_jul23}/sets.gms (96%) delete mode 100644 modules/18_residues/flexcluster_july23/postsolve.gms diff --git a/main.gms b/main.gms index bf9d0f1587..74151a0464 100644 --- a/main.gms +++ b/main.gms @@ -160,9 +160,9 @@ $title magpie * md5sum: d42abd58de683506a807b411d7fe87cb * Repository: /p/projects/rd3mod/mirror/rse.pik-potsdam.de/data/magpie/public * -* Used data set: additional_data_rev4.43.tgz -* md5sum: 7f537e5df805af11f0e67e84e6010290 -* Repository: /p/projects/rd3mod/mirror/rse.pik-potsdam.de/data/magpie/public +* Used data set: additional_data_rev4.45.tgz +* md5sum: bb51c8c8608b8b9363582eb4aa220754 +* Repository: /p/projects/landuse/data/input/archive * * Used data set: calibration_H12_per_ton_fao_may22_glo_08Aug23.tgz * md5sum: 5d34e4b54112db10f330f1e59dd60cc9 @@ -195,7 +195,7 @@ $title magpie * * Call: withCallingHandlers(expr, message = messageHandler, warning = warningHandler, error = errorHandler) * * -* Last modification (input data): Wed Aug 23 14:34:40 2023 +* Last modification (input data): Fri Sep 22 15:20:24 2023 * *###################### R SECTION END (VERSION INFO) ########################### @@ -241,7 +241,7 @@ $setglobal food anthro_iso_jun22 $setglobal demand sector_may15 $setglobal production flexreg_apr16 -$setglobal residues flexcell_july23 +$setglobal residues flexreg_apr16 $setglobal processing substitution_may21 $setglobal trade selfsuff_reduced diff --git a/modules/18_residues/flexcluster_july23/declarations.gms b/modules/18_residues/flexcluster_jul23/declarations.gms similarity index 51% rename from modules/18_residues/flexcluster_july23/declarations.gms rename to modules/18_residues/flexcluster_jul23/declarations.gms index dc98a59c61..3add0dc21d 100644 --- a/modules/18_residues/flexcluster_july23/declarations.gms +++ b/modules/18_residues/flexcluster_jul23/declarations.gms @@ -8,7 +8,7 @@ positive variables v18_prod_res(j,kres) Cluster-level production of residues (mio. tDM) - v18_res_biomass_ag_clust(j,kcr) Production of aboveground residues in each cluster (mio. tDM) + v18_res_biomass_ag_clust(j,kcr) Production of aboveground residues in each cluster (mio. tDM) vm_res_biomass_ag(i,kcr,attributes) Production of aboveground residues in each region (mio. tDM) vm_res_biomass_bg(i,kcr,dm_nr) Production of belowground residues in each region (mio. tDM) @@ -30,7 +30,7 @@ equations q18_regional_removals(i,kcr,attributes) Calculation of regional level removals (mio. tX) q18_res_field_balance(i,kcr,attributes) Calculation of the residues amount recycled to soils (mio. tDM) - q18_clust_field_constraint(j,kres) Make sure the amount removed in any cluster does not exceed the amount available + q18_clust_field_constraint(j,kres) Make sure the amount removed in any cluster does not exceed the amount available (mio. tDM) q18_res_field_burn(i,kcr,attributes) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) q18_translate(j,kres,attributes) Transformation of the multiple crop residues into supply balance crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) @@ -43,31 +43,33 @@ equations ; parameters - i18_res_use_burn(t_all,dev18,kcr) Share of residues burned on field (1) + i18_res_use_burn(t_all,dev18,kcr) Share of residues burned on field (1) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov18_prod_res(t,j,kres,type) Cluster-level production of residues (mio. tDM) - ov18_res_biomass_ag_cell(t,j,kcr,type) Production of aboveground residues in each cluster (mio. tDM) - ov_res_biomass_ag(t,i,kcr,attributes,type) Production of aboveground residues in each region (mio. tDM) - ov_res_biomass_bg(t,i,kcr,dm_nr,type) Production of belowground residues in each region (mio. tDM) - ov18_res_ag_removal(t,j,kcr,attributes,type) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov18_res_ag_recycling(t,i,kcr,attributes,type) Recycling of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov_res_ag_burn(t,i,kcr,attributes,type) Regional residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov_res_recycling(t,i,npk,type) Residues recycled to croplands in respective nutrients Nr P K units (mio. tX) - ov_cost_prod_kres(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER per yr) - oq18_prod_res_ag_cell(t,j,kcr,type) Cluster-level production constraint of aboveground residues (mio. tDM) - oq18_prod_res_ag_reg(t,i,kcr,attributes,type) Regional production constraint of aboveground residues (mio. tDM) - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,type) Cluster-level production constraint of belowground residues (mio. tDM) - oq18_res_field_balance(t,i,kcr,attributes,type) Calculation of the residues amount recycled to soils (mio. tDM) - oq18_cell_field_constraint(t,j,kres,type) Make sure the amount removed in any cell does not exceet the amoutn available - oq18_res_field_burn(t,i,kcr,attributes,type) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) - oq18_translate(t,j,kres,attributes,type) Transformation of the multiple crop residues into supply balance crop redisues in respective attribute units DM GJ Nr P K WM C (mio. tX) - oq18_res_recycling_nr(t,i,type) Nutrient recycling of reaactive nitrogen (mio. tNr) - oq18_res_recycling_pk(t,i,pk18,type) Nutrient recycling of phosphorus and potash (mio. tX) - oq18_cost_prod_res(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER) - oq18_prod_res_reg(t,i,kall,type) Regional production of residues (mio. tDM) + ov18_prod_res(t,j,kres,type) Cluster-level production of residues (mio. tDM) + ov18_res_biomass_ag_clust(t,j,kcr,type) Production of aboveground residues in each cluster (mio. tDM) + ov_res_biomass_ag(t,i,kcr,attributes,type) Production of aboveground residues in each region (mio. tDM) + ov_res_biomass_bg(t,i,kcr,dm_nr,type) Production of belowground residues in each region (mio. tDM) + ov18_res_ag_removal(t,j,kcr,attributes,type) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov18_res_ag_removal_reg(t,i,kcr,attributes,type) Regional removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov18_res_ag_recycling(t,i,kcr,attributes,type) Recycling of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov_res_ag_burn(t,i,kcr,attributes,type) Regional residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov_res_recycling(t,i,npk,type) Residues recycled to croplands in respective nutrients Nr P K units (mio. tX) + ov_cost_prod_kres(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER per yr) + oq18_prod_res_ag_clust(t,j,kcr,type) Cluster-level production constraint of aboveground residues (mio. tDM) + oq18_prod_res_ag_reg(t,i,kcr,attributes,type) Regional production constraint of aboveground residues (mio. tDM) + oq18_prod_res_bg_clust(t,i,kcr,dm_nr,type) Cluster-level production constraint of belowground residues (mio. tDM) + oq18_regional_removals(t,i,kcr,attributes,type) Calculation of regional level removals (mio. tX) + oq18_res_field_balance(t,i,kcr,attributes,type) Calculation of the residues amount recycled to soils (mio. tDM) + oq18_clust_field_constraint(t,j,kres,type) Make sure the amount removed in any cluster does not exceed the amount available (mio. tDM) + oq18_res_field_burn(t,i,kcr,attributes,type) Fixing of the residues amount burned in a region in respective attribute units DM GJ Nr P K WM C (mio. tX) + oq18_translate(t,j,kres,attributes,type) Transformation of the multiple crop residues into supply balance crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) + oq18_res_recycling_nr(t,i,type) Nutrient recycling of reaactive nitrogen (mio. tNr) + oq18_res_recycling_pk(t,i,pk18,type) Nutrient recycling of phosphorus and potash (mio. tX) + oq18_cost_prod_res(t,i,kres,type) Production costs of harvesting crop residues (mio. USD05MER) + oq18_prod_res_reg(t,i,kall,type) Regional production of residues (mio. tDM) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/18_residues/flexcluster_july23/equations.gms b/modules/18_residues/flexcluster_jul23/equations.gms similarity index 99% rename from modules/18_residues/flexcluster_july23/equations.gms rename to modules/18_residues/flexcluster_jul23/equations.gms index 22ac9f13a5..68e0a0d6c8 100644 --- a/modules/18_residues/flexcluster_july23/equations.gms +++ b/modules/18_residues/flexcluster_jul23/equations.gms @@ -79,7 +79,7 @@ * vm_res_biomass_ag(i2,kcr,attributes); -*' While the residue biomass is estiamted with a crop-specific nutrient +*' While the residue biomass is estimated with a crop-specific nutrient *' composition (which is required for consistent nutrient budgets), the *' removed residues are assumed to have homogeneous properties *' (to reduce the number of commodities in MAgPIE) within three crop residue diff --git a/modules/18_residues/flexcluster_july23/input.gms b/modules/18_residues/flexcluster_jul23/input.gms similarity index 88% rename from modules/18_residues/flexcluster_july23/input.gms rename to modules/18_residues/flexcluster_jul23/input.gms index 80805ed3f8..cc9039bfa6 100644 --- a/modules/18_residues/flexcluster_july23/input.gms +++ b/modules/18_residues/flexcluster_jul23/input.gms @@ -26,12 +26,12 @@ $offdelim; table f18_cgf(cgf,kve) Crop growth functions for all vegetation types containing slope intercept and belowground to aboveground ratio (1) $ondelim -$include "./modules/18_residues/flexcluster_july23/input/f18_cgf.csv" +$include "./modules/18_residues/flexcluster_jul23/input/f18_cgf.csv" $offdelim; table f18_res_use_burn(t_all,burn_scen18,dev18,kcr) Minimum and maximum burn share use for residues developing over time (1) $ondelim -$include "./modules/18_residues/flexcluster_july23/input/f18_res_use_burn.cs3" +$include "./modules/18_residues/flexcluster_jul23/input/f18_res_use_burn.cs3" $offdelim; parameter f18_res_combust_eff(kve) Combustion efficiency of residue burning (1) @@ -44,7 +44,7 @@ $offdelim parameter f18_fac_req_kres(kres) Factor requirements (USD05MER per tDM) / $ondelim -$include "./modules/18_residues/flexcluster_july23/input/f18_fac_req_kres.csv" +$include "./modules/18_residues/flexcluster_jul23/input/f18_fac_req_kres.csv" $offdelim /; diff --git a/modules/18_residues/flexcluster_july23/input/files b/modules/18_residues/flexcluster_jul23/input/files similarity index 100% rename from modules/18_residues/flexcluster_july23/input/files rename to modules/18_residues/flexcluster_jul23/input/files diff --git a/modules/18_residues/flexcluster_jul23/postsolve.gms b/modules/18_residues/flexcluster_jul23/postsolve.gms new file mode 100644 index 0000000000..9de0597987 --- /dev/null +++ b/modules/18_residues/flexcluster_jul23/postsolve.gms @@ -0,0 +1,102 @@ +*** | (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 + +****** Residues + +*** EOF postsolve.gms *** + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov18_prod_res(t,j,kres,"marginal") = v18_prod_res.m(j,kres); + ov18_res_biomass_ag_clust(t,j,kcr,"marginal") = v18_res_biomass_ag_clust.m(j,kcr); + ov_res_biomass_ag(t,i,kcr,attributes,"marginal") = vm_res_biomass_ag.m(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"marginal") = vm_res_biomass_bg.m(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"marginal") = v18_res_ag_removal.m(j,kcr,attributes); + ov18_res_ag_removal_reg(t,i,kcr,attributes,"marginal") = v18_res_ag_removal_reg.m(i,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"marginal") = v18_res_ag_recycling.m(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"marginal") = vm_res_ag_burn.m(i,kcr,attributes); + ov_res_recycling(t,i,npk,"marginal") = vm_res_recycling.m(i,npk); + ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,kres); + oq18_prod_res_ag_clust(t,j,kcr,"marginal") = q18_prod_res_ag_clust.m(j,kcr); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"marginal") = q18_prod_res_ag_reg.m(i,kcr,attributes); + oq18_prod_res_bg_clust(t,i,kcr,dm_nr,"marginal") = q18_prod_res_bg_clust.m(i,kcr,dm_nr); + oq18_regional_removals(t,i,kcr,attributes,"marginal") = q18_regional_removals.m(i,kcr,attributes); + oq18_res_field_balance(t,i,kcr,attributes,"marginal") = q18_res_field_balance.m(i,kcr,attributes); + oq18_clust_field_constraint(t,j,kres,"marginal") = q18_clust_field_constraint.m(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"marginal") = q18_res_field_burn.m(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"marginal") = q18_translate.m(j,kres,attributes); + oq18_res_recycling_nr(t,i,"marginal") = q18_res_recycling_nr.m(i); + oq18_res_recycling_pk(t,i,pk18,"marginal") = q18_res_recycling_pk.m(i,pk18); + oq18_cost_prod_res(t,i,kres,"marginal") = q18_cost_prod_res.m(i,kres); + oq18_prod_res_reg(t,i,kall,"marginal") = q18_prod_res_reg.m(i,kall); + ov18_prod_res(t,j,kres,"level") = v18_prod_res.l(j,kres); + ov18_res_biomass_ag_clust(t,j,kcr,"level") = v18_res_biomass_ag_clust.l(j,kcr); + ov_res_biomass_ag(t,i,kcr,attributes,"level") = vm_res_biomass_ag.l(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"level") = vm_res_biomass_bg.l(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"level") = v18_res_ag_removal.l(j,kcr,attributes); + ov18_res_ag_removal_reg(t,i,kcr,attributes,"level") = v18_res_ag_removal_reg.l(i,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"level") = v18_res_ag_recycling.l(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"level") = vm_res_ag_burn.l(i,kcr,attributes); + ov_res_recycling(t,i,npk,"level") = vm_res_recycling.l(i,npk); + ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,kres); + oq18_prod_res_ag_clust(t,j,kcr,"level") = q18_prod_res_ag_clust.l(j,kcr); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"level") = q18_prod_res_ag_reg.l(i,kcr,attributes); + oq18_prod_res_bg_clust(t,i,kcr,dm_nr,"level") = q18_prod_res_bg_clust.l(i,kcr,dm_nr); + oq18_regional_removals(t,i,kcr,attributes,"level") = q18_regional_removals.l(i,kcr,attributes); + oq18_res_field_balance(t,i,kcr,attributes,"level") = q18_res_field_balance.l(i,kcr,attributes); + oq18_clust_field_constraint(t,j,kres,"level") = q18_clust_field_constraint.l(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"level") = q18_res_field_burn.l(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"level") = q18_translate.l(j,kres,attributes); + oq18_res_recycling_nr(t,i,"level") = q18_res_recycling_nr.l(i); + oq18_res_recycling_pk(t,i,pk18,"level") = q18_res_recycling_pk.l(i,pk18); + oq18_cost_prod_res(t,i,kres,"level") = q18_cost_prod_res.l(i,kres); + oq18_prod_res_reg(t,i,kall,"level") = q18_prod_res_reg.l(i,kall); + ov18_prod_res(t,j,kres,"upper") = v18_prod_res.up(j,kres); + ov18_res_biomass_ag_clust(t,j,kcr,"upper") = v18_res_biomass_ag_clust.up(j,kcr); + ov_res_biomass_ag(t,i,kcr,attributes,"upper") = vm_res_biomass_ag.up(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"upper") = vm_res_biomass_bg.up(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"upper") = v18_res_ag_removal.up(j,kcr,attributes); + ov18_res_ag_removal_reg(t,i,kcr,attributes,"upper") = v18_res_ag_removal_reg.up(i,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"upper") = v18_res_ag_recycling.up(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"upper") = vm_res_ag_burn.up(i,kcr,attributes); + ov_res_recycling(t,i,npk,"upper") = vm_res_recycling.up(i,npk); + ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,kres); + oq18_prod_res_ag_clust(t,j,kcr,"upper") = q18_prod_res_ag_clust.up(j,kcr); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"upper") = q18_prod_res_ag_reg.up(i,kcr,attributes); + oq18_prod_res_bg_clust(t,i,kcr,dm_nr,"upper") = q18_prod_res_bg_clust.up(i,kcr,dm_nr); + oq18_regional_removals(t,i,kcr,attributes,"upper") = q18_regional_removals.up(i,kcr,attributes); + oq18_res_field_balance(t,i,kcr,attributes,"upper") = q18_res_field_balance.up(i,kcr,attributes); + oq18_clust_field_constraint(t,j,kres,"upper") = q18_clust_field_constraint.up(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"upper") = q18_res_field_burn.up(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"upper") = q18_translate.up(j,kres,attributes); + oq18_res_recycling_nr(t,i,"upper") = q18_res_recycling_nr.up(i); + oq18_res_recycling_pk(t,i,pk18,"upper") = q18_res_recycling_pk.up(i,pk18); + oq18_cost_prod_res(t,i,kres,"upper") = q18_cost_prod_res.up(i,kres); + oq18_prod_res_reg(t,i,kall,"upper") = q18_prod_res_reg.up(i,kall); + ov18_prod_res(t,j,kres,"lower") = v18_prod_res.lo(j,kres); + ov18_res_biomass_ag_clust(t,j,kcr,"lower") = v18_res_biomass_ag_clust.lo(j,kcr); + ov_res_biomass_ag(t,i,kcr,attributes,"lower") = vm_res_biomass_ag.lo(i,kcr,attributes); + ov_res_biomass_bg(t,i,kcr,dm_nr,"lower") = vm_res_biomass_bg.lo(i,kcr,dm_nr); + ov18_res_ag_removal(t,j,kcr,attributes,"lower") = v18_res_ag_removal.lo(j,kcr,attributes); + ov18_res_ag_removal_reg(t,i,kcr,attributes,"lower") = v18_res_ag_removal_reg.lo(i,kcr,attributes); + ov18_res_ag_recycling(t,i,kcr,attributes,"lower") = v18_res_ag_recycling.lo(i,kcr,attributes); + ov_res_ag_burn(t,i,kcr,attributes,"lower") = vm_res_ag_burn.lo(i,kcr,attributes); + ov_res_recycling(t,i,npk,"lower") = vm_res_recycling.lo(i,npk); + ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); + oq18_prod_res_ag_clust(t,j,kcr,"lower") = q18_prod_res_ag_clust.lo(j,kcr); + oq18_prod_res_ag_reg(t,i,kcr,attributes,"lower") = q18_prod_res_ag_reg.lo(i,kcr,attributes); + oq18_prod_res_bg_clust(t,i,kcr,dm_nr,"lower") = q18_prod_res_bg_clust.lo(i,kcr,dm_nr); + oq18_regional_removals(t,i,kcr,attributes,"lower") = q18_regional_removals.lo(i,kcr,attributes); + oq18_res_field_balance(t,i,kcr,attributes,"lower") = q18_res_field_balance.lo(i,kcr,attributes); + oq18_clust_field_constraint(t,j,kres,"lower") = q18_clust_field_constraint.lo(j,kres); + oq18_res_field_burn(t,i,kcr,attributes,"lower") = q18_res_field_burn.lo(i,kcr,attributes); + oq18_translate(t,j,kres,attributes,"lower") = q18_translate.lo(j,kres,attributes); + oq18_res_recycling_nr(t,i,"lower") = q18_res_recycling_nr.lo(i); + oq18_res_recycling_pk(t,i,pk18,"lower") = q18_res_recycling_pk.lo(i,pk18); + oq18_cost_prod_res(t,i,kres,"lower") = q18_cost_prod_res.lo(i,kres); + oq18_prod_res_reg(t,i,kall,"lower") = q18_prod_res_reg.lo(i,kall); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + diff --git a/modules/18_residues/flexcluster_july23/preloop.gms b/modules/18_residues/flexcluster_jul23/preloop.gms similarity index 100% rename from modules/18_residues/flexcluster_july23/preloop.gms rename to modules/18_residues/flexcluster_jul23/preloop.gms diff --git a/modules/18_residues/flexcluster_july23/presolve.gms b/modules/18_residues/flexcluster_jul23/presolve.gms similarity index 100% rename from modules/18_residues/flexcluster_july23/presolve.gms rename to modules/18_residues/flexcluster_jul23/presolve.gms diff --git a/modules/18_residues/flexcluster_july23/realization.gms b/modules/18_residues/flexcluster_jul23/realization.gms similarity index 87% rename from modules/18_residues/flexcluster_july23/realization.gms rename to modules/18_residues/flexcluster_jul23/realization.gms index 3a879c7734..a1c737e440 100644 --- a/modules/18_residues/flexcluster_july23/realization.gms +++ b/modules/18_residues/flexcluster_jul23/realization.gms @@ -31,12 +31,12 @@ *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/18_residues/flexcell_july23/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/18_residues/flexcell_july23/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/18_residues/flexcell_july23/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/18_residues/flexcell_july23/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/18_residues/flexcell_july23/scaling.gms" -$Ifi "%phase%" == "preloop" $include "./modules/18_residues/flexcell_july23/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/18_residues/flexcell_july23/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/18_residues/flexcell_july23/postsolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/18_residues/flexcluster_jul23/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/18_residues/flexcluster_jul23/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/18_residues/flexcluster_jul23/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/18_residues/flexcluster_jul23/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/18_residues/flexcluster_jul23/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/18_residues/flexcluster_jul23/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/18_residues/flexcluster_jul23/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/18_residues/flexcluster_jul23/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/18_residues/flexcluster_july23/scaling.gms b/modules/18_residues/flexcluster_jul23/scaling.gms similarity index 100% rename from modules/18_residues/flexcluster_july23/scaling.gms rename to modules/18_residues/flexcluster_jul23/scaling.gms diff --git a/modules/18_residues/flexcluster_july23/sets.gms b/modules/18_residues/flexcluster_jul23/sets.gms similarity index 96% rename from modules/18_residues/flexcluster_july23/sets.gms rename to modules/18_residues/flexcluster_jul23/sets.gms index 428ccd5dbf..37140313ef 100644 --- a/modules/18_residues/flexcluster_july23/sets.gms +++ b/modules/18_residues/flexcluster_jul23/sets.gms @@ -14,7 +14,7 @@ dm_nr(attributes) dry matter and nr pk18(npk) subset of npk containing P and K nutrients /p, k/ -dev18 country develoment indicator +dev18 country development indicator /high_income,low_income/ burn_scen18 scenario for burning residues on field diff --git a/modules/18_residues/flexcluster_july23/postsolve.gms b/modules/18_residues/flexcluster_july23/postsolve.gms deleted file mode 100644 index 58ee960b3a..0000000000 --- a/modules/18_residues/flexcluster_july23/postsolve.gms +++ /dev/null @@ -1,94 +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 - -****** Residues - -*** EOF postsolve.gms *** - -*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov18_prod_res(t,j,kres,"marginal") = v18_prod_res.m(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,"marginal") = v18_res_biomass_ag_cell.m(j,kcr); - ov_res_biomass_ag(t,i,kcr,attributes,"marginal") = vm_res_biomass_ag.m(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"marginal") = vm_res_biomass_bg.m(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"marginal") = v18_res_ag_removal.m(j,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"marginal") = v18_res_ag_recycling.m(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"marginal") = vm_res_ag_burn.m(i,kcr,attributes); - ov_res_recycling(t,i,npk,"marginal") = vm_res_recycling.m(i,npk); - ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,"marginal") = q18_prod_res_ag_cell.m(j,kcr); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"marginal") = q18_prod_res_ag_reg.m(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"marginal") = q18_prod_res_bg_cell.m(i,kcr,dm_nr); - oq18_res_field_balance(t,i,kcr,attributes,"marginal") = q18_res_field_balance.m(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kres,"marginal") = q18_cell_field_constraint.m(j,kres); - oq18_res_field_burn(t,i,kcr,attributes,"marginal") = q18_res_field_burn.m(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"marginal") = q18_translate.m(j,kres,attributes); - oq18_res_recycling_nr(t,i,"marginal") = q18_res_recycling_nr.m(i); - oq18_res_recycling_pk(t,i,pk18,"marginal") = q18_res_recycling_pk.m(i,pk18); - oq18_cost_prod_res(t,i,kres,"marginal") = q18_cost_prod_res.m(i,kres); - oq18_prod_res_reg(t,i,kall,"marginal") = q18_prod_res_reg.m(i,kall); - ov18_prod_res(t,j,kres,"level") = v18_prod_res.l(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,"level") = v18_res_biomass_ag_cell.l(j,kcr); - ov_res_biomass_ag(t,i,kcr,attributes,"level") = vm_res_biomass_ag.l(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"level") = vm_res_biomass_bg.l(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"level") = v18_res_ag_removal.l(j,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"level") = v18_res_ag_recycling.l(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"level") = vm_res_ag_burn.l(i,kcr,attributes); - ov_res_recycling(t,i,npk,"level") = vm_res_recycling.l(i,npk); - ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,"level") = q18_prod_res_ag_cell.l(j,kcr); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"level") = q18_prod_res_ag_reg.l(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"level") = q18_prod_res_bg_cell.l(i,kcr,dm_nr); - oq18_res_field_balance(t,i,kcr,attributes,"level") = q18_res_field_balance.l(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kres,"level") = q18_cell_field_constraint.l(j,kres); - oq18_res_field_burn(t,i,kcr,attributes,"level") = q18_res_field_burn.l(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"level") = q18_translate.l(j,kres,attributes); - oq18_res_recycling_nr(t,i,"level") = q18_res_recycling_nr.l(i); - oq18_res_recycling_pk(t,i,pk18,"level") = q18_res_recycling_pk.l(i,pk18); - oq18_cost_prod_res(t,i,kres,"level") = q18_cost_prod_res.l(i,kres); - oq18_prod_res_reg(t,i,kall,"level") = q18_prod_res_reg.l(i,kall); - ov18_prod_res(t,j,kres,"upper") = v18_prod_res.up(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,"upper") = v18_res_biomass_ag_cell.up(j,kcr); - ov_res_biomass_ag(t,i,kcr,attributes,"upper") = vm_res_biomass_ag.up(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"upper") = vm_res_biomass_bg.up(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"upper") = v18_res_ag_removal.up(j,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"upper") = v18_res_ag_recycling.up(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"upper") = vm_res_ag_burn.up(i,kcr,attributes); - ov_res_recycling(t,i,npk,"upper") = vm_res_recycling.up(i,npk); - ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,"upper") = q18_prod_res_ag_cell.up(j,kcr); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"upper") = q18_prod_res_ag_reg.up(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"upper") = q18_prod_res_bg_cell.up(i,kcr,dm_nr); - oq18_res_field_balance(t,i,kcr,attributes,"upper") = q18_res_field_balance.up(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kres,"upper") = q18_cell_field_constraint.up(j,kres); - oq18_res_field_burn(t,i,kcr,attributes,"upper") = q18_res_field_burn.up(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"upper") = q18_translate.up(j,kres,attributes); - oq18_res_recycling_nr(t,i,"upper") = q18_res_recycling_nr.up(i); - oq18_res_recycling_pk(t,i,pk18,"upper") = q18_res_recycling_pk.up(i,pk18); - oq18_cost_prod_res(t,i,kres,"upper") = q18_cost_prod_res.up(i,kres); - oq18_prod_res_reg(t,i,kall,"upper") = q18_prod_res_reg.up(i,kall); - ov18_prod_res(t,j,kres,"lower") = v18_prod_res.lo(j,kres); - ov18_res_biomass_ag_cell(t,j,kcr,"lower") = v18_res_biomass_ag_cell.lo(j,kcr); - ov_res_biomass_ag(t,i,kcr,attributes,"lower") = vm_res_biomass_ag.lo(i,kcr,attributes); - ov_res_biomass_bg(t,i,kcr,dm_nr,"lower") = vm_res_biomass_bg.lo(i,kcr,dm_nr); - ov18_res_ag_removal(t,j,kcr,attributes,"lower") = v18_res_ag_removal.lo(j,kcr,attributes); - ov18_res_ag_recycling(t,i,kcr,attributes,"lower") = v18_res_ag_recycling.lo(i,kcr,attributes); - ov_res_ag_burn(t,i,kcr,attributes,"lower") = vm_res_ag_burn.lo(i,kcr,attributes); - ov_res_recycling(t,i,npk,"lower") = vm_res_recycling.lo(i,npk); - ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); - oq18_prod_res_ag_cell(t,j,kcr,"lower") = q18_prod_res_ag_cell.lo(j,kcr); - oq18_prod_res_ag_reg(t,i,kcr,attributes,"lower") = q18_prod_res_ag_reg.lo(i,kcr,attributes); - oq18_prod_res_bg_cell(t,i,kcr,dm_nr,"lower") = q18_prod_res_bg_cell.lo(i,kcr,dm_nr); - oq18_res_field_balance(t,i,kcr,attributes,"lower") = q18_res_field_balance.lo(i,kcr,attributes); - oq18_cell_field_constraint(t,j,kres,"lower") = q18_cell_field_constraint.lo(j,kres); - oq18_res_field_burn(t,i,kcr,attributes,"lower") = q18_res_field_burn.lo(i,kcr,attributes); - oq18_translate(t,j,kres,attributes,"lower") = q18_translate.lo(j,kres,attributes); - oq18_res_recycling_nr(t,i,"lower") = q18_res_recycling_nr.lo(i); - oq18_res_recycling_pk(t,i,pk18,"lower") = q18_res_recycling_pk.lo(i,pk18); - oq18_cost_prod_res(t,i,kres,"lower") = q18_cost_prod_res.lo(i,kres); - oq18_prod_res_reg(t,i,kall,"lower") = q18_prod_res_reg.lo(i,kall); -*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### - diff --git a/modules/18_residues/module.gms b/modules/18_residues/module.gms index c4fc9387b5..da6f79ebef 100644 --- a/modules/18_residues/module.gms +++ b/modules/18_residues/module.gms @@ -17,7 +17,7 @@ *' @authors Benjamin Leon Bodirsky *###################### R SECTION START (MODULETYPES) ########################## -$Ifi "%residues%" == "flexcell_july23" $include "./modules/18_residues/flexcell_july23/realization.gms" +$Ifi "%residues%" == "flexcluster_jul23" $include "./modules/18_residues/flexcluster_jul23/realization.gms" $Ifi "%residues%" == "flexreg_apr16" $include "./modules/18_residues/flexreg_apr16/realization.gms" $Ifi "%residues%" == "off" $include "./modules/18_residues/off/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ From 74565429eb9087ab9c079014ce04457be60b1094 Mon Sep 17 00:00:00 2001 From: emolinab <55435245+emolinab@users.noreply.github.com> Date: Wed, 27 Sep 2023 12:12:50 +0200 Subject: [PATCH 25/68] Update disaggregation_LUH2.R --- scripts/output/extra/disaggregation_LUH2.R | 68 ++++++++++------------ 1 file changed, 32 insertions(+), 36 deletions(-) diff --git a/scripts/output/extra/disaggregation_LUH2.R b/scripts/output/extra/disaggregation_LUH2.R index dba0a2affc..a5cf90a43d 100644 --- a/scripts/output/extra/disaggregation_LUH2.R +++ b/scripts/output/extra/disaggregation_LUH2.R @@ -6,7 +6,7 @@ # | Contact: magpie@pik-potsdam.de # ------------------------------------------------------------------------------------------------ -# description: Interpolates MAgPIE results to 0.5 degree resolution in LUH2 format for ISIMIP 3b +# description: Interpolates MAgPIE results to 0.25 degree resolution in LUH2 format for ISIMIP 3b # comparison script: FALSE # ------------------------------------------------------------------------------------------------ @@ -175,8 +175,10 @@ other_hr_shr <- other_hr_shr * setNames(land_hr_shr[,,"other"],NULL) if(!file.exists(paste0(out_dir,"/LUH2_states.nc"))){ states <- mbind(dimSums(crop_hr_shr_LUH2_FAO,dim=3.2), + setNames(dimSums(crop_hr_shr_LUH2_FAO, dim = 3), "cropland"), setNames(past_range_hr_shr[,,"past"],"pastr"), setNames(past_range_hr_shr[,,"range"],"range"), + setNames(dimSums(past_range_hr_shr,dim=3),"grazing"), setNames(land_hr_shr[,,"primforest"],"primf"), setNames(forestry_hr_shr[,,"plant"],"timber"), setNames(land_hr_shr[,,"secdforest"]+forestry_hr_shr[,,"ndc"]+forestry_hr_shr[,,"aff"],"secdf"), @@ -191,7 +193,7 @@ saveRDS(states,paste0(outputdir,"/states.rds")) gc() states <- convertLUH2(states) gc() -write.magpie(states,paste0(out_dir,"/LUH2_states.nc"),comment = "unit: fraction of grid-cell area") +write.magpie(states, paste0(out_dir, "/LUH2_states.nc"), comment = "unit: fraction of grid-cell area", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") rm(states) gc() } @@ -214,7 +216,7 @@ gc() if(!file.exists(paste0(out_dir,"/LUH2_protected_area.nc"))){ b <- convertLUH2(b) gc() -write.magpie(b,paste0(out_dir,"/LUH2_protected_area.nc"),comment = "unit: fraction of grid-cell") +write.magpie(b, paste0(out_dir, "/LUH2_protected_area.nc"), comment = "unit: fraction of grid-cell", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") rm(b) gc() } @@ -242,7 +244,7 @@ if(!is.null(harvested_area_timber(gdx,level = "cell"))) { if(!file.exists(paste0(out_dir,"/LUH2_wood_harvest_area.nc"))){ b <- convertLUH2(b) gc() - write.magpie(b,paste0(out_dir,"/LUH2_wood_harvest_area.nc"),comment = "unit: fraction of grid-cell area per year") + write.magpie(b, paste0(out_dir, "/LUH2_wood_harvest_area.nc"), comment = "unit: fraction of grid-cell area per year", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") rm(a,b) gc() } @@ -268,7 +270,7 @@ if(!is.null(harvested_area_timber(gdx,level = "cell"))) { if(!file.exists(paste0(out_dir,"/LUH2_wood_harvest_yields.nc"))){ b <- convertLUH2(b) gc() - write.magpie(b,paste0(out_dir,"/LUH2_wood_harvest_yields.nc"),comment = "unit: m3 per ha per year") + write.magpie(b, paste0(out_dir, "/LUH2_wood_harvest_yields.nc"), comment = "unit: m3 per ha per year", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") rm(a,b) gc() } @@ -282,7 +284,7 @@ if(!is.null(harvested_area_timber(gdx,level = "cell"))) { if(!file.exists(paste0(out_dir,"/LUH2_wood_harvest_biomass_split.nc"))){ b <- convertLUH2(b) gc() - write.magpie(b,paste0(out_dir,"/LUH2_wood_harvest_biomass_split.nc"),comment = "unit: fraction of wood harvest biomass") + write.magpie(b, paste0(out_dir, "/LUH2_wood_harvest_biomass_split.nc"), comment = "unit: fraction of wood harvest biomass", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") rm(b) gc() } @@ -301,36 +303,30 @@ if (any(abs(d) > 0.1 )) message(paste0("Difference between cluster and grid cell if(!file.exists(paste0(out_dir,"/LUH2_irrigation.nc"))){ irrig_hr_shr <- convertLUH2(irrig_hr_shr) gc() -write.magpie(irrig_hr_shr,paste0(out_dir,"/LUH2_irrigation.nc"),comment = "unit: fraction of crop area") +write.magpie(irrig_hr_shr, paste0(out_dir, "/LUH2_irrigation.nc"), comment = "unit: fraction of crop area", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") rm(irrig_hr_shr,d) gc() } #### Flood -rice_historical<-calcOutput("Ricearea",cellular=TRUE,aggregate=FALSE, share = FALSE) -rice_historical<-speed_aggregate(rice_historical,rel=mapping_spatial,from="cell",to="region",weight=NULL) -share_rice_flooded<-setNames(1-(rice_historical[,,"nonflooded"]/rice_historical[,,"total"])[,c(1995,2000,2005,2010),],NULL) -share<-speed_aggregate(share_rice_flooded,rel=mapping_spatial,from="region",to="cell",weight=NULL) - -rice <- dimSums(crop_hr_shr[,,"rice_pro"],dim=3.2) -rice[,c(1995,2000,2005,2010),]<-rice[,c(1995,2000,2005,2010),]*share[,c(1995,2000,2005,2010),] -ye<-getYears(rice, as.integer=T)[!(getYears(rice, as.integer=T) %in% c(1995,2000,2005,2010))] -rice[,ye,]<-rice[,ye,]*setYears(share[,2010,],NULL) -flooded<-round(rice,3) -getNames(flooded,dim=1) <- "flood" -flooded <- flooded / dimSums(crop_hr_shr_LUH2_FAO[,,"c3ann"],dim=3) -flooded[!is.finite(flooded)]<-0 -d <- dimSums(flooded* dimSums(crop_hr_shr_LUH2_FAO[,,"c3ann"],dim=3)*dimSums(land_hr,dim=3),dim=c(1,3))-croparea(gdx,level="glo",product_aggr = F,water_aggr = T)[,,"rice_pro"] -if (any(abs(d) > 0.1 )) message(paste0("Difference between cluster and grid cell production > 0.1 detected!")) -if(!file.exists(paste0(out_dir,"/LUH2_flood.nc"))){ -flooded <- convertLUH2(flooded) -gc() -write.magpie(flooded,paste0(out_dir,"/LUH2_flood.nc"),comment = "unit: flooded fraction of C3 annual crop area") -rm(flooded,d) -gc() +rice <- dimSums(crop_hr[, , "rice_pro"], dim = 3.2) +crop_hr_c3ann <- dimSums(crop_hr_LUH[, , "c3ann"], dim = 3.2) + +flooded <- rice / crop_hr_c3ann +flooded[!is.finite(flooded)] <- 0 + +d <- dimSums(flooded * dimSums(crop_hr_shr_LUH2_FAO[, , "c3ann"], dim = 3) * dimSums(land_hr, dim = 3), dim = c(1, 3)) - croparea(gdx, level = "glo", product_aggr = F, water_aggr = T)[, , "rice_pro"] +if (any(abs(d) > 0.1)) message(paste0("Difference between cluster and grid cell production > 0.1 detected!")) +if (!file.exists(paste0(out_dir, "/LUH2_flood.nc"))) { + flooded <- convertLUH2(flooded) + gc() + write.magpie(flooded, paste0(out_dir, "/LUH2_flood.nc"), comment = "unit: flooded fraction of C3 annual crop area", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") + rm(flooded, d) + gc() } + #### Bioenergy bio_hr_shr <- dimSums(crop_hr_shr[,,c("begr","betr")],dim=3.2) getNames(bio_hr_shr,dim=1) <- c("c4per","c3per") @@ -344,7 +340,7 @@ getNames(bio_hr_shr,dim=1) <- c("crpbf_c4per","crpbf_c3per") if(!file.exists(paste0(out_dir,"/LUH2_bioenergy.nc"))){ bio_hr_shr <- convertLUH2(bio_hr_shr) gc() -write.magpie(bio_hr_shr,paste0(out_dir,"/LUH2_bioenergy.nc"),comment = "unit: fraction of crop type area occupied by biofuel crops") +write.magpie(bio_hr_shr, paste0(out_dir, "/LUH2_bioenergy.nc"), comment = "unit: fraction of crop type area occupied by biofuel crops", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") rm(bio_hr_shr,d) gc() } @@ -401,19 +397,19 @@ x <- NULL if(!file.exists(paste0(out_dir,"/LUH2_Nitrogen_fertilizer.nc"))){ x <- convertLUH2(clean_magpie(collapseNames(a[,,"fertilizer"],collapsedim = 3.1))) gc() -write.magpie(x,paste0(out_dir,"/LUH2_Nitrogen_fertilizer.nc"),comment = "unit: kgN-per-ha") +write.magpie(x, paste0(out_dir, "/LUH2_Nitrogen_fertilizer.nc"), comment = "unit: kgN-per-ha", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") } if(!file.exists(paste0(out_dir,"/LUH2_Nitrogen_manure.nc"))){ x <- convertLUH2(clean_magpie(collapseNames(a[,,"manure"],collapsedim = 3.1))) gc() -write.magpie(x,paste0(out_dir,"/LUH2_Nitrogen_manure.nc"),comment = "unit: kgN-per-ha") +write.magpie(x, paste0(out_dir, "/LUH2_Nitrogen_manure.nc"), comment = "unit: kgN-per-ha", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") } if(!file.exists(paste0(out_dir,"/LUH2_Nitrogen_surplus.nc"))){ x <- convertLUH2(clean_magpie(collapseNames(a[,,"surplus"],collapsedim = 3.1))) gc() -write.magpie(x,paste0(out_dir,"/LUH2_Nitrogen_surplus.nc"),comment = "unit: kgN-per-ha") +write.magpie(x, paste0(out_dir, "/LUH2_Nitrogen_surplus.nc"), comment = "unit: kgN-per-ha", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") } rm(a,x,weight) @@ -433,7 +429,7 @@ a[,,n]<-dimSums(yield_kr_su[,,n],dim=3)/dimSums(map_LUHMAg_grid[,,n],dim=3) if(!file.exists(paste0(out_dir,"/LUH2_Yield_DM.nc"))){ a <- convertLUH2(a) gc() -write.magpie(a,paste0(out_dir,"/LUH2_Yield_DM.nc"),comment = "unit: tDM-per-ha") +write.magpie(a, paste0(out_dir, "/LUH2_Yield_DM.nc"), comment = "unit: tDM-per-ha", , datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") rm(a,yield_kr,yield_kr_su) gc() } @@ -452,7 +448,7 @@ a[,,n]<-dimSums(yield_kr_su[,,n],dim=3)/dimSums(map_LUHMAg_grid[,,n],dim=3) if(!file.exists(paste0(out_dir,"/LUH2_Yield_DM_rainfed.nc"))){ a <- convertLUH2(a) gc() -write.magpie(a,paste0(out_dir,"/LUH2_Yield_DM_rainfed.nc"),comment = "unit: tDM-per-ha") +write.magpie(a, paste0(out_dir, "/LUH2_Yield_DM_rainfed.nc"), comment = "unit: tDM-per-ha", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") rm(a,yield_kr,yield_kr_su) gc() } @@ -471,7 +467,7 @@ a[,,n]<-dimSums(yield_kr_su[,,n],dim=3)/dimSums(map_LUHMAg_grid[,,n],dim=3) if(!file.exists(paste0(out_dir,"/LUH2_Yield_DM_irrigated.nc"))){ a <- convertLUH2(a) gc() -write.magpie(a,paste0(out_dir,"/LUH2_Yield_DM_irrigated.nc"),comment = "unit: tDM-per-ha") +write.magpie(a, paste0(out_dir, "/LUH2_Yield_DM_irrigated.nc"), comment = "unit: tDM-per-ha", , datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") rm(a,yield_kr,yield_kr_su) gc() } @@ -490,7 +486,7 @@ a[,,n]<-dimSums(yield_kr_su[,,n],dim=3)/dimSums(map_LUHMAg_grid[,,n],dim=3) if(!file.exists(paste0(out_dir,"/LUH2_Yield_Nr.nc"))){ a <- convertLUH2(a) gc() -write.magpie(a,paste0(out_dir,"/LUH2_Yield_Nr.nc"),comment = "unit: kgN-per-ha") +write.magpie(a, paste0(out_dir, "/LUH2_Yield_Nr.nc"), comment = "unit: kgN-per-ha", , datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") rm(a,yield_kr,yield_kr_su) gc() } From 06327e620ab60e82d462bc0f17b9a1a59acfb936 Mon Sep 17 00:00:00 2001 From: emolinab <55435245+emolinab@users.noreply.github.com> Date: Wed, 27 Sep 2023 12:30:35 +0200 Subject: [PATCH 26/68] Update CHANGELOG.md for PR --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b43b267f19..40d7080d64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### changed -- +- **scripts** LUH2_disaggregation output script was modified. Specifically, flooded area was made compatible with the LUH definition, cropland and grazing land were added to the states.nc file, and specific naming/details (datatype, zname, xname, and yname) were added when creating the .nc files. ### added - **18_residues** Included cluster-level residue realization, for cluster-level production of residues (but balancing of recycling and burning budgets remains at region-level, for computational lightness) From 6ecfbff21b51d9580c0828c78b10edd7eb617b32 Mon Sep 17 00:00:00 2001 From: emolinab <55435245+emolinab@users.noreply.github.com> Date: Wed, 27 Sep 2023 12:51:13 +0200 Subject: [PATCH 27/68] typos disaggregation_LUH2.R --- scripts/output/extra/disaggregation_LUH2.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/output/extra/disaggregation_LUH2.R b/scripts/output/extra/disaggregation_LUH2.R index a5cf90a43d..f58721e7e3 100644 --- a/scripts/output/extra/disaggregation_LUH2.R +++ b/scripts/output/extra/disaggregation_LUH2.R @@ -92,7 +92,7 @@ grarea <- new.magpie(cells_and_regions=mapping_spatial$cell, fill=cal_area(coord[,"lon"],coord[,"lat"], mha=10^-10)) #grarea <- round(grarea,6) -# adjust total grid land area so that it is smaller than the gridcell area (some cells have a larger area acually; should be investigated) +# adjust total grid land area so that it is smaller than the gridcell area (some cells have a larger area actually; should be investigated) frac <- grarea/dimSums(land_hr, dim=3) frac[frac>1] <- 1 land_hr <- land_hr*frac @@ -429,7 +429,7 @@ a[,,n]<-dimSums(yield_kr_su[,,n],dim=3)/dimSums(map_LUHMAg_grid[,,n],dim=3) if(!file.exists(paste0(out_dir,"/LUH2_Yield_DM.nc"))){ a <- convertLUH2(a) gc() -write.magpie(a, paste0(out_dir, "/LUH2_Yield_DM.nc"), comment = "unit: tDM-per-ha", , datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") +write.magpie(a, paste0(out_dir, "/LUH2_Yield_DM.nc"), comment = "unit: tDM-per-ha", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") rm(a,yield_kr,yield_kr_su) gc() } @@ -467,7 +467,7 @@ a[,,n]<-dimSums(yield_kr_su[,,n],dim=3)/dimSums(map_LUHMAg_grid[,,n],dim=3) if(!file.exists(paste0(out_dir,"/LUH2_Yield_DM_irrigated.nc"))){ a <- convertLUH2(a) gc() -write.magpie(a, paste0(out_dir, "/LUH2_Yield_DM_irrigated.nc"), comment = "unit: tDM-per-ha", , datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") +write.magpie(a, paste0(out_dir, "/LUH2_Yield_DM_irrigated.nc"), comment = "unit: tDM-per-ha", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") rm(a,yield_kr,yield_kr_su) gc() } @@ -486,7 +486,7 @@ a[,,n]<-dimSums(yield_kr_su[,,n],dim=3)/dimSums(map_LUHMAg_grid[,,n],dim=3) if(!file.exists(paste0(out_dir,"/LUH2_Yield_Nr.nc"))){ a <- convertLUH2(a) gc() -write.magpie(a, paste0(out_dir, "/LUH2_Yield_Nr.nc"), comment = "unit: kgN-per-ha", , datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") +write.magpie(a, paste0(out_dir, "/LUH2_Yield_Nr.nc"), comment = "unit: kgN-per-ha", datatype = "FLT8S", zname = "time", xname = "lon", yname = "lat") rm(a,yield_kr,yield_kr_su) gc() } From b925dc7965da952f6eb27caaebfbb77746561cdd Mon Sep 17 00:00:00 2001 From: emolinab <55435245+emolinab@users.noreply.github.com> Date: Wed, 27 Sep 2023 16:15:34 +0200 Subject: [PATCH 28/68] Update scripts/output/extra/disaggregation_LUH2.R MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Pascal Führlich <82826417+pfuehrlich-pik@users.noreply.github.com> --- scripts/output/extra/disaggregation_LUH2.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/output/extra/disaggregation_LUH2.R b/scripts/output/extra/disaggregation_LUH2.R index f58721e7e3..b90dded6a7 100644 --- a/scripts/output/extra/disaggregation_LUH2.R +++ b/scripts/output/extra/disaggregation_LUH2.R @@ -6,7 +6,7 @@ # | Contact: magpie@pik-potsdam.de # ------------------------------------------------------------------------------------------------ -# description: Interpolates MAgPIE results to 0.25 degree resolution in LUH2 format for ISIMIP 3b +# description: Downscale MAgPIE results to 0.25 degree resolution in LUH2 format for ISIMIP 3b # comparison script: FALSE # ------------------------------------------------------------------------------------------------ From 26a28517a9cb07f7eb46b0f9a4411bc18688b245 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Fri, 13 Oct 2023 14:07:40 +0200 Subject: [PATCH 29/68] updated pre-processing --- config/default.cfg | 6 +++--- config/scenario_config.csv | 2 +- config/scenario_fsec.csv | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index fab0b203fa..b24db49bf9 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.88_h12_magpie.tgz", - cellular = "rev4.88_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.88_h12_validation.tgz", +cfg$input <- c(regional = "rev4.91_h12_magpie.tgz", + cellular = "rev4.91_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.91_h12_validation.tgz", additional = "additional_data_rev4.45.tgz", calibration = "calibration_H12_per_ton_fao_may22_glo_08Aug23.tgz") diff --git a/config/scenario_config.csv b/config/scenario_config.csv index 8fc52c3c0f..eaf1555c9f 100644 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -79,7 +79,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.88_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.88_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.88_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.88_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.88_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.88_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz; +input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.91_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.91_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.91_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.91_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.91_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.91_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 5210788d95..b4dc8ca0f7 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -65,9 +65,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.87_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.87_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.87_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.87_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.87_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.87_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.87_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz; -input['regional'];rev4.87_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['validation'];rev4.87_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['cellular'];rev4.87_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.91_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.91_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz; +input['regional'];rev4.91_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['validation'];rev4.91_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['additional'];additional_data_rev4.43.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['calibration'];calibration_FSEC_24Mar23.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; magicc_emis_scen;bjoernAR6_C_SSP2-NDC.mif;;;bjoernAR6_C_SSP2-PkBudg900.mif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bjoernAR6_C_SSP1-NDC.mif;;;;;;;;;;;;bjoernAR6_C_SSP1-PkBudg900.mif From 3521d39970ee77063a315ad24690fb1de917c328 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Fri, 13 Oct 2023 14:22:36 +0200 Subject: [PATCH 30/68] updated additional data revision --- config/default.cfg | 2 +- config/scenario_fsec.csv | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index b24db49bf9..86300e7e00 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.91_h12_magpie.tgz", cellular = "rev4.91_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", validation = "rev4.91_h12_validation.tgz", - additional = "additional_data_rev4.45.tgz", + additional = "additional_data_rev4.46.tgz", calibration = "calibration_H12_per_ton_fao_may22_glo_08Aug23.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 b4dc8ca0f7..cc27086414 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -68,6 +68,6 @@ gms$c73_build_demand;;;;;;;;;;;;;;;;;;;;;;;;50pc;;;;;;;;;;;;;;;;;;;;;;;;; input['cellular'];rev4.87_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.91_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.91_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz; input['regional'];rev4.91_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['validation'];rev4.91_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['additional'];additional_data_rev4.43.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['additional'];additional_data_rev4.46.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['calibration'];calibration_FSEC_24Mar23.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; magicc_emis_scen;bjoernAR6_C_SSP2-NDC.mif;;;bjoernAR6_C_SSP2-PkBudg900.mif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bjoernAR6_C_SSP1-NDC.mif;;;;;;;;;;;;bjoernAR6_C_SSP1-PkBudg900.mif From f4823d0a98a36c9c61fe3b3f89ed8fa90d51ddf6 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Fri, 13 Oct 2023 14:30:16 +0200 Subject: [PATCH 31/68] updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40d7080d64..2d59f50fe5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### changed - **scripts** LUH2_disaggregation output script was modified. Specifically, flooded area was made compatible with the LUH definition, cropland and grazing land were added to the states.nc file, and specific naming/details (datatype, zname, xname, and yname) were added when creating the .nc files. +- **36_employment** regression between hourly labor regression and GDP pc changed from linear to log-log ### added - **18_residues** Included cluster-level residue realization, for cluster-level production of residues (but balancing of recycling and burning budgets remains at region-level, for computational lightness) From 1f69c7c46869588017257a4369a409affa4ea3c7 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Mon, 16 Oct 2023 15:11:25 +0200 Subject: [PATCH 32/68] fixed revision number in scenario_fsec.csv --- 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 cc27086414..0d9e279936 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -65,7 +65,7 @@ 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.87_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.91_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.91_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz; +input['cellular'];rev4.91_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.91_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.91_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz; input['regional'];rev4.91_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['validation'];rev4.91_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['additional'];additional_data_rev4.46.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; From 63380bf8263988568eae2b6ff7e3cda6271c51dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Thu, 19 Oct 2023 11:05:06 +0200 Subject: [PATCH 33/68] switch inputdata --- config/default.cfg | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 86300e7e00..00023aa6cc 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -22,12 +22,11 @@ cfg$model <- "main.gms" #def = "main.gms" #### input settings #### # which input data sets should be used? -cfg$input <- c(regional = "rev4.91_h12_magpie.tgz", - cellular = "rev4.91_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.91_h12_validation.tgz", +cfg$input <- c(regional = "rev4.91_2023-10-18_67k_piam1.25_h12_magpie.tgz", + cellular = "rev4.91_2023-10-18_67k_piam1.25_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.91_2023-10-18_67k_piam1.25_h12_validation.tgz", additional = "additional_data_rev4.46.tgz", calibration = "calibration_H12_per_ton_fao_may22_glo_08Aug23.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, # e.g. changes in costs structure, NPI policies, etc. From 1577405878d831b6a07788352e04025eb46b4746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Mon, 23 Oct 2023 14:20:02 +0200 Subject: [PATCH 34/68] bugfixed inputdata --- config/default.cfg | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 00023aa6cc..6021648b05 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -22,11 +22,12 @@ cfg$model <- "main.gms" #def = "main.gms" #### input settings #### # which input data sets should be used? -cfg$input <- c(regional = "rev4.91_2023-10-18_67k_piam1.25_h12_magpie.tgz", - cellular = "rev4.91_2023-10-18_67k_piam1.25_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.91_2023-10-18_67k_piam1.25_h12_validation.tgz", +cfg$input <- c(regional = "rev4.92_h12_magpie.tgz", + cellular = "rev4.92_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.92_h12_validation.tgz", additional = "additional_data_rev4.46.tgz", calibration = "calibration_H12_per_ton_fao_may22_glo_08Aug23.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, # e.g. changes in costs structure, NPI policies, etc. From 85ce8107939d7fda5deebd3335a37d34e1fd2d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Mon, 23 Oct 2023 14:33:56 +0200 Subject: [PATCH 35/68] change fuehrlich -> sauer --- .zenodo.json | 2 +- CITATION.cff | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index 7c1affc38f..20f0640376 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -90,7 +90,7 @@ "affiliation": "Potsdam Institute for Climate Impact Research" }, { - "name": "Führlich, Pascal", + "name": "Sauer, Pascal", "affiliation": "Potsdam Institute for Climate Impact Research", "orcid": "0000-0002-6856-8239" }, diff --git a/CITATION.cff b/CITATION.cff index 414bb68781..bde8fd0ac5 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -106,11 +106,11 @@ authors: given-names: Anne affiliation: "Potsdam Institute for Climate Impact Research" - - family-names: Führlich + - family-names: Sauer given-names: Pascal orcid: https://orcid.org/0000-0002-6856-8239 affiliation: "Potsdam Institute for Climate Impact Research" - email: pascal.fuehrlich@pik-potsdam.de + email: pascal.sauer@pik-potsdam.de - family-names: Lotze-Campen given-names: Hermann From 462a68aea7fdd7e7adb2c1865a91df909fd561c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Mon, 23 Oct 2023 15:12:13 +0200 Subject: [PATCH 36/68] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d59f50fe5..532523977d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### changed +- **inputdata** There was a major bug (related to proj/terra) in the rev4.91 inputdata that was fixed with rev4.92 - **scripts** LUH2_disaggregation output script was modified. Specifically, flooded area was made compatible with the LUH definition, cropland and grazing land were added to the states.nc file, and specific naming/details (datatype, zname, xname, and yname) were added when creating the .nc files. - **36_employment** regression between hourly labor regression and GDP pc changed from linear to log-log From 12987e3e7fb15e02ac156c361c232d48f325bb58 Mon Sep 17 00:00:00 2001 From: David Klein Date: Tue, 24 Oct 2023 13:56:39 +0200 Subject: [PATCH 37/68] Clean and update code: - set minimal bioenergy demand in MAgPIE to zero to avoid multiple scenarios with the same demand but different prices. This improves the fits in many cases. - remove deprecated calculation of co2 price trajectories. They are now only taken from REMIND reports - add mute_ghgprices_until to the scenario_config_emulator.csv to have the same tax regimes as in REMIND-MAgPIE coupled runs - update order in which the emulator runs are started. The runs will be started in descending order according to their running time in order to achieve the lowest possible total running time. --- config/scenario_config_emulator.csv | 22 ++++-- scripts/start/extra/emulator.R | 116 ++++++++++------------------ 2 files changed, 56 insertions(+), 82 deletions(-) diff --git a/config/scenario_config_emulator.csv b/config/scenario_config_emulator.csv index e415b5b1a8..d071e157ae 100644 --- a/config/scenario_config_emulator.csv +++ b/config/scenario_config_emulator.csv @@ -1,6 +1,16 @@ -title;start;mag_scen;co2tax_name;co2tax_2025 -2;1;SSP2,NPI;Base;C_SSP2-Base-rem-5 -3;0;SSP2,NDC;NDC;C_SSP2-NDC-rem-5 -4;0;SSP2,NDC;PkBudg1300;C_SSP2-PkBudg1300-rem-5 -5;0;SSP2,NDC;PkBudg1100;C_SSP2-PkBudg1100-rem-5 -5;0;SSP2,NDC;PkBudg900;C_SSP2-PkBudg900-rem-5 +start;mag_scen;ghgtax_name;mifname;no_ghgprices_land_until +0;SDP-MC|NPI|nocc_hist;Base; C_SDP_MC-Base;y2150 +0;SDP-MC|NDC|nocc_hist;NDC; C_SDP_MC-NDC;y2150 +0;SDP-MC|NDC|nocc_hist;PkBudg500; C_SDP_MC-PkBudg500;y2030 +0;SSP1|NPI|nocc_hist;Base; C_SSP1-Base;y2150 +0;SSP1|NDC|nocc_hist;NDC; C_SSP1-NDC;y2150 +0;SSP1|NDC|nocc_hist;PkBudg1150; C_SSP1-PkBudg1150;y2030 +0;SSP1|NDC|nocc_hist;PkBudg500; C_SSP1-PkBudg500;y2030 +0;SSP2|NPI|nocc_hist;Base; C_SSP2EU-Base;y2150 +0;SSP2|NDC|nocc_hist;NDC; C_SSP2EU-NDC;y2150 +1;SSP2|NDC|nocc_hist;PkBudg1150; C_SSP2EU-PkBudg1150;y2030 +0;SSP2|NDC|nocc_hist;PkBudg500; C_SSP2EU-PkBudg500;y2030 +0;SSP5|NPI|nocc_hist;Base; C_SSP5-Base;y2150 +0;SSP5|NDC|nocc_hist;NDC; C_SSP5-NDC;y2150 +0;SSP5|NDC|nocc_hist;PkBudg1150; C_SSP5-PkBudg1150;y2030 +0;SSP5|NDC|nocc_hist;PkBudg500; C_SSP5-PkBudg500;y2030 diff --git a/scripts/start/extra/emulator.R b/scripts/start/extra/emulator.R index 7a5b65bd1c..8926a6a775 100644 --- a/scripts/start/extra/emulator.R +++ b/scripts/start/extra/emulator.R @@ -9,7 +9,6 @@ # description: run simulations for calculation of MAgPIE emulators # --------------------------------------------------------------- - ######################################################### #### Start MAgPIE runs to derive price emulator from #### ######################################################### @@ -26,16 +25,10 @@ source("config/default.cfg") ##################### General settings ######################## ############################################################### +cfg$qos <- "standby" cfg$results_folder <- "output/:title:" -cfg$output <- c("report","emulator") #unique(c(cfg$output,"remind","bioenergy","coupling_report","david")) - -# use old regions: c30c1c580039c2b300d86cc46ff4036a -# use H12 regions: 690d3718e151be1b450b394c1064b1c5 -#cfg$input <- c("isimip_rcp-IPSL_CM5A_LR-rcp2p6-noco2_rev29_h200_690d3718e151be1b450b394c1064b1c5.tgz", -# "rev3.15_690d3718e151be1b450b394c1064b1c5_magpie.tgz", -# "rev3.15_690d3718e151be1b450b394c1064b1c5_validation.tgz", -# "additional_data_rev3.28.tgz", -# "npi_ndc_base_SSP2_fixed.tgz") +cfg$output <- c("rds_report","extra/emulator") #unique(c(cfg$output,"remind","bioenergy","coupling_report","david")) +cfg$gms$s60_2ndgen_bioenergy_dem_min <- 0 # Download bioenergy demand scenarios filemap <- gms::download_unpack(input="emulator.tgz", targetdir="input", repositories=list("/p/projects/landuse/data/input/archive"=NULL), debug=FALSE) @@ -47,9 +40,6 @@ demand <- add_columns(demand,dim = 2.1,addnm = c("y2110","y2130","y2150")) # keep demand constant after 2100 demand[,c("y2110","y2130","y2150"),] <- setYears(demand[,"y2100",]) -#reg <- read.csv2(cfg$regionmapping) # read regional resolution, used for ghg tax -reg <- list(RegionCode = "GLO") - scenarios <- read.csv2("config/scenario_config_emulator.csv",strip.white=TRUE,stringsAsFactors=FALSE) scenarios <- subset(scenarios, subset=(start == "1")) @@ -57,62 +47,36 @@ scenarios <- subset(scenarios, subset=(start == "1")) ######################## Functions ############################ ############################################################### -# calculate expoLinear tax with transition in 2060 -write.ghgtax <- function(co2tax_2025=NULL,regions=NULL,out="./modules/56_ghg_policy/input/f56_pollutant_prices_emulator.cs3") { - - fname <- paste0(scenarios[scen,"co2tax_2025"],".mif") - - if (file.exists(fname)) { - - # If there is a REMIND report with the name, read the GHG prices from the file, otherwise calculate expo-linear tax - cat("Loading CO2 prices from",fname,"\n") - tmp <- read.report(fname, as.list = FALSE) +# Read GHG prices from REMIND or coupled mif file +write.ghgtax <- function(mifname, outfile) { - # Select variables from REMIND report - ghg_price_names <- c("Price|Carbon (US$2005/t CO2)", - "Price|N2O (US$2005/t N2O)", - "Price|CH4 (US$2005/t CH4)") - tmp <- collapseNames(tmp[,,ghg_price_names]) - # remove global dimension - tmp <- tmp["GLO",,,invert=TRUE] + fname <- paste0(mifname, ".mif") - # interpolate missing years (REMIND has less_TS only, emulator script need 5 year time steps) - time <- seq(1995,2100,5) - tmp <- time_interpolate(tmp,interpolated_year=time,extrapolation_type="constant") + if(!file.exists(fname)) stop("Could not find ",fname) - ghgtax <- new.magpie(cells_and_regions = getRegions(tmp),years = time,fill = NA,sets = c("regions","years","gas"),names = c("n2o_n_direct","n2o_n_indirect","ch4","co2_c")) + # If there is a REMIND report with the name, read the GHG prices from the file, otherwise calculate expo-linear tax + cat("Loading GHG prices from",fname,"\n") + tmp <- read.report(fname, as.list = FALSE) - # unit defined in modules/56_ghg_policy/input/f56_pollutant_prices.cs3: US$ 2005 per Mg N2O-N CH4 and CO2-C - ghgtax[,,"co2_c"] <- tmp[,,"Price|Carbon (US$2005/t CO2)"] * 44/12 # US$2005/tCO2 -> US$2005/tC - ghgtax[,,"ch4"] <- tmp[,,"Price|CH4 (US$2005/t CH4)"] - ghgtax[,,"n2o_n_direct"] <- tmp[,,"Price|N2O (US$2005/t N2O)"] * 44/28 # US$2005/tN2O -> US$2005/tN - ghgtax[,,"n2o_n_indirect"] <- tmp[,,"Price|N2O (US$2005/t N2O)"] * 44/28 # US$2005/tN2O -> US$2005/tN + # Select variables from REMIND report + ghg_price_names <- c("Price|Carbon (US$2005/t CO2)", + "Price|N2O (US$2005/t N2O)", + "Price|CH4 (US$2005/t CH4)") + tmp <- collapseNames(tmp[,,ghg_price_names]) + # remove global dimension + tmp <- tmp["GLO",,,invert=TRUE] - } else { - - stop("Could not find ", fname) - - # Calculate expo-linear tax - - if(is.null(co2tax_2025)) stop("No initial value for ghg tax supplied.") - if(is.null(regions)) stop("Please supply regions for ghg tax.") + # interpolate missing years (REMIND has less_TS only, emulator script need 5 year time steps) + time <- seq(1995,2100,5) + tmp <- time_interpolate(tmp,interpolated_year=time,extrapolation_type="constant") - # construct combination of exponential tax (5% increase) until 2050 and linear continuation thereafter (using the slope of 2045-2050) - time <- seq(1995,2100,5) - co2tax <- as.numeric(co2tax_2025) * 1.05 ^(time-2025) - names(co2tax)<-time - slope <- (co2tax["2050"] - co2tax["2045"]) / (2050 - 2045) - co2tax[names(co2tax)>"2050"] <- co2tax["2050"] + slope * (time[time>2050] - 2050) + ghgtax <- new.magpie(cells_and_regions = getRegions(tmp),years = time,fill = NA,sets = c("regions","years","gas"),names = c("n2o_n_direct","n2o_n_indirect","ch4","co2_c")) - ghgtax <- new.magpie(cells_and_regions = regions,years = time,fill = NA,sets = c("regions","years","gas"),names = c("n2o_n_direct","n2o_n_indirect","ch4","co2_c")) - - # unit defined in modules/56_ghg_policy/input/f56_pollutant_prices.cs3: US$ 2005 per Mg N2O-N CH4 and CO2-C - ghgtax[,,"co2_c"] <- as.magpie(co2tax) * 44/12 # US$2005/tCO2 -> US$2005/tC - ghgtax[,,"ch4"] <- as.magpie(co2tax) * 28 # US$2005/tCO2 -> US$2005/tCH4 (using Global Warming Potentials from AR5 WG1 CH08 Table 8.7) - ghgtax[,,"n2o_n_direct"] <- as.magpie(co2tax) * 44/28 * 265 # US$2005/tCO2 -> US$2005/tN (using Global Warming Potentials from AR5 WG1 CH08 Table 8.7) - ghgtax[,,"n2o_n_indirect"] <- as.magpie(co2tax) * 44/28 * 265 # US$2005/tCO2 -> US$2005/tN (using Global Warming Potentials from AR5 WG1 CH08 Table 8.7) - - } + # unit defined in modules/56_ghg_policy/input/f56_pollutant_prices.cs3: US$ 2005 per Mg N2O-N CH4 and CO2-C + ghgtax[,,"co2_c"] <- tmp[,,"Price|Carbon (US$2005/t CO2)"] * 44/12 # US$2005/tCO2 -> US$2005/tC + ghgtax[,,"ch4"] <- tmp[,,"Price|CH4 (US$2005/t CH4)"] + ghgtax[,,"n2o_n_direct"] <- tmp[,,"Price|N2O (US$2005/t N2O)"] * 44/28 # US$2005/tN2O -> US$2005/tN + ghgtax[,,"n2o_n_indirect"] <- tmp[,,"Price|N2O (US$2005/t N2O)"] * 44/28 # US$2005/tN2O -> US$2005/tN # set ghg prices before and in 2020 to zero ghgtax[,getYears(ghgtax)<="y2020",] <- 0 @@ -127,8 +91,8 @@ write.ghgtax <- function(co2tax_2025=NULL,regions=NULL,out="./modules/56_ghg_pol #for_plot <- for_plot[,c("y1995","y2110","y2130","y2150"),,invert=TRUE] txtplot(as.numeric(gsub("y","",getYears(for_plot))),for_plot,ylab="US$2005/tCO2") - cat("Writing GHG tax scenario",scenarios[scen,"co2tax_name"],"\n\n") - write.magpie(ghgtax,file_name = out) + cat("Writing GHG tax scenario",scenarios[scen,"ghgtax_name"],"\n\n") + write.magpie(ghgtax, file_name = outfile) #library(ggplot2) #library(luplot) @@ -144,28 +108,28 @@ for (scen in rownames(scenarios)) { cat("\n################ Scenario",scen,"################\n") # Configure MAgPIE # Set scenario - cfg<-setScenario(cfg,scenario = c(trimws(unlist(strsplit(scenarios[scen,"mag_scen"],split=","))))) + cfg<-setScenario(cfg,scenario = c(trimws(unlist(strsplit(scenarios[scen,"mag_scen"],split="\\|"))))) # emulator has to be set AFTER SSP because SSP would set bioenergy demand to predefined scenario and not to input from this script cfg<-setScenario(cfg,scenario="emulator") # Choose GHG tax scenario - if (scenarios[scen,"co2tax_2025"] == "built-in") { + if (scenarios[scen,"mifname"] == "built-in") { # see magpie/config/default.cfg for available scenarios - cfg$gms$c56_pollutant_prices <- scenarios[scen,"co2tax_name"] + cfg$gms$c56_pollutant_prices <- scenarios[scen,"ghgtax_name"] } else { - # If none of the built-in GHG price scenarios was chosen, provide GHG prices + # If no built-in GHG price scenario was chosen, take GHG prices from REMIND report cfg$gms$c56_pollutant_prices <- "emulator" - write.ghgtax(co2tax_2025=scenarios[scen,"co2tax_2025"],regions=unique(reg$RegionCode)) + cfg$gms$c56_mute_ghgprices_until <- scenarios[scen, "no_ghgprices_land_until"] + write.ghgtax(mifname = scenarios[scen, "mifname"], outfile = "./modules/56_ghg_policy/input/f56_pollutant_prices_emulator.cs3") } # Compose string with scenario name - expname <- paste0(gsub(",","-",scenarios[scen,"mag_scen"]),"-",scenarios[scen,"co2tax_name"]) + expname <- paste0(gsub("\\|","-",scenarios[scen,"mag_scen"]),"-",scenarios[scen,"ghgtax_name"]) - # run numbers sorted in descending by runtime (taken from former SSP2-26 emulator runs) - runtime_order <- c("4","17","34","12","11","22","32","15","21","2","58","18","20","16","19", - "31","67","41","48","54","65","47","13","44","70","28","52","53","62","36","40","9","14","46", - "10","29","38","71","57","50","60","37","64","69","68","51","61","5","27","7","66","6","49", - "35","45","59","56","24","72","25","63","42","30","1","55","43","26","3","39","73","23","33","8") + # run numbers sorted descending by runtime (determined with script sort_runtimes.R from dklein) + runtime_order <- c('32','68','5','46','22','58','41','53','65','11','10','12','47','70','17','34','56','18','54','29', + '62','57','2','26','48','51','20','8','15','52','21','44','16','30','71','38','13','50','67','35','45','1','37','6','31', + '49','40','24','60','69','14','4','9','33','66','61','64','25','42','55','28','23','19','7','43','59','63','39','3','72','73','36','27') # the intersect command in the for-loop below keeps the order of the vector given first # Copy bioenergy demand files and start runs @@ -179,7 +143,7 @@ for (scen in rownames(scenarios)) { #for_plot <- for_plot[,c("y1995","y2110","y2130","y2150"),,invert=TRUE] txtplot(as.numeric(gsub("y","",getYears(for_plot))),for_plot,ylab="EJ/yr") write.magpie(setNames(dem,NULL), file_name = "./modules/60_bioenergy/input/glo.2ndgen_bioenergy_demand.csv") - manipulateConfig("scripts/run_submit/submit.sh","--job-name"=cfg$title,line_endings = "NOTwin") + manipulateConfig(paste0("scripts/run_submit/submit_", cfg$qos, ".sh"), "--job-name" = cfg$title, line_endings = "NOTwin") start_run(cfg,codeCheck=FALSE) } } From 0aa50cb85d774be21bffeb713a4acb022fb73f9c Mon Sep 17 00:00:00 2001 From: David Klein Date: Tue, 24 Oct 2023 14:05:02 +0200 Subject: [PATCH 38/68] Replace fit variable, since the variable that was used so far also included other bioenergy sources, not just bioenergy crops. This, in combination with the minimal bioenergy demand > 0 (changed in the previous commit), led to clusters of data points with the same very low demand but multiple prices. - old: "Demand|Bioenergy|++|2nd generation (EJ/yr)" - new: "Demand|Bioenergy|2nd generation|++|Bioenergy crops (EJ/yr)" Further changes: - remove commented sections - keep regionscode from being removed --- scripts/output/extra/emulator.R | 49 ++++++++------------------------- 1 file changed, 11 insertions(+), 38 deletions(-) diff --git a/scripts/output/extra/emulator.R b/scripts/output/extra/emulator.R index 68adaa910c..5af6da2122 100644 --- a/scripts/output/extra/emulator.R +++ b/scripts/output/extra/emulator.R @@ -121,61 +121,36 @@ collect_data_and_make_emulator <- function(outputdir,name_of_fit="linear") { # Prices|Bioenergy (US$05/GJ) # Clean data + "Demand|Bioenergy|2nd generation|++|Bioenergy crops (EJ/yr)" + "Prices|Bioenergy (US$05/GJ)" # 1. Exclude points with zero production (there are cases where production is zero but there is a price) - x[,,"Demand|Bioenergy|++|2nd generation (EJ/yr)"][x[,,"Demand|Bioenergy|++|2nd generation (EJ/yr)"]==0] <- NA - x[,,"Prices|Bioenergy (US$05/GJ)"][is.na(x[,,"Demand|Bioenergy|++|2nd generation (EJ/yr)"])] <- NA + x[,,"Demand|Bioenergy|2nd generation|++|Bioenergy crops (EJ/yr)"][x[,,"Demand|Bioenergy|2nd generation|++|Bioenergy crops (EJ/yr)"]==0] <- NA + x[,,"Prices|Bioenergy (US$05/GJ)"][is.na(x[,,"Demand|Bioenergy|2nd generation|++|Bioenergy crops (EJ/yr)"])] <- NA # 2. Normally, where production (x) is zero resulting prices (y) are NA -> set production to NA where prices are NA - x[,,"Demand|Bioenergy|++|2nd generation (EJ/yr)"][is.na(x[,,"Prices|Bioenergy (US$05/GJ)"])] <- NA + x[,,"Demand|Bioenergy|2nd generation|++|Bioenergy crops (EJ/yr)"][is.na(x[,,"Prices|Bioenergy (US$05/GJ)"])] <- NA x[,,"Modelstatus (-)"] <- x["GLO",,"Modelstatus (-)"] # Convert units to REMIND units TWa_2_EJ <- 365.25*24*3600/1E6 - tmp1 <- x[,,"Demand|Bioenergy|++|2nd generation (EJ/yr)"] / TWa_2_EJ # EJ -> TWa + tmp1 <- x[,,"Demand|Bioenergy|2nd generation|++|Bioenergy crops (EJ/yr)"] / TWa_2_EJ # EJ -> TWa tmp2 <- x[,,"Prices|Bioenergy (US$05/GJ)"] * TWa_2_EJ/1000 # $/GJ -> T$/TWa getNames(tmp1,dim=4) <- gsub("EJ/yr","TWa/yr", getNames(tmp1,dim=4),fixed=TRUE) getNames(tmp2,dim=4) <- gsub("US$05/GJ","T$/TWa",getNames(tmp2,dim=4),fixed=TRUE) x <- mbind(x,tmp1,tmp2) + + # transfer regionscode from mag_res to x since it was erased above everywhere where x was 'mbind'ed + regionscode <- attributes(mag_res)$regionscode + attributes(x)$regionscode <- regionscode ############################################################### ############# C A L C U L A T E E M U L A T O R ############# ############################################################### - # vars <- c("Demand|Bioenergy|++|2nd generation (EJ/yr)", - # "Prices|Bioenergy (US$05/GJ)", - # "Modelstatus (-)") - # - # y <- x[,,vars] - # - # # Make up model data for fitting: If in current year not enough data is availalbe copy it from other years - # # Criteria for "enough" data available: - # # number of - # # 1. non-zero and - # # 2. feasible and - # # 3. unique and - # # 4. non-NA elements - # # > n - # - # # 1. non-zero: set zero elements to NA - # # has been done before -> does not have to be checked here - # - # # 2. feasible: set data to NA in infeasible years and the years after - # y <- mute_infes(data = y, name="Modelstatus (-)", infeasible = 5) - # - # # 3. unique elements: set duplicated samples to NA - # y <- mute_duplicated(y) - # - # # 4. non-NA: find number of non-NA elements - # n_exist <- as.magpie(apply(unwrap(y),c(1,2,3,5,6),function(x)sum(!is.na(x)))) - # nodata <- n_exist[,,"Demand|Bioenergy|++|2nd generation (EJ/yr)"]<1 - # - # # Finally: Copy data from other years where data is not availalbe - # z <- fill_missing_years(y,nodata) - # Calculate emulator fc <- emulator(data=x, - name_x="Demand|Bioenergy|++|2nd generation (TWa/yr)", + name_x="Demand|Bioenergy|2nd generation|++|Bioenergy crops (TWa/yr)", name_y="Prices|Bioenergy (T$/TWa)", name_modelstat="Modelstatus (-)", userfun=function(param,x)return(param[[1]] + param[[2]] * x), @@ -190,8 +165,6 @@ collect_data_and_make_emulator <- function(outputdir,name_of_fit="linear") { print(fc) print(attributes(fc)) - regionscode <- attributes(mag_res)$regionscode - # write fit coefficients to REMIND input file for (scen in getNames(fc,dim="scenario")) { write.magpie(fc,file_name = paste0("f30_bioen_price_",scen,"_",regionscode,".cs4r"), file_folder = file.path(emu_path,scen,name_of_fit)) From ae08b789839b613b0e0486d01050438682221b44 Mon Sep 17 00:00:00 2001 From: David Klein Date: Tue, 24 Oct 2023 14:36:06 +0200 Subject: [PATCH 39/68] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 532523977d..0f1a5b3c84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### changed - **inputdata** There was a major bug (related to proj/terra) in the rev4.91 inputdata that was fixed with rev4.92 - **scripts** LUH2_disaggregation output script was modified. Specifically, flooded area was made compatible with the LUH definition, cropland and grazing land were added to the states.nc file, and specific naming/details (datatype, zname, xname, and yname) were added when creating the .nc files. +- **scripts** For the emulator scripts select a diffrent bioenergy demand variable that excludes bioenergy sources other than second generation bioenergy crops. Set the minimal bioenergy demand to zero. Both avoid artificial clustering of data points and allow for better fits. - **36_employment** regression between hourly labor regression and GDP pc changed from linear to log-log ### added From be76e2de2c8a37af2b9447ef28310d5d3dca2c9e Mon Sep 17 00:00:00 2001 From: David Klein Date: Tue, 24 Oct 2023 14:38:39 +0200 Subject: [PATCH 40/68] Typo in CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f1a5b3c84..5ba750102f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### changed - **inputdata** There was a major bug (related to proj/terra) in the rev4.91 inputdata that was fixed with rev4.92 - **scripts** LUH2_disaggregation output script was modified. Specifically, flooded area was made compatible with the LUH definition, cropland and grazing land were added to the states.nc file, and specific naming/details (datatype, zname, xname, and yname) were added when creating the .nc files. -- **scripts** For the emulator scripts select a diffrent bioenergy demand variable that excludes bioenergy sources other than second generation bioenergy crops. Set the minimal bioenergy demand to zero. Both avoid artificial clustering of data points and allow for better fits. +- **scripts** For the emulator scripts select a different bioenergy demand variable that excludes bioenergy sources other than second generation bioenergy crops. Set the minimal bioenergy demand to zero. Both avoid artificial clustering of data points and allow for better fits. - **36_employment** regression between hourly labor regression and GDP pc changed from linear to log-log ### added From 3ed2afadd076002e4bc23556ff27b9499f9cdd74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Tue, 24 Oct 2023 14:38:53 +0200 Subject: [PATCH 41/68] inputdata rev4.93 --- CHANGELOG.md | 1 + config/default.cfg | 6 +++--- config/scenario_config.csv | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 532523977d..d5d01f0031 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### changed +- **inputdata** There was another bug (terra default na.rm changed) in the inputdata that was fixed with rev4.93 - **inputdata** There was a major bug (related to proj/terra) in the rev4.91 inputdata that was fixed with rev4.92 - **scripts** LUH2_disaggregation output script was modified. Specifically, flooded area was made compatible with the LUH definition, cropland and grazing land were added to the states.nc file, and specific naming/details (datatype, zname, xname, and yname) were added when creating the .nc files. - **36_employment** regression between hourly labor regression and GDP pc changed from linear to log-log diff --git a/config/default.cfg b/config/default.cfg index 6021648b05..db95d70a4f 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.92_h12_magpie.tgz", - cellular = "rev4.92_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.92_h12_validation.tgz", +cfg$input <- c(regional = "rev4.93_h12_magpie.tgz", + cellular = "rev4.93_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.93_h12_validation.tgz", additional = "additional_data_rev4.46.tgz", calibration = "calibration_H12_per_ton_fao_may22_glo_08Aug23.tgz") diff --git a/config/scenario_config.csv b/config/scenario_config.csv index eaf1555c9f..e5e9b126e7 100644 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -79,7 +79,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.91_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.91_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.91_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.91_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.91_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.91_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz; +input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.93_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.93_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.93_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.93_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.93_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.93_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;;;;;;;;;;;;;;; From 18238834aa85f3ec9410273fdcbe543f5731c50c Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 26 Oct 2023 21:42:32 +0200 Subject: [PATCH 42/68] peatland 2023 --- .../dynamic_feb21/declarations.gms | 4 ++ .../32_forestry/dynamic_feb21/equations.gms | 3 + .../32_forestry/dynamic_feb21/postsolve.gms | 8 +++ modules/32_forestry/dynamic_feb21/preloop.gms | 2 + modules/56_ghg_policy/price_aug22/sets.gms | 4 ++ modules/58_peatland/input/files | 2 + modules/58_peatland/off/not_used.txt | 1 + modules/58_peatland/on/not_used.txt | 2 + modules/58_peatland/on_2023/declarations.gms | 65 ++++++++----------- modules/58_peatland/on_2023/equations.gms | 39 +++++------ modules/58_peatland/on_2023/input.gms | 18 ++--- modules/58_peatland/on_2023/postsolve.gms | 23 +++---- modules/58_peatland/on_2023/preloop.gms | 22 +++---- modules/58_peatland/on_2023/presolve.gms | 3 +- modules/58_peatland/on_2023/realization.gms | 12 ++-- modules/58_peatland/on_2023/scaling.gms | 7 -- modules/58_peatland/on_2023/sets.gms | 36 ++-------- 17 files changed, 112 insertions(+), 139 deletions(-) create mode 100644 modules/58_peatland/on/not_used.txt delete mode 100644 modules/58_peatland/on_2023/scaling.gms diff --git a/modules/32_forestry/dynamic_feb21/declarations.gms b/modules/32_forestry/dynamic_feb21/declarations.gms index 112cf412b6..e6fc7366d0 100644 --- a/modules/32_forestry/dynamic_feb21/declarations.gms +++ b/modules/32_forestry/dynamic_feb21/declarations.gms @@ -73,6 +73,7 @@ positive variables v32_cost_establishment(i) Cost of establishment calculated at the current time step (mio. USD) v32_hvarea_forestry(j,ac) Harvested area from timber plantations (mio. ha) vm_prod_forestry(j,kforestry) Production of woody biomass from commercial plantations (mio. tDM per yr) + vm_land_forestry(j,type32) Forestry land (mio. ha) ; variables @@ -104,6 +105,7 @@ equations q32_bv_aff(j,potnatveg) Biodiversity value for aff forestry land (Mha) q32_bv_ndc(j,potnatveg) Biodiversity value for ndc forestry land (Mha) q32_bv_plant(j,potnatveg) Biodiversity value for plantations (Mha) + q32_land_forestry(j,type32) Forestry land (Mha) ; @@ -120,6 +122,7 @@ parameters ov32_cost_establishment(t,i,type) Cost of establishment calculated at the current time step (mio. USD) ov32_hvarea_forestry(t,j,ac,type) Harvested area from timber plantations (mio. ha) ov_prod_forestry(t,j,kforestry,type) Production of woody biomass from commercial plantations (mio. tDM per yr) + ov_land_forestry(t,j,type32,type) Forestry land (mio. ha) 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) @@ -145,5 +148,6 @@ parameters oq32_bv_aff(t,j,potnatveg,type) Biodiversity value for aff forestry land (Mha) oq32_bv_ndc(t,j,potnatveg,type) Biodiversity value for ndc forestry land (Mha) oq32_bv_plant(t,j,potnatveg,type) Biodiversity value for plantations (Mha) + oq32_land_forestry(t,j,type32,type) Forestry land (Mha) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/32_forestry/dynamic_feb21/equations.gms b/modules/32_forestry/dynamic_feb21/equations.gms index d17234cce2..08a5a60016 100644 --- a/modules/32_forestry/dynamic_feb21/equations.gms +++ b/modules/32_forestry/dynamic_feb21/equations.gms @@ -56,6 +56,9 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum( q32_land(j2) .. vm_land(j2,"forestry") =e= sum((type32,ac), v32_land(j2,type32,ac)); + q32_land_forestry(j2,type32) .. + vm_land_forestry(j2,type32) =e= sum(ac, v32_land(j2,type32,ac)); + *' The constraint `q32_aff_pol` accounts for the exogenous afforestation prescribed by NPI/NDC policies. q32_aff_pol(j2) .. diff --git a/modules/32_forestry/dynamic_feb21/postsolve.gms b/modules/32_forestry/dynamic_feb21/postsolve.gms index c8d03d0a2e..ea867f01da 100644 --- a/modules/32_forestry/dynamic_feb21/postsolve.gms +++ b/modules/32_forestry/dynamic_feb21/postsolve.gms @@ -21,6 +21,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_establishment(t,i,"marginal") = v32_cost_establishment.m(i); ov32_hvarea_forestry(t,j,ac,"marginal") = v32_hvarea_forestry.m(j,ac); ov_prod_forestry(t,j,kforestry,"marginal") = vm_prod_forestry.m(j,kforestry); + ov_land_forestry(t,j,type32,"marginal") = vm_land_forestry.m(j,type32); 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); @@ -46,6 +47,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_bv_aff(t,j,potnatveg,"marginal") = q32_bv_aff.m(j,potnatveg); oq32_bv_ndc(t,j,potnatveg,"marginal") = q32_bv_ndc.m(j,potnatveg); oq32_bv_plant(t,j,potnatveg,"marginal") = q32_bv_plant.m(j,potnatveg); + oq32_land_forestry(t,j,type32,"marginal") = q32_land_forestry.m(j,type32); ov_cost_fore(t,i,"level") = vm_cost_fore.l(i); ov32_cost_hvarea(t,i,"level") = v32_cost_hvarea.l(i); ov32_land(t,j,type32,ac,"level") = v32_land.l(j,type32,ac); @@ -57,6 +59,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_establishment(t,i,"level") = v32_cost_establishment.l(i); ov32_hvarea_forestry(t,j,ac,"level") = v32_hvarea_forestry.l(j,ac); ov_prod_forestry(t,j,kforestry,"level") = vm_prod_forestry.l(j,kforestry); + ov_land_forestry(t,j,type32,"level") = vm_land_forestry.l(j,type32); 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); @@ -82,6 +85,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_bv_aff(t,j,potnatveg,"level") = q32_bv_aff.l(j,potnatveg); oq32_bv_ndc(t,j,potnatveg,"level") = q32_bv_ndc.l(j,potnatveg); oq32_bv_plant(t,j,potnatveg,"level") = q32_bv_plant.l(j,potnatveg); + oq32_land_forestry(t,j,type32,"level") = q32_land_forestry.l(j,type32); ov_cost_fore(t,i,"upper") = vm_cost_fore.up(i); ov32_cost_hvarea(t,i,"upper") = v32_cost_hvarea.up(i); ov32_land(t,j,type32,ac,"upper") = v32_land.up(j,type32,ac); @@ -93,6 +97,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_establishment(t,i,"upper") = v32_cost_establishment.up(i); ov32_hvarea_forestry(t,j,ac,"upper") = v32_hvarea_forestry.up(j,ac); ov_prod_forestry(t,j,kforestry,"upper") = vm_prod_forestry.up(j,kforestry); + ov_land_forestry(t,j,type32,"upper") = vm_land_forestry.up(j,type32); 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); @@ -118,6 +123,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_bv_aff(t,j,potnatveg,"upper") = q32_bv_aff.up(j,potnatveg); oq32_bv_ndc(t,j,potnatveg,"upper") = q32_bv_ndc.up(j,potnatveg); oq32_bv_plant(t,j,potnatveg,"upper") = q32_bv_plant.up(j,potnatveg); + oq32_land_forestry(t,j,type32,"upper") = q32_land_forestry.up(j,type32); ov_cost_fore(t,i,"lower") = vm_cost_fore.lo(i); ov32_cost_hvarea(t,i,"lower") = v32_cost_hvarea.lo(i); ov32_land(t,j,type32,ac,"lower") = v32_land.lo(j,type32,ac); @@ -129,6 +135,7 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); ov32_cost_establishment(t,i,"lower") = v32_cost_establishment.lo(i); ov32_hvarea_forestry(t,j,ac,"lower") = v32_hvarea_forestry.lo(j,ac); ov_prod_forestry(t,j,kforestry,"lower") = vm_prod_forestry.lo(j,kforestry); + ov_land_forestry(t,j,type32,"lower") = vm_land_forestry.lo(j,type32); 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); @@ -154,4 +161,5 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); oq32_bv_aff(t,j,potnatveg,"lower") = q32_bv_aff.lo(j,potnatveg); oq32_bv_ndc(t,j,potnatveg,"lower") = q32_bv_ndc.lo(j,potnatveg); oq32_bv_plant(t,j,potnatveg,"lower") = q32_bv_plant.lo(j,potnatveg); + oq32_land_forestry(t,j,type32,"lower") = q32_land_forestry.lo(j,type32); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/32_forestry/dynamic_feb21/preloop.gms b/modules/32_forestry/dynamic_feb21/preloop.gms index 4702a2457f..672705e0a1 100644 --- a/modules/32_forestry/dynamic_feb21/preloop.gms +++ b/modules/32_forestry/dynamic_feb21/preloop.gms @@ -218,6 +218,8 @@ loop(j, ** Initialization of land *p32_land_start_ac(j,type32,ac) = p32_land("y1995",j,type32,ac); +vm_land_forestry.l(j,type32) = sum(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/56_ghg_policy/price_aug22/sets.gms b/modules/56_ghg_policy/price_aug22/sets.gms index 93118855d6..f64637e8cb 100644 --- a/modules/56_ghg_policy/price_aug22/sets.gms +++ b/modules/56_ghg_policy/price_aug22/sets.gms @@ -84,12 +84,16 @@ sets all_nosoil, redd_nosoil, redd_nosoil_nopeat, + redd_nosoil_peatCO2only, reddnatveg_nosoil, reddnatveg_nosoil_nopeat, + reddnatveg_nosoil_peatCO2only, redd+_nosoil, redd+_nosoil_nopeat, + redd+_nosoil_peatCO2only, redd+natveg_nosoil, redd+natveg_nosoil_nopeat, + redd+natveg_nosoil_peatCO2only, all_vegc, redd_vegc, reddnatveg_vegc, diff --git a/modules/58_peatland/input/files b/modules/58_peatland/input/files index 8d133b4e46..3509c27c10 100644 --- a/modules/58_peatland/input/files +++ b/modules/58_peatland/input/files @@ -2,3 +2,5 @@ f58_peatland_degrad.cs2 f58_peatland_intact.cs2 f58_ipcc_wetland_ef.cs3 +f58_ipcc_wetland_ef2.cs3 +f58_peatland_area.cs2 diff --git a/modules/58_peatland/off/not_used.txt b/modules/58_peatland/off/not_used.txt index 33f27da3b8..f58d704878 100644 --- a/modules/58_peatland/off/not_used.txt +++ b/modules/58_peatland/off/not_used.txt @@ -3,3 +3,4 @@ vm_land, input, not used pcm_land, input, not used pm_interest, input, not used pm_climate_class, input, not used +vm_land_forestry, input, not used diff --git a/modules/58_peatland/on/not_used.txt b/modules/58_peatland/on/not_used.txt new file mode 100644 index 0000000000..b5befb7b25 --- /dev/null +++ b/modules/58_peatland/on/not_used.txt @@ -0,0 +1,2 @@ +name, type, reason +vm_land_forestry, input, not used diff --git a/modules/58_peatland/on_2023/declarations.gms b/modules/58_peatland/on_2023/declarations.gms index 31fbaba15b..8d943a6c84 100644 --- a/modules/58_peatland/on_2023/declarations.gms +++ b/modules/58_peatland/on_2023/declarations.gms @@ -6,68 +6,59 @@ *** | Contact: magpie@pik-potsdam.de parameters - p58_scaling_factor(j) Scaling factor for managed peatland (1) - p58_calib_factor(j,land58) Calibration factor for managed peatland (1) - p58_peatland_degrad(j) Intermediate calculation in peatland initialization (mio. ha) - p58_ipcc_wetland_ef(clcl58,land58,emis58) Wetland GWP100 emission factors (t CO2eq per ha) - p58_man_land_area(j) Total managed land (mio. ha) - pc58_peatland(j,land58) Managed peatland (mio. ha) - pc58_peatland_intact(j) Intact peatland (mio. ha) - p58_mapping_cell_climate(j,clcl58) Mapping between cells and climate regions (binary) - p58_peatland_degrad_weight(j,land58) Weight for peatland distribution to land58 (1) - i58_cost_rewet_recur(t) Recurring costs for rewetted peatland (USD05MER per ha) - i58_cost_rewet_onetime(t) One-time costs for peatland restoration (USD05MER per ha) - i58_cost_degrad_recur(t) Recurring costs for degraded peatland (USD05MER per ha) - i58_cost_degrad_onetime(t) One-time costs for peatland degradation (USD05MER per ha) - p58_conversion_factor(emisSub58) Conversion factor from GWP100 GHG emissions to element (1) + p58_scaling_factor(j) Scaling factor for managed peatland (1) + pc58_peatland(j,land58) Peatland area (mio. ha) + p58_mapping_cell_climate(j,clcl58) Mapping between cells and climate regions (binary) + i58_cost_rewet_recur(t) Recurring costs for rewetted peatland (USD05MER per ha) + i58_cost_rewet_onetime(t) One-time costs for peatland restoration (USD05MER per ha) + i58_cost_degrad_recur(t) Recurring costs for degraded peatland (USD05MER per ha) + i58_cost_degrad_onetime(t) One-time costs for peatland degradation (USD05MER per ha) ; equations - q58_peatland(j) Constraint for peatland area (mio. ha) - q58_expansion(j,land58) Peatland expansion (mio. ha) - q58_reduction(j,land58) Peatland reduction (mio. ha) - q58_peatland_crop(j) Constraint for peatland degradation (mio. ha) - q58_peatland_past(j) Constraint for peatland degradation (mio. ha) - q58_peatland_forestry(j) Constraint for peatland degradation (mio. ha) - q58_peatland_cost_full(j) One-time and recurring cost of peatland conversion and management including artifical balance cost (mio. USD05MER per yr) - q58_peatland_cost(j) One-time and recurring cost of peatland conversion and management (mio. USD05MER per yr) - q58_peatland_cost_annuity(j) Annuity costs of peatland conversion in the current timestep (mio. USD05MER per yr) - q58_peatland_emis_detail(j,land58,emis58) Detailed GHG emissions from managed peatland (t CO2eq per year) - q58_peatland_emis(i,poll58) GHG emissions from managed peatland (Tg per yr) + q58_peatland(j) Constraint for peatland area (mio. ha) + q58_expansion(j,land58) Peatland expansion (mio. ha) + q58_reduction(j,land58) Peatland reduction (mio. ha) + q58_peatland_rewet(j) Constraint for peatland rewetting (mio. ha) + q58_peatland_crop(j) Degraded peatland used as cropland (mio. ha) + q58_peatland_past(j) Degraded peatland used as pasture (mio. ha) + q58_peatland_forestry(j) Degraded peatland used for forestry (mio. ha) + q58_peatland_cost(j) One-time and recurring cost of peatland conversion and management (mio. USD05MER per yr) + q58_peatland_cost_annuity(j) Annuity costs of peatland conversion in the current timestep (mio. USD05MER per yr) + q58_peatland_emis_detail(j,land58,emis58) Detailed GHG emissions from peatlands (Tg per yr) + q58_peatland_emis(i,poll58) GHG emissions from managed peatland (Tg per yr) ; variables - vm_peatland_cost(j) One-time and recurring cost of managed peatland including artifical balance cost (mio. USD05MER per yr) - v58_peatland_cost(j) One-time and recurring cost of managed peatland (mio. USD05MER per yr) + vm_peatland_cost(j) One-time and recurring cost of managed peatland (mio. USD05MER per yr) v58_peatland_cost_annuity(j) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) - v58_peatland_emis(j,land58,emis58) Detailed GHG emissions from managed peatland (t CO2eq per year) + v58_peatland_emis(j,land58,emis58) Detailed GHG peatland GHG emissions (Tg per yr) ; positive variables v58_expansion(j,land58) Peatland expansion (mio. ha) v58_reduction(j,land58) Peatland reduction (mio. ha) - v58_peatland(j,land58) Managed peatland (mio. ha) + v58_peatland(j,land58) Managed peatland (mio. ha) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_peatland_cost(t,j,type) One-time and recurring cost of managed peatland including artifical balance cost (mio. USD05MER per yr) - ov58_peatland_cost(t,j,type) One-time and recurring cost of managed peatland (mio. USD05MER per yr) + ov_peatland_cost(t,j,type) One-time and recurring cost of managed peatland (mio. USD05MER per yr) ov58_peatland_cost_annuity(t,j,type) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) - ov58_peatland_emis(t,j,land58,emis58,type) Detailed GHG emissions from managed peatland (t CO2eq per year) + ov58_peatland_emis(t,j,land58,emis58,type) Detailed GHG peatland GHG emissions (Tg per yr) ov58_expansion(t,j,land58,type) Peatland expansion (mio. ha) ov58_reduction(t,j,land58,type) Peatland reduction (mio. ha) ov58_peatland(t,j,land58,type) Managed peatland (mio. ha) oq58_peatland(t,j,type) Constraint for peatland area (mio. ha) oq58_expansion(t,j,land58,type) Peatland expansion (mio. ha) oq58_reduction(t,j,land58,type) Peatland reduction (mio. ha) - oq58_peatland_crop(t,j,type) Constraint for peatland degradation (mio. ha) - oq58_peatland_past(t,j,type) Constraint for peatland degradation (mio. ha) - oq58_peatland_forestry(t,j,type) Constraint for peatland degradation (mio. ha) - oq58_peatland_cost_full(t,j,type) One-time and recurring cost of peatland conversion and management including artifical balance cost (mio. USD05MER per yr) + oq58_peatland_rewet(t,j,type) Constraint for peatland rewetting (mio. ha) + oq58_peatland_crop(t,j,type) Degraded peatland used as cropland (mio. ha) + oq58_peatland_past(t,j,type) Degraded peatland used as pasture (mio. ha) + oq58_peatland_forestry(t,j,type) Degraded peatland used for forestry (mio. ha) oq58_peatland_cost(t,j,type) One-time and recurring cost of peatland conversion and management (mio. USD05MER per yr) oq58_peatland_cost_annuity(t,j,type) Annuity costs of peatland conversion in the current timestep (mio. USD05MER per yr) - oq58_peatland_emis_detail(t,j,land58,emis58,type) Detailed GHG emissions from managed peatland (t CO2eq per year) + oq58_peatland_emis_detail(t,j,land58,emis58,type) Detailed GHG emissions from peatlands (Tg per yr) oq58_peatland_emis(t,i,poll58,type) GHG emissions from managed peatland (Tg per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/58_peatland/on_2023/equations.gms b/modules/58_peatland/on_2023/equations.gms index bbee85e65f..2c20a1e97f 100644 --- a/modules/58_peatland/on_2023/equations.gms +++ b/modules/58_peatland/on_2023/equations.gms @@ -7,6 +7,9 @@ *' @equations +*' Sum over total peatland area (degraded, intact, rewetted) is assumed constant. +*' Intact peatland area can only decrease. + q58_peatland(j2)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. sum(land58, v58_peatland(j2,land58)) =e= sum(land58, pc58_peatland(j2,land58)); @@ -16,11 +19,9 @@ q58_reduction(j2,land58) .. v58_reduction(j2,land58) =g= pc58_peatland(j2,land58)-v58_peatland(j2,land58); - -*' Future peatland degradation (`v58_peatland_man`) depends on managed land (`vm_land`), -*' scaled with the ratio of total peatland area and total land area (`p58_scaling_factor`) -*' and a calibration factor (`p58_calib_factor`) for alignment with historic levels of degraded peatland. -*' By multiplying changes in managed land (`vm_land`) with the scaling factor we implicitly assume +*' Future peatland degradation (`v58_peatland`) depends on managed land (`vm_land`, `vm_land_forestry`), +*' scaled with the ratio of total peatland area and total land area (`p58_scaling_factor`). +*' By multiplying changes in managed land with the scaling factor we implicitly assume *' that intact peatlands are distributed equally within a grid cell. *' The following example illustrates the mechanism used for projecting peatland dynamics: *' In a given grid cell, the total land area is 50 Mha and the total peatland area is 10 Mha. @@ -41,39 +42,35 @@ q58_peatland_forestry(j2)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. v58_peatland(j2,"forestry") =e= pc58_peatland(j2,"forestry") - + ((vm_land(j2,"forestry")-pcm_land(j2,"forestry"))*p58_scaling_factor(j2)); + + ((vm_land_forestry(j2,"plant")-vm_land_forestry.l(j2,"plant"))*p58_scaling_factor(j2)); -*crop, past, forestry. -*intact no increase -*unused decrase and incrase -*rewetted incrase at cost. +*' This constraint avoids the conversion of intact peatland into rewetted peatland. +*' Therefore, rewetted peatland area can only increase if degraded peatland area declines. + q58_peatland_rewet(j2) .. + v58_expansion(j2,"rewetted") * v58_reduction(j2,"intact") =e= 0; *' Costs for peatland degradation and rewetting - q58_peatland_cost_full(j2) .. - vm_peatland_cost(j2) =e= v58_peatland_cost(j2); - q58_peatland_cost(j2) .. - v58_peatland_cost(j2) =e= v58_peatland_cost_annuity(j2) - + (v58_peatland(j2,"rewetted") + v58_peatland(j2,"intact")) * sum(ct, i58_cost_rewet_recur(ct)) - + sum(landMan58, v58_peatland(j2,landMan58)) * sum(ct, i58_cost_degrad_recur(ct)); + vm_peatland_cost(j2) =e= v58_peatland_cost_annuity(j2) + + v58_peatland(j2,"rewetted") * sum(ct, i58_cost_rewet_recur(ct)) + + sum(landDrainedUsed58, v58_peatland(j2,landDrainedUsed58)) * sum(ct, i58_cost_degrad_recur(ct)); q58_peatland_cost_annuity(j2) .. v58_peatland_cost_annuity(j2) =e= (v58_expansion(j2,"rewetted") * sum(ct, i58_cost_rewet_onetime(ct)) - + v58_reduction(j2,"intact") * sum(ct, i58_cost_degrad_onetime(ct))) + + sum(landDrainedUsed58, v58_expansion(j2,landDrainedUsed58)) * sum(ct, i58_cost_degrad_onetime(ct))) * sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); -*' GHG emissions from managed peatlands (degraded and rewetted) +*' Detailed peatland GHG emissions q58_peatland_emis_detail(j2,land58,emis58) .. v58_peatland_emis(j2,land58,emis58) =e= sum(clcl58, v58_peatland(j2,land58) * - p58_mapping_cell_climate(j2,clcl58) * p58_ipcc_wetland_ef(clcl58,land58,emis58)); + p58_mapping_cell_climate(j2,clcl58) * f58_ipcc_wetland_ef(clcl58,land58,emis58)); -*' Conversion from CO2 equivalent to element unit for interface `vm_emissions_reg` -*' using GWP100 conversion factors from AR5 (same as in @wilson_2016). +*' Aggregation of detailed peatland GHG emissions for interface `vm_emissions_reg` q58_peatland_emis(i2,poll58) .. vm_emissions_reg(i2,"peatland",poll58) =e= diff --git a/modules/58_peatland/on_2023/input.gms b/modules/58_peatland/on_2023/input.gms index ab4eb109bb..3dfd0ee85b 100644 --- a/modules/58_peatland/on_2023/input.gms +++ b/modules/58_peatland/on_2023/input.gms @@ -6,22 +6,24 @@ *** | Contact: magpie@pik-potsdam.de scalars - s58_cost_rewet_recur Recurring costs for rewetted peatland (USD05MER per ha) / -4000 / - s58_cost_rewet_onetime One-time costs for peatland restoration (USD05MER per ha) / 4000 / - s58_cost_degrad_recur Recurring costs for degraded peatland (USD05MER per ha) / 200 / - s58_cost_degrad_onetime One-time costs for peatland degradation (USD05MER per ha) / 10000 / + s58_cost_rewet_recur Recurring costs for rewetted peatland (USD05MER per ha) / 200 / + s58_cost_rewet_onetime One-time costs for peatland restoration (USD05MER per ha) / 7000 / + s58_cost_degrad_recur Recurring costs for degraded peatland (USD05MER per ha) / 0 / + s58_cost_degrad_onetime One-time costs for peatland degradation (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 to 2015 levels (year) / 2020 / + s58_fix_peatland Year indicating until when peatland area should be fixed to 2020 levels (year) / 2015 / s58_cost_balance Artificial cost for balance variable (USD05MER per ha) / 1e+06 / ; -table f58_peatlandArea(j,land58) Peatland area (mio. ha) +*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/peatlandArea.cs3" +$include "./modules/58_peatland/input/f58_peatland_area.cs2" $offdelim ; -table f58_ipcc_wetland_ef(clcl58,land58,emis58) Wetland emission factors (t CO2-C N2O-N CH4 per ha) +*Wetland GHG emission factors based on IPCC Wetlands 2014 and Tiemeyer et al. 2020 +table f58_ipcc_wetland_ef(clcl58,land58,emis58) Wetland emission factors (Tg per yr) $ondelim $include "./modules/58_peatland/input/f58_ipcc_wetland_ef2.cs3" $offdelim diff --git a/modules/58_peatland/on_2023/postsolve.gms b/modules/58_peatland/on_2023/postsolve.gms index ed3a3ccd89..02203cfd6c 100644 --- a/modules/58_peatland/on_2023/postsolve.gms +++ b/modules/58_peatland/on_2023/postsolve.gms @@ -7,19 +7,17 @@ * Update of degraded peatland based on current managed land in the last time steps of fixed peatland area. if (m_year(t) = s58_fix_peatland, - p58_scaling_factor(j)$(sum(land, vm_land.l(j,land)) > 1e-20) = sum(land58, f58_peatlandArea(j,land58)) / sum(land, vm_land.l(j,land)); - pc58_peatland(j,"crop") = min(f58_peatlandArea(j,"crop"),vm_land.l(j,"crop") * p58_scaling_factor(j)); - pc58_peatland(j,"past") = min(f58_peatlandArea(j,"past"), vm_land.l(j,"past") * p58_scaling_factor(j)); - pc58_peatland(j,"forestry") = min(f58_peatlandArea(j,"forestry"), vm_land.l(j,"forestry") * p58_scaling_factor(j)); - pc58_peatland(j,"unused") = sum(landMan58, f58_peatlandArea(j,landMan58) - pc58_peatland(j,landMan58)); - pc58_peatland(j,"peatExtract") = f58_peatlandArea(j,"peatExtract"); + p58_scaling_factor(j)$(sum(land, vm_land.l(j,land)) > 1e-20) = sum(land58, f58_peatland_area(j,land58)) / sum(land, vm_land.l(j,land)); + pc58_peatland(j,"crop") = min(f58_peatland_area(j,"crop"),vm_land.l(j,"crop") * p58_scaling_factor(j)); + pc58_peatland(j,"past") = min(f58_peatland_area(j,"past"), vm_land.l(j,"past") * p58_scaling_factor(j)); + pc58_peatland(j,"forestry") = min(f58_peatland_area(j,"forestry"), vm_land_forestry.l(j,"plant") * p58_scaling_factor(j)); + pc58_peatland(j,"unused") = sum(landDrainedUsed58, f58_peatland_area(j,landDrainedUsed58) - pc58_peatland(j,landDrainedUsed58)); else pc58_peatland(j,land58) = v58_peatland.l(j,land58); ); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_peatland_cost(t,j,"marginal") = vm_peatland_cost.m(j); - ov58_peatland_cost(t,j,"marginal") = v58_peatland_cost.m(j); ov58_peatland_cost_annuity(t,j,"marginal") = v58_peatland_cost_annuity.m(j); ov58_peatland_emis(t,j,land58,emis58,"marginal") = v58_peatland_emis.m(j,land58,emis58); ov58_expansion(t,j,land58,"marginal") = v58_expansion.m(j,land58); @@ -28,16 +26,15 @@ else oq58_peatland(t,j,"marginal") = q58_peatland.m(j); oq58_expansion(t,j,land58,"marginal") = q58_expansion.m(j,land58); oq58_reduction(t,j,land58,"marginal") = q58_reduction.m(j,land58); + oq58_peatland_rewet(t,j,"marginal") = q58_peatland_rewet.m(j); oq58_peatland_crop(t,j,"marginal") = q58_peatland_crop.m(j); oq58_peatland_past(t,j,"marginal") = q58_peatland_past.m(j); oq58_peatland_forestry(t,j,"marginal") = q58_peatland_forestry.m(j); - oq58_peatland_cost_full(t,j,"marginal") = q58_peatland_cost_full.m(j); oq58_peatland_cost(t,j,"marginal") = q58_peatland_cost.m(j); oq58_peatland_cost_annuity(t,j,"marginal") = q58_peatland_cost_annuity.m(j); oq58_peatland_emis_detail(t,j,land58,emis58,"marginal") = q58_peatland_emis_detail.m(j,land58,emis58); oq58_peatland_emis(t,i,poll58,"marginal") = q58_peatland_emis.m(i,poll58); ov_peatland_cost(t,j,"level") = vm_peatland_cost.l(j); - ov58_peatland_cost(t,j,"level") = v58_peatland_cost.l(j); ov58_peatland_cost_annuity(t,j,"level") = v58_peatland_cost_annuity.l(j); ov58_peatland_emis(t,j,land58,emis58,"level") = v58_peatland_emis.l(j,land58,emis58); ov58_expansion(t,j,land58,"level") = v58_expansion.l(j,land58); @@ -46,16 +43,15 @@ else oq58_peatland(t,j,"level") = q58_peatland.l(j); oq58_expansion(t,j,land58,"level") = q58_expansion.l(j,land58); oq58_reduction(t,j,land58,"level") = q58_reduction.l(j,land58); + oq58_peatland_rewet(t,j,"level") = q58_peatland_rewet.l(j); oq58_peatland_crop(t,j,"level") = q58_peatland_crop.l(j); oq58_peatland_past(t,j,"level") = q58_peatland_past.l(j); oq58_peatland_forestry(t,j,"level") = q58_peatland_forestry.l(j); - oq58_peatland_cost_full(t,j,"level") = q58_peatland_cost_full.l(j); oq58_peatland_cost(t,j,"level") = q58_peatland_cost.l(j); oq58_peatland_cost_annuity(t,j,"level") = q58_peatland_cost_annuity.l(j); oq58_peatland_emis_detail(t,j,land58,emis58,"level") = q58_peatland_emis_detail.l(j,land58,emis58); oq58_peatland_emis(t,i,poll58,"level") = q58_peatland_emis.l(i,poll58); ov_peatland_cost(t,j,"upper") = vm_peatland_cost.up(j); - ov58_peatland_cost(t,j,"upper") = v58_peatland_cost.up(j); ov58_peatland_cost_annuity(t,j,"upper") = v58_peatland_cost_annuity.up(j); ov58_peatland_emis(t,j,land58,emis58,"upper") = v58_peatland_emis.up(j,land58,emis58); ov58_expansion(t,j,land58,"upper") = v58_expansion.up(j,land58); @@ -64,16 +60,15 @@ else oq58_peatland(t,j,"upper") = q58_peatland.up(j); oq58_expansion(t,j,land58,"upper") = q58_expansion.up(j,land58); oq58_reduction(t,j,land58,"upper") = q58_reduction.up(j,land58); + oq58_peatland_rewet(t,j,"upper") = q58_peatland_rewet.up(j); oq58_peatland_crop(t,j,"upper") = q58_peatland_crop.up(j); oq58_peatland_past(t,j,"upper") = q58_peatland_past.up(j); oq58_peatland_forestry(t,j,"upper") = q58_peatland_forestry.up(j); - oq58_peatland_cost_full(t,j,"upper") = q58_peatland_cost_full.up(j); oq58_peatland_cost(t,j,"upper") = q58_peatland_cost.up(j); oq58_peatland_cost_annuity(t,j,"upper") = q58_peatland_cost_annuity.up(j); oq58_peatland_emis_detail(t,j,land58,emis58,"upper") = q58_peatland_emis_detail.up(j,land58,emis58); oq58_peatland_emis(t,i,poll58,"upper") = q58_peatland_emis.up(i,poll58); ov_peatland_cost(t,j,"lower") = vm_peatland_cost.lo(j); - ov58_peatland_cost(t,j,"lower") = v58_peatland_cost.lo(j); ov58_peatland_cost_annuity(t,j,"lower") = v58_peatland_cost_annuity.lo(j); ov58_peatland_emis(t,j,land58,emis58,"lower") = v58_peatland_emis.lo(j,land58,emis58); ov58_expansion(t,j,land58,"lower") = v58_expansion.lo(j,land58); @@ -82,10 +77,10 @@ else oq58_peatland(t,j,"lower") = q58_peatland.lo(j); oq58_expansion(t,j,land58,"lower") = q58_expansion.lo(j,land58); oq58_reduction(t,j,land58,"lower") = q58_reduction.lo(j,land58); + oq58_peatland_rewet(t,j,"lower") = q58_peatland_rewet.lo(j); oq58_peatland_crop(t,j,"lower") = q58_peatland_crop.lo(j); oq58_peatland_past(t,j,"lower") = q58_peatland_past.lo(j); oq58_peatland_forestry(t,j,"lower") = q58_peatland_forestry.lo(j); - oq58_peatland_cost_full(t,j,"lower") = q58_peatland_cost_full.lo(j); oq58_peatland_cost(t,j,"lower") = q58_peatland_cost.lo(j); oq58_peatland_cost_annuity(t,j,"lower") = q58_peatland_cost_annuity.lo(j); oq58_peatland_emis_detail(t,j,land58,emis58,"lower") = q58_peatland_emis_detail.lo(j,land58,emis58); diff --git a/modules/58_peatland/on_2023/preloop.gms b/modules/58_peatland/on_2023/preloop.gms index 8d91f63d60..fba472690e 100644 --- a/modules/58_peatland/on_2023/preloop.gms +++ b/modules/58_peatland/on_2023/preloop.gms @@ -14,21 +14,19 @@ p58_mapping_cell_climate(j,clcl58) = sum(clcl_mapping(clcl,clcl58),pm_climate_cl p58_ipcc_wetland_ef(clcl58,land58,emis58) = f58_ipcc_wetland_ef(clcl58,land58,emis58); * Peatland scaling factor: ratio of total peatland area and total land area -p58_scaling_factor(j)$(sum(land, pcm_land(j,land)) > 1e-20) = sum(land58, f58_peatlandArea(j,land58)) / sum(land, pcm_land(j,land)); - +p58_scaling_factor(j)$(sum(land, pcm_land(j,land)) > 1e-20) = sum(land58, f58_peatland_area(j,land58)) / sum(land, pcm_land(j,land)); * Initialization of peatland pc58_peatland(j,land58) = 0; -* Degraded peatland is estimated by multiplication of managed land (pcm_land) with the peatland scaling factor (p58_scaling_factor). -pc58_peatland(j,"crop") = min(f58_peatlandArea(j,"crop"),pcm_land(j,"crop") * p58_scaling_factor(j)); -pc58_peatland(j,"past") = min(f58_peatlandArea(j,"past"),pcm_land(j,"past") * p58_scaling_factor(j)); -pc58_peatland(j,"forestry") = min(f58_peatlandArea(j,"forestry"),pcm_land(j,"forestry") * p58_scaling_factor(j)); +* Degraded peatland is estimated by multiplication of managed land (cropland, pasture, forestry) with the peatland scaling factor (p58_scaling_factor) +* and simultaneously constrained by observed degraded peatland area (f58_peatland_area). +pc58_peatland(j,"crop") = min(f58_peatland_area(j,"crop"),pcm_land(j,"crop") * p58_scaling_factor(j)); +pc58_peatland(j,"past") = min(f58_peatland_area(j,"past"),pcm_land(j,"past") * p58_scaling_factor(j)); +pc58_peatland(j,"forestry") = min(f58_peatland_area(j,"forestry"),vm_land_forestry.l(j,"plant") * p58_scaling_factor(j)); * The residual is added to an "unused" category, which represents degraded but unused peatland. -pc58_peatland(j,"unused") = sum(landMan58, f58_peatlandArea(j,landMan58) - pc58_peatland(j,landMan58)); -*pc58_peatland(j,"unused")$(pc58_peatland(j,"unused") < 0) = 0; -*p58_peatland_degrad(j) = sum((man58,land58), pc58_peatland_man(j,man58,land58)); -pc58_peatland(j,"peatExtract") = f58_peatlandArea(j,"peatExtract"); - -pc58_peatland(j,"intact") = f58_peatlandArea(j,"intact"); +pc58_peatland(j,"unused") = sum(landDrainedUsed58, f58_peatland_area(j,landDrainedUsed58) - pc58_peatland(j,landDrainedUsed58)); +pc58_peatland(j,"unused")$(pc58_peatland(j,"unused") < 0) = 0; +pc58_peatland(j,"peatExtract") = f58_peatland_area(j,"peatExtract"); +pc58_peatland(j,"intact") = f58_peatland_area(j,"intact"); diff --git a/modules/58_peatland/on_2023/presolve.gms b/modules/58_peatland/on_2023/presolve.gms index 0975025517..0ac8fb7c4f 100644 --- a/modules/58_peatland/on_2023/presolve.gms +++ b/modules/58_peatland/on_2023/presolve.gms @@ -17,8 +17,7 @@ if (m_year(t) <= s58_fix_peatland, else v58_peatland.lo(j,land58) = 0; v58_peatland.l(j,land58) = pc58_peatland(j,land58); - v58_peatland.up(j,landMan58) = Inf; - v58_peatland.up(j,"unused") = Inf; + v58_peatland.up(j,landDrained58) = Inf; v58_peatland.up(j,"rewetted") = s58_rewetting_switch; v58_peatland.up(j,"intact") = pc58_peatland(j,"intact"); v58_peatland.fx(j,"peatExtract") = pc58_peatland(j,"peatExtract"); diff --git a/modules/58_peatland/on_2023/realization.gms b/modules/58_peatland/on_2023/realization.gms index 587ab2868f..e5606faeda 100644 --- a/modules/58_peatland/on_2023/realization.gms +++ b/modules/58_peatland/on_2023/realization.gms @@ -5,16 +5,17 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -*' @description In this realization, the state of peatlands is modelled as described in @humpenoder_peatland_2020. -*' The initial map of peatland area consists of intact and degraded peatland area for the year 2015. +*' @description In this realization, the state of peatlands is modelled based on the +*' methodology described in @humpenoder_peatland_2020. +*' The initial map for intact, degraded and rewetted peatland in based on the Global Peatland Map 2.0 and Global Peatland Database. *' Future peatland dynamics depend on the ratio of total peatland area and total land area. -*' GHG emissions from degraded and rewetted peatlands as are calculated based on GHG emission factors from the -*' "2013 Supplement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories: Wetlands". +*' GHG emissions from peatlands as are calculated based on GHG emission factors from the +*' "2013 Supplement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories: Wetlands" and @tiemeyer_peatland_2020. *' @stop *' -*' @limitations Peatland area and GHG emissions are fixed to 2015 levels for the historic period, +*' @limitations Peatland area and GHG emissions are fixed to 2015/2020 levels for the historic period, *' depending on `s58_fix_peatland`. Organic carbon stocks in peatlands are not accounted for. *####################### R SECTION START (PHASES) ############################## @@ -22,7 +23,6 @@ $Ifi "%phase%" == "sets" $include "./modules/58_peatland/on_2023/sets.gms" $Ifi "%phase%" == "declarations" $include "./modules/58_peatland/on_2023/declarations.gms" $Ifi "%phase%" == "input" $include "./modules/58_peatland/on_2023/input.gms" $Ifi "%phase%" == "equations" $include "./modules/58_peatland/on_2023/equations.gms" -$Ifi "%phase%" == "scaling" $include "./modules/58_peatland/on_2023/scaling.gms" $Ifi "%phase%" == "preloop" $include "./modules/58_peatland/on_2023/preloop.gms" $Ifi "%phase%" == "presolve" $include "./modules/58_peatland/on_2023/presolve.gms" $Ifi "%phase%" == "postsolve" $include "./modules/58_peatland/on_2023/postsolve.gms" diff --git a/modules/58_peatland/on_2023/scaling.gms b/modules/58_peatland/on_2023/scaling.gms deleted file mode 100644 index c10a69cca2..0000000000 --- a/modules/58_peatland/on_2023/scaling.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/58_peatland/on_2023/sets.gms b/modules/58_peatland/on_2023/sets.gms index 9bcca82dd9..0abd629107 100644 --- a/modules/58_peatland/on_2023/sets.gms +++ b/modules/58_peatland/on_2023/sets.gms @@ -7,40 +7,14 @@ sets - man58 State of managed peatland - / degrad, unused, rewet / - - degrad58(man58) State of degraded peatland - / degrad, unused / - - ef58(man58) Peatland emissions factors - / degrad, rewet / - - land58 Peatland land types / intact, crop, past, forestry, peatExtract, unused, rewetted / - landMan58(land58) Peatland land types - / crop, past, forestry / - + landDrained58(land58) Peatland land types + / crop, past, forestry, unused / - stat58 Peatland status - / intact, - degrad_crop, degrad_past, degrad_forestry, - unused_crop, unused_past, unused_forestry, - rewet_crop, rewet_past, rewet_forestry / - - stat_man58(stat58) Peatland status managed land - / degrad_crop, degrad_past, degrad_forestry, - unused_crop, unused_past, unused_forestry, - rewet_crop, rewet_past, rewet_forestry / - - stat_degrad58(stat58) Peatland status degrad - / degrad_crop, degrad_past, degrad_forestry, - unused_crop, unused_past, unused_forestry / - - stat_rewet58(stat58) Peatland status rewet - / rewet_crop, rewet_past, rewet_forestry / + landDrainedUsed58(land58) Peatland land types + / crop, past, forestry / emis58 Wetland emission types / co2, doc, ch4, n2o / @@ -95,5 +69,3 @@ sets / ; - -alias (stat58, from58, to58); From 4e6488597e17b4abef8c8d01306f10856077b197 Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 26 Oct 2023 21:50:54 +0200 Subject: [PATCH 43/68] changelog --- CHANGELOG.md | 1 + config/default.cfg | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e799d66e5e..aa39a25463 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/). ### added - **18_residues** Included cluster-level residue realization, for cluster-level production of residues (but balancing of recycling and burning budgets remains at region-level, for computational lightness) - **14_yields/config** Added option for considering impacts of land degradation on yields. If `s14_degradation` is switched to 1, MAgPIE will include cluster-specific information on the state of nature's contributions to people relevant for yields `./modules/14_yields/input/f14_yld_ncp_report.cs3`. +- **58_peatland** added realization "on_2023" with updated peatland map and GHG emission factors ### removed - diff --git a/config/default.cfg b/config/default.cfg index db95d70a4f..0d29f078d0 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1526,6 +1526,7 @@ cfg$gms$s57_maxmac_ch4_awms <- -1 # def = -1 # * (off): Peatland area and associated GHG emissions are assumed zero # * (on): Peatland area is initialized with present-day degraded and intact peatland. # * GHG emissions are calculated using IPCC Tier 1 emission factors (2013 Wetland supplement). +# * (on_2023): Similar to "on" but with updated peatland map and GHG emission factors cfg$gms$peatland <- "on" # def = on # * peatland rewetting From ac672cb69941ae5c41469ee8270446eff2141357 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 27 Oct 2023 09:48:50 +0200 Subject: [PATCH 44/68] bugfix --- modules/58_peatland/on_2023/preloop.gms | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/58_peatland/on_2023/preloop.gms b/modules/58_peatland/on_2023/preloop.gms index fba472690e..3db139e54a 100644 --- a/modules/58_peatland/on_2023/preloop.gms +++ b/modules/58_peatland/on_2023/preloop.gms @@ -11,8 +11,6 @@ vm_emissions_reg.up(i,"peatland",poll58) = Inf; p58_mapping_cell_climate(j,clcl58) = sum(clcl_mapping(clcl,clcl58),pm_climate_class(j,clcl)); -p58_ipcc_wetland_ef(clcl58,land58,emis58) = f58_ipcc_wetland_ef(clcl58,land58,emis58); - * Peatland scaling factor: ratio of total peatland area and total land area p58_scaling_factor(j)$(sum(land, pcm_land(j,land)) > 1e-20) = sum(land58, f58_peatland_area(j,land58)) / sum(land, pcm_land(j,land)); From ad3dcd113b19354ef42fe7b099403d8e15769632 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 27 Oct 2023 10:18:26 +0200 Subject: [PATCH 45/68] tab to space --- modules/58_peatland/on_2023/equations.gms | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/58_peatland/on_2023/equations.gms b/modules/58_peatland/on_2023/equations.gms index 2c20a1e97f..cce1fe6433 100644 --- a/modules/58_peatland/on_2023/equations.gms +++ b/modules/58_peatland/on_2023/equations.gms @@ -32,17 +32,17 @@ q58_peatland_crop(j2)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. v58_peatland(j2,"crop") =e= pc58_peatland(j2,"crop") - + ((vm_land(j2,"crop")-pcm_land(j2,"crop"))*p58_scaling_factor(j2)); + + ((vm_land(j2,"crop")-pcm_land(j2,"crop"))*p58_scaling_factor(j2)); q58_peatland_past(j2)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. v58_peatland(j2,"past") =e= pc58_peatland(j2,"past") - + ((vm_land(j2,"past")-pcm_land(j2,"past"))*p58_scaling_factor(j2)); + + ((vm_land(j2,"past")-pcm_land(j2,"past"))*p58_scaling_factor(j2)); q58_peatland_forestry(j2)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. v58_peatland(j2,"forestry") =e= pc58_peatland(j2,"forestry") - + ((vm_land_forestry(j2,"plant")-vm_land_forestry.l(j2,"plant"))*p58_scaling_factor(j2)); + + ((vm_land_forestry(j2,"plant")-vm_land_forestry.l(j2,"plant"))*p58_scaling_factor(j2)); *' This constraint avoids the conversion of intact peatland into rewetted peatland. *' Therefore, rewetted peatland area can only increase if degraded peatland area declines. From 31ba284a5b25ca6a5498421f6a25f8b8a27425b7 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 27 Oct 2023 11:40:22 +0200 Subject: [PATCH 46/68] doc --- literature.bib | 82 +++++++++++++++++++ .../32_forestry/dynamic_feb21/realization.gms | 2 +- modules/32_forestry/module.gms | 16 ++-- modules/73_timber/default/realization.gms | 6 +- 4 files changed, 97 insertions(+), 9 deletions(-) diff --git a/literature.bib b/literature.bib index 3478c9b626..46f5ffdb5d 100644 --- a/literature.bib +++ b/literature.bib @@ -1472,3 +1472,85 @@ @article{olson_biome_2001 year = {2001}, pages = {933--938}, } + + +@article{tiemeyer_peatland_2020, + title = {A new methodology for organic soils in national greenhouse gas inventories: {Data} synthesis, derivation and application}, + volume = {109}, + issn = {1470160X}, + shorttitle = {A new methodology for organic soils in national greenhouse gas inventories}, + url = {https://linkinghub.elsevier.com/retrieve/pii/S1470160X19308325}, + doi = {10.1016/j.ecolind.2019.105838}, + abstract = {Drained organic soils are large sources of anthropogenic greenhouse gases (GHG) in many European and Asian countries. Therefore, these soils urgently need to be considered and adequately accounted for when attempting to decrease emissions from the Agriculture and Land Use, Land Use Change and Forestry (LULUCF) sectors. Here, we describe the methodology, data and results of the German approach for measurement, reporting and verification (MRV) of anthropogenic GHG emissions from drained organic soils and outline ways forward towards tracking drainage and rewetting. The methodology was developed for and is currently applied in the German GHG inventory under the United Nations Framework Convention on Climate Change (UNFCCC) and the Kyoto Protocol.}, + language = {en}, + urldate = {2023-06-19}, + journal = {Ecological Indicators}, + author = {Tiemeyer, Bärbel and Freibauer, Annette and Borraz, Elisa Albiac and Augustin, Jürgen and Bechtold, Michel and Beetz, Sascha and Beyer, Colja and Ebli, Martin and Eickenscheidt, Tim and Fiedler, Sabine and Förster, Christoph and Gensior, Andreas and Giebels, Michael and Glatzel, Stephan and Heinichen, Jan and Hoffmann, Mathias and Höper, Heinrich and Jurasinski, Gerald and Laggner, Andreas and Leiber-Sauheitl, Katharina and Peichl-Brak, Mandy and Drösler, Matthias}, + month = feb, + year = {2020}, + pages = {105838}, +} + + +@article{humpenoeder_overcoming_2022, + title = {Overcoming global inequality is critical for land-based mitigation in line with the {Paris} {Agreement}}, + volume = {13}, + copyright = {2022 The Author(s)}, + issn = {2041-1723}, + url = {https://www.nature.com/articles/s41467-022-35114-7}, + doi = {10.1038/s41467-022-35114-7}, + abstract = {Transformation pathways for the land sector in line with the Paris Agreement depend on the assumption of globally implemented greenhouse gas (GHG) emission pricing, and in some cases also on inclusive socio-economic development and sustainable land-use practices. In such pathways, the majority of GHG emission reductions in the land system is expected to come from low- and middle-income countries, which currently account for a large share of emissions from agriculture, forestry and other land use (AFOLU). However, in low- and middle-income countries the economic, financial and institutional barriers for such transformative changes are high. Here, we show that if sustainable development in the land sector remained highly unequal and limited to high-income countries only, global AFOLU emissions would remain substantial throughout the 21st century. Our model-based projections highlight that overcoming global inequality is critical for land-based mitigation in line with the Paris Agreement. While also a scenario purely based on either global GHG emission pricing or on inclusive socio-economic development would achieve the stringent emissions reductions required, only the latter ensures major co-benefits for other Sustainable Development Goals, especially in low- and middle-income regions.}, + language = {en}, + number = {1}, + urldate = {2022-12-02}, + journal = {Nature Communications}, + author = {Humpenöder, Florian and Popp, Alexander and Schleussner, Carl-Friedrich and Orlov, Anton and Windisch, Michael Gregory and Menke, Inga and Pongratz, Julia and Havermann, Felix and Thiery, Wim and Luo, Fei and v. Jeetze, Patrick and Dietrich, Jan Philipp and Lotze-Campen, Hermann and Weindl, Isabelle and Lejeune, Quentin}, + month = dec, + year = {2022}, + note = {Number: 1 +Publisher: Nature Publishing Group}, + keywords = {Sustainability, Climate-change policy, Climate-change mitigation, Socioeconomic scenarios}, + pages = {7453}, +} + + +@article{mishra_forestry_2021, + title = {Estimating global land system impacts of timber plantations using {MAgPIE} 4.3.5}, + volume = {14}, + copyright = {All rights reserved}, + issn = {1991-959X}, + url = {https://gmd.copernicus.org/articles/14/6467/2021/}, + doi = {10.5194/gmd-14-6467-2021}, + abstract = {{\textless}p{\textgreater}{\textless}strong class="journal-contentHeaderColor"{\textgreater}Abstract.{\textless}/strong{\textgreater} Out of 1150 {\textless}span class="inline-formula"{\textgreater}Mha{\textless}/span{\textgreater} (million hectares) of forest designated primarily for production purposes in 2020, plantations accounted for 11 \% (131 {\textless}span class="inline-formula"{\textgreater}Mha{\textless}/span{\textgreater}) of this area and fulfilled more than 33 \% of the global industrial roundwood demand. However, adding additional timber plantations to meet increasing timber demand intensifies competition for scarce land resources between different land uses such as food, feed, livestock and timber production. Despite the significance of plantations with respect to roundwood production, their importance in meeting the long-term timber demand and the implications of plantation expansion for overall land-use dynamics have not been studied in detail, in particular regarding the competition for land between agriculture and forestry in existing land-use models.{\textless}/p{\textgreater} {\textless}p{\textgreater}This paper describes the extension of the modular, open-source land system Model of Agricultural Production and its Impact on the Environment (MAgPIE) using a detailed representation of forest land, timber production and timber demand dynamics. These extensions allow for a better understanding of the land-use dynamics (including competition for land) and the associated land-use change emissions of timber production.{\textless}/p{\textgreater} {\textless}p{\textgreater}We show that the spatial cropland patterns differ when timber production is accounted for, indicating that timber plantations compete with cropland for the same scarce land resources. When plantations are established on cropland, it causes cropland expansion and deforestation elsewhere. Using the exogenous extrapolation of historical roundwood production from plantations, future timber demand and plantation rotation lengths, we model the future spatial expansion of forest plantations. As a result of increasing timber demand, we show a 177 \% increase in plantation area by the end of the century ({\textless}span class="inline-formula"{\textgreater}+{\textless}/span{\textgreater}171 {\textless}span class="inline-formula"{\textgreater}Mha{\textless}/span{\textgreater} in 1995–2100). We also observe (in our model results) that the increasing demand for timber amplifies the scarcity of land, which is indicated by shifting agricultural land-use patterns and increasing yields from cropland compared with a case without forestry. Through the inclusion of new forest plantation and natural forest dynamics, our estimates of land-related {\textless}span class="inline-formula"{\textgreater}CO$_{\textrm{2}}${\textless}/span{\textgreater} emissions better match with observed data, in particular the gross land-use change emissions and carbon uptake (via regrowth), reflecting higher deforestation with the expansion of managed land and timber production as well as higher regrowth in natural forests and plantations.{\textless}/p{\textgreater}}, + language = {English}, + number = {10}, + urldate = {2021-10-27}, + journal = {Geoscientific Model Development}, + author = {Mishra, Abhijeet and Humpenöder, Florian and Dietrich, Jan Philipp and Bodirsky, Benjamin Leon and Sohngen, Brent and P. O. Reyer, Christopher and Lotze-Campen, Hermann and Popp, Alexander}, + month = oct, + year = {2021}, + note = {Publisher: Copernicus GmbH}, + pages = {6467--6494}, +} + + +@article{mishra_timbercities_2022, + title = {Land use change and carbon emissions of a transformation to timber cities}, + volume = {13}, + copyright = {2022 The Author(s)}, + issn = {2041-1723}, + url = {https://www.nature.com/articles/s41467-022-32244-w}, + doi = {10.1038/s41467-022-32244-w}, + abstract = {Using engineered wood for construction has been discussed for climate change mitigation. It remains unclear where and in which way the additional demand for wooden construction material shall be fulfilled. Here we assess the global and regional impacts of increased demand for engineered wood on land use and associated CO2 emissions until 2100 using an open-source land system model. We show that if 90\% of the new urban population would be housed in newly built urban mid-rise buildings with wooden constructions, 106 Gt of additional CO2 could be saved by 2100. Forest plantations would need to expand by up to 149 Mha by 2100 and harvests from unprotected natural forests would increase. Our results indicate that expansion of timber plantations for wooden buildings is possible without major repercussions on agricultural production. Strong governance and careful planning are required to ensure a sustainable transition to timber cities even if frontier forests and biodiversity hotspots are protected.}, + language = {en}, + number = {1}, + urldate = {2022-08-30}, + journal = {Nature Communications}, + author = {Mishra, Abhijeet and Humpenöder, Florian and Churkina, Galina and Reyer, Christopher P. O. and Beier, Felicitas and Bodirsky, Benjamin Leon and Schellnhuber, Hans Joachim and Lotze-Campen, Hermann and Popp, Alexander}, + month = aug, + year = {2022}, + note = {Number: 1 +Publisher: Nature Publishing Group}, + keywords = {Forestry, Climate-change mitigation}, + pages = {4889}, +} diff --git a/modules/32_forestry/dynamic_feb21/realization.gms b/modules/32_forestry/dynamic_feb21/realization.gms index 9d61742870..996c9c38e4 100644 --- a/modules/32_forestry/dynamic_feb21/realization.gms +++ b/modules/32_forestry/dynamic_feb21/realization.gms @@ -29,7 +29,7 @@ *' For harvesting decisions we assume that land owners stick to their establishment decision, *' e.g. if a plantation has been established with a rotation length of 30 years *' it will be harvested after 30 years, even so the rotation length in the prevailing -*' time step, used for establishment, is shorter or longer. +*' time step, used for establishment, is shorter or longer. See @mishra_forestry_2021 for more details. *' @limitations Rotation lengths for timber plantations are not endogenous. diff --git a/modules/32_forestry/module.gms b/modules/32_forestry/module.gms index f929157732..b9448dd6d7 100644 --- a/modules/32_forestry/module.gms +++ b/modules/32_forestry/module.gms @@ -7,11 +7,17 @@ *' @title Forestry *' -*' @description The forestry module describes the constraints under which managed -*' forest (age-class forest) exists. At the same time it calculates the corresponding -*' carbon stocks and biodiversity value. The module provides carbon dioxide removal (CDR) from afforestation -*' to the GHG policy module ([56_ghg_policy]) as well as afforestation related costs -*' to the costs module ([11_costs]). +*' @description The forestry module describes the constraints under which three different +*' types of managed age-class forests exist: plantations used for wood harvesting (plant), +*' prescribed re/afforestation based on existing national policies (ndc) and endogenous +*' CO2-price driven re/afforestation (aff) (@humpenoeder_overcoming_2022). +*' These types of managed forests are made +*' available to other modules via the interface `vm_land_forestry`. At the same time, +*' the module calculates the corresponding carbon stocks and biodiversity values for all +*' three types of managed forest. The module provides expected carbon dioxide removal (CDR) +*' from endogenous re/afforestation to the GHG policy module ([56_ghg_policy]). +*' Costs related to managed forests including costs for harvesting, establishment and +*' management are provided to the cost module ([11_costs]). *' *' @authors Florian Humpenöder, Abhijeet Mishra diff --git a/modules/73_timber/default/realization.gms b/modules/73_timber/default/realization.gms index 15fa94b41d..54b2e821a3 100644 --- a/modules/73_timber/default/realization.gms +++ b/modules/73_timber/default/realization.gms @@ -11,9 +11,9 @@ *' 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 -*' and income elasticities from @morland2018supply. This realization can also account for -*' construction wood demand based on @churkina2020buildings which is added on top of -*' industrial roundwood 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). *' @limitations Timber demand cannot be determined endogenously From df75672790905db72c4db2a24b88f231baf20f11 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 27 Oct 2023 11:46:15 +0200 Subject: [PATCH 47/68] tab to space --- literature.bib | 128 ++++++++++++++++++++++++------------------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/literature.bib b/literature.bib index 46f5ffdb5d..155762c560 100644 --- a/literature.bib +++ b/literature.bib @@ -1475,82 +1475,82 @@ @article{olson_biome_2001 @article{tiemeyer_peatland_2020, - title = {A new methodology for organic soils in national greenhouse gas inventories: {Data} synthesis, derivation and application}, - volume = {109}, - issn = {1470160X}, - shorttitle = {A new methodology for organic soils in national greenhouse gas inventories}, - url = {https://linkinghub.elsevier.com/retrieve/pii/S1470160X19308325}, - doi = {10.1016/j.ecolind.2019.105838}, - abstract = {Drained organic soils are large sources of anthropogenic greenhouse gases (GHG) in many European and Asian countries. Therefore, these soils urgently need to be considered and adequately accounted for when attempting to decrease emissions from the Agriculture and Land Use, Land Use Change and Forestry (LULUCF) sectors. Here, we describe the methodology, data and results of the German approach for measurement, reporting and verification (MRV) of anthropogenic GHG emissions from drained organic soils and outline ways forward towards tracking drainage and rewetting. The methodology was developed for and is currently applied in the German GHG inventory under the United Nations Framework Convention on Climate Change (UNFCCC) and the Kyoto Protocol.}, - language = {en}, - urldate = {2023-06-19}, - journal = {Ecological Indicators}, - author = {Tiemeyer, Bärbel and Freibauer, Annette and Borraz, Elisa Albiac and Augustin, Jürgen and Bechtold, Michel and Beetz, Sascha and Beyer, Colja and Ebli, Martin and Eickenscheidt, Tim and Fiedler, Sabine and Förster, Christoph and Gensior, Andreas and Giebels, Michael and Glatzel, Stephan and Heinichen, Jan and Hoffmann, Mathias and Höper, Heinrich and Jurasinski, Gerald and Laggner, Andreas and Leiber-Sauheitl, Katharina and Peichl-Brak, Mandy and Drösler, Matthias}, - month = feb, - year = {2020}, - pages = {105838}, + title = {A new methodology for organic soils in national greenhouse gas inventories: {Data} synthesis, derivation and application}, + volume = {109}, + issn = {1470160X}, + shorttitle = {A new methodology for organic soils in national greenhouse gas inventories}, + url = {https://linkinghub.elsevier.com/retrieve/pii/S1470160X19308325}, + doi = {10.1016/j.ecolind.2019.105838}, + abstract = {Drained organic soils are large sources of anthropogenic greenhouse gases (GHG) in many European and Asian countries. Therefore, these soils urgently need to be considered and adequately accounted for when attempting to decrease emissions from the Agriculture and Land Use, Land Use Change and Forestry (LULUCF) sectors. Here, we describe the methodology, data and results of the German approach for measurement, reporting and verification (MRV) of anthropogenic GHG emissions from drained organic soils and outline ways forward towards tracking drainage and rewetting. The methodology was developed for and is currently applied in the German GHG inventory under the United Nations Framework Convention on Climate Change (UNFCCC) and the Kyoto Protocol.}, + language = {en}, + urldate = {2023-06-19}, + journal = {Ecological Indicators}, + author = {Tiemeyer, Bärbel and Freibauer, Annette and Borraz, Elisa Albiac and Augustin, Jürgen and Bechtold, Michel and Beetz, Sascha and Beyer, Colja and Ebli, Martin and Eickenscheidt, Tim and Fiedler, Sabine and Förster, Christoph and Gensior, Andreas and Giebels, Michael and Glatzel, Stephan and Heinichen, Jan and Hoffmann, Mathias and Höper, Heinrich and Jurasinski, Gerald and Laggner, Andreas and Leiber-Sauheitl, Katharina and Peichl-Brak, Mandy and Drösler, Matthias}, + month = feb, + year = {2020}, + pages = {105838}, } @article{humpenoeder_overcoming_2022, - title = {Overcoming global inequality is critical for land-based mitigation in line with the {Paris} {Agreement}}, - volume = {13}, - copyright = {2022 The Author(s)}, - issn = {2041-1723}, - url = {https://www.nature.com/articles/s41467-022-35114-7}, - doi = {10.1038/s41467-022-35114-7}, - abstract = {Transformation pathways for the land sector in line with the Paris Agreement depend on the assumption of globally implemented greenhouse gas (GHG) emission pricing, and in some cases also on inclusive socio-economic development and sustainable land-use practices. In such pathways, the majority of GHG emission reductions in the land system is expected to come from low- and middle-income countries, which currently account for a large share of emissions from agriculture, forestry and other land use (AFOLU). However, in low- and middle-income countries the economic, financial and institutional barriers for such transformative changes are high. Here, we show that if sustainable development in the land sector remained highly unequal and limited to high-income countries only, global AFOLU emissions would remain substantial throughout the 21st century. Our model-based projections highlight that overcoming global inequality is critical for land-based mitigation in line with the Paris Agreement. While also a scenario purely based on either global GHG emission pricing or on inclusive socio-economic development would achieve the stringent emissions reductions required, only the latter ensures major co-benefits for other Sustainable Development Goals, especially in low- and middle-income regions.}, - language = {en}, - number = {1}, - urldate = {2022-12-02}, - journal = {Nature Communications}, - author = {Humpenöder, Florian and Popp, Alexander and Schleussner, Carl-Friedrich and Orlov, Anton and Windisch, Michael Gregory and Menke, Inga and Pongratz, Julia and Havermann, Felix and Thiery, Wim and Luo, Fei and v. Jeetze, Patrick and Dietrich, Jan Philipp and Lotze-Campen, Hermann and Weindl, Isabelle and Lejeune, Quentin}, - month = dec, - year = {2022}, - note = {Number: 1 + title = {Overcoming global inequality is critical for land-based mitigation in line with the {Paris} {Agreement}}, + volume = {13}, + copyright = {2022 The Author(s)}, + issn = {2041-1723}, + url = {https://www.nature.com/articles/s41467-022-35114-7}, + doi = {10.1038/s41467-022-35114-7}, + abstract = {Transformation pathways for the land sector in line with the Paris Agreement depend on the assumption of globally implemented greenhouse gas (GHG) emission pricing, and in some cases also on inclusive socio-economic development and sustainable land-use practices. In such pathways, the majority of GHG emission reductions in the land system is expected to come from low- and middle-income countries, which currently account for a large share of emissions from agriculture, forestry and other land use (AFOLU). However, in low- and middle-income countries the economic, financial and institutional barriers for such transformative changes are high. Here, we show that if sustainable development in the land sector remained highly unequal and limited to high-income countries only, global AFOLU emissions would remain substantial throughout the 21st century. Our model-based projections highlight that overcoming global inequality is critical for land-based mitigation in line with the Paris Agreement. While also a scenario purely based on either global GHG emission pricing or on inclusive socio-economic development would achieve the stringent emissions reductions required, only the latter ensures major co-benefits for other Sustainable Development Goals, especially in low- and middle-income regions.}, + language = {en}, + number = {1}, + urldate = {2022-12-02}, + journal = {Nature Communications}, + author = {Humpenöder, Florian and Popp, Alexander and Schleussner, Carl-Friedrich and Orlov, Anton and Windisch, Michael Gregory and Menke, Inga and Pongratz, Julia and Havermann, Felix and Thiery, Wim and Luo, Fei and v. Jeetze, Patrick and Dietrich, Jan Philipp and Lotze-Campen, Hermann and Weindl, Isabelle and Lejeune, Quentin}, + month = dec, + year = {2022}, + note = {Number: 1 Publisher: Nature Publishing Group}, - keywords = {Sustainability, Climate-change policy, Climate-change mitigation, Socioeconomic scenarios}, - pages = {7453}, + keywords = {Sustainability, Climate-change policy, Climate-change mitigation, Socioeconomic scenarios}, + pages = {7453}, } @article{mishra_forestry_2021, - title = {Estimating global land system impacts of timber plantations using {MAgPIE} 4.3.5}, - volume = {14}, - copyright = {All rights reserved}, - issn = {1991-959X}, - url = {https://gmd.copernicus.org/articles/14/6467/2021/}, - doi = {10.5194/gmd-14-6467-2021}, - abstract = {{\textless}p{\textgreater}{\textless}strong class="journal-contentHeaderColor"{\textgreater}Abstract.{\textless}/strong{\textgreater} Out of 1150 {\textless}span class="inline-formula"{\textgreater}Mha{\textless}/span{\textgreater} (million hectares) of forest designated primarily for production purposes in 2020, plantations accounted for 11 \% (131 {\textless}span class="inline-formula"{\textgreater}Mha{\textless}/span{\textgreater}) of this area and fulfilled more than 33 \% of the global industrial roundwood demand. However, adding additional timber plantations to meet increasing timber demand intensifies competition for scarce land resources between different land uses such as food, feed, livestock and timber production. Despite the significance of plantations with respect to roundwood production, their importance in meeting the long-term timber demand and the implications of plantation expansion for overall land-use dynamics have not been studied in detail, in particular regarding the competition for land between agriculture and forestry in existing land-use models.{\textless}/p{\textgreater} {\textless}p{\textgreater}This paper describes the extension of the modular, open-source land system Model of Agricultural Production and its Impact on the Environment (MAgPIE) using a detailed representation of forest land, timber production and timber demand dynamics. These extensions allow for a better understanding of the land-use dynamics (including competition for land) and the associated land-use change emissions of timber production.{\textless}/p{\textgreater} {\textless}p{\textgreater}We show that the spatial cropland patterns differ when timber production is accounted for, indicating that timber plantations compete with cropland for the same scarce land resources. When plantations are established on cropland, it causes cropland expansion and deforestation elsewhere. Using the exogenous extrapolation of historical roundwood production from plantations, future timber demand and plantation rotation lengths, we model the future spatial expansion of forest plantations. As a result of increasing timber demand, we show a 177 \% increase in plantation area by the end of the century ({\textless}span class="inline-formula"{\textgreater}+{\textless}/span{\textgreater}171 {\textless}span class="inline-formula"{\textgreater}Mha{\textless}/span{\textgreater} in 1995–2100). We also observe (in our model results) that the increasing demand for timber amplifies the scarcity of land, which is indicated by shifting agricultural land-use patterns and increasing yields from cropland compared with a case without forestry. Through the inclusion of new forest plantation and natural forest dynamics, our estimates of land-related {\textless}span class="inline-formula"{\textgreater}CO$_{\textrm{2}}${\textless}/span{\textgreater} emissions better match with observed data, in particular the gross land-use change emissions and carbon uptake (via regrowth), reflecting higher deforestation with the expansion of managed land and timber production as well as higher regrowth in natural forests and plantations.{\textless}/p{\textgreater}}, - language = {English}, - number = {10}, - urldate = {2021-10-27}, - journal = {Geoscientific Model Development}, - author = {Mishra, Abhijeet and Humpenöder, Florian and Dietrich, Jan Philipp and Bodirsky, Benjamin Leon and Sohngen, Brent and P. O. Reyer, Christopher and Lotze-Campen, Hermann and Popp, Alexander}, - month = oct, - year = {2021}, - note = {Publisher: Copernicus GmbH}, - pages = {6467--6494}, + title = {Estimating global land system impacts of timber plantations using {MAgPIE} 4.3.5}, + volume = {14}, + copyright = {All rights reserved}, + issn = {1991-959X}, + url = {https://gmd.copernicus.org/articles/14/6467/2021/}, + doi = {10.5194/gmd-14-6467-2021}, + abstract = {{\textless}p{\textgreater}{\textless}strong class="journal-contentHeaderColor"{\textgreater}Abstract.{\textless}/strong{\textgreater} Out of 1150 {\textless}span class="inline-formula"{\textgreater}Mha{\textless}/span{\textgreater} (million hectares) of forest designated primarily for production purposes in 2020, plantations accounted for 11 \% (131 {\textless}span class="inline-formula"{\textgreater}Mha{\textless}/span{\textgreater}) of this area and fulfilled more than 33 \% of the global industrial roundwood demand. However, adding additional timber plantations to meet increasing timber demand intensifies competition for scarce land resources between different land uses such as food, feed, livestock and timber production. Despite the significance of plantations with respect to roundwood production, their importance in meeting the long-term timber demand and the implications of plantation expansion for overall land-use dynamics have not been studied in detail, in particular regarding the competition for land between agriculture and forestry in existing land-use models.{\textless}/p{\textgreater} {\textless}p{\textgreater}This paper describes the extension of the modular, open-source land system Model of Agricultural Production and its Impact on the Environment (MAgPIE) using a detailed representation of forest land, timber production and timber demand dynamics. These extensions allow for a better understanding of the land-use dynamics (including competition for land) and the associated land-use change emissions of timber production.{\textless}/p{\textgreater} {\textless}p{\textgreater}We show that the spatial cropland patterns differ when timber production is accounted for, indicating that timber plantations compete with cropland for the same scarce land resources. When plantations are established on cropland, it causes cropland expansion and deforestation elsewhere. Using the exogenous extrapolation of historical roundwood production from plantations, future timber demand and plantation rotation lengths, we model the future spatial expansion of forest plantations. As a result of increasing timber demand, we show a 177 \% increase in plantation area by the end of the century ({\textless}span class="inline-formula"{\textgreater}+{\textless}/span{\textgreater}171 {\textless}span class="inline-formula"{\textgreater}Mha{\textless}/span{\textgreater} in 1995–2100). We also observe (in our model results) that the increasing demand for timber amplifies the scarcity of land, which is indicated by shifting agricultural land-use patterns and increasing yields from cropland compared with a case without forestry. Through the inclusion of new forest plantation and natural forest dynamics, our estimates of land-related {\textless}span class="inline-formula"{\textgreater}CO$_{\textrm{2}}${\textless}/span{\textgreater} emissions better match with observed data, in particular the gross land-use change emissions and carbon uptake (via regrowth), reflecting higher deforestation with the expansion of managed land and timber production as well as higher regrowth in natural forests and plantations.{\textless}/p{\textgreater}}, + language = {English}, + number = {10}, + urldate = {2021-10-27}, + journal = {Geoscientific Model Development}, + author = {Mishra, Abhijeet and Humpenöder, Florian and Dietrich, Jan Philipp and Bodirsky, Benjamin Leon and Sohngen, Brent and P. O. Reyer, Christopher and Lotze-Campen, Hermann and Popp, Alexander}, + month = oct, + year = {2021}, + note = {Publisher: Copernicus GmbH}, + pages = {6467--6494}, } @article{mishra_timbercities_2022, - title = {Land use change and carbon emissions of a transformation to timber cities}, - volume = {13}, - copyright = {2022 The Author(s)}, - issn = {2041-1723}, - url = {https://www.nature.com/articles/s41467-022-32244-w}, - doi = {10.1038/s41467-022-32244-w}, - abstract = {Using engineered wood for construction has been discussed for climate change mitigation. It remains unclear where and in which way the additional demand for wooden construction material shall be fulfilled. Here we assess the global and regional impacts of increased demand for engineered wood on land use and associated CO2 emissions until 2100 using an open-source land system model. We show that if 90\% of the new urban population would be housed in newly built urban mid-rise buildings with wooden constructions, 106 Gt of additional CO2 could be saved by 2100. Forest plantations would need to expand by up to 149 Mha by 2100 and harvests from unprotected natural forests would increase. Our results indicate that expansion of timber plantations for wooden buildings is possible without major repercussions on agricultural production. Strong governance and careful planning are required to ensure a sustainable transition to timber cities even if frontier forests and biodiversity hotspots are protected.}, - language = {en}, - number = {1}, - urldate = {2022-08-30}, - journal = {Nature Communications}, - author = {Mishra, Abhijeet and Humpenöder, Florian and Churkina, Galina and Reyer, Christopher P. O. and Beier, Felicitas and Bodirsky, Benjamin Leon and Schellnhuber, Hans Joachim and Lotze-Campen, Hermann and Popp, Alexander}, - month = aug, - year = {2022}, - note = {Number: 1 + title = {Land use change and carbon emissions of a transformation to timber cities}, + volume = {13}, + copyright = {2022 The Author(s)}, + issn = {2041-1723}, + url = {https://www.nature.com/articles/s41467-022-32244-w}, + doi = {10.1038/s41467-022-32244-w}, + abstract = {Using engineered wood for construction has been discussed for climate change mitigation. It remains unclear where and in which way the additional demand for wooden construction material shall be fulfilled. Here we assess the global and regional impacts of increased demand for engineered wood on land use and associated CO2 emissions until 2100 using an open-source land system model. We show that if 90\% of the new urban population would be housed in newly built urban mid-rise buildings with wooden constructions, 106 Gt of additional CO2 could be saved by 2100. Forest plantations would need to expand by up to 149 Mha by 2100 and harvests from unprotected natural forests would increase. Our results indicate that expansion of timber plantations for wooden buildings is possible without major repercussions on agricultural production. Strong governance and careful planning are required to ensure a sustainable transition to timber cities even if frontier forests and biodiversity hotspots are protected.}, + language = {en}, + number = {1}, + urldate = {2022-08-30}, + journal = {Nature Communications}, + author = {Mishra, Abhijeet and Humpenöder, Florian and Churkina, Galina and Reyer, Christopher P. O. and Beier, Felicitas and Bodirsky, Benjamin Leon and Schellnhuber, Hans Joachim and Lotze-Campen, Hermann and Popp, Alexander}, + month = aug, + year = {2022}, + note = {Number: 1 Publisher: Nature Publishing Group}, - keywords = {Forestry, Climate-change mitigation}, - pages = {4889}, + keywords = {Forestry, Climate-change mitigation}, + pages = {4889}, } From feb231f5f44352f02e3b94c3392d085eb70bc59c Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 27 Oct 2023 12:29:20 +0200 Subject: [PATCH 48/68] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index aa39a25463..69ea28e3ea 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/). - **18_residues** Included cluster-level residue realization, for cluster-level production of residues (but balancing of recycling and burning budgets remains at region-level, for computational lightness) - **14_yields/config** Added option for considering impacts of land degradation on yields. If `s14_degradation` is switched to 1, MAgPIE will include cluster-specific information on the state of nature's contributions to people relevant for yields `./modules/14_yields/input/f14_yld_ncp_report.cs3`. - **58_peatland** added realization "on_2023" with updated peatland map and GHG emission factors +- **32_forestry** new interface `vm_land_forestry` ### removed - From f8c2386e1979bec8fa64f5a4f4d183d12beda741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Humpen=C3=B6der?= Date: Fri, 27 Oct 2023 14:40:49 +0200 Subject: [PATCH 49/68] Update modules/32_forestry/module.gms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Pascal Führlich <82826417+pfuehrlich-pik@users.noreply.github.com> --- modules/32_forestry/module.gms | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/32_forestry/module.gms b/modules/32_forestry/module.gms index b9448dd6d7..002538276d 100644 --- a/modules/32_forestry/module.gms +++ b/modules/32_forestry/module.gms @@ -16,8 +16,8 @@ *' the module calculates the corresponding carbon stocks and biodiversity values for all *' three types of managed forest. The module provides expected carbon dioxide removal (CDR) *' from endogenous re/afforestation to the GHG policy module ([56_ghg_policy]). -*' Costs related to managed forests including costs for harvesting, establishment and -*' management are provided to the cost module ([11_costs]). +*' Costs related to managed forests, including costs for harvesting, establishment and +*' management, are provided to the cost module ([11_costs]). *' *' @authors Florian Humpenöder, Abhijeet Mishra From bba3e786e1d0860bdf18138f0ea9e9c9b94b3cd2 Mon Sep 17 00:00:00 2001 From: florianh Date: Fri, 27 Oct 2023 14:47:47 +0200 Subject: [PATCH 50/68] renamed on_2023 to v2 --- CHANGELOG.md | 2 +- config/default.cfg | 2 +- modules/58_peatland/module.gms | 2 +- .../58_peatland/{on_2023 => v2}/declarations.gms | 0 modules/58_peatland/{on_2023 => v2}/equations.gms | 0 modules/58_peatland/{on_2023 => v2}/input.gms | 0 modules/58_peatland/{on_2023 => v2}/postsolve.gms | 0 modules/58_peatland/{on_2023 => v2}/preloop.gms | 0 modules/58_peatland/{on_2023 => v2}/presolve.gms | 0 .../58_peatland/{on_2023 => v2}/realization.gms | 14 +++++++------- modules/58_peatland/{on_2023 => v2}/sets.gms | 0 11 files changed, 10 insertions(+), 10 deletions(-) rename modules/58_peatland/{on_2023 => v2}/declarations.gms (100%) rename modules/58_peatland/{on_2023 => v2}/equations.gms (100%) rename modules/58_peatland/{on_2023 => v2}/input.gms (100%) rename modules/58_peatland/{on_2023 => v2}/postsolve.gms (100%) rename modules/58_peatland/{on_2023 => v2}/preloop.gms (100%) rename modules/58_peatland/{on_2023 => v2}/presolve.gms (100%) rename modules/58_peatland/{on_2023 => v2}/realization.gms (73%) rename modules/58_peatland/{on_2023 => v2}/sets.gms (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69ea28e3ea..fa24e5da3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,7 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### added - **18_residues** Included cluster-level residue realization, for cluster-level production of residues (but balancing of recycling and burning budgets remains at region-level, for computational lightness) - **14_yields/config** Added option for considering impacts of land degradation on yields. If `s14_degradation` is switched to 1, MAgPIE will include cluster-specific information on the state of nature's contributions to people relevant for yields `./modules/14_yields/input/f14_yld_ncp_report.cs3`. -- **58_peatland** added realization "on_2023" with updated peatland map and GHG emission factors +- **58_peatland** added realization "v2" with updated peatland map and GHG emission factors - **32_forestry** new interface `vm_land_forestry` ### removed diff --git a/config/default.cfg b/config/default.cfg index 0d29f078d0..a4869f7a31 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1526,7 +1526,7 @@ cfg$gms$s57_maxmac_ch4_awms <- -1 # def = -1 # * (off): Peatland area and associated GHG emissions are assumed zero # * (on): Peatland area is initialized with present-day degraded and intact peatland. # * GHG emissions are calculated using IPCC Tier 1 emission factors (2013 Wetland supplement). -# * (on_2023): Similar to "on" but with updated peatland map and GHG emission factors +# * (v2): Similar to "on" but with updated peatland map and GHG emission factors cfg$gms$peatland <- "on" # def = on # * peatland rewetting diff --git a/modules/58_peatland/module.gms b/modules/58_peatland/module.gms index 4304ec38f9..a69f8bb9a3 100644 --- a/modules/58_peatland/module.gms +++ b/modules/58_peatland/module.gms @@ -14,5 +14,5 @@ *###################### R SECTION START (MODULETYPES) ########################## $Ifi "%peatland%" == "off" $include "./modules/58_peatland/off/realization.gms" $Ifi "%peatland%" == "on" $include "./modules/58_peatland/on/realization.gms" -$Ifi "%peatland%" == "on_2023" $include "./modules/58_peatland/on_2023/realization.gms" +$Ifi "%peatland%" == "v2" $include "./modules/58_peatland/v2/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/58_peatland/on_2023/declarations.gms b/modules/58_peatland/v2/declarations.gms similarity index 100% rename from modules/58_peatland/on_2023/declarations.gms rename to modules/58_peatland/v2/declarations.gms diff --git a/modules/58_peatland/on_2023/equations.gms b/modules/58_peatland/v2/equations.gms similarity index 100% rename from modules/58_peatland/on_2023/equations.gms rename to modules/58_peatland/v2/equations.gms diff --git a/modules/58_peatland/on_2023/input.gms b/modules/58_peatland/v2/input.gms similarity index 100% rename from modules/58_peatland/on_2023/input.gms rename to modules/58_peatland/v2/input.gms diff --git a/modules/58_peatland/on_2023/postsolve.gms b/modules/58_peatland/v2/postsolve.gms similarity index 100% rename from modules/58_peatland/on_2023/postsolve.gms rename to modules/58_peatland/v2/postsolve.gms diff --git a/modules/58_peatland/on_2023/preloop.gms b/modules/58_peatland/v2/preloop.gms similarity index 100% rename from modules/58_peatland/on_2023/preloop.gms rename to modules/58_peatland/v2/preloop.gms diff --git a/modules/58_peatland/on_2023/presolve.gms b/modules/58_peatland/v2/presolve.gms similarity index 100% rename from modules/58_peatland/on_2023/presolve.gms rename to modules/58_peatland/v2/presolve.gms diff --git a/modules/58_peatland/on_2023/realization.gms b/modules/58_peatland/v2/realization.gms similarity index 73% rename from modules/58_peatland/on_2023/realization.gms rename to modules/58_peatland/v2/realization.gms index e5606faeda..1bd4edc2b8 100644 --- a/modules/58_peatland/on_2023/realization.gms +++ b/modules/58_peatland/v2/realization.gms @@ -19,11 +19,11 @@ *' depending on `s58_fix_peatland`. Organic carbon stocks in peatlands are not accounted for. *####################### R SECTION START (PHASES) ############################## -$Ifi "%phase%" == "sets" $include "./modules/58_peatland/on_2023/sets.gms" -$Ifi "%phase%" == "declarations" $include "./modules/58_peatland/on_2023/declarations.gms" -$Ifi "%phase%" == "input" $include "./modules/58_peatland/on_2023/input.gms" -$Ifi "%phase%" == "equations" $include "./modules/58_peatland/on_2023/equations.gms" -$Ifi "%phase%" == "preloop" $include "./modules/58_peatland/on_2023/preloop.gms" -$Ifi "%phase%" == "presolve" $include "./modules/58_peatland/on_2023/presolve.gms" -$Ifi "%phase%" == "postsolve" $include "./modules/58_peatland/on_2023/postsolve.gms" +$Ifi "%phase%" == "sets" $include "./modules/58_peatland/v2/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/58_peatland/v2/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/58_peatland/v2/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/58_peatland/v2/equations.gms" +$Ifi "%phase%" == "preloop" $include "./modules/58_peatland/v2/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/58_peatland/v2/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/58_peatland/v2/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/58_peatland/on_2023/sets.gms b/modules/58_peatland/v2/sets.gms similarity index 100% rename from modules/58_peatland/on_2023/sets.gms rename to modules/58_peatland/v2/sets.gms From da89d8d6dd1e86b61e406bc4cc7da333dab1918d Mon Sep 17 00:00:00 2001 From: florianh Date: Wed, 1 Nov 2023 14:36:27 +0100 Subject: [PATCH 51/68] doc + bugfixes --- config/default.cfg | 17 ++++++++++----- literature.bib | 29 +++++++++++++++++++++++++ modules/58_peatland/on/equations.gms | 4 ++-- modules/58_peatland/on/realization.gms | 8 +++---- modules/58_peatland/v2/declarations.gms | 8 +++++-- modules/58_peatland/v2/equations.gms | 19 ++++++++++------ modules/58_peatland/v2/postsolve.gms | 8 +++++++ modules/58_peatland/v2/preloop.gms | 1 - modules/58_peatland/v2/realization.gms | 18 +++++++++++---- 9 files changed, 86 insertions(+), 26 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index a4869f7a31..02ad96131b 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1524,9 +1524,14 @@ cfg$gms$s57_maxmac_ch4_awms <- -1 # def = -1 # ***--------------------- 58_peatland ------------------------------------ # * (off): Peatland area and associated GHG emissions are assumed zero -# * (on): Peatland area is initialized with present-day degraded and intact peatland. -# * GHG emissions are calculated using IPCC Tier 1 emission factors (2013 Wetland supplement). -# * (v2): Similar to "on" but with updated peatland map and GHG emission factors +# * (on): Peatland area is initialized with degraded and intact peatland for the year 2015, +# * and projected into the future based on changes in managed land. +# * GHG emissions are calculated using IPCC Tier 1 emission factors (2013 Wetland supplement). +# * (v2): Peatland area is initialized with degraded and intact peatland area for the year 2020, +# * and projected into the future based on changes in managed land. +# * For boreal and tropical climates, GHG emissions are calculated using emission +# * factors from the IPCC 2013 Wetland supplement. For temperate climates, more recent +# * estimates from Tiemeyer et al 2020 are used. cfg$gms$peatland <- "on" # def = on # * peatland rewetting @@ -1554,9 +1559,9 @@ cfg$gms$s58_cost_degrad_recur <- 0 # def = 0 # * High costs make sure that the balance variables are only used as a last resort. cfg$gms$s58_cost_balance <- 1e+06 # def = 1e+06 -# * Switch for fixing peatland area to 2015 levels from 1995 onwards until the given year -# * Note: The initial peatland area is only available for the year 2015. -# * Fixing the peatland area in previous time steps to 2015 levels provides a better +# * Switch for fixing peatland area to 2015/2020 levels from 1995 onwards until the given year +# * Note: Depending on the realisation, the initial peatland area is only available for the year 2015 (`on`) or 2020 (`v2`). +# * Fixing the peatland area in previous time steps to 2015/2020 levels provides a better # * proxy for GHG emissions from peatlands than assuming no peatland area. cfg$gms$s58_fix_peatland <- 2015 # def = 2015 diff --git a/literature.bib b/literature.bib index 155762c560..697d7d6b71 100644 --- a/literature.bib +++ b/literature.bib @@ -881,6 +881,35 @@ @article{humpenoder_peatland_2020 pages = {104093}, } + +@article{leifeld_2018, + title = {The underappreciated potential of peatlands in global climate change mitigation strategies}, + volume = {9}, + copyright = {2018 The Author(s)}, + issn = {2041-1723}, + url = {https://www.nature.com/articles/s41467-018-03406-6}, + doi = {10.1038/s41467-018-03406-6}, + abstract = {Human activity, such as draining and mining of peatlands, is transforming these long-term carbon sinks into sources. Here, the authors assess current and future greenhouse gas (GHG) emissions from degrading peatlands and estimate the magnitude of potential GHG savings that could be achieved by restoring them.}, + language = {en}, + number = {1}, + urldate = {2018-05-11}, + journal = {Nature Communications}, + author = {Leifeld, J. and Menichetti, L.}, + month = mar, + year = {2018}, + pages = {1071}, +} + + +@book{IPCC_wetland_2013, + address = {Switzerland}, + title = {2013 {Supplement} to the 2006 {IPCC} {Guidelines} for {National} {Greenhouse} {Gas} {Inventories}: {Wetlands}}, + url = {http://www.ipcc-nggip.iges.or.jp/public/wetlands/}, + publisher = {IPCC}, + editor = {Hiraishi, T and Krug, T and Tanabe, K and Srivastava, N and Baasansuren, J and Fukuda, M and Troxler, T.G.}, + year = {2014}, +} + @article{valin_fooddemand_2013, title = {The future of food demand: understanding differences in global economic models}, issn = {1574-0862}, diff --git a/modules/58_peatland/on/equations.gms b/modules/58_peatland/on/equations.gms index b2214146eb..78b8ef032b 100644 --- a/modules/58_peatland/on/equations.gms +++ b/modules/58_peatland/on/equations.gms @@ -69,8 +69,8 @@ *' The following example illustrates the mechanism used for projecting peatland dynamics: *' In a given grid cell, the total land area is 50 Mha and the total peatland area is 10 Mha. *' Therefore, the scaling factor is 0.2 (10 Mha divided by 50 Mha). -*' If cropland expands by 5 Mha, 1 Mha of intact peatland is converted to degraded peatland (5 Mha*0.2). -*' If the total cell would become cropland, degraded peatland would equal to the total peatland area (50 Mha * 0.2 = 10 Mha). +*' If cropland expands by 5 Mha, 1 Mha of intact peatland is converted to degraded peatland (5 Mha x 0.2). +*' If the total cell would become cropland, degraded peatland would equal to the total peatland area (50 Mha x 0.2 = 10 Mha). q58_peatland_degrad(j2,land58)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. v58_peatland_man(j2,"degrad",land58) =e= diff --git a/modules/58_peatland/on/realization.gms b/modules/58_peatland/on/realization.gms index 41418aa77b..8485443ce9 100644 --- a/modules/58_peatland/on/realization.gms +++ b/modules/58_peatland/on/realization.gms @@ -6,10 +6,10 @@ *** | Contact: magpie@pik-potsdam.de *' @description In this realization, the state of peatlands is modelled as described in @humpenoder_peatland_2020. -*' The initial map of peatland area consists of intact and degraded peatland area for the year 2015. -*' Future peatland dynamics depend on the ratio of total peatland area and total land area. -*' GHG emissions from degraded and rewetted peatlands as are calculated based on GHG emission factors from the -*' "2013 Supplement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories: Wetlands". +*' The initial map of peatland area consists of intact and degraded peatland area for the year 2015, +*' based on @leifeld_2018 and the [Global Peatland Database](https://greifswaldmoor.de/global-peatland-database-en.html). +*' Future peatland dynamics are estimated by scaling changes in managed land with the ratio of total peatland area and total land area (peatland scaling factor). +*' GHG emissions from degraded and rewetted peatlands are calculated using IPCC wetland GHG emission factors from @IPCC_wetland_2013 and @wilson_2016. *' @stop diff --git a/modules/58_peatland/v2/declarations.gms b/modules/58_peatland/v2/declarations.gms index 8d943a6c84..79deb095b0 100644 --- a/modules/58_peatland/v2/declarations.gms +++ b/modules/58_peatland/v2/declarations.gms @@ -23,6 +23,7 @@ equations q58_peatland_crop(j) Degraded peatland used as cropland (mio. ha) q58_peatland_past(j) Degraded peatland used as pasture (mio. ha) q58_peatland_forestry(j) Degraded peatland used for forestry (mio. ha) + q58_peatland_cost_full(j) One-time and recurring cost of peatland conversion and management including artifical balance cost (mio. USD05MER per yr) q58_peatland_cost(j) One-time and recurring cost of peatland conversion and management (mio. USD05MER per yr) q58_peatland_cost_annuity(j) Annuity costs of peatland conversion in the current timestep (mio. USD05MER per yr) q58_peatland_emis_detail(j,land58,emis58) Detailed GHG emissions from peatlands (Tg per yr) @@ -30,7 +31,8 @@ equations ; variables - vm_peatland_cost(j) One-time and recurring cost of managed peatland (mio. USD05MER per yr) + vm_peatland_cost(j) One-time and recurring cost of managed peatland including artifical balance cost (mio. USD05MER per yr) + v58_peatland_cost(j) One-time and recurring cost of managed peatland (mio. USD05MER per yr) v58_peatland_cost_annuity(j) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) v58_peatland_emis(j,land58,emis58) Detailed GHG peatland GHG emissions (Tg per yr) ; @@ -43,7 +45,8 @@ positive variables *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_peatland_cost(t,j,type) One-time and recurring cost of managed peatland (mio. USD05MER per yr) + ov_peatland_cost(t,j,type) One-time and recurring cost of managed peatland including artifical balance cost (mio. USD05MER per yr) + ov58_peatland_cost(t,j,type) One-time and recurring cost of managed peatland (mio. USD05MER per yr) ov58_peatland_cost_annuity(t,j,type) Annuity costs of managed peatland expansion in the current timestep (mio. USD05MER per yr) ov58_peatland_emis(t,j,land58,emis58,type) Detailed GHG peatland GHG emissions (Tg per yr) ov58_expansion(t,j,land58,type) Peatland expansion (mio. ha) @@ -56,6 +59,7 @@ parameters oq58_peatland_crop(t,j,type) Degraded peatland used as cropland (mio. ha) oq58_peatland_past(t,j,type) Degraded peatland used as pasture (mio. ha) oq58_peatland_forestry(t,j,type) Degraded peatland used for forestry (mio. ha) + oq58_peatland_cost_full(t,j,type) One-time and recurring cost of peatland conversion and management including artifical balance cost (mio. USD05MER per yr) oq58_peatland_cost(t,j,type) One-time and recurring cost of peatland conversion and management (mio. USD05MER per yr) oq58_peatland_cost_annuity(t,j,type) Annuity costs of peatland conversion in the current timestep (mio. USD05MER per yr) oq58_peatland_emis_detail(t,j,land58,emis58,type) Detailed GHG emissions from peatlands (Tg per yr) diff --git a/modules/58_peatland/v2/equations.gms b/modules/58_peatland/v2/equations.gms index cce1fe6433..c77c5830ac 100644 --- a/modules/58_peatland/v2/equations.gms +++ b/modules/58_peatland/v2/equations.gms @@ -7,12 +7,13 @@ *' @equations -*' Sum over total peatland area (degraded, intact, rewetted) is assumed constant. -*' Intact peatland area can only decrease. +*' Constraint for constant total peatland area: q58_peatland(j2)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. sum(land58, v58_peatland(j2,land58)) =e= sum(land58, pc58_peatland(j2,land58)); +*' Constraints for peatland area expansion and reduction: + q58_expansion(j2,land58) .. v58_expansion(j2,land58) =g= v58_peatland(j2,land58)-pc58_peatland(j2,land58); @@ -26,8 +27,8 @@ *' The following example illustrates the mechanism used for projecting peatland dynamics: *' In a given grid cell, the total land area is 50 Mha and the total peatland area is 10 Mha. *' Therefore, the scaling factor is 0.2 (10 Mha divided by 50 Mha). -*' If cropland expands by 5 Mha, 1 Mha of intact peatland is converted to degraded peatland (5 Mha*0.2). -*' If the total cell would become cropland, degraded peatland would equal to the total peatland area (50 Mha * 0.2 = 10 Mha). +*' If cropland expands by 5 Mha, 1 Mha of intact peatland is converted to degraded peatland (5 Mha x 0.2). +*' If the total cell would become cropland, degraded peatland would equal to the total peatland area (50 Mha x 0.2 = 10 Mha). q58_peatland_crop(j2)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. v58_peatland(j2,"crop") =e= @@ -45,22 +46,26 @@ + ((vm_land_forestry(j2,"plant")-vm_land_forestry.l(j2,"plant"))*p58_scaling_factor(j2)); *' This constraint avoids the conversion of intact peatland into rewetted peatland. -*' Therefore, rewetted peatland area can only increase if degraded peatland area declines. +*' In each cluster, rewetted peatland area can only increase if no intact peatland area is lost. +*' Therefore, rewetted peatland area can only increase if degraded peatland area (`landDrained58`) declines. q58_peatland_rewet(j2) .. v58_expansion(j2,"rewetted") * v58_reduction(j2,"intact") =e= 0; *' Costs for peatland degradation and rewetting + q58_peatland_cost_full(j2) .. + vm_peatland_cost(j2) =e= v58_peatland_cost(j2); + q58_peatland_cost(j2) .. - vm_peatland_cost(j2) =e= v58_peatland_cost_annuity(j2) + v58_peatland_cost(j2) =e= v58_peatland_cost_annuity(j2) + v58_peatland(j2,"rewetted") * sum(ct, i58_cost_rewet_recur(ct)) + sum(landDrainedUsed58, v58_peatland(j2,landDrainedUsed58)) * sum(ct, i58_cost_degrad_recur(ct)); q58_peatland_cost_annuity(j2) .. v58_peatland_cost_annuity(j2) =e= (v58_expansion(j2,"rewetted") * sum(ct, i58_cost_rewet_onetime(ct)) - + sum(landDrainedUsed58, v58_expansion(j2,landDrainedUsed58)) * sum(ct, i58_cost_degrad_onetime(ct))) + + v58_reduction(j2,"intact") * sum(ct, i58_cost_degrad_onetime(ct))) * sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2))); *' Detailed peatland GHG emissions diff --git a/modules/58_peatland/v2/postsolve.gms b/modules/58_peatland/v2/postsolve.gms index 02203cfd6c..3b777317f0 100644 --- a/modules/58_peatland/v2/postsolve.gms +++ b/modules/58_peatland/v2/postsolve.gms @@ -18,6 +18,7 @@ else *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_peatland_cost(t,j,"marginal") = vm_peatland_cost.m(j); + ov58_peatland_cost(t,j,"marginal") = v58_peatland_cost.m(j); ov58_peatland_cost_annuity(t,j,"marginal") = v58_peatland_cost_annuity.m(j); ov58_peatland_emis(t,j,land58,emis58,"marginal") = v58_peatland_emis.m(j,land58,emis58); ov58_expansion(t,j,land58,"marginal") = v58_expansion.m(j,land58); @@ -30,11 +31,13 @@ else oq58_peatland_crop(t,j,"marginal") = q58_peatland_crop.m(j); oq58_peatland_past(t,j,"marginal") = q58_peatland_past.m(j); oq58_peatland_forestry(t,j,"marginal") = q58_peatland_forestry.m(j); + oq58_peatland_cost_full(t,j,"marginal") = q58_peatland_cost_full.m(j); oq58_peatland_cost(t,j,"marginal") = q58_peatland_cost.m(j); oq58_peatland_cost_annuity(t,j,"marginal") = q58_peatland_cost_annuity.m(j); oq58_peatland_emis_detail(t,j,land58,emis58,"marginal") = q58_peatland_emis_detail.m(j,land58,emis58); oq58_peatland_emis(t,i,poll58,"marginal") = q58_peatland_emis.m(i,poll58); ov_peatland_cost(t,j,"level") = vm_peatland_cost.l(j); + ov58_peatland_cost(t,j,"level") = v58_peatland_cost.l(j); ov58_peatland_cost_annuity(t,j,"level") = v58_peatland_cost_annuity.l(j); ov58_peatland_emis(t,j,land58,emis58,"level") = v58_peatland_emis.l(j,land58,emis58); ov58_expansion(t,j,land58,"level") = v58_expansion.l(j,land58); @@ -47,11 +50,13 @@ else oq58_peatland_crop(t,j,"level") = q58_peatland_crop.l(j); oq58_peatland_past(t,j,"level") = q58_peatland_past.l(j); oq58_peatland_forestry(t,j,"level") = q58_peatland_forestry.l(j); + oq58_peatland_cost_full(t,j,"level") = q58_peatland_cost_full.l(j); oq58_peatland_cost(t,j,"level") = q58_peatland_cost.l(j); oq58_peatland_cost_annuity(t,j,"level") = q58_peatland_cost_annuity.l(j); oq58_peatland_emis_detail(t,j,land58,emis58,"level") = q58_peatland_emis_detail.l(j,land58,emis58); oq58_peatland_emis(t,i,poll58,"level") = q58_peatland_emis.l(i,poll58); ov_peatland_cost(t,j,"upper") = vm_peatland_cost.up(j); + ov58_peatland_cost(t,j,"upper") = v58_peatland_cost.up(j); ov58_peatland_cost_annuity(t,j,"upper") = v58_peatland_cost_annuity.up(j); ov58_peatland_emis(t,j,land58,emis58,"upper") = v58_peatland_emis.up(j,land58,emis58); ov58_expansion(t,j,land58,"upper") = v58_expansion.up(j,land58); @@ -64,11 +69,13 @@ else oq58_peatland_crop(t,j,"upper") = q58_peatland_crop.up(j); oq58_peatland_past(t,j,"upper") = q58_peatland_past.up(j); oq58_peatland_forestry(t,j,"upper") = q58_peatland_forestry.up(j); + oq58_peatland_cost_full(t,j,"upper") = q58_peatland_cost_full.up(j); oq58_peatland_cost(t,j,"upper") = q58_peatland_cost.up(j); oq58_peatland_cost_annuity(t,j,"upper") = q58_peatland_cost_annuity.up(j); oq58_peatland_emis_detail(t,j,land58,emis58,"upper") = q58_peatland_emis_detail.up(j,land58,emis58); oq58_peatland_emis(t,i,poll58,"upper") = q58_peatland_emis.up(i,poll58); ov_peatland_cost(t,j,"lower") = vm_peatland_cost.lo(j); + ov58_peatland_cost(t,j,"lower") = v58_peatland_cost.lo(j); ov58_peatland_cost_annuity(t,j,"lower") = v58_peatland_cost_annuity.lo(j); ov58_peatland_emis(t,j,land58,emis58,"lower") = v58_peatland_emis.lo(j,land58,emis58); ov58_expansion(t,j,land58,"lower") = v58_expansion.lo(j,land58); @@ -81,6 +88,7 @@ else oq58_peatland_crop(t,j,"lower") = q58_peatland_crop.lo(j); oq58_peatland_past(t,j,"lower") = q58_peatland_past.lo(j); oq58_peatland_forestry(t,j,"lower") = q58_peatland_forestry.lo(j); + oq58_peatland_cost_full(t,j,"lower") = q58_peatland_cost_full.lo(j); oq58_peatland_cost(t,j,"lower") = q58_peatland_cost.lo(j); oq58_peatland_cost_annuity(t,j,"lower") = q58_peatland_cost_annuity.lo(j); oq58_peatland_emis_detail(t,j,land58,emis58,"lower") = q58_peatland_emis_detail.lo(j,land58,emis58); diff --git a/modules/58_peatland/v2/preloop.gms b/modules/58_peatland/v2/preloop.gms index 3db139e54a..9d604b9a2d 100644 --- a/modules/58_peatland/v2/preloop.gms +++ b/modules/58_peatland/v2/preloop.gms @@ -24,7 +24,6 @@ pc58_peatland(j,"forestry") = min(f58_peatland_area(j,"forestry"),vm_land_forest * The residual is added to an "unused" category, which represents degraded but unused peatland. pc58_peatland(j,"unused") = sum(landDrainedUsed58, f58_peatland_area(j,landDrainedUsed58) - pc58_peatland(j,landDrainedUsed58)); -pc58_peatland(j,"unused")$(pc58_peatland(j,"unused") < 0) = 0; pc58_peatland(j,"peatExtract") = f58_peatland_area(j,"peatExtract"); pc58_peatland(j,"intact") = f58_peatland_area(j,"intact"); diff --git a/modules/58_peatland/v2/realization.gms b/modules/58_peatland/v2/realization.gms index 1bd4edc2b8..1a521c029c 100644 --- a/modules/58_peatland/v2/realization.gms +++ b/modules/58_peatland/v2/realization.gms @@ -7,10 +7,20 @@ *' @description In this realization, the state of peatlands is modelled based on the *' methodology described in @humpenoder_peatland_2020. -*' The initial map for intact, degraded and rewetted peatland in based on the Global Peatland Map 2.0 and Global Peatland Database. -*' Future peatland dynamics depend on the ratio of total peatland area and total land area. -*' GHG emissions from peatlands as are calculated based on GHG emission factors from the -*' "2013 Supplement to the 2006 IPCC Guidelines for National Greenhouse Gas Inventories: Wetlands" and @tiemeyer_peatland_2020. +*' The initial map for intact, degraded and rewetted peatland is based on the +*' [Global Peatland Map 2.0](https://globalpeatlands.org/resource-library/global-peatland-map-20) +*' and the [Global Peatland Database](https://greifswaldmoor.de/global-peatland-database-en.html), both for the year 2020. +*' Therefore, it is advised to set `s58_fix_peatland` to `2020` when using this realisation. +*' Future peatland dynamics are estimated by scaling changes in managed land with the ratio of total peatland area and total land area (peatland scaling factor). +*' GHG emissions from drained and rewetted peatlands as well as from peat extraction are calculated based on GHG emission factors. +*' In this realisation, peatland GHG emission factors for boreal and tropical climates are based on @IPCC_wetland_2013 and @wilson_2016. +*' Peatland GHG emission factors for temperate climates are based on more recent estimates from @tiemeyer_peatland_2020. +*' Assumed rules for changes in peatland area: +*' Sum over total peatland area (degraded, intact, rewetted) is assumed constant. +*' Intact peatland area can only decrease. +*' Degraded peatland area (crop, past, forestry and unused) depends on managed land. +*' Area for peat extraction (peatExtract) is fixed. +*' Rewetted peatland area can only increase if degraded peatland area declines and intact peatland area remains constant. *' @stop From 33e796d72ec85403c34741872a870145f96ea68c Mon Sep 17 00:00:00 2001 From: florianh Date: Thu, 2 Nov 2023 10:10:46 +0100 Subject: [PATCH 52/68] code simplification --- config/default.cfg | 4 ++-- .../32_forestry/dynamic_feb21/declarations.gms | 1 + modules/32_forestry/dynamic_feb21/postsolve.gms | 1 + modules/32_forestry/dynamic_feb21/preloop.gms | 3 +-- modules/58_peatland/off/not_used.txt | 1 + modules/58_peatland/on/not_used.txt | 1 + modules/58_peatland/v2/equations.gms | 2 +- modules/58_peatland/v2/postsolve.gms | 11 +---------- modules/58_peatland/v2/preloop.gms | 13 +------------ modules/58_peatland/v2/presolve.gms | 17 +++++++++++++++-- 10 files changed, 25 insertions(+), 29 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 02ad96131b..ecb455b574 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -1559,9 +1559,9 @@ cfg$gms$s58_cost_degrad_recur <- 0 # def = 0 # * High costs make sure that the balance variables are only used as a last resort. cfg$gms$s58_cost_balance <- 1e+06 # def = 1e+06 -# * Switch for fixing peatland area to 2015/2020 levels from 1995 onwards until the given year +# * Switch for fixing peatland area between 1995 and the year given by s58_fix_peatland # * Note: Depending on the realisation, the initial peatland area is only available for the year 2015 (`on`) or 2020 (`v2`). -# * Fixing the peatland area in previous time steps to 2015/2020 levels provides a better +# * Fixing peatland area in previous time steps provides a better # * proxy for GHG emissions from peatlands than assuming no peatland area. cfg$gms$s58_fix_peatland <- 2015 # def = 2015 diff --git a/modules/32_forestry/dynamic_feb21/declarations.gms b/modules/32_forestry/dynamic_feb21/declarations.gms index e6fc7366d0..02cfec92c9 100644 --- a/modules/32_forestry/dynamic_feb21/declarations.gms +++ b/modules/32_forestry/dynamic_feb21/declarations.gms @@ -59,6 +59,7 @@ parameters 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 (mio. ha) ; positive variables diff --git a/modules/32_forestry/dynamic_feb21/postsolve.gms b/modules/32_forestry/dynamic_feb21/postsolve.gms index ea867f01da..71a9bd11c6 100644 --- a/modules/32_forestry/dynamic_feb21/postsolve.gms +++ b/modules/32_forestry/dynamic_feb21/postsolve.gms @@ -7,6 +7,7 @@ *' @code *' Exchange land information after optimization p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac); +pcm_land_forestry(j,type32) = vm_land_forestry.l(j,type32); *' @stop *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### diff --git a/modules/32_forestry/dynamic_feb21/preloop.gms b/modules/32_forestry/dynamic_feb21/preloop.gms index 672705e0a1..a1754a92d2 100644 --- a/modules/32_forestry/dynamic_feb21/preloop.gms +++ b/modules/32_forestry/dynamic_feb21/preloop.gms @@ -216,9 +216,8 @@ loop(j, ); ); ** Initialization of land -*p32_land_start_ac(j,type32,ac) = p32_land("y1995",j,type32,ac); - vm_land_forestry.l(j,type32) = sum(ac, p32_land_start_ac(j,type32,ac)); +pcm_land_forestry(j,type32) = vm_land_forestry.l(j,type32); *** NPI/NDC policies BEGIN ** Afforestation policies NPI and NDCs diff --git a/modules/58_peatland/off/not_used.txt b/modules/58_peatland/off/not_used.txt index f58d704878..8b45b33bd6 100644 --- a/modules/58_peatland/off/not_used.txt +++ b/modules/58_peatland/off/not_used.txt @@ -4,3 +4,4 @@ pcm_land, input, not used pm_interest, input, not used pm_climate_class, input, not used vm_land_forestry, input, not used +pcm_land_forestry, input, not used diff --git a/modules/58_peatland/on/not_used.txt b/modules/58_peatland/on/not_used.txt index b5befb7b25..a2be78997a 100644 --- a/modules/58_peatland/on/not_used.txt +++ b/modules/58_peatland/on/not_used.txt @@ -1,2 +1,3 @@ name, type, reason vm_land_forestry, input, not used +pcm_land_forestry, input, not used diff --git a/modules/58_peatland/v2/equations.gms b/modules/58_peatland/v2/equations.gms index c77c5830ac..93a71cee3a 100644 --- a/modules/58_peatland/v2/equations.gms +++ b/modules/58_peatland/v2/equations.gms @@ -43,7 +43,7 @@ q58_peatland_forestry(j2)$(sum(ct, m_year(ct)) > s58_fix_peatland) .. v58_peatland(j2,"forestry") =e= pc58_peatland(j2,"forestry") - + ((vm_land_forestry(j2,"plant")-vm_land_forestry.l(j2,"plant"))*p58_scaling_factor(j2)); + + ((vm_land_forestry(j2,"plant")-pcm_land_forestry(j2,"plant"))*p58_scaling_factor(j2)); *' This constraint avoids the conversion of intact peatland into rewetted peatland. *' In each cluster, rewetted peatland area can only increase if no intact peatland area is lost. diff --git a/modules/58_peatland/v2/postsolve.gms b/modules/58_peatland/v2/postsolve.gms index 3b777317f0..a8ac15872b 100644 --- a/modules/58_peatland/v2/postsolve.gms +++ b/modules/58_peatland/v2/postsolve.gms @@ -5,16 +5,7 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -* Update of degraded peatland based on current managed land in the last time steps of fixed peatland area. -if (m_year(t) = s58_fix_peatland, - p58_scaling_factor(j)$(sum(land, vm_land.l(j,land)) > 1e-20) = sum(land58, f58_peatland_area(j,land58)) / sum(land, vm_land.l(j,land)); - pc58_peatland(j,"crop") = min(f58_peatland_area(j,"crop"),vm_land.l(j,"crop") * p58_scaling_factor(j)); - pc58_peatland(j,"past") = min(f58_peatland_area(j,"past"), vm_land.l(j,"past") * p58_scaling_factor(j)); - pc58_peatland(j,"forestry") = min(f58_peatland_area(j,"forestry"), vm_land_forestry.l(j,"plant") * p58_scaling_factor(j)); - pc58_peatland(j,"unused") = sum(landDrainedUsed58, f58_peatland_area(j,landDrainedUsed58) - pc58_peatland(j,landDrainedUsed58)); -else - pc58_peatland(j,land58) = v58_peatland.l(j,land58); -); +pc58_peatland(j,land58) = v58_peatland.l(j,land58); *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### ov_peatland_cost(t,j,"marginal") = vm_peatland_cost.m(j); diff --git a/modules/58_peatland/v2/preloop.gms b/modules/58_peatland/v2/preloop.gms index 9d604b9a2d..2b06e06be0 100644 --- a/modules/58_peatland/v2/preloop.gms +++ b/modules/58_peatland/v2/preloop.gms @@ -14,16 +14,5 @@ p58_mapping_cell_climate(j,clcl58) = sum(clcl_mapping(clcl,clcl58),pm_climate_cl * Peatland scaling factor: ratio of total peatland area and total land area p58_scaling_factor(j)$(sum(land, pcm_land(j,land)) > 1e-20) = sum(land58, f58_peatland_area(j,land58)) / sum(land, pcm_land(j,land)); -* Initialization of peatland +* Initialization of peatland area pc58_peatland(j,land58) = 0; -* Degraded peatland is estimated by multiplication of managed land (cropland, pasture, forestry) with the peatland scaling factor (p58_scaling_factor) -* and simultaneously constrained by observed degraded peatland area (f58_peatland_area). -pc58_peatland(j,"crop") = min(f58_peatland_area(j,"crop"),pcm_land(j,"crop") * p58_scaling_factor(j)); -pc58_peatland(j,"past") = min(f58_peatland_area(j,"past"),pcm_land(j,"past") * p58_scaling_factor(j)); -pc58_peatland(j,"forestry") = min(f58_peatland_area(j,"forestry"),vm_land_forestry.l(j,"plant") * p58_scaling_factor(j)); - -* The residual is added to an "unused" category, which represents degraded but unused peatland. -pc58_peatland(j,"unused") = sum(landDrainedUsed58, f58_peatland_area(j,landDrainedUsed58) - pc58_peatland(j,landDrainedUsed58)); - -pc58_peatland(j,"peatExtract") = f58_peatland_area(j,"peatExtract"); -pc58_peatland(j,"intact") = f58_peatland_area(j,"intact"); diff --git a/modules/58_peatland/v2/presolve.gms b/modules/58_peatland/v2/presolve.gms index 0ac8fb7c4f..bb84a16ec5 100644 --- a/modules/58_peatland/v2/presolve.gms +++ b/modules/58_peatland/v2/presolve.gms @@ -6,15 +6,28 @@ *** | Contact: magpie@pik-potsdam.de - -*define bound for peatland area if (m_year(t) <= s58_fix_peatland, +* For initialization, degraded peatland is estimated by multiplication of managed land (cropland, pasture, forestry) with the peatland scaling factor (p58_scaling_factor) +* and simultaneously constrained by observed degraded peatland area (f58_peatland_area). + p58_scaling_factor(j)$(sum(land, pcm_land(j,land)) > 1e-20) = sum(land58, f58_peatland_area(j,land58)) / sum(land, pcm_land(j,land)); + pc58_peatland(j,"crop") = min(f58_peatland_area(j,"crop"),pcm_land(j,"crop") * p58_scaling_factor(j)); + pc58_peatland(j,"past") = min(f58_peatland_area(j,"past"), pcm_land(j,"past") * p58_scaling_factor(j)); + pc58_peatland(j,"forestry") = min(f58_peatland_area(j,"forestry"), pcm_land_forestry(j,"plant") * p58_scaling_factor(j)); +* The residual is added to an "unused" category, which represents degraded but unused peatland. + pc58_peatland(j,"unused") = sum(landDrainedUsed58, f58_peatland_area(j,landDrainedUsed58) - pc58_peatland(j,landDrainedUsed58)); +* Area used for peat extraction + pc58_peatland(j,"peatExtract") = f58_peatland_area(j,"peatExtract"); +* Intact peatland area + pc58_peatland(j,"intact") = f58_peatland_area(j,"intact"); + +* Peatland area is fixed to `pc58_peatland` until the year given by s58_fix_peatland v58_peatland.fx(j,land58) = pc58_peatland(j,land58); i58_cost_rewet_recur(t) = 0; i58_cost_rewet_onetime(t) = 0; i58_cost_degrad_recur(t) = 0; i58_cost_degrad_onetime(t) = 0; else +* Define bounds and costs for peatland area after the year given by s58_fix_peatland v58_peatland.lo(j,land58) = 0; v58_peatland.l(j,land58) = pc58_peatland(j,land58); v58_peatland.up(j,landDrained58) = Inf; From 8ea4564c69574942ef0c5919a11f5c78d9ad91f3 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Thu, 2 Nov 2023 17:21:11 +0100 Subject: [PATCH 53/68] updated input data revision in scenario_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 0d9e279936..3728e722ad 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -65,9 +65,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.91_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.91_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.91_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.91_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz; -input['regional'];rev4.91_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['validation'];rev4.91_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['cellular'];rev4.93_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.93_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.93_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.93_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.93_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.93_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.93_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz; +input['regional'];rev4.93_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['validation'];rev4.93_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['additional'];additional_data_rev4.46.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['calibration'];calibration_FSEC_24Mar23.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; magicc_emis_scen;bjoernAR6_C_SSP2-NDC.mif;;;bjoernAR6_C_SSP2-PkBudg900.mif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bjoernAR6_C_SSP1-NDC.mif;;;;;;;;;;;;bjoernAR6_C_SSP1-PkBudg900.mif From 9f55ad3b81a12a543d99359927bb60cb712891a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Thu, 9 Nov 2023 11:49:56 +0100 Subject: [PATCH 54/68] remove calibration data --- config/default.cfg | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index db95d70a4f..088b992f81 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -22,11 +22,10 @@ cfg$model <- "main.gms" #def = "main.gms" #### input settings #### # which input data sets should be used? -cfg$input <- c(regional = "rev4.93_h12_magpie.tgz", - cellular = "rev4.93_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.93_h12_validation.tgz", - additional = "additional_data_rev4.46.tgz", - calibration = "calibration_H12_per_ton_fao_may22_glo_08Aug23.tgz") +cfg$input <- c(regional = "rev4.94_h12_magpie.tgz", + cellular = "rev4.94_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.94_h12_validation.tgz", + additional = "additional_data_rev4.46.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 699beae24224867ef0f1ddd8054a4c29a3982bd7 Mon Sep 17 00:00:00 2001 From: Jan Philipp Dietrich Date: Thu, 9 Nov 2023 13:21:12 +0100 Subject: [PATCH 55/68] bugfix in NPI/NDC calculations: Reference stocks were set to 0 for 67k cells in all countries leading to removal of all AD policies --- scripts/npi_ndc/start_npi_ndc.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/npi_ndc/start_npi_ndc.R b/scripts/npi_ndc/start_npi_ndc.R index 237650a8df..38cbabf597 100644 --- a/scripts/npi_ndc/start_npi_ndc.R +++ b/scripts/npi_ndc/start_npi_ndc.R @@ -258,7 +258,11 @@ calc_policy <- function(policy, stock, pol_type="aff", pol_mapping=pol_mapping, #set stock to zero or Inf for countries without policies # (representing no constraint for min and max constraints) if(pol_type=="ad"){ - stock[!(sub("\\..*$","",getCells(stock)) %in% policy_countries),,] <- 0 + if(dim(stock)[1] == 59199) { + stock[!(sub("\\..*$","",getCells(stock)) %in% policy_countries),,] <- 0 + } else { + stock[!(getItems(stock, "iso", full = TRUE) %in% policy_countries),,] <- 0 + } #calculate flows flow <- calc_flows(stock) #account only for positive flows, i.e. deforestation From 16bcab0e631712e1fdc3e1a09b4c3cc0f35a5cf6 Mon Sep 17 00:00:00 2001 From: Jan Philipp Dietrich Date: Thu, 9 Nov 2023 13:25:07 +0100 Subject: [PATCH 56/68] added changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa24e5da3b..c68602a951 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - ### fixed -- +- **scripts** Fixed a bug in NPI/NDC calculations leading to missing AD policies when run with 67k ## [4.6.11] - 2023-09-05 From 3ff1f8d7cfdf5e1ee90c7f5b998fe17061f32b97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Thu, 9 Nov 2023 15:09:22 +0100 Subject: [PATCH 57/68] changelog and scenario_config.csv use rev4.94 --- CHANGELOG.md | 5 +++-- config/scenario_config.csv | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c68602a951..89fcad0c19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,8 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### changed -- **inputdata** There was another bug (terra default na.rm changed) in the inputdata that was fixed with rev4.93 -- **inputdata** There was a major bug (related to proj/terra) in the rev4.91 inputdata that was fixed with rev4.92 +- **inputdata** Now using inputdata rev4.94 which is based on 67420 cells (67k, previously 59k) - **scripts** LUH2_disaggregation output script was modified. Specifically, flooded area was made compatible with the LUH definition, cropland and grazing land were added to the states.nc file, and specific naming/details (datatype, zname, xname, and yname) were added when creating the .nc files. - **scripts** For the emulator scripts select a different bioenergy demand variable that excludes bioenergy sources other than second generation bioenergy crops. Set the minimal bioenergy demand to zero. Both avoid artificial clustering of data points and allow for better fits. - **36_employment** regression between hourly labor regression and GDP pc changed from linear to log-log @@ -24,6 +23,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - ### fixed +- **inputdata** There was another bug (terra default na.rm changed) in the inputdata that was fixed with rev4.93 +- **inputdata** There was a major bug (related to proj/terra) in the rev4.91 inputdata that was fixed with rev4.92 - **scripts** Fixed a bug in NPI/NDC calculations leading to missing AD policies when run with 67k diff --git a/config/scenario_config.csv b/config/scenario_config.csv index e5e9b126e7..1bc205be25 100644 --- a/config/scenario_config.csv +++ b/config/scenario_config.csv @@ -79,7 +79,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.93_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.93_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.93_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.93_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.93_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.93_h12_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz; +input['cellular'];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.94_h12_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.94_h12_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;rev4.94_h12_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.94_h12_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.94_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.94_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;;;;;;;;;;;;;;; From debc2bdc74c6d56deee8801509ebba7598ee2235 Mon Sep 17 00:00:00 2001 From: davidho Date: Thu, 9 Nov 2023 15:31:13 +0100 Subject: [PATCH 58/68] added switch to turn off yield calib --- config/default.cfg | 9 +++++++++ modules/14_yields/managementcalib_aug19/input.gms | 2 ++ modules/14_yields/managementcalib_aug19/preloop.gms | 11 ++++++----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index ecb455b574..ecb5b0f0c1 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -56,6 +56,9 @@ cfg$force_download <- FALSE cfg$force_replace <- FALSE # Settings for the yield calibration +# For this preprocessing yield calibration to function +# the switch s14_use_yield_calib needs to be turned on. (Default is off) +# Switch to turn on/off recalibration of yields. # * (TRUE): Yield calibration will be performed # * (ifneeded): Yield calibration will only be executed if input data is # * downloaded from repository @@ -316,6 +319,12 @@ cfg$gms$s14_calib_ir2rf <- 1 # def = 1 # * 0 (land degradation is switched off) cfg$gms$s14_degradation <- 0 # def = 0 +# Switch to toggle the use of yield calibration factors from the preprocessing in the model run. +# If 0, no yield calibration factors are used, meaning all calibration factors are set to 1. +# If 1, yield calibration factors are used. (For this option to function, either an existing calibration file +# must be supplied in the input directory, or yields must be recalibrated during preprocessing.) +cfg$gms$s14_use_yield_calib <- 0 # def = 0 + # ***--------------------- 15_food --------------------------------------- # * (anthropometrics_jan18): estimates food using scenario dependent regression # * and demography drivers diff --git a/modules/14_yields/managementcalib_aug19/input.gms b/modules/14_yields/managementcalib_aug19/input.gms index 62e1a60cb6..ffab5eb9ee 100644 --- a/modules/14_yields/managementcalib_aug19/input.gms +++ b/modules/14_yields/managementcalib_aug19/input.gms @@ -16,6 +16,8 @@ scalar s14_calib_ir2rf Switch to calibrate rainfed to irrigated yield ratios ( scalar s14_degradation Switch to include yield impacts of land degradation(0=no degradation 1=with degradation) / 0 /; +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 /; + scalars s14_yld_past_switch Spillover parameter for translating technological change in the crop sector into pasture yield increases (1) / 0.25 / s14_yld_reduction_soil_loss Decline of land productivity in areas with severe soil loss (1) / 0.08 / diff --git a/modules/14_yields/managementcalib_aug19/preloop.gms b/modules/14_yields/managementcalib_aug19/preloop.gms index b7649dfa3c..9785cbea2a 100644 --- a/modules/14_yields/managementcalib_aug19/preloop.gms +++ b/modules/14_yields/managementcalib_aug19/preloop.gms @@ -144,13 +144,14 @@ if ((s14_calib_ir2rf = 1), ***YIELD CALIBRATION*********************************************************************** *' @code -*' Calibrated yields are additionally adjusted by calibration factors 'f14_yld_calib' +*' 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 only be reproduced -*' with this additional step of correction: +*' yields are outlier corrected, historical production and croparea can in some cases +*' be better represented with this additional correction: -* set default values in case of missing input file -if(sum((i,ltype14),f14_yld_calib(i,ltype14)) = 0, +* 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; ); From 27d3f4a954914408437bb99ac402c24625b771f1 Mon Sep 17 00:00:00 2001 From: DavidhoPIK <101278418+DavidhoPIK@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:53:15 +0100 Subject: [PATCH 59/68] Update default.cfg --- config/default.cfg | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index ecb5b0f0c1..36076e1363 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -56,8 +56,10 @@ cfg$force_download <- FALSE cfg$force_replace <- FALSE # Settings for the yield calibration -# For this preprocessing yield calibration to function -# the switch s14_use_yield_calib needs to be turned on. (Default is off) +# For this preprocessing yield calibration triggered by the recalibrate switch +# to function the switch s14_use_yield_calib needs to be turned on. (Default is off) +# This switch should only be activated for penalty_apr22 crop realization. +# For other realizations, it is recommended not to use this yield calibration. # Switch to turn on/off recalibration of yields. # * (TRUE): Yield calibration will be performed # * (ifneeded): Yield calibration will only be executed if input data is From ed2cb51c420bb1c11db003dbd660c965e39d747e Mon Sep 17 00:00:00 2001 From: DavidhoPIK <101278418+DavidhoPIK@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:54:03 +0100 Subject: [PATCH 60/68] Update default.cfg --- config/default.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/default.cfg b/config/default.cfg index 36076e1363..1f56b7f20f 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -325,6 +325,8 @@ cfg$gms$s14_degradation <- 0 # def = 0 # If 0, no yield calibration factors are used, meaning all calibration factors are set to 1. # If 1, yield calibration factors are used. (For this option to function, either an existing calibration file # must be supplied in the input directory, or yields must be recalibrated during preprocessing.) +# This switch should only be activated for penalty_apr22 crop realization. +# For other realizations, it is recommended not to use this yield calibration. cfg$gms$s14_use_yield_calib <- 0 # def = 0 # ***--------------------- 15_food --------------------------------------- From 1094ec0d8cdc47874d053b4f36303960448a4f46 Mon Sep 17 00:00:00 2001 From: davidho Date: Thu, 9 Nov 2023 16:12:24 +0100 Subject: [PATCH 61/68] changed comments and fsec scenario --- CHANGELOG.md | 1 + config/scenario_fsec.csv | 1 + scripts/start/extra/recalibrate_FSEC.R | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c68602a951..e3b753dd5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### changed +- **14_yields_and_config** The new default is to not use yield calibration factors from the preprocessing. The switch s14_use_yield_calib can optionally reenable the use of yield calibration factors. - **inputdata** There was another bug (terra default na.rm changed) in the inputdata that was fixed with rev4.93 - **inputdata** There was a major bug (related to proj/terra) in the rev4.91 inputdata that was fixed with rev4.92 - **scripts** LUH2_disaggregation output script was modified. Specifically, flooded area was made compatible with the LUH definition, cropland and grazing land were added to the states.nc file, and specific naming/details (datatype, zname, xname, and yname) were added when creating the .nc files. diff --git a/config/scenario_fsec.csv b/config/scenario_fsec.csv index 3728e722ad..4768afbbce 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -5,6 +5,7 @@ gms$c09_pal_scenario;;;;SSP1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s12_interest_lic;;;0.06;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s12_interest_hic;;;0.04;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$food;anthro_iso_jun22;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +gms$s14_use_yield_calib;1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; gms$s15_exo_waste;;;;;;;;0;0;0;0;0;0;0;0;1;;;;;;;;;;;;;;;;;0;1;;;;;;;;;;;;;;; gms$s15_exo_diet;;;;;;;;1;1;1;1;1;1;1;1;0;;;;;;;;;;;;;;;;;1;1;;;;;;;;;;;;;;; gms$c15_kcal_scen;;;;;;;;no_underweight;half_overweight;endo;endo;endo;endo;endo;endo;endo;;;;;;;;;;;;;;;;;no_underweight_half_overweight;no_underweight_half_overweight;;;;;;;;;;;;;;; diff --git a/scripts/start/extra/recalibrate_FSEC.R b/scripts/start/extra/recalibrate_FSEC.R index 5833ccaf5b..22c894b2d1 100644 --- a/scripts/start/extra/recalibrate_FSEC.R +++ b/scripts/start/extra/recalibrate_FSEC.R @@ -22,7 +22,7 @@ source("scripts/projects/fsec.R") cfg <- fsecScenario(scenario = "c_BAU") cfg$title <- "FSEC24Mar23" cfg$results_folder <- "output/:title:" -cfg$recalibrate <- TRUE +cfg$recalibrate <- TRUE # required when penality_apr22 activated cfg$best_calib <- TRUE cfg$recalibrate_landconversion_cost <- TRUE cfg$best_calib_landconversion_cost <- FALSE From 5b8d758deffc9366611bbc554395199caca3412c Mon Sep 17 00:00:00 2001 From: davidho Date: Thu, 9 Nov 2023 16:16:31 +0100 Subject: [PATCH 62/68] changed default of yield recalibration --- config/default.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/default.cfg b/config/default.cfg index 1f56b7f20f..6a9fea54c8 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -65,7 +65,7 @@ cfg$force_replace <- FALSE # * (ifneeded): Yield calibration will only be executed if input data is # * downloaded from repository # * (FALSE): Yield calibration will not be performed -cfg$recalibrate <- "ifneeded" # def = "ifneeded" +cfg$recalibrate <- FALSE # def = FALSE # Up to which accuracy shall be recalibrated? cfg$calib_accuracy <- 0.05 # def = 0.05 # What is the maximum number of iterations if the precision goal is not reached? From 025f7941c0a3e6424fb46ea03375e26d7ce665a9 Mon Sep 17 00:00:00 2001 From: DavidhoPIK <101278418+DavidhoPIK@users.noreply.github.com> Date: Thu, 9 Nov 2023 16:46:11 +0100 Subject: [PATCH 63/68] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3b753dd5d..35f2a5a968 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### changed -- **14_yields_and_config** The new default is to not use yield calibration factors from the preprocessing. The switch s14_use_yield_calib can optionally reenable the use of yield calibration factors. +- **14_yields_and_config** The new default is to not use yield calibration factors from a calibration run. The switch s14_use_yield_calib can optionally reenable the use of yield calibration factors. - **inputdata** There was another bug (terra default na.rm changed) in the inputdata that was fixed with rev4.93 - **inputdata** There was a major bug (related to proj/terra) in the rev4.91 inputdata that was fixed with rev4.92 - **scripts** LUH2_disaggregation output script was modified. Specifically, flooded area was made compatible with the LUH definition, cropland and grazing land were added to the states.nc file, and specific naming/details (datatype, zname, xname, and yname) were added when creating the .nc files. From 955af0c052fd4458a49650ea5a3a02a1e1b3cb84 Mon Sep 17 00:00:00 2001 From: DavidhoPIK <101278418+DavidhoPIK@users.noreply.github.com> Date: Thu, 9 Nov 2023 16:51:27 +0100 Subject: [PATCH 64/68] Update default.cfg --- config/default.cfg | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 6a9fea54c8..63038e34b4 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -56,8 +56,9 @@ cfg$force_download <- FALSE cfg$force_replace <- FALSE # Settings for the yield calibration -# For this preprocessing yield calibration triggered by the recalibrate switch -# to function the switch s14_use_yield_calib needs to be turned on. (Default is off) +# For this yield calibration (that uses results from a special MAgPIE calibration run +# triggered by the recalibrate switch) to function the switch s14_use_yield_calib needs +# to be turned on. (Default is off) # This switch should only be activated for penalty_apr22 crop realization. # For other realizations, it is recommended not to use this yield calibration. # Switch to turn on/off recalibration of yields. @@ -321,7 +322,7 @@ cfg$gms$s14_calib_ir2rf <- 1 # def = 1 # * 0 (land degradation is switched off) cfg$gms$s14_degradation <- 0 # def = 0 -# Switch to toggle the use of yield calibration factors from the preprocessing in the model run. +# Switch to toggle the use of yield calibration factors (that resulted from a calibration run). # If 0, no yield calibration factors are used, meaning all calibration factors are set to 1. # If 1, yield calibration factors are used. (For this option to function, either an existing calibration file # must be supplied in the input directory, or yields must be recalibrated during preprocessing.) From 1db56be5b363c8860d072497b575cb73a560ec0e Mon Sep 17 00:00:00 2001 From: Felicitas Beier <39262100+FelicitasBeier@users.noreply.github.com> Date: Fri, 10 Nov 2023 10:10:19 +0100 Subject: [PATCH 65/68] Update default.cfg --- config/default.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/default.cfg b/config/default.cfg index 63038e34b4..f0cc0aa48a 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -57,10 +57,11 @@ cfg$force_replace <- FALSE # Settings for the yield calibration # For this yield calibration (that uses results from a special MAgPIE calibration run -# triggered by the recalibrate switch) to function the switch s14_use_yield_calib needs +# triggered by the recalibrate switch) to be activated the switch s14_use_yield_calib needs # to be turned on. (Default is off) # This switch should only be activated for penalty_apr22 crop realization. # For other realizations, it is recommended not to use this yield calibration. +# # Switch to turn on/off recalibration of yields. # * (TRUE): Yield calibration will be performed # * (ifneeded): Yield calibration will only be executed if input data is From 359a6ba0f3a2de919787197a4bf15e501a48a813 Mon Sep 17 00:00:00 2001 From: Debbora Leip Date: Fri, 10 Nov 2023 10:20:35 +0100 Subject: [PATCH 66/68] Update preprocessing revision in scenario_fsec.csv --- 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 3728e722ad..db841f8d2f 100644 --- a/config/scenario_fsec.csv +++ b/config/scenario_fsec.csv @@ -65,9 +65,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.93_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.93_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.93_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.93_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.93_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.93_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.93_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz; -input['regional'];rev4.93_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -input['validation'];rev4.93_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['cellular'];rev4.94_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;rev4.94_FSEC_0bd54110_cellularmagpie_c200_MRI-ESM2-0-ssp119_lpjml-8e6c5eb1.tgz;rev4.94_FSEC_6819938d_cellularmagpie_c200_MRI-ESM2-0-ssp126_lpjml-8e6c5eb1.tgz;;rev4.94_FSEC_1b5c3817_cellularmagpie_c200_MRI-ESM2-0-ssp245_lpjml-8e6c5eb1.tgz;rev4.94_FSEC_3c888fa5_cellularmagpie_c200_MRI-ESM2-0-ssp460_lpjml-8e6c5eb1.tgz;rev4.94_FSEC_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz;rev4.94_FSEC_09a63995_cellularmagpie_c200_MRI-ESM2-0-ssp585_lpjml-8e6c5eb1.tgz; +input['regional'];rev4.94_FSEC_magpie.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +input['validation'];rev4.94_FSEC_validation.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['additional'];additional_data_rev4.46.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; input['calibration'];calibration_FSEC_24Mar23.tgz;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; magicc_emis_scen;bjoernAR6_C_SSP2-NDC.mif;;;bjoernAR6_C_SSP2-PkBudg900.mif;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;bjoernAR6_C_SSP1-NDC.mif;;;;;;;;;;;;bjoernAR6_C_SSP1-PkBudg900.mif From 8b5e771b55776095d55a34ee995db94aba2298b8 Mon Sep 17 00:00:00 2001 From: Felicitas Beier <39262100+FelicitasBeier@users.noreply.github.com> Date: Fri, 10 Nov 2023 14:07:43 +0100 Subject: [PATCH 67/68] Re-introduced calibration.tgz in default.cfg --- config/default.cfg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/default.cfg b/config/default.cfg index c6b62defb9..e9332310dc 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -25,7 +25,8 @@ cfg$model <- "main.gms" #def = "main.gms" cfg$input <- c(regional = "rev4.94_h12_magpie.tgz", cellular = "rev4.94_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", validation = "rev4.94_h12_validation.tgz", - additional = "additional_data_rev4.46.tgz") + additional = "additional_data_rev4.46.tgz", + calibration = "calibration_H12_per_ton_fao_may22_glo_08Aug23.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 5ab3dcdc4a270412a7a5d509bacfbb1fca54c301 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pascal=20F=C3=BChrlich?= Date: Mon, 11 Dec 2023 14:29:12 +0100 Subject: [PATCH 68/68] magpie release 4.7.0 --- .zenodo.json | 4 ++-- CHANGELOG.md | 20 +++++++++----------- CITATION.cff | 4 ++-- README.md | 6 +++--- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/.zenodo.json b/.zenodo.json index 20f0640376..af7b7c0d33 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -1,6 +1,6 @@ { "title": "MAgPIE - An Open Source land-use modeling framework", - "version": "4.6.11dev", + "version": "4.7.0", "creators": [ { "name": "Dietrich, Jan Philipp", @@ -109,5 +109,5 @@ "license": { "id": "AGPL-3.0-or-later" }, - "publication_date": "2023-09-05" + "publication_date": "2023-12-11" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 97228b5c6d..775263e8a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,27 +5,24 @@ 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.7.0] - 2023-12-11 ### changed -- **inputdata** Now using inputdata rev4.94 which is based on 67420 cells (67k, previously 59k) - **14_yields_and_config** The new default is to not use yield calibration factors from a calibration run. The switch s14_use_yield_calib can optionally reenable the use of yield calibration factors. -- **scripts** LUH2_disaggregation output script was modified. Specifically, flooded area was made compatible with the LUH definition, cropland and grazing land were added to the states.nc file, and specific naming/details (datatype, zname, xname, and yname) were added when creating the .nc files. -- **scripts** For the emulator scripts select a different bioenergy demand variable that excludes bioenergy sources other than second generation bioenergy crops. Set the minimal bioenergy demand to zero. Both avoid artificial clustering of data points and allow for better fits. - **36_employment** regression between hourly labor regression and GDP pc changed from linear to log-log +- **inputdata** Now using inputdata rev4.94 which is based on 67420 cells (67k, previously 59k) +- **scripts** For the emulator scripts select a different bioenergy demand variable that excludes bioenergy sources other than second generation bioenergy crops. Set the minimal bioenergy demand to zero. Both avoid artificial clustering of data points and allow for better fits. +- **scripts** LUH2_disaggregation output script was modified. Specifically, flooded area was made compatible with the LUH definition, cropland and grazing land were added to the states.nc file, and specific naming/details (datatype, zname, xname, and yname) were added when creating the .nc files. ### added -- **18_residues** Included cluster-level residue realization, for cluster-level production of residues (but balancing of recycling and burning budgets remains at region-level, for computational lightness) - **14_yields/config** Added option for considering impacts of land degradation on yields. If `s14_degradation` is switched to 1, MAgPIE will include cluster-specific information on the state of nature's contributions to people relevant for yields `./modules/14_yields/input/f14_yld_ncp_report.cs3`. -- **58_peatland** added realization "v2" with updated peatland map and GHG emission factors +- **18_residues** Included cluster-level residue realization, for cluster-level production of residues (but balancing of recycling and burning budgets remains at region-level, for computational lightness) - **32_forestry** new interface `vm_land_forestry` - -### removed -- +- **58_peatland** added realization "v2" with updated peatland map and GHG emission factors ### fixed -- **inputdata** There was another bug (terra default na.rm changed) in the inputdata that was fixed with rev4.93 - **inputdata** There was a major bug (related to proj/terra) in the rev4.91 inputdata that was fixed with rev4.92 +- **inputdata** There was another bug (terra default na.rm changed) in the inputdata that was fixed with rev4.93 - **scripts** Fixed a bug in NPI/NDC calculations leading to missing AD policies when run with 67k @@ -784,7 +781,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.6.11...develop +[Unreleased]: https://github.com/magpiemodel/magpie/compare/v4.7.0...develop +[4.7.0]: https://github.com/magpiemodel/magpie/compare/v4.6.11...v4.7.0 [4.6.11]: https://github.com/magpiemodel/magpie/compare/v4.6.10...v4.6.11 [4.6.10]: https://github.com/magpiemodel/magpie/compare/v4.6.9...v4.6.10 [4.6.9]: https://github.com/magpiemodel/magpie/compare/v4.6.8...v4.6.9 diff --git a/CITATION.cff b/CITATION.cff index bde8fd0ac5..80b1e60eeb 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -125,8 +125,8 @@ authors: email: popp@pik-potsdam.de title: MAgPIE - An Open Source land-use modeling framework -version: 4.6.11dev -date-released: 2023-09-05 +version: 4.7.0 +date-released: 2023-12-11 repository-code: https://github.com/magpiemodel/magpie keywords: - landuse diff --git a/README.md b/README.md index f94e7d1c09..7ae86d6331 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.6.11 can be found at -https://rse.pik-potsdam.de/doc/magpie/4.6.11/ +The model documentation for version 4.7.0 can be found at +https://rse.pik-potsdam.de/doc/magpie/4.7.0/ A most recent version of the documentation can also be extracted from the model source code via the R package goxygen @@ -188,7 +188,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.6.11/#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.7.0/#how-to-cite) in the model documentation for information how to cite the model. ## AUTHORS See list of authors in CITATION.cff