diff --git a/CHANGELOG.md b/CHANGELOG.md index 4987a42076..b43b267f19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +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, 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 92c1f0f7ba..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) ########################### @@ -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/flexcluster_jul23/declarations.gms b/modules/18_residues/flexcluster_jul23/declarations.gms new file mode 100644 index 0000000000..3add0dc21d --- /dev/null +++ b/modules/18_residues/flexcluster_jul23/declarations.gms @@ -0,0 +1,76 @@ +*** | (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) Cluster-level production of residues (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) + + 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) 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) + vm_cost_prod_kres(i,kres) Production costs of harvesting crop residues (mio. USD05MER per yr) +; + +equations + + 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_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_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) + + 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) 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) ##################### + +*** EOF declarations.gms *** diff --git a/modules/18_residues/flexcluster_jul23/equations.gms b/modules/18_residues/flexcluster_jul23/equations.gms new file mode 100644 index 0000000000..68e0a0d6c8 --- /dev/null +++ b/modules/18_residues/flexcluster_jul23/equations.gms @@ -0,0 +1,150 @@ +*** | (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_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)); + + q18_prod_res_ag_reg(i2,kcr,attributes) .. + vm_res_biomass_ag(i2,kcr,attributes) + =e= + 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_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) + * 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)) + =e= + 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 +*' 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= + 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 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); + +*' 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 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 +*' 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/flexcluster_jul23/input.gms b/modules/18_residues/flexcluster_jul23/input.gms new file mode 100644 index 0000000000..cc9039bfa6 --- /dev/null +++ b/modules/18_residues/flexcluster_jul23/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/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_jul23/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/flexcluster_jul23/input/f18_fac_req_kres.csv" +$offdelim +/; + +*** EOF input.gms *** diff --git a/modules/18_residues/flexcluster_jul23/input/files b/modules/18_residues/flexcluster_jul23/input/files new file mode 100644 index 0000000000..45135c7cef --- /dev/null +++ b/modules/18_residues/flexcluster_jul23/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/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_jul23/preloop.gms b/modules/18_residues/flexcluster_jul23/preloop.gms new file mode 100644 index 0000000000..dd1bb671f2 --- /dev/null +++ b/modules/18_residues/flexcluster_jul23/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/flexcluster_jul23/presolve.gms b/modules/18_residues/flexcluster_jul23/presolve.gms new file mode 100644 index 0000000000..df3fd6721f --- /dev/null +++ b/modules/18_residues/flexcluster_jul23/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/flexcluster_jul23/realization.gms b/modules/18_residues/flexcluster_jul23/realization.gms new file mode 100644 index 0000000000..a1c737e440 --- /dev/null +++ b/modules/18_residues/flexcluster_jul23/realization.gms @@ -0,0 +1,42 @@ +*** | (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. +*' +*' 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/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_jul23/scaling.gms b/modules/18_residues/flexcluster_jul23/scaling.gms new file mode 100644 index 0000000000..2e8ecb4d44 --- /dev/null +++ b/modules/18_residues/flexcluster_jul23/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/flexcluster_jul23/sets.gms b/modules/18_residues/flexcluster_jul23/sets.gms new file mode 100644 index 0000000000..37140313ef --- /dev/null +++ b/modules/18_residues/flexcluster_jul23/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 development 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..f5ecba6dc3 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,6 +25,7 @@ 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_pk(i,pk18) Nutrient recycling of phosphorus and potash (mio. tX) @@ -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,6 +52,7 @@ 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_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 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/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..07cb618a78 --- /dev/null +++ b/modules/18_residues/flexreg_apr16/not_used.txt @@ -0,0 +1,2 @@ +name,type,reason +vm_prod,input,not needed \ 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..da6f79ebef 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%" == "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) ############################ 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