diff --git a/config/default.cfg b/config/default.cfg index f2be8a9e02..1215b59e0a 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -574,7 +574,7 @@ cfg$gms$c17_prod_init <- "on" # default = on # ***--------------------- 18_residues ----------------------------------- # * (flexreg_apr16): detailed residue calculations # * (off): off -cfg$gms$residues <- "flexreg_apr16" # def = flexreg_apr16 +cfg$gms$residues <- "disaggRes_apr25" # def = flexreg_apr16 # * residue on field burning # * options: phaseout - phaseout of residue burning to minimum burn share (0-10%) @@ -1827,6 +1827,7 @@ cfg$gms$s58_fix_peatland <- 2020 # def = 2020 # * (static_jan19): static soil carbon loss for cropland # * (cellpool_jan23): dynamic soil organic matter pool on cellular level # * with updated, regionalized stock change factors (IPCC guidelines 2019) +# cfg$gms$som <- "threepool_may23" cfg$gms$som <- "cellpool_jan23" # def = cellpool_jan23 # * static realization switch @@ -2177,7 +2178,12 @@ cfg$gms$c80_nlp_solver <- "conopt4" # def = conopt4 # * 1: using optfile for specified solver settings # * 0: default settings (optfile will be ignored) -cfg$gms$s80_optfile <- 0 # def = 0 +cfg$gms$s80_optfile <- 1 # def = 1 + +# Solver setting Tol_Optimality (real): +# Optimality tolerance for reduced gradient when feasible. +# Range: [3.e-13, 1], Solver default: 1.e-7 +cfg$gms$s80_toloptimal <- 1.0e-8 # def = 1.0e-8 # * Optional second solve statement (0=off, 1=on) cfg$gms$s80_secondsolve <- 0 # def = 0 diff --git a/core/calculations.gms b/core/calculations.gms index 9063d06f87..bf7e4bf3ef 100644 --- a/core/calculations.gms +++ b/core/calculations.gms @@ -21,6 +21,7 @@ $batinclude "./modules/include.gms" preloop * to be done here because a file declaration cannot be inside a loop file dummy; dummy.pw=2000; put dummy; +File optfile /conopt4.opt/; ************************OPTIMIZATION PROCESS START****************************** * This section contains only sourcecode that is directly connected to the diff --git a/modules/18_residues/disaggRes_apr25/.equations.gms.swp b/modules/18_residues/disaggRes_apr25/.equations.gms.swp new file mode 100644 index 0000000000..194e85b3e3 Binary files /dev/null and b/modules/18_residues/disaggRes_apr25/.equations.gms.swp differ diff --git a/modules/18_residues/disaggRes_apr25/declarations.gms b/modules/18_residues/disaggRes_apr25/declarations.gms new file mode 100644 index 0000000000..c1a7d51b00 --- /dev/null +++ b/modules/18_residues/disaggRes_apr25/declarations.gms @@ -0,0 +1,75 @@ +*** | (C) 2008-2025 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) + vm_res_biomass_ag(i,kcr,w,dm_cnr) Production of aboveground residues in each region (mio. tDM) + vm_res_biomass_bg(i,kcr,w,dm_cnr) Production of belowground residues in each region (mio. tDM) + vm_res_ag_burn(i,kcr,w,dm_cnr) Residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) + vm_res_recycling(i,kcr,w,dm_cnr) 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. USD17MER per yr) + v18_res_ag_removal_clust(j,kcr,w,dm_cnr) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) + v18_res_ag_recycling_clust(j,kcr,w,dm_cnr) Recylcing of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) +; + +variables + v18_res_biomass_ag_clust(j,kcr,w,dm_cnr) Production of aboveground residues in each cluster (mio. tDM) + v18_res_biomass_bg_clust(j,kcr,w,dm_cnr) Production of belowground residues in each cluster (mio. tDM) + v18_res_ag_burn_clust(j,kcr,w,dm_cnr) Residues burned on fields in respective attribute units DM GJ Nr P K WM C in each cluster (mio. tX) + v18_res_recycling_clust(j,kcr,w,dm_cnr) Residues recycled to croplands in respective nutrients Nr P K units in each cluster (mio. tX) +; + +equations + q18_prod_res_ag_clust(j,kcr,w,dm_cnr) Production constraint of aboveground residues (mio. tDM) + q18_sumreg_res_biomass_ag(i,kcr,w,dm_cnr) Regional above-ground residue biomass (mio. tX per yr) + q18_prod_res_bg_clust(j,kcr,w,dm_cnr) Production constraint of belowground residues (mio. tDM) + q18_sumreg_res_biomass_bg(i,kcr,w,dm_cnr) Regional below-ground residue biomass (mio. tX per yr) + q18_res_field_balance_clust(j,kcr,w,dm_cnr) Calculation of the residues amount recycled to soils (mio. tDM) + q18_res_field_burn_clust(j,kcr,w,dm_cnr) Fixing of the residues amount burned in a cluster in respective attribute units DM GJ Nr P K WM C (mio. tX) + q18_sumreg_res_biomass_burn(i,kcr,w,dm_cnr) Regional burned residue biomass (mio. tX per yr) + q18_translate(j,kres,dm_cnr) 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(i,kres) Allows for distribution of residues to cellular level (mio. tDM) + q18_res_recycling_cnr_clust(j,kcr,w,cnr) Nutrient recycling of carbon and reaactive nitrogen (mio. tX) + q18_sumreg_res_recycling(i,kcr,w,cnr) Regional recycled residue biomass (mio. tX per yr) + q18_cost_prod_res(i,kres) Production costs of harvesting crop residues (mio. USD17MER) +; + +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) + ov_res_biomass_ag(t,i,kcr,w,dm_cnr,type) Production of aboveground residues in each region (mio. tDM) + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,type) Production of belowground residues in each region (mio. tDM) + ov_res_ag_burn(t,i,kcr,w,dm_cnr,type) Residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov_res_recycling(t,i,kcr,w,dm_cnr,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. USD17MER per yr) + ov18_res_ag_removal_clust(t,j,kcr,w,dm_cnr,type) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov18_res_ag_recycling_clust(t,j,kcr,w,dm_cnr,type) Recylcing of crop residues to soils in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov18_res_biomass_ag_clust(t,j,kcr,w,dm_cnr,type) Production of aboveground residues in each cluster (mio. tDM) + ov18_res_biomass_bg_clust(t,j,kcr,w,dm_cnr,type) Production of belowground residues in each cluster (mio. tDM) + ov18_res_ag_burn_clust(t,j,kcr,w,dm_cnr,type) Residues burned on fields in respective attribute units DM GJ Nr P K WM C in each cluster (mio. tX) + ov18_res_recycling_clust(t,j,kcr,w,dm_cnr,type) Residues recycled to croplands in respective nutrients Nr P K units in each cluster (mio. tX) + oq18_prod_res_ag_clust(t,j,kcr,w,dm_cnr,type) Production constraint of aboveground residues (mio. tDM) + oq18_sumreg_res_biomass_ag(t,i,kcr,w,dm_cnr,type) Regional above-ground residue biomass (mio. tX per yr) + oq18_prod_res_bg_clust(t,j,kcr,w,dm_cnr,type) Production constraint of belowground residues (mio. tDM) + oq18_sumreg_res_biomass_bg(t,i,kcr,w,dm_cnr,type) Regional below-ground residue biomass (mio. tX per yr) + oq18_res_field_balance_clust(t,j,kcr,w,dm_cnr,type) Calculation of the residues amount recycled to soils (mio. tDM) + oq18_res_field_burn_clust(t,j,kcr,w,dm_cnr,type) Fixing of the residues amount burned in a cluster in respective attribute units DM GJ Nr P K WM C (mio. tX) + oq18_sumreg_res_biomass_burn(t,i,kcr,w,dm_cnr,type) Regional burned residue biomass (mio. tX per yr) + oq18_translate(t,j,kres,dm_cnr,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,i,kres,type) Allows for distribution of residues to cellular level (mio. tDM) + oq18_res_recycling_cnr_clust(t,j,kcr,w,cnr,type) Nutrient recycling of carbon and reaactive nitrogen (mio. tX) + oq18_sumreg_res_recycling(t,i,kcr,w,cnr,type) Regional recycled residue biomass (mio. tX per yr) + oq18_cost_prod_res(t,i,kres,type) Production costs of harvesting crop residues (mio. USD17MER) +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### + +*** EOF declarations.gms *** diff --git a/modules/18_residues/disaggRes_apr25/equations.gms b/modules/18_residues/disaggRes_apr25/equations.gms new file mode 100644 index 0000000000..374c4f3700 --- /dev/null +++ b/modules/18_residues/disaggRes_apr25/equations.gms @@ -0,0 +1,126 @@ +*** | (C) 2008-2025 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_sumreg_res_biomass_ag(i2,kcr,w,dm_cnr) .. + vm_res_biomass_ag(i2,kcr,w,dm_cnr) =e= + sum(cell(i2,j2), v18_res_biomass_ag_clust(j2,kcr,w,dm_cnr)); + + + q18_prod_res_ag_clust(j2,kcr,w,dm_cnr) .. + v18_res_biomass_ag_clust(j2,kcr,w,dm_cnr) + =e= + (vm_area(j2,kcr,w) * sum((ct, cell(i2,j2)), f18_multicropping(ct,i2)) * f18_cgf("intercept",kcr) + + vm_prod_kcr_w(j2,kcr,w) * f18_cgf("slope",kcr)) + * f18_attributes_residue_ag(dm_cnr,kcr); + +*' The BG crop residue biomass `vm_res_biomass_bg` is calculated as a function of +*' total aboveground biomass. + + + q18_prod_res_bg_clust(j2,kcr,w,dm_cnr) .. + v18_res_biomass_bg_clust(j2,kcr,w,dm_cnr) + =e= + (vm_prod_kcr_w(j2,kcr,w) + + v18_res_biomass_ag_clust(j2,kcr,w,"dm")) * f18_cgf("bg_to_ag",kcr) + * f18_attributes_residue_bg(dm_cnr,kcr); + + q18_sumreg_res_biomass_bg(i2,kcr,w,dm_cnr) .. + vm_res_biomass_bg(i2,kcr,w,dm_cnr) =e= + sum(cell(i2,j2), v18_res_biomass_bg_clust(j2,kcr,w,dm_cnr)); + +*' In contrast to AG biomass, AG production `vm_res_biomass_ag(i,kcr,dm_cnr)` +*' 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,dm_cnr)` is properly assigned to different uses: +*' removal, on-field burning and recycling of AG residues. + + q18_res_field_balance_clust(j2,kcr,w,dm_cnr) .. + v18_res_biomass_ag_clust(j2,kcr,w,dm_cnr) + =e= + v18_res_ag_removal_clust(j2,kcr,w,dm_cnr) + + v18_res_ag_burn_clust(j2,kcr,w,dm_cnr) + + v18_res_ag_recycling_clust(j2,kcr,w,dm_cnr); + +*' 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_clust(j2,kcr,w,dm_cnr) .. + v18_res_ag_burn_clust(j2,kcr,w,dm_cnr) + =e= + sum((cell(i2,j2),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)) + * v18_res_biomass_ag_clust(j2,kcr,w,dm_cnr); + + q18_sumreg_res_biomass_burn(i2,kcr,w,dm_cnr) .. + vm_res_ag_burn(i2,kcr,w,dm_cnr) =e= + sum(cell(i2,j2), v18_res_ag_burn_clust(j2,kcr,w,dm_cnr)); + +*' 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,dm_cnr).. + sum((kres_kcr(kres,kcr),w), v18_res_ag_removal_clust(j2,kcr,w,dm_cnr)) + =e= + v18_prod_res(j2,kres) * fm_attributes(dm_cnr,kres); + +*' sum to the regional amount of residues produced for the regional interface + + q18_prod_res_cell(i2,kres).. + sum(cell(i2,j2), v18_prod_res(j2,kres)) + =e= + vm_prod_reg(i2,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 +*' BG residues. They are calculated to be transmitted to the nitrogen budget +*' module [50_nr_soil_budget]. + + q18_res_recycling_cnr_clust(j2,kcr,w,cnr) .. + v18_res_recycling_clust(j2,kcr,w,cnr) + =e= + v18_res_ag_recycling_clust(j2,kcr,w,cnr) + + v18_res_ag_burn_clust(j2,kcr,w,cnr)*(1-f18_res_combust_eff(kcr)) + + v18_res_biomass_bg_clust(j2,kcr,w,cnr) + ; + + q18_sumreg_res_recycling(i2,kcr,w,cnr) .. + vm_res_recycling(i2,kcr,w,cnr) =e= + sum(cell(i2,j2), v18_res_recycling_clust(j2,kcr,w,cnr)); + +*' Costs of residue harvest are based on straw baling and hauling from +*' Budynski, Stephanie. 2020. Straw Manufacturing in Alberta (@budynski_straw_2020), +*' using the lower range of the US costs. + + 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/disaggRes_apr25/input.gms similarity index 81% rename from modules/18_residues/flexcluster_jul23/input.gms rename to modules/18_residues/disaggRes_apr25/input.gms index 0e2ed9f46e..b098d0fc8c 100644 --- a/modules/18_residues/flexcluster_jul23/input.gms +++ b/modules/18_residues/disaggRes_apr25/input.gms @@ -19,19 +19,19 @@ $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) +table f18_attributes_residue_bg(dm_cnr,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" +$include "./modules/18_residues/disaggRes_apr25/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" +$include "./modules/18_residues/disaggRes_apr25/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 (USD17MER per tDM) / $ondelim -$include "./modules/18_residues/flexcluster_jul23/input/f18_fac_req_kres.csv" +$include "./modules/18_residues/disaggRes_apr25/input/f18_fac_req_kres.csv" $offdelim /; diff --git a/modules/18_residues/flexcluster_jul23/input/files b/modules/18_residues/disaggRes_apr25/input/files similarity index 100% rename from modules/18_residues/flexcluster_jul23/input/files rename to modules/18_residues/disaggRes_apr25/input/files diff --git a/modules/18_residues/disaggRes_apr25/postsolve.gms b/modules/18_residues/disaggRes_apr25/postsolve.gms new file mode 100644 index 0000000000..cac2de2964 --- /dev/null +++ b/modules/18_residues/disaggRes_apr25/postsolve.gms @@ -0,0 +1,110 @@ +*** | (C) 2008-2025 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); + ov_res_biomass_ag(t,i,kcr,w,dm_cnr,"marginal") = vm_res_biomass_ag.m(i,kcr,w,dm_cnr); + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,"marginal") = vm_res_biomass_bg.m(i,kcr,w,dm_cnr); + ov_res_ag_burn(t,i,kcr,w,dm_cnr,"marginal") = vm_res_ag_burn.m(i,kcr,w,dm_cnr); + ov_res_recycling(t,i,kcr,w,dm_cnr,"marginal") = vm_res_recycling.m(i,kcr,w,dm_cnr); + ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,kres); + ov18_res_ag_removal_clust(t,j,kcr,w,dm_cnr,"marginal") = v18_res_ag_removal_clust.m(j,kcr,w,dm_cnr); + ov18_res_ag_recycling_clust(t,j,kcr,w,dm_cnr,"marginal") = v18_res_ag_recycling_clust.m(j,kcr,w,dm_cnr); + ov18_res_biomass_ag_clust(t,j,kcr,w,dm_cnr,"marginal") = v18_res_biomass_ag_clust.m(j,kcr,w,dm_cnr); + ov18_res_biomass_bg_clust(t,j,kcr,w,dm_cnr,"marginal") = v18_res_biomass_bg_clust.m(j,kcr,w,dm_cnr); + ov18_res_ag_burn_clust(t,j,kcr,w,dm_cnr,"marginal") = v18_res_ag_burn_clust.m(j,kcr,w,dm_cnr); + ov18_res_recycling_clust(t,j,kcr,w,dm_cnr,"marginal") = v18_res_recycling_clust.m(j,kcr,w,dm_cnr); + oq18_prod_res_ag_clust(t,j,kcr,w,dm_cnr,"marginal") = q18_prod_res_ag_clust.m(j,kcr,w,dm_cnr); + oq18_sumreg_res_biomass_ag(t,i,kcr,w,dm_cnr,"marginal") = q18_sumreg_res_biomass_ag.m(i,kcr,w,dm_cnr); + oq18_prod_res_bg_clust(t,j,kcr,w,dm_cnr,"marginal") = q18_prod_res_bg_clust.m(j,kcr,w,dm_cnr); + oq18_sumreg_res_biomass_bg(t,i,kcr,w,dm_cnr,"marginal") = q18_sumreg_res_biomass_bg.m(i,kcr,w,dm_cnr); + oq18_res_field_balance_clust(t,j,kcr,w,dm_cnr,"marginal") = q18_res_field_balance_clust.m(j,kcr,w,dm_cnr); + oq18_res_field_burn_clust(t,j,kcr,w,dm_cnr,"marginal") = q18_res_field_burn_clust.m(j,kcr,w,dm_cnr); + oq18_sumreg_res_biomass_burn(t,i,kcr,w,dm_cnr,"marginal") = q18_sumreg_res_biomass_burn.m(i,kcr,w,dm_cnr); + oq18_translate(t,j,kres,dm_cnr,"marginal") = q18_translate.m(j,kres,dm_cnr); + oq18_prod_res_cell(t,i,kres,"marginal") = q18_prod_res_cell.m(i,kres); + oq18_res_recycling_cnr_clust(t,j,kcr,w,cnr,"marginal") = q18_res_recycling_cnr_clust.m(j,kcr,w,cnr); + oq18_sumreg_res_recycling(t,i,kcr,w,cnr,"marginal") = q18_sumreg_res_recycling.m(i,kcr,w,cnr); + 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,w,dm_cnr,"level") = vm_res_biomass_ag.l(i,kcr,w,dm_cnr); + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,"level") = vm_res_biomass_bg.l(i,kcr,w,dm_cnr); + ov_res_ag_burn(t,i,kcr,w,dm_cnr,"level") = vm_res_ag_burn.l(i,kcr,w,dm_cnr); + ov_res_recycling(t,i,kcr,w,dm_cnr,"level") = vm_res_recycling.l(i,kcr,w,dm_cnr); + ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,kres); + ov18_res_ag_removal_clust(t,j,kcr,w,dm_cnr,"level") = v18_res_ag_removal_clust.l(j,kcr,w,dm_cnr); + ov18_res_ag_recycling_clust(t,j,kcr,w,dm_cnr,"level") = v18_res_ag_recycling_clust.l(j,kcr,w,dm_cnr); + ov18_res_biomass_ag_clust(t,j,kcr,w,dm_cnr,"level") = v18_res_biomass_ag_clust.l(j,kcr,w,dm_cnr); + ov18_res_biomass_bg_clust(t,j,kcr,w,dm_cnr,"level") = v18_res_biomass_bg_clust.l(j,kcr,w,dm_cnr); + ov18_res_ag_burn_clust(t,j,kcr,w,dm_cnr,"level") = v18_res_ag_burn_clust.l(j,kcr,w,dm_cnr); + ov18_res_recycling_clust(t,j,kcr,w,dm_cnr,"level") = v18_res_recycling_clust.l(j,kcr,w,dm_cnr); + oq18_prod_res_ag_clust(t,j,kcr,w,dm_cnr,"level") = q18_prod_res_ag_clust.l(j,kcr,w,dm_cnr); + oq18_sumreg_res_biomass_ag(t,i,kcr,w,dm_cnr,"level") = q18_sumreg_res_biomass_ag.l(i,kcr,w,dm_cnr); + oq18_prod_res_bg_clust(t,j,kcr,w,dm_cnr,"level") = q18_prod_res_bg_clust.l(j,kcr,w,dm_cnr); + oq18_sumreg_res_biomass_bg(t,i,kcr,w,dm_cnr,"level") = q18_sumreg_res_biomass_bg.l(i,kcr,w,dm_cnr); + oq18_res_field_balance_clust(t,j,kcr,w,dm_cnr,"level") = q18_res_field_balance_clust.l(j,kcr,w,dm_cnr); + oq18_res_field_burn_clust(t,j,kcr,w,dm_cnr,"level") = q18_res_field_burn_clust.l(j,kcr,w,dm_cnr); + oq18_sumreg_res_biomass_burn(t,i,kcr,w,dm_cnr,"level") = q18_sumreg_res_biomass_burn.l(i,kcr,w,dm_cnr); + oq18_translate(t,j,kres,dm_cnr,"level") = q18_translate.l(j,kres,dm_cnr); + oq18_prod_res_cell(t,i,kres,"level") = q18_prod_res_cell.l(i,kres); + oq18_res_recycling_cnr_clust(t,j,kcr,w,cnr,"level") = q18_res_recycling_cnr_clust.l(j,kcr,w,cnr); + oq18_sumreg_res_recycling(t,i,kcr,w,cnr,"level") = q18_sumreg_res_recycling.l(i,kcr,w,cnr); + 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,w,dm_cnr,"upper") = vm_res_biomass_ag.up(i,kcr,w,dm_cnr); + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,"upper") = vm_res_biomass_bg.up(i,kcr,w,dm_cnr); + ov_res_ag_burn(t,i,kcr,w,dm_cnr,"upper") = vm_res_ag_burn.up(i,kcr,w,dm_cnr); + ov_res_recycling(t,i,kcr,w,dm_cnr,"upper") = vm_res_recycling.up(i,kcr,w,dm_cnr); + ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,kres); + ov18_res_ag_removal_clust(t,j,kcr,w,dm_cnr,"upper") = v18_res_ag_removal_clust.up(j,kcr,w,dm_cnr); + ov18_res_ag_recycling_clust(t,j,kcr,w,dm_cnr,"upper") = v18_res_ag_recycling_clust.up(j,kcr,w,dm_cnr); + ov18_res_biomass_ag_clust(t,j,kcr,w,dm_cnr,"upper") = v18_res_biomass_ag_clust.up(j,kcr,w,dm_cnr); + ov18_res_biomass_bg_clust(t,j,kcr,w,dm_cnr,"upper") = v18_res_biomass_bg_clust.up(j,kcr,w,dm_cnr); + ov18_res_ag_burn_clust(t,j,kcr,w,dm_cnr,"upper") = v18_res_ag_burn_clust.up(j,kcr,w,dm_cnr); + ov18_res_recycling_clust(t,j,kcr,w,dm_cnr,"upper") = v18_res_recycling_clust.up(j,kcr,w,dm_cnr); + oq18_prod_res_ag_clust(t,j,kcr,w,dm_cnr,"upper") = q18_prod_res_ag_clust.up(j,kcr,w,dm_cnr); + oq18_sumreg_res_biomass_ag(t,i,kcr,w,dm_cnr,"upper") = q18_sumreg_res_biomass_ag.up(i,kcr,w,dm_cnr); + oq18_prod_res_bg_clust(t,j,kcr,w,dm_cnr,"upper") = q18_prod_res_bg_clust.up(j,kcr,w,dm_cnr); + oq18_sumreg_res_biomass_bg(t,i,kcr,w,dm_cnr,"upper") = q18_sumreg_res_biomass_bg.up(i,kcr,w,dm_cnr); + oq18_res_field_balance_clust(t,j,kcr,w,dm_cnr,"upper") = q18_res_field_balance_clust.up(j,kcr,w,dm_cnr); + oq18_res_field_burn_clust(t,j,kcr,w,dm_cnr,"upper") = q18_res_field_burn_clust.up(j,kcr,w,dm_cnr); + oq18_sumreg_res_biomass_burn(t,i,kcr,w,dm_cnr,"upper") = q18_sumreg_res_biomass_burn.up(i,kcr,w,dm_cnr); + oq18_translate(t,j,kres,dm_cnr,"upper") = q18_translate.up(j,kres,dm_cnr); + oq18_prod_res_cell(t,i,kres,"upper") = q18_prod_res_cell.up(i,kres); + oq18_res_recycling_cnr_clust(t,j,kcr,w,cnr,"upper") = q18_res_recycling_cnr_clust.up(j,kcr,w,cnr); + oq18_sumreg_res_recycling(t,i,kcr,w,cnr,"upper") = q18_sumreg_res_recycling.up(i,kcr,w,cnr); + 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,w,dm_cnr,"lower") = vm_res_biomass_ag.lo(i,kcr,w,dm_cnr); + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,"lower") = vm_res_biomass_bg.lo(i,kcr,w,dm_cnr); + ov_res_ag_burn(t,i,kcr,w,dm_cnr,"lower") = vm_res_ag_burn.lo(i,kcr,w,dm_cnr); + ov_res_recycling(t,i,kcr,w,dm_cnr,"lower") = vm_res_recycling.lo(i,kcr,w,dm_cnr); + ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); + ov18_res_ag_removal_clust(t,j,kcr,w,dm_cnr,"lower") = v18_res_ag_removal_clust.lo(j,kcr,w,dm_cnr); + ov18_res_ag_recycling_clust(t,j,kcr,w,dm_cnr,"lower") = v18_res_ag_recycling_clust.lo(j,kcr,w,dm_cnr); + ov18_res_biomass_ag_clust(t,j,kcr,w,dm_cnr,"lower") = v18_res_biomass_ag_clust.lo(j,kcr,w,dm_cnr); + ov18_res_biomass_bg_clust(t,j,kcr,w,dm_cnr,"lower") = v18_res_biomass_bg_clust.lo(j,kcr,w,dm_cnr); + ov18_res_ag_burn_clust(t,j,kcr,w,dm_cnr,"lower") = v18_res_ag_burn_clust.lo(j,kcr,w,dm_cnr); + ov18_res_recycling_clust(t,j,kcr,w,dm_cnr,"lower") = v18_res_recycling_clust.lo(j,kcr,w,dm_cnr); + oq18_prod_res_ag_clust(t,j,kcr,w,dm_cnr,"lower") = q18_prod_res_ag_clust.lo(j,kcr,w,dm_cnr); + oq18_sumreg_res_biomass_ag(t,i,kcr,w,dm_cnr,"lower") = q18_sumreg_res_biomass_ag.lo(i,kcr,w,dm_cnr); + oq18_prod_res_bg_clust(t,j,kcr,w,dm_cnr,"lower") = q18_prod_res_bg_clust.lo(j,kcr,w,dm_cnr); + oq18_sumreg_res_biomass_bg(t,i,kcr,w,dm_cnr,"lower") = q18_sumreg_res_biomass_bg.lo(i,kcr,w,dm_cnr); + oq18_res_field_balance_clust(t,j,kcr,w,dm_cnr,"lower") = q18_res_field_balance_clust.lo(j,kcr,w,dm_cnr); + oq18_res_field_burn_clust(t,j,kcr,w,dm_cnr,"lower") = q18_res_field_burn_clust.lo(j,kcr,w,dm_cnr); + oq18_sumreg_res_biomass_burn(t,i,kcr,w,dm_cnr,"lower") = q18_sumreg_res_biomass_burn.lo(i,kcr,w,dm_cnr); + oq18_translate(t,j,kres,dm_cnr,"lower") = q18_translate.lo(j,kres,dm_cnr); + oq18_prod_res_cell(t,i,kres,"lower") = q18_prod_res_cell.lo(i,kres); + oq18_res_recycling_cnr_clust(t,j,kcr,w,cnr,"lower") = q18_res_recycling_cnr_clust.lo(j,kcr,w,cnr); + oq18_sumreg_res_recycling(t,i,kcr,w,cnr,"lower") = q18_sumreg_res_recycling.lo(i,kcr,w,cnr); + oq18_cost_prod_res(t,i,kres,"lower") = q18_cost_prod_res.lo(i,kres); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### + diff --git a/modules/18_residues/flexcluster_jul23/preloop.gms b/modules/18_residues/disaggRes_apr25/preloop.gms similarity index 100% rename from modules/18_residues/flexcluster_jul23/preloop.gms rename to modules/18_residues/disaggRes_apr25/preloop.gms diff --git a/modules/18_residues/flexcluster_jul23/presolve.gms b/modules/18_residues/disaggRes_apr25/presolve.gms similarity index 88% rename from modules/18_residues/flexcluster_jul23/presolve.gms rename to modules/18_residues/disaggRes_apr25/presolve.gms index be2459d824..7e152307fa 100644 --- a/modules/18_residues/flexcluster_jul23/presolve.gms +++ b/modules/18_residues/disaggRes_apr25/presolve.gms @@ -5,6 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -v18_res_ag_removal.fx(j,nonused18,attributes)=0; +v18_res_ag_removal_clust.fx(j,nonused18,w,dm_cnr)=0; *** EOF solve.gms *** diff --git a/modules/18_residues/flexcluster_jul23/realization.gms b/modules/18_residues/disaggRes_apr25/realization.gms similarity index 67% rename from modules/18_residues/flexcluster_jul23/realization.gms rename to modules/18_residues/disaggRes_apr25/realization.gms index 084b9ac6b9..f0b95d5ba1 100644 --- a/modules/18_residues/flexcluster_jul23/realization.gms +++ b/modules/18_residues/disaggRes_apr25/realization.gms @@ -24,19 +24,14 @@ *' 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" +$Ifi "%phase%" == "sets" $include "./modules/18_residues/disaggRes_apr25/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/18_residues/disaggRes_apr25/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/18_residues/disaggRes_apr25/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/18_residues/disaggRes_apr25/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/18_residues/disaggRes_apr25/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/18_residues/disaggRes_apr25/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/18_residues/disaggRes_apr25/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/18_residues/disaggRes_apr25/postsolve.gms" *######################## R SECTION END (PHASES) ############################### diff --git a/modules/18_residues/flexcluster_jul23/scaling.gms b/modules/18_residues/disaggRes_apr25/scaling.gms similarity index 100% rename from modules/18_residues/flexcluster_jul23/scaling.gms rename to modules/18_residues/disaggRes_apr25/scaling.gms diff --git a/modules/18_residues/flexcluster_jul23/sets.gms b/modules/18_residues/disaggRes_apr25/sets.gms similarity index 88% rename from modules/18_residues/flexcluster_jul23/sets.gms rename to modules/18_residues/disaggRes_apr25/sets.gms index 0ce45cea6c..74b6032e54 100644 --- a/modules/18_residues/flexcluster_jul23/sets.gms +++ b/modules/18_residues/disaggRes_apr25/sets.gms @@ -8,13 +8,13 @@ sets -dm_nr(attributes) dry matter and nr +dm_cnr(attributes) dry matter carbon and nr /dm, nr, c/ -pk18(npk) subset of npk containing P and K nutrients -/p, k/ +cnr(dm_cnr) carbon and nr +/nr, c/ -dev18 country development indicator +dev18 country develoment indicator /high_income,low_income/ burn_scen18 scenario for burning residues on field diff --git a/modules/18_residues/flexcluster_jul23/declarations.gms b/modules/18_residues/flexcluster_jul23/declarations.gms deleted file mode 100644 index ab53bb9b53..0000000000 --- a/modules/18_residues/flexcluster_jul23/declarations.gms +++ /dev/null @@ -1,76 +0,0 @@ -*** | (C) 2008-2025 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. USD17MER 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. USD17MER) - - 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. USD17MER 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. USD17MER) - 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 deleted file mode 100644 index 1a99e73d49..0000000000 --- a/modules/18_residues/flexcluster_jul23/equations.gms +++ /dev/null @@ -1,145 +0,0 @@ -*** | (C) 2008-2025 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 residue harvest are based on straw baling and hauling from -*' Budynski, Stephanie. 2020. Straw Manufacturing in Alberta (@budynski_straw_2020), -*' using the lower range of the US costs. - - 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/postsolve.gms b/modules/18_residues/flexcluster_jul23/postsolve.gms deleted file mode 100644 index 3593595ada..0000000000 --- a/modules/18_residues/flexcluster_jul23/postsolve.gms +++ /dev/null @@ -1,102 +0,0 @@ -*** | (C) 2008-2025 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/flexreg_apr16/declarations.gms b/modules/18_residues/flexreg_apr16/declarations.gms index e000474151..fa070b3196 100644 --- a/modules/18_residues/flexreg_apr16/declarations.gms +++ b/modules/18_residues/flexreg_apr16/declarations.gms @@ -8,54 +8,48 @@ 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) - 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) 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_res_biomass_ag(i,kcr,w,dm_cnr) Production of aboveground residues in each region (mio. tDM) + vm_res_biomass_bg(i,kcr,w,dm_cnr) Production of belowground residues in each region (mio. tDM) + v18_res_ag_removal(i,kcr,w,dm_cnr) Removal of crop residues in respective attribute units DM GJ Nr P K WM C (mio. tX) + v18_res_ag_recycling(i,kcr,w,dm_cnr) 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,w,dm_cnr) Residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) + vm_res_recycling(i,kcr,w,dm_cnr) 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. USD17MER per yr) ; equations - - q18_prod_res_ag_reg(i,kcr,attributes) Production constraint of aboveground residues (mio. tDM) - q18_prod_res_bg_reg(i,kcr,dm_nr) 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_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) - q18_cost_prod_res(i,kres) Production costs of harvesting crop residues (mio. USD17MER) - + q18_prod_res_ag_reg(i,kcr,w,dm_cnr) Production constraint of aboveground residues (mio. tDM) + q18_prod_res_bg_reg(i,kcr,w,dm_cnr) Production constraint of belowground residues (mio. tDM) + q18_res_field_balance(i,kcr,w,dm_cnr) Calculation of the residues amount recycled to soils (mio. tDM) + q18_res_field_burn(i,kcr,w,dm_cnr) 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,dm_cnr) 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_reg(i,kres) Allows for distribution of residues to cellular level (mio. tDM) + q18_res_recycling_cnr(i,kcr,w,cnr) Nutrient recycling of carbon and reaactive nitrogen (mio. tX) + q18_cost_prod_res(i,kres) Production costs of harvesting crop residues (mio. USD17MER) ; 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) 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) - 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) 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. USD17MER per yr) - oq18_prod_res_ag_reg(t,i,kcr,attributes,type) Production constraint of aboveground residues (mio. tDM) - oq18_prod_res_bg_reg(t,i,kcr,dm_nr,type) 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_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. USD17MER) + ov18_prod_res(t,j,kres,type) Cellular production of residues (mio. tDM) + ov_res_biomass_ag(t,i,kcr,w,dm_cnr,type) Production of aboveground residues in each region (mio. tDM) + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,type) Production of belowground residues in each region (mio. tDM) + ov18_res_ag_removal(t,i,kcr,w,dm_cnr,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,w,dm_cnr,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,w,dm_cnr,type) Residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov_res_recycling(t,i,kcr,w,dm_cnr,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. USD17MER per yr) + oq18_prod_res_ag_reg(t,i,kcr,w,dm_cnr,type) Production constraint of aboveground residues (mio. tDM) + oq18_prod_res_bg_reg(t,i,kcr,w,dm_cnr,type) Production constraint of belowground residues (mio. tDM) + oq18_res_field_balance(t,i,kcr,w,dm_cnr,type) Calculation of the residues amount recycled to soils (mio. tDM) + oq18_res_field_burn(t,i,kcr,w,dm_cnr,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,dm_cnr,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_reg(t,i,kres,type) Allows for distribution of residues to cellular level (mio. tDM) + oq18_res_recycling_cnr(t,i,kcr,w,cnr,type) Nutrient recycling of carbon and reaactive nitrogen (mio. tX) + oq18_cost_prod_res(t,i,kres,type) Production costs of harvesting crop residues (mio. USD17MER) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/18_residues/flexreg_apr16/equations.gms b/modules/18_residues/flexreg_apr16/equations.gms index e01b0d2072..57c38e0cbb 100644 --- a/modules/18_residues/flexreg_apr16/equations.gms +++ b/modules/18_residues/flexreg_apr16/equations.gms @@ -11,36 +11,37 @@ *' of harvested area `vm_area` and production `vm_prod_reg`. `f18_cgf` contains *' slope and intercept parameters of the CGFs. - q18_prod_res_ag_reg(i2,kcr,attributes) .. - vm_res_biomass_ag(i2,kcr,attributes) + q18_prod_res_ag_reg(i2,kcr,w,dm_cnr) .. + vm_res_biomass_ag(i2,kcr,w,dm_cnr) =e= - (sum((cell(i2,j2),w), vm_area(j2,kcr,w)) * sum(ct,f18_multicropping(ct,i2)) * f18_cgf("intercept",kcr) - + vm_prod_reg(i2,kcr) * f18_cgf("slope",kcr)) - * f18_attributes_residue_ag(attributes,kcr); + (sum(cell(i2,j2), vm_area(j2,kcr,w)) * sum(ct,f18_multicropping(ct,i2)) * f18_cgf("intercept",kcr) + + sum(cell(i2,j2), vm_prod_kcr_w(j2,kcr,w)) * f18_cgf("slope",kcr)) + * f18_attributes_residue_ag(dm_cnr,kcr); *' The BG crop residue biomass `vm_res_biomass_bg` is calculated as a function of *' total aboveground biomass. - q18_prod_res_bg_reg(i2,kcr,dm_nr) .. - vm_res_biomass_bg(i2,kcr,dm_nr) + q18_prod_res_bg_reg(i2,kcr,w,dm_cnr) .. + vm_res_biomass_bg(i2,kcr,w,dm_cnr) =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); + (sum(cell(i2,j2), vm_prod_kcr_w(j2,kcr,w)) + + vm_res_biomass_ag(i2,kcr,w,"dm")) * f18_cgf("bg_to_ag",kcr) + * f18_attributes_residue_bg(dm_cnr,kcr); -*' In contrast to AG biomass, AG production `vm_res_biomass_ag(i,kcr,attributes)` +*' In contrast to AG biomass, AG production `vm_res_biomass_ag(i,kcr,w,dm_cnr)` *' 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: +*' `vm_res_biomass_ag(i,kcr,w,dm_cnr)` 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) + q18_res_field_balance(i2,kcr,w,dm_cnr) .. + vm_res_biomass_ag(i2,kcr,w,dm_cnr) =e= - v18_res_ag_removal(i2,kcr,attributes) - + vm_res_ag_burn(i2,kcr,attributes) - + v18_res_ag_recycling(i2,kcr,attributes); + v18_res_ag_removal(i2,kcr,w,dm_cnr) + + vm_res_ag_burn(i2,kcr,w,dm_cnr) + + v18_res_ag_recycling(i2,kcr,w,dm_cnr); *' 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. @@ -49,12 +50,12 @@ *' 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) + q18_res_field_burn(i2,kcr,w,dm_cnr) .. + vm_res_ag_burn(i2,kcr,w,dm_cnr) =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); + * vm_res_biomass_ag(i2,kcr,w,dm_cnr); *' While the residue biomass is estiamted with a crop-specific nutrient @@ -67,17 +68,18 @@ *' guarantees that mass balances are not violated while a homogeneous *' good is extracted from heterogeneous goods. - q18_translate(i2,kres,attributes).. - sum(kres_kcr(kres,kcr), v18_res_ag_removal(i2,kcr,attributes)) + + q18_translate(i2,kres,dm_cnr).. + sum((kres_kcr(kres,kcr),w), v18_res_ag_removal(i2,kcr,w,dm_cnr)) =e= - vm_prod_reg(i2,kres) * fm_attributes(attributes,kres); + vm_prod_reg(i2,kres) * fm_attributes(dm_cnr,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) ; + q18_prod_res_reg(i2,kres).. + sum(cell(i2,j2), v18_prod_res(j2,kres)) + =e= + vm_prod_reg(i2,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 @@ -85,27 +87,13 @@ *' 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) + q18_res_recycling_cnr(i2,kcr,w,cnr) .. + vm_res_recycling(i2,kcr,w,cnr) =e= - sum(kcr, - v18_res_ag_recycling(i2,kcr,pk18) - + vm_res_ag_burn(i2,kcr,pk18) - ); + v18_res_ag_recycling(i2,kcr,w,cnr) + + vm_res_ag_burn(i2,kcr,w,cnr)*(1-f18_res_combust_eff(kcr)) + + vm_res_biomass_bg(i2,kcr,w,cnr) + ; *' Costs of residue harvest are based on straw baling and hauling from *' Budynski, Stephanie. 2020. Straw Manufacturing in Alberta (@budynski_straw_2020), @@ -114,7 +102,7 @@ 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); + 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. diff --git a/modules/18_residues/flexreg_apr16/input.gms b/modules/18_residues/flexreg_apr16/input.gms index b6c23e24f1..f45820cc55 100644 --- a/modules/18_residues/flexreg_apr16/input.gms +++ b/modules/18_residues/flexreg_apr16/input.gms @@ -19,7 +19,7 @@ $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) +table f18_attributes_residue_bg(dm_cnr,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; diff --git a/modules/18_residues/flexreg_apr16/not_used.txt b/modules/18_residues/flexreg_apr16/not_used.txt deleted file mode 100644 index 07cb618a78..0000000000 --- a/modules/18_residues/flexreg_apr16/not_used.txt +++ /dev/null @@ -1,2 +0,0 @@ -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 0b0007332b..8aa7ee916e 100644 --- a/modules/18_residues/flexreg_apr16/postsolve.gms +++ b/modules/18_residues/flexreg_apr16/postsolve.gms @@ -10,73 +10,69 @@ *** 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); - 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_reg(t,i,kcr,attributes,"marginal") = q18_prod_res_ag_reg.m(i,kcr,attributes); - oq18_prod_res_bg_reg(t,i,kcr,dm_nr,"marginal") = q18_prod_res_bg_reg.m(i,kcr,dm_nr); - 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); - 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_reg(t,i,kcr,attributes,"level") = q18_prod_res_ag_reg.l(i,kcr,attributes); - oq18_prod_res_bg_reg(t,i,kcr,dm_nr,"level") = q18_prod_res_bg_reg.l(i,kcr,dm_nr); - 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); - 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_reg(t,i,kcr,attributes,"upper") = q18_prod_res_ag_reg.up(i,kcr,attributes); - oq18_prod_res_bg_reg(t,i,kcr,dm_nr,"upper") = q18_prod_res_bg_reg.up(i,kcr,dm_nr); - 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); - 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_reg(t,i,kcr,attributes,"lower") = q18_prod_res_ag_reg.lo(i,kcr,attributes); - oq18_prod_res_bg_reg(t,i,kcr,dm_nr,"lower") = q18_prod_res_bg_reg.lo(i,kcr,dm_nr); - 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); + ov18_prod_res(t,j,kres,"marginal") = v18_prod_res.m(j,kres); + ov_res_biomass_ag(t,i,kcr,w,dm_cnr,"marginal") = vm_res_biomass_ag.m(i,kcr,w,dm_cnr); + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,"marginal") = vm_res_biomass_bg.m(i,kcr,w,dm_cnr); + ov18_res_ag_removal(t,i,kcr,w,dm_cnr,"marginal") = v18_res_ag_removal.m(i,kcr,w,dm_cnr); + ov18_res_ag_recycling(t,i,kcr,w,dm_cnr,"marginal") = v18_res_ag_recycling.m(i,kcr,w,dm_cnr); + ov_res_ag_burn(t,i,kcr,w,dm_cnr,"marginal") = vm_res_ag_burn.m(i,kcr,w,dm_cnr); + ov_res_recycling(t,i,kcr,w,dm_cnr,"marginal") = vm_res_recycling.m(i,kcr,w,dm_cnr); + ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,kres); + oq18_prod_res_ag_reg(t,i,kcr,w,dm_cnr,"marginal") = q18_prod_res_ag_reg.m(i,kcr,w,dm_cnr); + oq18_prod_res_bg_reg(t,i,kcr,w,dm_cnr,"marginal") = q18_prod_res_bg_reg.m(i,kcr,w,dm_cnr); + oq18_res_field_balance(t,i,kcr,w,dm_cnr,"marginal") = q18_res_field_balance.m(i,kcr,w,dm_cnr); + oq18_res_field_burn(t,i,kcr,w,dm_cnr,"marginal") = q18_res_field_burn.m(i,kcr,w,dm_cnr); + oq18_translate(t,i,kres,dm_cnr,"marginal") = q18_translate.m(i,kres,dm_cnr); + oq18_prod_res_reg(t,i,kres,"marginal") = q18_prod_res_reg.m(i,kres); + oq18_res_recycling_cnr(t,i,kcr,w,cnr,"marginal") = q18_res_recycling_cnr.m(i,kcr,w,cnr); + 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,w,dm_cnr,"level") = vm_res_biomass_ag.l(i,kcr,w,dm_cnr); + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,"level") = vm_res_biomass_bg.l(i,kcr,w,dm_cnr); + ov18_res_ag_removal(t,i,kcr,w,dm_cnr,"level") = v18_res_ag_removal.l(i,kcr,w,dm_cnr); + ov18_res_ag_recycling(t,i,kcr,w,dm_cnr,"level") = v18_res_ag_recycling.l(i,kcr,w,dm_cnr); + ov_res_ag_burn(t,i,kcr,w,dm_cnr,"level") = vm_res_ag_burn.l(i,kcr,w,dm_cnr); + ov_res_recycling(t,i,kcr,w,dm_cnr,"level") = vm_res_recycling.l(i,kcr,w,dm_cnr); + ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,kres); + oq18_prod_res_ag_reg(t,i,kcr,w,dm_cnr,"level") = q18_prod_res_ag_reg.l(i,kcr,w,dm_cnr); + oq18_prod_res_bg_reg(t,i,kcr,w,dm_cnr,"level") = q18_prod_res_bg_reg.l(i,kcr,w,dm_cnr); + oq18_res_field_balance(t,i,kcr,w,dm_cnr,"level") = q18_res_field_balance.l(i,kcr,w,dm_cnr); + oq18_res_field_burn(t,i,kcr,w,dm_cnr,"level") = q18_res_field_burn.l(i,kcr,w,dm_cnr); + oq18_translate(t,i,kres,dm_cnr,"level") = q18_translate.l(i,kres,dm_cnr); + oq18_prod_res_reg(t,i,kres,"level") = q18_prod_res_reg.l(i,kres); + oq18_res_recycling_cnr(t,i,kcr,w,cnr,"level") = q18_res_recycling_cnr.l(i,kcr,w,cnr); + 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,w,dm_cnr,"upper") = vm_res_biomass_ag.up(i,kcr,w,dm_cnr); + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,"upper") = vm_res_biomass_bg.up(i,kcr,w,dm_cnr); + ov18_res_ag_removal(t,i,kcr,w,dm_cnr,"upper") = v18_res_ag_removal.up(i,kcr,w,dm_cnr); + ov18_res_ag_recycling(t,i,kcr,w,dm_cnr,"upper") = v18_res_ag_recycling.up(i,kcr,w,dm_cnr); + ov_res_ag_burn(t,i,kcr,w,dm_cnr,"upper") = vm_res_ag_burn.up(i,kcr,w,dm_cnr); + ov_res_recycling(t,i,kcr,w,dm_cnr,"upper") = vm_res_recycling.up(i,kcr,w,dm_cnr); + ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,kres); + oq18_prod_res_ag_reg(t,i,kcr,w,dm_cnr,"upper") = q18_prod_res_ag_reg.up(i,kcr,w,dm_cnr); + oq18_prod_res_bg_reg(t,i,kcr,w,dm_cnr,"upper") = q18_prod_res_bg_reg.up(i,kcr,w,dm_cnr); + oq18_res_field_balance(t,i,kcr,w,dm_cnr,"upper") = q18_res_field_balance.up(i,kcr,w,dm_cnr); + oq18_res_field_burn(t,i,kcr,w,dm_cnr,"upper") = q18_res_field_burn.up(i,kcr,w,dm_cnr); + oq18_translate(t,i,kres,dm_cnr,"upper") = q18_translate.up(i,kres,dm_cnr); + oq18_prod_res_reg(t,i,kres,"upper") = q18_prod_res_reg.up(i,kres); + oq18_res_recycling_cnr(t,i,kcr,w,cnr,"upper") = q18_res_recycling_cnr.up(i,kcr,w,cnr); + 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,w,dm_cnr,"lower") = vm_res_biomass_ag.lo(i,kcr,w,dm_cnr); + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,"lower") = vm_res_biomass_bg.lo(i,kcr,w,dm_cnr); + ov18_res_ag_removal(t,i,kcr,w,dm_cnr,"lower") = v18_res_ag_removal.lo(i,kcr,w,dm_cnr); + ov18_res_ag_recycling(t,i,kcr,w,dm_cnr,"lower") = v18_res_ag_recycling.lo(i,kcr,w,dm_cnr); + ov_res_ag_burn(t,i,kcr,w,dm_cnr,"lower") = vm_res_ag_burn.lo(i,kcr,w,dm_cnr); + ov_res_recycling(t,i,kcr,w,dm_cnr,"lower") = vm_res_recycling.lo(i,kcr,w,dm_cnr); + ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); + oq18_prod_res_ag_reg(t,i,kcr,w,dm_cnr,"lower") = q18_prod_res_ag_reg.lo(i,kcr,w,dm_cnr); + oq18_prod_res_bg_reg(t,i,kcr,w,dm_cnr,"lower") = q18_prod_res_bg_reg.lo(i,kcr,w,dm_cnr); + oq18_res_field_balance(t,i,kcr,w,dm_cnr,"lower") = q18_res_field_balance.lo(i,kcr,w,dm_cnr); + oq18_res_field_burn(t,i,kcr,w,dm_cnr,"lower") = q18_res_field_burn.lo(i,kcr,w,dm_cnr); + oq18_translate(t,i,kres,dm_cnr,"lower") = q18_translate.lo(i,kres,dm_cnr); + oq18_prod_res_reg(t,i,kres,"lower") = q18_prod_res_reg.lo(i,kres); + oq18_res_recycling_cnr(t,i,kcr,w,cnr,"lower") = q18_res_recycling_cnr.lo(i,kcr,w,cnr); + oq18_cost_prod_res(t,i,kres,"lower") = q18_cost_prod_res.lo(i,kres); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/18_residues/flexreg_apr16/presolve.gms b/modules/18_residues/flexreg_apr16/presolve.gms index e30abe7706..99b4fedd49 100644 --- a/modules/18_residues/flexreg_apr16/presolve.gms +++ b/modules/18_residues/flexreg_apr16/presolve.gms @@ -5,6 +5,6 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -v18_res_ag_removal.fx(i,nonused18,attributes)=0; +v18_res_ag_removal.fx(i,nonused18,w,dm_cnr)=0; *** EOF solve.gms *** diff --git a/modules/18_residues/flexreg_apr16/sets.gms b/modules/18_residues/flexreg_apr16/sets.gms index d7f8b76c4c..74b6032e54 100644 --- a/modules/18_residues/flexreg_apr16/sets.gms +++ b/modules/18_residues/flexreg_apr16/sets.gms @@ -8,11 +8,11 @@ sets -dm_nr(attributes) dry matter and nr +dm_cnr(attributes) dry matter carbon and nr /dm, nr, c/ -pk18(npk) subset of npk containing P and K nutrients -/p, k/ +cnr(dm_cnr) carbon and nr +/nr, c/ dev18 country develoment indicator /high_income,low_income/ diff --git a/modules/18_residues/module.gms b/modules/18_residues/module.gms index f44727ae6f..c7c29bbfaa 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%" == "flexcluster_jul23" $include "./modules/18_residues/flexcluster_jul23/realization.gms" +$Ifi "%residues%" == "disaggRes_apr25" $include "./modules/18_residues/disaggRes_apr25/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/declarations.gms b/modules/18_residues/off/declarations.gms index 8e99f755b8..c04ed7bb36 100644 --- a/modules/18_residues/off/declarations.gms +++ b/modules/18_residues/off/declarations.gms @@ -7,21 +7,21 @@ positive variables - 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) - vm_res_recycling(i,npk) residues recycled to croplands (mio tons nutrients) - vm_res_ag_burn(i,kcr,attributes) Residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) + vm_res_biomass_ag(i,kcr,w,dm_cnr) production of aboveground residues in each region (mio. tDM) + vm_res_biomass_bg(i,kcr,w,dm_cnr) production of belowground residues in each region (mio. tDM) + vm_res_recycling(i,kcr,w,dm_cnr) residues recycled to croplands (mio tons nutrients) + vm_res_ag_burn(i,kcr,w,dm_cnr) Residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) vm_cost_prod_kres(i,kres) Production costs of harvesting crop residues (mio. USD17MER per yr) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - 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) - ov_res_recycling(t,i,npk,type) residues recycled to croplands (mio tons nutrients) - ov_res_ag_burn(t,i,kcr,attributes,type) Residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) - ov_cost_prod_kres(t,i,kres,type) Production costs of harvesting crop residues (mio. USD17MER per yr) + ov_res_biomass_ag(t,i,kcr,w,dm_cnr,type) production of aboveground residues in each region (mio. tDM) + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,type) production of belowground residues in each region (mio. tDM) + ov_res_recycling(t,i,kcr,w,dm_cnr,type) residues recycled to croplands (mio tons nutrients) + ov_res_ag_burn(t,i,kcr,w,dm_cnr,type) Residues burned on fields in respective attribute units DM GJ Nr P K WM C (mio. tX) + ov_cost_prod_kres(t,i,kres,type) Production costs of harvesting crop residues (mio. USD17MER per yr) ; *##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/18_residues/off/not_used.txt b/modules/18_residues/off/not_used.txt index 85051d6636..dcaf0f78ad 100644 --- a/modules/18_residues/off/not_used.txt +++ b/modules/18_residues/off/not_used.txt @@ -1,6 +1,6 @@ name,type,reason +vm_prod_reg,input,questionnaire 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 +vm_prod_kcr_w,input,questionnaire diff --git a/modules/18_residues/off/postsolve.gms b/modules/18_residues/off/postsolve.gms index bbc140e738..c280cd0977 100644 --- a/modules/18_residues/off/postsolve.gms +++ b/modules/18_residues/off/postsolve.gms @@ -6,24 +6,24 @@ *** | Contact: magpie@pik-potsdam.de *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - 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); - ov_res_recycling(t,i,npk,"marginal") = vm_res_recycling.m(i,npk); - ov_res_ag_burn(t,i,kcr,attributes,"marginal") = vm_res_ag_burn.m(i,kcr,attributes); - ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,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); - ov_res_recycling(t,i,npk,"level") = vm_res_recycling.l(i,npk); - ov_res_ag_burn(t,i,kcr,attributes,"level") = vm_res_ag_burn.l(i,kcr,attributes); - ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,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); - ov_res_recycling(t,i,npk,"upper") = vm_res_recycling.up(i,npk); - ov_res_ag_burn(t,i,kcr,attributes,"upper") = vm_res_ag_burn.up(i,kcr,attributes); - ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,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); - ov_res_recycling(t,i,npk,"lower") = vm_res_recycling.lo(i,npk); - ov_res_ag_burn(t,i,kcr,attributes,"lower") = vm_res_ag_burn.lo(i,kcr,attributes); - ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); + ov_res_biomass_ag(t,i,kcr,w,dm_cnr,"marginal") = vm_res_biomass_ag.m(i,kcr,w,dm_cnr); + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,"marginal") = vm_res_biomass_bg.m(i,kcr,w,dm_cnr); + ov_res_recycling(t,i,kcr,w,dm_cnr,"marginal") = vm_res_recycling.m(i,kcr,w,dm_cnr); + ov_res_ag_burn(t,i,kcr,w,dm_cnr,"marginal") = vm_res_ag_burn.m(i,kcr,w,dm_cnr); + ov_cost_prod_kres(t,i,kres,"marginal") = vm_cost_prod_kres.m(i,kres); + ov_res_biomass_ag(t,i,kcr,w,dm_cnr,"level") = vm_res_biomass_ag.l(i,kcr,w,dm_cnr); + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,"level") = vm_res_biomass_bg.l(i,kcr,w,dm_cnr); + ov_res_recycling(t,i,kcr,w,dm_cnr,"level") = vm_res_recycling.l(i,kcr,w,dm_cnr); + ov_res_ag_burn(t,i,kcr,w,dm_cnr,"level") = vm_res_ag_burn.l(i,kcr,w,dm_cnr); + ov_cost_prod_kres(t,i,kres,"level") = vm_cost_prod_kres.l(i,kres); + ov_res_biomass_ag(t,i,kcr,w,dm_cnr,"upper") = vm_res_biomass_ag.up(i,kcr,w,dm_cnr); + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,"upper") = vm_res_biomass_bg.up(i,kcr,w,dm_cnr); + ov_res_recycling(t,i,kcr,w,dm_cnr,"upper") = vm_res_recycling.up(i,kcr,w,dm_cnr); + ov_res_ag_burn(t,i,kcr,w,dm_cnr,"upper") = vm_res_ag_burn.up(i,kcr,w,dm_cnr); + ov_cost_prod_kres(t,i,kres,"upper") = vm_cost_prod_kres.up(i,kres); + ov_res_biomass_ag(t,i,kcr,w,dm_cnr,"lower") = vm_res_biomass_ag.lo(i,kcr,w,dm_cnr); + ov_res_biomass_bg(t,i,kcr,w,dm_cnr,"lower") = vm_res_biomass_bg.lo(i,kcr,w,dm_cnr); + ov_res_recycling(t,i,kcr,w,dm_cnr,"lower") = vm_res_recycling.lo(i,kcr,w,dm_cnr); + ov_res_ag_burn(t,i,kcr,w,dm_cnr,"lower") = vm_res_ag_burn.lo(i,kcr,w,dm_cnr); + ov_cost_prod_kres(t,i,kres,"lower") = vm_cost_prod_kres.lo(i,kres); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/18_residues/off/preloop.gms b/modules/18_residues/off/preloop.gms index 039b71abcd..8bfcfd3205 100644 --- a/modules/18_residues/off/preloop.gms +++ b/modules/18_residues/off/preloop.gms @@ -7,8 +7,8 @@ -vm_res_biomass_ag.fx(i,kcr,attributes) = 0; -vm_res_biomass_bg.fx(i,kcr,dm_nr) = 0; -vm_res_recycling.fx(i,npk) = 0; -vm_res_ag_burn.fx(i,kcr,attributes) = 0; -vm_cost_prod_kres.fx(i,kres) = 0; +vm_res_biomass_ag.fx(i,kcr,w,dm_cnr) = 0; +vm_res_biomass_bg.fx(i,kcr,w,dm_cnr) = 0; +vm_res_recycling.fx(i,kcr,w,dm_cnr) = 0; +vm_res_ag_burn.fx(i,kcr,w,dm_cnr) = 0; +vm_cost_prod_kres.fx(i,kres) = 0; diff --git a/modules/18_residues/off/sets.gms b/modules/18_residues/off/sets.gms index 5ec47281b4..fecc54a446 100644 --- a/modules/18_residues/off/sets.gms +++ b/modules/18_residues/off/sets.gms @@ -7,8 +7,8 @@ sets -dm_nr(attributes) dry matter and nr -/dm, nr/ +dm_cnr(attributes) dry matter and nr +/dm, nr, c/ ; *** EOF sets.gms *** diff --git a/modules/30_croparea/detail_apr24/declarations.gms b/modules/30_croparea/detail_apr24/declarations.gms index d60c7a369b..7365f13f6b 100644 --- a/modules/30_croparea/detail_apr24/declarations.gms +++ b/modules/30_croparea/detail_apr24/declarations.gms @@ -25,9 +25,11 @@ positive variables v30_penalty(j,rota30) Penalty for violating rotational constraints (mio. USD17MER) v30_betr_missing(j) Missing bioenergy tree land towards target (mio. ha) v30_crop_area(i) Total regional crop production area (mio. ha) + vm_prod_kcr_w(j,kcr,w) Agricultural production per crop group and irrigation type (mio. tDM per yr) ; equations + q30_prod_kcr_w(j,kcr,w) Irrigation type specific production of cropped products (mio. tDM per yr) q30_prod(j,kcr) Production of cropped products (mio. tDM) q30_betr_missing(j) Missing bioenergy tree land towards target (mio. ha) q30_rotation_penalty(i) Total penalty for rotational constraint violations (mio. USD17MER) @@ -51,6 +53,8 @@ parameters ov30_penalty(t,j,rota30,type) Penalty for violating rotational constraints (mio. USD17MER) ov30_betr_missing(t,j,type) Missing bioenergy tree land towards target (mio. ha) ov30_crop_area(t,i,type) Total regional crop production area (mio. ha) + ov_prod_kcr_w(t,j,kcr,w,type) Agricultural production per crop group and irrigation type (mio. tDM per yr) + oq30_prod_kcr_w(t,j,kcr,w,type) Irrigation type specific production of cropped products (mio. tDM per yr) oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) oq30_betr_missing(t,j,type) Missing bioenergy tree land towards target (mio. ha) oq30_rotation_penalty(t,i,type) Total penalty for rotational constraint violations (mio. USD17MER) diff --git a/modules/30_croparea/detail_apr24/equations.gms b/modules/30_croparea/detail_apr24/equations.gms index 2f19a5fcf5..7bf4181c4b 100644 --- a/modules/30_croparea/detail_apr24/equations.gms +++ b/modules/30_croparea/detail_apr24/equations.gms @@ -8,11 +8,16 @@ *' @equations *' Agricultural production is calculated by multiplying the area under -*' production with corresponding yields. Production from rainfed and irrigated -*' areas is summed up: +*' production with corresponding yields. - q30_prod(j2,kcr) .. - vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); + q30_prod_kcr_w(j2,kcr,w) .. + vm_prod_kcr_w(j2,kcr,w) =e= vm_area(j2,kcr,w) * vm_yld(j2,kcr,w); + +*' For total production rainfed and irrigated production is summed up: +*** Maybe test here other types of contrains (lower) + + q30_prod(j2,kcr) .. + vm_prod(j2,kcr) =e= sum(w, vm_prod_kcr_w(j2,kcr,w)); *' A penalty is applied for the violation of bioenergy tree (betr) rules. *' The penalty applies to the missing bioenergy tree land, i.e. where bioenergy tree land diff --git a/modules/30_croparea/detail_apr24/postsolve.gms b/modules/30_croparea/detail_apr24/postsolve.gms index e97dda0ca3..2613a82124 100644 --- a/modules/30_croparea/detail_apr24/postsolve.gms +++ b/modules/30_croparea/detail_apr24/postsolve.gms @@ -14,6 +14,8 @@ ov30_penalty(t,j,rota30,"marginal") = v30_penalty.m(j,rota30); ov30_betr_missing(t,j,"marginal") = v30_betr_missing.m(j); ov30_crop_area(t,i,"marginal") = v30_crop_area.m(i); + ov_prod_kcr_w(t,j,kcr,w,"marginal") = vm_prod_kcr_w.m(j,kcr,w); + oq30_prod_kcr_w(t,j,kcr,w,"marginal") = q30_prod_kcr_w.m(j,kcr,w); oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); oq30_betr_missing(t,j,"marginal") = q30_betr_missing.m(j); oq30_rotation_penalty(t,i,"marginal") = q30_rotation_penalty.m(i); @@ -33,6 +35,8 @@ ov30_penalty(t,j,rota30,"level") = v30_penalty.l(j,rota30); ov30_betr_missing(t,j,"level") = v30_betr_missing.l(j); ov30_crop_area(t,i,"level") = v30_crop_area.l(i); + ov_prod_kcr_w(t,j,kcr,w,"level") = vm_prod_kcr_w.l(j,kcr,w); + oq30_prod_kcr_w(t,j,kcr,w,"level") = q30_prod_kcr_w.l(j,kcr,w); oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); oq30_betr_missing(t,j,"level") = q30_betr_missing.l(j); oq30_rotation_penalty(t,i,"level") = q30_rotation_penalty.l(i); @@ -52,6 +56,8 @@ ov30_penalty(t,j,rota30,"upper") = v30_penalty.up(j,rota30); ov30_betr_missing(t,j,"upper") = v30_betr_missing.up(j); ov30_crop_area(t,i,"upper") = v30_crop_area.up(i); + ov_prod_kcr_w(t,j,kcr,w,"upper") = vm_prod_kcr_w.up(j,kcr,w); + oq30_prod_kcr_w(t,j,kcr,w,"upper") = q30_prod_kcr_w.up(j,kcr,w); oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); oq30_betr_missing(t,j,"upper") = q30_betr_missing.up(j); oq30_rotation_penalty(t,i,"upper") = q30_rotation_penalty.up(i); @@ -71,6 +77,8 @@ ov30_penalty(t,j,rota30,"lower") = v30_penalty.lo(j,rota30); ov30_betr_missing(t,j,"lower") = v30_betr_missing.lo(j); ov30_crop_area(t,i,"lower") = v30_crop_area.lo(i); + ov_prod_kcr_w(t,j,kcr,w,"lower") = vm_prod_kcr_w.lo(j,kcr,w); + oq30_prod_kcr_w(t,j,kcr,w,"lower") = q30_prod_kcr_w.lo(j,kcr,w); oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); oq30_betr_missing(t,j,"lower") = q30_betr_missing.lo(j); oq30_rotation_penalty(t,i,"lower") = q30_rotation_penalty.lo(i); diff --git a/modules/30_croparea/simple_apr24/declarations.gms b/modules/30_croparea/simple_apr24/declarations.gms index 3430df82f6..b3c1c352e5 100644 --- a/modules/30_croparea/simple_apr24/declarations.gms +++ b/modules/30_croparea/simple_apr24/declarations.gms @@ -20,9 +20,11 @@ positive variables vm_carbon_stock_croparea(j,ag_pools) Carbon stock in croparea (tC) v30_betr_missing(j) Missing bioenergy tree land towards target (mio. ha) v30_crop_area(i) Total regional crop production area (mio. ha) + vm_prod_kcr_w(j,kcr,w) Agricultural production per crop group and irrigation type (mio. tDM per yr) ; equations + q30_prod_kcr_w(j,kcr,w) Irrigation type specific production of cropped products (mio. tDM per yr) q30_prod(j,kcr) Production of cropped products (mio. tDM) q30_betr_missing(j) Missing bioenergy tree land towards target (mio. ha) q30_cost(i) Cost (mio. USD17MER) @@ -41,6 +43,8 @@ parameters ov_carbon_stock_croparea(t,j,ag_pools,type) Carbon stock in croparea (tC) ov30_betr_missing(t,j,type) Missing bioenergy tree land towards target (mio. ha) ov30_crop_area(t,i,type) Total regional crop production area (mio. ha) + ov_prod_kcr_w(t,j,kcr,w,type) Agricultural production per crop group and irrigation type (mio. tDM per yr) + oq30_prod_kcr_w(t,j,kcr,w,type) Irrigation type specific production of cropped products (mio. tDM per yr) oq30_prod(t,j,kcr,type) Production of cropped products (mio. tDM) oq30_betr_missing(t,j,type) Missing bioenergy tree land towards target (mio. ha) oq30_cost(t,i,type) Cost (mio. USD17MER) diff --git a/modules/30_croparea/simple_apr24/equations.gms b/modules/30_croparea/simple_apr24/equations.gms index 0c9a633dd8..02062a70f5 100644 --- a/modules/30_croparea/simple_apr24/equations.gms +++ b/modules/30_croparea/simple_apr24/equations.gms @@ -8,11 +8,16 @@ *' @equations *' Agricultural production is calculated by multiplying the area under -*' production with corresponding yields. Production from rainfed and irrigated -*' areas is summed up: +*' production with corresponding yields. + + q30_prod_kcr_w(j2,kcr,w) .. + vm_prod_kcr_w(j2,kcr,w) =e= vm_area(j2,kcr,w) * vm_yld(j2,kcr,w); + +*' For total production rainfed and irrigated production is summed up: +*** Maybe test here other types of contrains (lower) q30_prod(j2,kcr) .. - vm_prod(j2,kcr) =e= sum(w, vm_area(j2,kcr,w) * vm_yld(j2,kcr,w)); + vm_prod(j2,kcr) =e= sum(w, vm_prod_kcr_w(j2,kcr,w)); *' A penalty is applied for the violation of bioenergy tree (betr) rules. *' The penalty applies to the missing bioenergy tree land, i.e. where bioenergy tree land diff --git a/modules/30_croparea/simple_apr24/postsolve.gms b/modules/30_croparea/simple_apr24/postsolve.gms index b402e3eca0..02daeab516 100644 --- a/modules/30_croparea/simple_apr24/postsolve.gms +++ b/modules/30_croparea/simple_apr24/postsolve.gms @@ -12,6 +12,8 @@ ov_carbon_stock_croparea(t,j,ag_pools,"marginal") = vm_carbon_stock_croparea.m(j,ag_pools); ov30_betr_missing(t,j,"marginal") = v30_betr_missing.m(j); ov30_crop_area(t,i,"marginal") = v30_crop_area.m(i); + ov_prod_kcr_w(t,j,kcr,w,"marginal") = vm_prod_kcr_w.m(j,kcr,w); + oq30_prod_kcr_w(t,j,kcr,w,"marginal") = q30_prod_kcr_w.m(j,kcr,w); oq30_prod(t,j,kcr,"marginal") = q30_prod.m(j,kcr); oq30_betr_missing(t,j,"marginal") = q30_betr_missing.m(j); oq30_cost(t,i,"marginal") = q30_cost.m(i); @@ -26,6 +28,8 @@ ov_carbon_stock_croparea(t,j,ag_pools,"level") = vm_carbon_stock_croparea.l(j,ag_pools); ov30_betr_missing(t,j,"level") = v30_betr_missing.l(j); ov30_crop_area(t,i,"level") = v30_crop_area.l(i); + ov_prod_kcr_w(t,j,kcr,w,"level") = vm_prod_kcr_w.l(j,kcr,w); + oq30_prod_kcr_w(t,j,kcr,w,"level") = q30_prod_kcr_w.l(j,kcr,w); oq30_prod(t,j,kcr,"level") = q30_prod.l(j,kcr); oq30_betr_missing(t,j,"level") = q30_betr_missing.l(j); oq30_cost(t,i,"level") = q30_cost.l(i); @@ -40,6 +44,8 @@ ov_carbon_stock_croparea(t,j,ag_pools,"upper") = vm_carbon_stock_croparea.up(j,ag_pools); ov30_betr_missing(t,j,"upper") = v30_betr_missing.up(j); ov30_crop_area(t,i,"upper") = v30_crop_area.up(i); + ov_prod_kcr_w(t,j,kcr,w,"upper") = vm_prod_kcr_w.up(j,kcr,w); + oq30_prod_kcr_w(t,j,kcr,w,"upper") = q30_prod_kcr_w.up(j,kcr,w); oq30_prod(t,j,kcr,"upper") = q30_prod.up(j,kcr); oq30_betr_missing(t,j,"upper") = q30_betr_missing.up(j); oq30_cost(t,i,"upper") = q30_cost.up(i); @@ -54,6 +60,8 @@ ov_carbon_stock_croparea(t,j,ag_pools,"lower") = vm_carbon_stock_croparea.lo(j,ag_pools); ov30_betr_missing(t,j,"lower") = v30_betr_missing.lo(j); ov30_crop_area(t,i,"lower") = v30_crop_area.lo(i); + ov_prod_kcr_w(t,j,kcr,w,"lower") = vm_prod_kcr_w.lo(j,kcr,w); + oq30_prod_kcr_w(t,j,kcr,w,"lower") = q30_prod_kcr_w.lo(j,kcr,w); oq30_prod(t,j,kcr,"lower") = q30_prod.lo(j,kcr); oq30_betr_missing(t,j,"lower") = q30_betr_missing.lo(j); oq30_cost(t,i,"lower") = q30_cost.lo(i); diff --git a/modules/50_nr_soil_budget/macceff_aug22/equations.gms b/modules/50_nr_soil_budget/macceff_aug22/equations.gms index b0055f341f..f1f5680774 100644 --- a/modules/50_nr_soil_budget/macceff_aug22/equations.gms +++ b/modules/50_nr_soil_budget/macceff_aug22/equations.gms @@ -21,13 +21,13 @@ q50_nr_inputs(i2) .. v50_nr_inputs(i2) =e= - vm_res_recycling(i2,"nr") + sum((kcr,w), vm_res_recycling(i2,kcr,w,"nr")) + sum((cell(i2,j2),kcr,w), vm_area(j2,kcr,w) * f50_nr_fix_area(kcr)) + sum(cell(i2,j2),vm_fallow(j2) * f50_nr_fix_area("tece")) + vm_manure_recycling(i2,"nr") + sum(kli, vm_manure(i2, kli, "stubble_grazing","nr")) + vm_nr_inorg_fert_reg(i2,"crop") - + sum(cell(i2,j2),vm_nr_som_fertilizer(j2)) + + vm_nr_som_fertilizer(i2) + sum(ct,f50_nitrogen_balanceflow(ct,i2)) + v50_nr_deposition(i2,"crop"); @@ -37,8 +37,8 @@ q50_nr_inputs(i2) .. v50_nr_withdrawals(i2,kcr) =e= (1-sum(ct,f50_nr_fix_ndfa(ct,i2,kcr))) * (vm_prod_reg(i2,kcr) * fm_attributes("nr",kcr) - + vm_res_biomass_ag(i2,kcr,"nr") - + vm_res_biomass_bg(i2,kcr,"nr")) + + sum(w, vm_res_biomass_ag(i2,kcr,w,"nr") + + vm_res_biomass_bg(i2,kcr,w,"nr"))) - vm_dem_seed(i2,kcr) * fm_attributes("nr",kcr) ; diff --git a/modules/51_nitrogen/rescaled_jan21/equations.gms b/modules/51_nitrogen/rescaled_jan21/equations.gms index 2f04b0902d..c4e7245e1b 100644 --- a/modules/51_nitrogen/rescaled_jan21/equations.gms +++ b/modules/51_nitrogen/rescaled_jan21/equations.gms @@ -42,20 +42,20 @@ q51_emissions_resid(i2,n_pollutants_direct).. vm_emissions_reg(i2,"resid",n_pollutants_direct) =e= - vm_res_recycling(i2,"nr") * sum(ct, i51_ef_n_soil(ct,i2,n_pollutants_direct,"resid")) + sum((kcr,w), vm_res_recycling(i2,kcr,w,"nr")) * sum(ct, i51_ef_n_soil(ct,i2,n_pollutants_direct,"resid")) / (1-s51_snupe_base) * (1-vm_nr_eff(i2)); *' emissions from burning crop residues, N2O and NOx q51_emissions_resid_burn(i2,n_pollutants_direct).. vm_emissions_reg(i2,"resid_burn",n_pollutants_direct) =e= - sum(kcr, vm_res_ag_burn(i2,kcr,"dm")) * f51_ef_resid_burn(n_pollutants_direct); + sum((kcr,w), vm_res_ag_burn(i2,kcr,w,"dm")) * f51_ef_resid_burn(n_pollutants_direct); *' soil organic matter loss: q51_emissions_som(i2,n_pollutants_direct).. vm_emissions_reg(i2,"som",n_pollutants_direct) =e= - sum(cell(i2,j2),vm_nr_som(j2)) * sum(ct, i51_ef_n_soil(ct,i2,n_pollutants_direct,"som")) + vm_nr_som(i2) * sum(ct, i51_ef_n_soil(ct,i2,n_pollutants_direct,"som")) / (1-s51_snupe_base) * (1-vm_nr_eff(i2)); *' animal waste management diff --git a/modules/53_methane/ipcc2006_aug22/equations.gms b/modules/53_methane/ipcc2006_aug22/equations.gms index 43c572e114..04ba5913bb 100644 --- a/modules/53_methane/ipcc2006_aug22/equations.gms +++ b/modules/53_methane/ipcc2006_aug22/equations.gms @@ -69,4 +69,4 @@ q53_emissions_resid_burn(i2) .. vm_emissions_reg(i2,"resid_burn","ch4") =e= - sum(kcr, vm_res_ag_burn(i2,kcr,"dm")) * s53_ef_ch4_res_ag_burn; + sum((kcr,w), vm_res_ag_burn(i2,kcr,w,"dm")) * s53_ef_ch4_res_ag_burn; diff --git a/modules/56_ghg_policy/price_aug22/input.gms b/modules/56_ghg_policy/price_aug22/input.gms index 164f887f84..e57b0a549e 100644 --- a/modules/56_ghg_policy/price_aug22/input.gms +++ b/modules/56_ghg_policy/price_aug22/input.gms @@ -58,7 +58,6 @@ sets pollutants_fader(pollutants) pollutants affected by GHG policy fader / co2_c, ch4, n2o_n_direct, n2o_n_indirect, nh3_n, no2_n, no3_n / - ; scalars diff --git a/modules/59_som/cellpool_jan23/declarations.gms b/modules/59_som/cellpool_jan23/declarations.gms index fd21f13631..e724c5d907 100644 --- a/modules/59_som/cellpool_jan23/declarations.gms +++ b/modules/59_som/cellpool_jan23/declarations.gms @@ -28,9 +28,9 @@ equations q59_som_target_cropland(j) Estimates the long-term target state of cropland (mio. tC) q59_som_target_noncropland(j,noncropland59) Estimates the long-term target state of noncropland (mio. tC) q59_som_pool(j,land) Actual C pool (mio. tC) - q59_nr_som(j) Soil organic matter loss (Mt N per yr) - q59_nr_som_fertilizer(j) Bound of nitrogen fertilizer of soil organic matter loss (Mt N per yr) - q59_nr_som_fertilizer2(j) Fraction of soil organic matter loss take is taken up by plants (Mt N per yr) + q59_nr_som(i) Soil organic matter loss (Mt N per yr) + q59_nr_som_fertilizer(i) Bound of nitrogen fertilizer of soil organic matter loss (Mt N per yr) + q59_nr_som_fertilizer2(i) Fraction of soil organic matter loss take is taken up by plants (Mt N per yr) q59_carbon_soil(j,land,stockType) Soil carbon content calculation (mio. tC) q59_cost_scm(j) Recurring cost for soil carbon management on cropland (mio. USD17MER per yr) ; @@ -42,8 +42,8 @@ positive variables ; variables - vm_nr_som(j) Release of soil organic matter (Mt N per yr) - vm_nr_som_fertilizer(j) Uptake of soil organic matter from plants (Mt N per yr) + vm_nr_som(i) Release of soil organic matter (Mt N per yr) + vm_nr_som_fertilizer(i) Uptake of soil organic matter from plants (Mt N per yr) ; *#################### R SECTION START (OUTPUT DECLARATIONS) #################### @@ -51,14 +51,14 @@ parameters ov59_som_target(t,j,land,type) Long-term target state of C pool (mio. tC) ov59_som_pool(t,j,land,type) Soil organic matter pool (mio. tC) ov_cost_scm(t,j,type) Recurring cost for soil carbon management on cropland (mio. USD17MER per yr) - ov_nr_som(t,j,type) Release of soil organic matter (Mt N per yr) - ov_nr_som_fertilizer(t,j,type) Uptake of soil organic matter from plants (Mt N per yr) + ov_nr_som(t,i,type) Release of soil organic matter (Mt N per yr) + ov_nr_som_fertilizer(t,i,type) Uptake of soil organic matter from plants (Mt N per yr) oq59_som_target_cropland(t,j,type) Estimates the long-term target state of cropland (mio. tC) oq59_som_target_noncropland(t,j,noncropland59,type) Estimates the long-term target state of noncropland (mio. tC) oq59_som_pool(t,j,land,type) Actual C pool (mio. tC) - oq59_nr_som(t,j,type) Soil organic matter loss (Mt N per yr) - oq59_nr_som_fertilizer(t,j,type) Bound of nitrogen fertilizer of soil organic matter loss (Mt N per yr) - oq59_nr_som_fertilizer2(t,j,type) Fraction of soil organic matter loss take is taken up by plants (Mt N per yr) + oq59_nr_som(t,i,type) Soil organic matter loss (Mt N per yr) + oq59_nr_som_fertilizer(t,i,type) Bound of nitrogen fertilizer of soil organic matter loss (Mt N per yr) + oq59_nr_som_fertilizer2(t,i,type) Fraction of soil organic matter loss take is taken up by plants (Mt N per yr) oq59_carbon_soil(t,j,land,stockType,type) Soil carbon content calculation (mio. tC) oq59_cost_scm(t,j,type) Recurring cost for soil carbon management on cropland (mio. USD17MER per yr) ; diff --git a/modules/59_som/cellpool_jan23/equations.gms b/modules/59_som/cellpool_jan23/equations.gms index f9de344608..341c6ae543 100644 --- a/modules/59_som/cellpool_jan23/equations.gms +++ b/modules/59_som/cellpool_jan23/equations.gms @@ -66,37 +66,34 @@ q59_carbon_soil(j2,land,stockType) .. *' The annual nitrogen release (or sink) for cropland soils is than *' calculated by the loss of soil organic carbon given by -q59_nr_som(j2) .. - vm_nr_som(j2) - =e= sum(ct,i59_lossrate(ct))/m_timestep_length*1/15 - * (sum((ct,land_from), p59_carbon_density(ct,j2,land_from) * - vm_lu_transitions(j2,land_from,"crop")) - - v59_som_target(j2,"crop")) +q59_nr_som(i2) .. + vm_nr_som(i2) + =e= sum(ct, i59_lossrate(ct)) / m_timestep_length * 1/15 * + sum(cell(i2, j2), sum((ct, land_from), p59_carbon_density(ct, j2, land_from) * + vm_lu_transitions(j2, land_from, "crop")) - v59_som_target(j2, "crop")) ; *' with the carbon to nitrogen ratio of soils assumed to be 15:1. *' The amount of nitrogen that becomes available to cropland farming is *' limited by loss of soil organic matter by -q59_nr_som_fertilizer(j2) .. - vm_nr_som_fertilizer(j2) +q59_nr_som_fertilizer(i2) .. + vm_nr_som_fertilizer(i2) =l= - vm_nr_som(j2); + vm_nr_som(i2); *' as well as by the amount that crops can take up -q59_nr_som_fertilizer2(j2) .. - vm_nr_som_fertilizer(j2) +q59_nr_som_fertilizer2(i2) .. + vm_nr_som_fertilizer(i2) =l= - vm_landexpansion(j2,"crop") * s59_nitrogen_uptake; + sum(cell(i2, j2), vm_landexpansion(j2, "crop")) * s59_nitrogen_uptake; *' Here we assume a maximum of 200 kg on the expanded area. - *' Cost for soil carbon management are based on a per hectare value q59_cost_scm(j2) .. vm_cost_scm(j2) =e= sum((kcr,w), vm_area(j2,kcr,w)) * sum(ct, i59_scm_target(ct,j2)) * s59_cost_scm_recur; - diff --git a/modules/59_som/cellpool_jan23/not_used.txt b/modules/59_som/cellpool_jan23/not_used.txt index a62a4ec738..51ff495d51 100644 --- a/modules/59_som/cellpool_jan23/not_used.txt +++ b/modules/59_som/cellpool_jan23/not_used.txt @@ -1,2 +1,3 @@ name,type,reason +vm_res_recycling,input,questionnaire vm_land_other,input,not needed diff --git a/modules/59_som/cellpool_jan23/postsolve.gms b/modules/59_som/cellpool_jan23/postsolve.gms index ea42e490a4..0cb2b6e5ca 100644 --- a/modules/59_som/cellpool_jan23/postsolve.gms +++ b/modules/59_som/cellpool_jan23/postsolve.gms @@ -13,53 +13,53 @@ pc59_carbon_density(j,land)$(pc59_land_before(j,land) > 1e-10) = pc59_som_pool(j ov59_som_target(t,j,land,"marginal") = v59_som_target.m(j,land); ov59_som_pool(t,j,land,"marginal") = v59_som_pool.m(j,land); ov_cost_scm(t,j,"marginal") = vm_cost_scm.m(j); - ov_nr_som(t,j,"marginal") = vm_nr_som.m(j); - ov_nr_som_fertilizer(t,j,"marginal") = vm_nr_som_fertilizer.m(j); + ov_nr_som(t,i,"marginal") = vm_nr_som.m(i); + ov_nr_som_fertilizer(t,i,"marginal") = vm_nr_som_fertilizer.m(i); oq59_som_target_cropland(t,j,"marginal") = q59_som_target_cropland.m(j); oq59_som_target_noncropland(t,j,noncropland59,"marginal") = q59_som_target_noncropland.m(j,noncropland59); oq59_som_pool(t,j,land,"marginal") = q59_som_pool.m(j,land); - oq59_nr_som(t,j,"marginal") = q59_nr_som.m(j); - oq59_nr_som_fertilizer(t,j,"marginal") = q59_nr_som_fertilizer.m(j); - oq59_nr_som_fertilizer2(t,j,"marginal") = q59_nr_som_fertilizer2.m(j); + oq59_nr_som(t,i,"marginal") = q59_nr_som.m(i); + oq59_nr_som_fertilizer(t,i,"marginal") = q59_nr_som_fertilizer.m(i); + oq59_nr_som_fertilizer2(t,i,"marginal") = q59_nr_som_fertilizer2.m(i); oq59_carbon_soil(t,j,land,stockType,"marginal") = q59_carbon_soil.m(j,land,stockType); oq59_cost_scm(t,j,"marginal") = q59_cost_scm.m(j); ov59_som_target(t,j,land,"level") = v59_som_target.l(j,land); ov59_som_pool(t,j,land,"level") = v59_som_pool.l(j,land); ov_cost_scm(t,j,"level") = vm_cost_scm.l(j); - ov_nr_som(t,j,"level") = vm_nr_som.l(j); - ov_nr_som_fertilizer(t,j,"level") = vm_nr_som_fertilizer.l(j); + ov_nr_som(t,i,"level") = vm_nr_som.l(i); + ov_nr_som_fertilizer(t,i,"level") = vm_nr_som_fertilizer.l(i); oq59_som_target_cropland(t,j,"level") = q59_som_target_cropland.l(j); oq59_som_target_noncropland(t,j,noncropland59,"level") = q59_som_target_noncropland.l(j,noncropland59); oq59_som_pool(t,j,land,"level") = q59_som_pool.l(j,land); - oq59_nr_som(t,j,"level") = q59_nr_som.l(j); - oq59_nr_som_fertilizer(t,j,"level") = q59_nr_som_fertilizer.l(j); - oq59_nr_som_fertilizer2(t,j,"level") = q59_nr_som_fertilizer2.l(j); + oq59_nr_som(t,i,"level") = q59_nr_som.l(i); + oq59_nr_som_fertilizer(t,i,"level") = q59_nr_som_fertilizer.l(i); + oq59_nr_som_fertilizer2(t,i,"level") = q59_nr_som_fertilizer2.l(i); oq59_carbon_soil(t,j,land,stockType,"level") = q59_carbon_soil.l(j,land,stockType); oq59_cost_scm(t,j,"level") = q59_cost_scm.l(j); ov59_som_target(t,j,land,"upper") = v59_som_target.up(j,land); ov59_som_pool(t,j,land,"upper") = v59_som_pool.up(j,land); ov_cost_scm(t,j,"upper") = vm_cost_scm.up(j); - ov_nr_som(t,j,"upper") = vm_nr_som.up(j); - ov_nr_som_fertilizer(t,j,"upper") = vm_nr_som_fertilizer.up(j); + ov_nr_som(t,i,"upper") = vm_nr_som.up(i); + ov_nr_som_fertilizer(t,i,"upper") = vm_nr_som_fertilizer.up(i); oq59_som_target_cropland(t,j,"upper") = q59_som_target_cropland.up(j); oq59_som_target_noncropland(t,j,noncropland59,"upper") = q59_som_target_noncropland.up(j,noncropland59); oq59_som_pool(t,j,land,"upper") = q59_som_pool.up(j,land); - oq59_nr_som(t,j,"upper") = q59_nr_som.up(j); - oq59_nr_som_fertilizer(t,j,"upper") = q59_nr_som_fertilizer.up(j); - oq59_nr_som_fertilizer2(t,j,"upper") = q59_nr_som_fertilizer2.up(j); + oq59_nr_som(t,i,"upper") = q59_nr_som.up(i); + oq59_nr_som_fertilizer(t,i,"upper") = q59_nr_som_fertilizer.up(i); + oq59_nr_som_fertilizer2(t,i,"upper") = q59_nr_som_fertilizer2.up(i); oq59_carbon_soil(t,j,land,stockType,"upper") = q59_carbon_soil.up(j,land,stockType); oq59_cost_scm(t,j,"upper") = q59_cost_scm.up(j); ov59_som_target(t,j,land,"lower") = v59_som_target.lo(j,land); ov59_som_pool(t,j,land,"lower") = v59_som_pool.lo(j,land); ov_cost_scm(t,j,"lower") = vm_cost_scm.lo(j); - ov_nr_som(t,j,"lower") = vm_nr_som.lo(j); - ov_nr_som_fertilizer(t,j,"lower") = vm_nr_som_fertilizer.lo(j); + ov_nr_som(t,i,"lower") = vm_nr_som.lo(i); + ov_nr_som_fertilizer(t,i,"lower") = vm_nr_som_fertilizer.lo(i); oq59_som_target_cropland(t,j,"lower") = q59_som_target_cropland.lo(j); oq59_som_target_noncropland(t,j,noncropland59,"lower") = q59_som_target_noncropland.lo(j,noncropland59); oq59_som_pool(t,j,land,"lower") = q59_som_pool.lo(j,land); - oq59_nr_som(t,j,"lower") = q59_nr_som.lo(j); - oq59_nr_som_fertilizer(t,j,"lower") = q59_nr_som_fertilizer.lo(j); - oq59_nr_som_fertilizer2(t,j,"lower") = q59_nr_som_fertilizer2.lo(j); + oq59_nr_som(t,i,"lower") = q59_nr_som.lo(i); + oq59_nr_som_fertilizer(t,i,"lower") = q59_nr_som_fertilizer.lo(i); + oq59_nr_som_fertilizer2(t,i,"lower") = q59_nr_som_fertilizer2.lo(i); oq59_carbon_soil(t,j,land,stockType,"lower") = q59_carbon_soil.lo(j,land,stockType); oq59_cost_scm(t,j,"lower") = q59_cost_scm.lo(j); *##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/59_som/module.gms b/modules/59_som/module.gms index d73e072cfc..5566dda3f2 100644 --- a/modules/59_som/module.gms +++ b/modules/59_som/module.gms @@ -19,4 +19,5 @@ *###################### R SECTION START (MODULETYPES) ########################## $Ifi "%som%" == "cellpool_jan23" $include "./modules/59_som/cellpool_jan23/realization.gms" $Ifi "%som%" == "static_jan19" $include "./modules/59_som/static_jan19/realization.gms" +$Ifi "%som%" == "threepool_may23" $include "./modules/59_som/threepool_may23/realization.gms" *###################### R SECTION END (MODULETYPES) ############################ diff --git a/modules/59_som/static_jan19/declarations.gms b/modules/59_som/static_jan19/declarations.gms index 5d83f75915..27ea68eb42 100644 --- a/modules/59_som/static_jan19/declarations.gms +++ b/modules/59_som/static_jan19/declarations.gms @@ -12,10 +12,9 @@ parameters ; variables - vm_nr_som(j) Release of soil organic matter (Mt N per yr) - vm_nr_som_fertilizer(j) Uptake of soil organic matter from plants (Mt N per yr) + vm_nr_som(i) Release of soil organic matter (Mt N per yr) + vm_nr_som_fertilizer(i) Uptake of soil organic matter from plants (Mt N per yr) vm_cost_scm(j) Recurring cost for soil carbon management on cropland (mio. USD17MER per yr) - ; equations @@ -26,8 +25,8 @@ equations *#################### R SECTION START (OUTPUT DECLARATIONS) #################### parameters - ov_nr_som(t,j,type) Release of soil organic matter (Mt N per yr) - ov_nr_som_fertilizer(t,j,type) Uptake of soil organic matter from plants (Mt N per yr) + ov_nr_som(t,i,type) Release of soil organic matter (Mt N per yr) + ov_nr_som_fertilizer(t,i,type) Uptake of soil organic matter from plants (Mt N per yr) ov_cost_scm(t,j,type) Recurring cost for soil carbon management on cropland (mio. USD17MER per yr) oq59_soilcarbon_cropland(t,j,stockType,type) Cropland soil carbon content calculation (mio. tC) oq59_soilcarbon_regular(t,j,regularland59,stockType,type) Regular soil carbon content calculation (mio. tC) diff --git a/modules/59_som/static_jan19/not_used.txt b/modules/59_som/static_jan19/not_used.txt index c99b479c30..2339fceb81 100644 --- a/modules/59_som/static_jan19/not_used.txt +++ b/modules/59_som/static_jan19/not_used.txt @@ -5,3 +5,4 @@ pm_avl_cropland_iso,input,questionnaire vm_landexpansion,input,questionnaire vm_lu_transitions,input,questionnaire pm_climate_class,input,questionnaire +vm_res_recycling,input,questionnaire diff --git a/modules/59_som/static_jan19/postsolve.gms b/modules/59_som/static_jan19/postsolve.gms index 32fda876c4..c31e2c31d7 100644 --- a/modules/59_som/static_jan19/postsolve.gms +++ b/modules/59_som/static_jan19/postsolve.gms @@ -8,26 +8,26 @@ *#################### R SECTION START (OUTPUT DEFINITIONS) ##################### - ov_nr_som(t,j,"marginal") = vm_nr_som.m(j); - ov_nr_som_fertilizer(t,j,"marginal") = vm_nr_som_fertilizer.m(j); + ov_nr_som(t,i,"marginal") = vm_nr_som.m(i); + ov_nr_som_fertilizer(t,i,"marginal") = vm_nr_som_fertilizer.m(i); ov_cost_scm(t,j,"marginal") = vm_cost_scm.m(j); oq59_soilcarbon_cropland(t,j,stockType,"marginal") = q59_soilcarbon_cropland.m(j,stockType); oq59_soilcarbon_regular(t,j,regularland59,stockType,"marginal") = q59_soilcarbon_regular.m(j,regularland59,stockType); oq59_soilcarbon_other(t,j,stockType,"marginal") = q59_soilcarbon_other.m(j,stockType); - ov_nr_som(t,j,"level") = vm_nr_som.l(j); - ov_nr_som_fertilizer(t,j,"level") = vm_nr_som_fertilizer.l(j); + ov_nr_som(t,i,"level") = vm_nr_som.l(i); + ov_nr_som_fertilizer(t,i,"level") = vm_nr_som_fertilizer.l(i); ov_cost_scm(t,j,"level") = vm_cost_scm.l(j); oq59_soilcarbon_cropland(t,j,stockType,"level") = q59_soilcarbon_cropland.l(j,stockType); oq59_soilcarbon_regular(t,j,regularland59,stockType,"level") = q59_soilcarbon_regular.l(j,regularland59,stockType); oq59_soilcarbon_other(t,j,stockType,"level") = q59_soilcarbon_other.l(j,stockType); - ov_nr_som(t,j,"upper") = vm_nr_som.up(j); - ov_nr_som_fertilizer(t,j,"upper") = vm_nr_som_fertilizer.up(j); + ov_nr_som(t,i,"upper") = vm_nr_som.up(i); + ov_nr_som_fertilizer(t,i,"upper") = vm_nr_som_fertilizer.up(i); ov_cost_scm(t,j,"upper") = vm_cost_scm.up(j); oq59_soilcarbon_cropland(t,j,stockType,"upper") = q59_soilcarbon_cropland.up(j,stockType); oq59_soilcarbon_regular(t,j,regularland59,stockType,"upper") = q59_soilcarbon_regular.up(j,regularland59,stockType); oq59_soilcarbon_other(t,j,stockType,"upper") = q59_soilcarbon_other.up(j,stockType); - ov_nr_som(t,j,"lower") = vm_nr_som.lo(j); - ov_nr_som_fertilizer(t,j,"lower") = vm_nr_som_fertilizer.lo(j); + ov_nr_som(t,i,"lower") = vm_nr_som.lo(i); + ov_nr_som_fertilizer(t,i,"lower") = vm_nr_som_fertilizer.lo(i); ov_cost_scm(t,j,"lower") = vm_cost_scm.lo(j); oq59_soilcarbon_cropland(t,j,stockType,"lower") = q59_soilcarbon_cropland.lo(j,stockType); oq59_soilcarbon_regular(t,j,regularland59,stockType,"lower") = q59_soilcarbon_regular.lo(j,regularland59,stockType); diff --git a/modules/59_som/static_jan19/presolve.gms b/modules/59_som/static_jan19/presolve.gms index d6dc9d883d..a77f489790 100644 --- a/modules/59_som/static_jan19/presolve.gms +++ b/modules/59_som/static_jan19/presolve.gms @@ -5,14 +5,13 @@ *** | MAgPIE License Exception, version 1.0 (see LICENSE file). *** | Contact: magpie@pik-potsdam.de -vm_nr_som.fx(j) = 0; -vm_nr_som_fertilizer.fx(j) = 0; +vm_nr_som.fx(i) = 0; +vm_nr_som_fertilizer.fx(i) = 0; i59_nr_som_exogenous_per_ha(t,i) = 0; $if "%c59_exo_scen%" == "constant" i59_nr_som_exogenous_per_ha(t,i)$(sum(cell(i,j),pcm_land(j,"crop")) > 0) = f59_som_exogenous(t,i,"constant")/sum(cell(i,j),pcm_land(j,"crop")); $if "%c59_exo_scen%" == "fadeout_2050" i59_nr_som_exogenous_per_ha(t,i)$(sum(cell(i,j),pcm_land(j,"crop")) > 0) = f59_som_exogenous(t,i,"fadeout_2050")/sum(cell(i,j),pcm_land(j,"crop")); -vm_nr_som.fx(j) = sum(cell(i,j),i59_nr_som_exogenous_per_ha(t,i)*pcm_land(j,"crop")); -vm_nr_som_fertilizer.fx(j) = sum(cell(i,j),i59_nr_som_exogenous_per_ha(t,i)*pcm_land(j,"crop")); - +vm_nr_som.fx(i) = i59_nr_som_exogenous_per_ha(t, i) * sum(cell(i,j), pcm_land(j, "crop")); +vm_nr_som_fertilizer.fx(i) = i59_nr_som_exogenous_per_ha(t, i) * sum(cell(i,j), pcm_land(j, "crop")); vm_cost_scm.fx(j) = 0; diff --git a/modules/59_som/threepool_cell_apr25/declarations.gms b/modules/59_som/threepool_cell_apr25/declarations.gms new file mode 100644 index 0000000000..783934e056 --- /dev/null +++ b/modules/59_som/threepool_cell_apr25/declarations.gms @@ -0,0 +1,74 @@ +*** | (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 + i59_cinput_multiplier_residue(j, sPools59, kcr) Carbon input to soil pool input multipliers (1) + i59_topsoilc_decay_max1(t, j, sPools59, w, tillage59) Soil decay rates for all SOC sub-pools per year cut at 1 (1) + pc59_topsoilc_decay_timestep(j, sPools59, w, tillage59) Soil decay rates for all SOC sub-pools per time steps length (1) + p59_topsoilc_density_pre(t_all, j, land, sPools59) Soil carbon density of the upper layer per hectare before solve (tC per ha) + p59_topsoilc_density_post(t_all, j, land, sPools59) Soil carbon density of the upper layer per hectare after solve (tC per ha) + p59_topsoilc_actualstate(j, land, sPools59) Actual soil carbon stock per land type (mio. tC) + p59_topsoilc_naturalstate(t_all, j, land, sPools59) Natural soil carbon stock per land type (mio. tC) + pc59_topsoilc_natural_steadystate(j, land, sPools59) Natural steady state soil carbon stpock (mio. tC) + pc59_topsoilc_naturalstate_previous(j, land, sPools59) Natural state of the time step before (mio. tC) + i59_subsoilc_density(t_all,j) Subsoil carbon density of per hectare (tC per ha) + p59_land_before(j,land) Land area in previous time step (mio. ha) +; + +equations + q59_steadystate_term_crop(j, sPools59, w, tillage59) Steady-state for SOC stock on cropland (mio. tC) + q59_previousstate_term_crop(j, sPools59, w, tillage59) bla + q59_lutransitions_to_cropareas(j, noncropland59) bla + q59_actualstate_crop(j, sPools59) bla + q59_steadystate_term_noncrop(j, noncropland59, sPools59) bla + q59_previousstate_term_noncrop(j, noncropland59, sPools59) Steady-state for SOC on various non-cropland types (mio. tC) + q59_actualstate_noncrop(j, noncropland59, sPools59) bla + q59_carbon_soil(j, land, stockType) bla + q59_nr_som(i) bla + q59_nr_som_fertilizer2(i) bla + q59_nr_som_fertilizer(i) bla +; + +positive variables + v59_topsoilc_crop_steadystate(j, sPools59, w, tillage59) bla + v59_topsoilc_noncrop_steadystate(j, noncropland59, sPools59) bla + v59_topsoilc_crop_previousstate(j, sPools59, w, tillage59) bla + v59_cropland_transitions(j, tillage59, w, noncropland59) bla + v59_topsoilc_noncrop_previousstate(j, noncropland59, sPools59) bla + v59_topsoilc_actualstate(j, land, sPools59) bla + vm_cost_scm(j) Recurring cost for soil carbon management on cropland (mio. USD17MER per yr) +; + +variables + vm_nr_som(i) Release of soil organic matter (Mt N per yr) + vm_nr_som_fertilizer(i) Uptake of soil organic matter from plants (Mt N per yr) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov59_topsoilc_crop_steadystate(t,i,sPools59,w,tillage59,type) bla + ov59_topsoilc_noncrop_steadystate(t,i,noncropland59,sPools59,type) bla + ov59_topsoilc_crop_previousstate(t,i,sPools59,w,tillage59,type) bla + ov59_cropland_transitions(t,i,tillage59,w,noncropland59,type) bla + ov59_topsoilc_noncrop_previousstate(t,i,noncropland59,sPools59,type) bla + ov59_topsoilc_actualstate(t,i,land,sPools59,type) bla + ov_cost_scm(t,j,type) Recurring cost for soil carbon management on cropland (mio. USD17MER per yr) + ov_nr_som(t,i,type) Release of soil organic matter (Mt N per yr) + ov_nr_som_fertilizer(t,i,type) Uptake of soil organic matter from plants (Mt N per yr) + oq59_steadystate_term_crop(t,i,sPools59,w,tillage59,type) Steady-state for SOC stock on cropland (mio. tC) + oq59_previousstate_term_crop(t,i,sPools59,w,tillage59,type) bla + oq59_lutransitions_to_cropareas(t,i,noncropland59,type) bla + oq59_actualstate_crop(t,i,sPools59,type) bla + oq59_steadystate_term_noncrop(t,i,noncropland59,sPools59,type) bla + oq59_previousstate_term_noncrop(t,i,noncropland59,sPools59,type) Steady-state for SOC on various non-cropland types (mio. tC) + oq59_actualstate_noncrop(t,i,noncropland59,sPools59,type) bla + oq59_carbon_soil(t,i,land,stockType,type) bla + oq59_nr_som(t,i,type) bla + oq59_nr_som_fertilizer2(t,i,type) bla + oq59_nr_som_fertilizer(t,i,type) bla +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/59_som/threepool_cell_apr25/equations.gms b/modules/59_som/threepool_cell_apr25/equations.gms new file mode 100644 index 0000000000..97615da8f8 --- /dev/null +++ b/modules/59_som/threepool_cell_apr25/equations.gms @@ -0,0 +1,120 @@ +*** | (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 + +*' For every cell a new equilibrium value for the soil organic carbon pool +*' on cropland is calculated as the sum over all crop types and irrigation regimes via + +q59_steadystate_term_crop(j2, sPools59, w, tillage59) .. + v59_topsoilc_crop_steadystate(j2, sPools59, w, tillage59) =e= + sum(kcr_tillage59(kcr, tillage59), vm_res_recycling(j2, kcr, w, "c") * + i59_cinput_multiplier_residue(j2, sPools59, kcr)) / + sum(ct, f59_topsoilc_decay(ct, j2, sPools59, w, tillage59)); + +*' as well as for all non cropland via + +q59_steadystate_term_noncrop(j2, noncropland59, sPools59) .. + v59_topsoilc_noncrop_steadystate(j2, noncropland59, sPools59) =e= + sum(ct, f59_litter_input(ct, j2, sPools59) / + f59_topsoilc_decay(ct, j2, sPools59, "rainfed", "notill")) * + vm_land(j2, noncropland59); + +*' To account for land-use transitions the previous carbon stocks has to be adjusted +*' to calculate the new actual carbon stocks. Previous stocks are thus given by +*' the carbons stocks of current cropland plus the carbon offset (plus or minus) +*' from area being non-cropland in the time step before. +*' For cropland the previous SOC state after accounting for transitions is given by + +q59_previousstate_term_crop(j2, sPools59, w, tillage59) .. + v59_topsoilc_crop_previousstate(j2, sPools59, w, tillage59) + =e= sum(ct, p59_topsoilc_density_pre(ct, j2, "crop", sPools59) * + sum(kcr_tillage59(kcr, tillage59), vm_area(j2, kcr, w))) + + sum((ct, noncropland59), (p59_topsoilc_density_pre(ct, j2, noncropland59, sPools59) - + p59_topsoilc_density_pre(ct, j2, "crop", sPools59)) * + v59_cropland_transitions(j2, tillage59, w, noncropland59)); + +*' with v59_cropland_transitions being a helper variable that translates cropland transitions +*' in to tillage- and irrigation-type-specific SOC transfers via +*** STILL TO FIX + +q59_lutransitions_to_cropareas(j2, noncropland59) .. + sum((tillage59, w), v59_cropland_transitions(j2, tillage59, w, noncropland59)) =e= + vm_lu_transitions(j2, noncropland59, "crop"); + +*' The previous SOC state on non-cropland after accounting for land-use transition is not +*' tillage- and irrgations-type-specific and thus given by + +q59_previousstate_term_noncrop(j2, noncropland59, sPools59) .. + v59_topsoilc_noncrop_previousstate(j2, noncropland59, sPools59) + =e= sum((ct, land_from), p59_topsoilc_density_pre(ct, j2, land_from, sPools59) * + vm_lu_transitions(j2, land_from, noncropland59)); + +*' Following the 2019-Refinement of the IPCC guidelines 2006 for cropland the actual state +*' can be calculated via + +q59_actualstate_crop(j2, sPools59) .. + v59_topsoilc_actualstate(j2, "crop", sPools59) + =e= sum((tillage59, w), v59_topsoilc_crop_previousstate(j2, sPools59, w, tillage59) * + (1 - pc59_topsoilc_decay_timestep(j2, sPools59, w, tillage59))) + + sum((tillage59, w), v59_topsoilc_crop_steadystate(j2, sPools59, w, tillage59) * + pc59_topsoilc_decay_timestep(j2, sPools59, w, tillage59)) + ; + +*' for cropland and via + +q59_actualstate_noncrop(j2, noncropland59, sPools59) .. + v59_topsoilc_actualstate(j2, noncropland59, sPools59) + =e= v59_topsoilc_noncrop_previousstate(j2, noncropland59, sPools59) * + (1 - pc59_topsoilc_decay_timestep(j2, sPools59, "rainfed", "notill")) + + v59_topsoilc_noncrop_steadystate(j2, noncropland59, sPools59) * + pc59_topsoilc_decay_timestep(j2, sPools59, "rainfed", "notill") + ; + +*' for non-cropland. + +*' The soil carbon content of the whole soil profile is than calculated as sum of actual topsoil pool +*' and the reference soil carbon pool of the subsoil, that is assumed to be unaffected by human management: + +q59_carbon_soil(j2, land, stockType) .. + vm_carbon_stock(j2, land, "soilc", stockType) + =e= sum(sPools59, v59_topsoilc_actualstate(j2, land, sPools59)) + + vm_land(j2, land) * sum(ct, i59_subsoilc_density(ct, j2)); + +*' Note, that as long as the three pool soil model is on regional scale, cluster scale soil carbon stocks +*' are not meaningful. + +*' The annual nitrogen release (or sink) for cropland soils is than +*' calculated by the loss of soil organic carbon given by + +q59_nr_som(i2) .. + vm_nr_som(i2) + =e= sum(cell(i2,j2), 1/m_timestep_length_forestry * 1/15 * sum((tillage59, w, sPools59), + (v59_topsoilc_crop_previousstate(j2, sPools59, w, tillage59) - + v59_topsoilc_crop_steadystate(j2, sPools59, w, tillage59)) + * pc59_topsoilc_decay_timestep(j2, sPools59, w, tillage59))) + ; + +*' with the carbon to nitrogen ratio of soils assumed to be 15:1. + +*' The amount of nitrogen that becomes available to cropland farming is +*' limited by loss of soil organic matter by + +q59_nr_som_fertilizer(i2) .. + vm_nr_som_fertilizer(i2) + =l= + vm_nr_som(i2); + +*' as well as by the amount that crops can take up + +q59_nr_som_fertilizer2(i2) .. + vm_nr_som_fertilizer(i2) + =l= + sum(cell(i2,j2), vm_landexpansion(j2,"crop")) * s59_nitrogen_uptake; + +*' Here we assume a maximum of 200 kg on the expanded area. diff --git a/modules/59_som/threepool_cell_apr25/input.gms b/modules/59_som/threepool_cell_apr25/input.gms new file mode 100644 index 0000000000..9fb9092a3e --- /dev/null +++ b/modules/59_som/threepool_cell_apr25/input.gms @@ -0,0 +1,82 @@ +*** | (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 + s59_nitrogen_uptake Maximum plant available nitrogen from soil organic matter loss (tN per ha) / 0.2 / +; + +$setglobal c59_som_scenario cc +* options: cc (climate change) +* nocc (no climate change) +* nocc_hist (no climate change after year defined by sm_fix_cc) + +parameters f59_topsoilc_density(t_all,j) LPJ topsoil carbon density for natural vegetation (tC per ha) +/ +$ondelim +$include "./modules/59_som/input/lpj_carbon_topsoil.cs2b" +$offdelim +/ +; +$if "%c59_som_scenario%" == "nocc" f59_topsoilc_density(t_all,j) = f59_topsoilc_density("y1995",j); +$if "%c59_som_scenario%" == "nocc_hist" f59_topsoilc_density(t_all,j)$(m_year(t_all) > sm_fix_cc) = f59_topsoilc_density(t_all,j)$(m_year(t_ai) = sm_fix_cc); +m_fillmissingyears(f59_topsoilc_density,"j"); + + +table f59_cinput_multiplier_residue(j,sPools59,kcr,tillage59) LPJ topsoil carbon density for natural vegetation (tC per ha) +$ondelim +$include "./modules/59_som/threepool_cell_apr25/input/f59_cinput_multiplier_residue.cs3" +$offdelim +; + +table f59_cinput_multiplier_manure(j,sPools59,kli,tillage59) LPJ topsoil carbon density for natural vegetation (tC per ha) +$ondelim +$include "./modules/59_som/threepool_cell_apr25/input/f59_cinput_multiplier_manure.cs3" +$offdelim +; + + +table f59_litter_input(t_all,j,sPools59) LPJ topsoil carbon density for natural vegetation (tC per ha) +$ondelim +$include "./modules/59_som/threepool_cell_apr25/input/f59_litter_input.cs3" +$offdelim +; +$if "%c59_som_scenario%" == "nocc" + f59_litter_input(t_all,j,sPools59) = f59_litter_input("y1995",j,sPools59); +$if "%c59_som_scenario%" == "nocc_hist" + f59_litter_input(t_all,j,sPools59)$(m_year(t_all) > sm_fix_cc) = f59_litter_input(t_all,j,sPools59)$(m_year(t_ai) = sm_fix_cc); +m_fillmissingyears(f59_litter_input,"j,sPools59"); + + +table f59_topsoilc_decay(t_all,j,sPools59,w,tillage59) Soil decay rates for all SOC sub-pools per year (1) +$ondelim +$include "./modules/59_som/threepool_cell_apr25/input/f59_topsoilc_decay.cs3" +$offdelim +; +$if "%c59_som_scenario%" == "nocc" + f59_topsoilc_decay(t_all,j,sPools59,w,tillage59) = f59_topsoilc_decay("y1995",j,sPools59,w,tillage59); +$if "%c59_som_scenario%" == "nocc_hist" + f59_topsoilc_decay(t_all,j,sPools59,w,tillage59)$(m_year(t_all) > sm_fix_cc) = f59_topsoilc_decay(t_all,j,sPools59,w,tillage59)$(m_year(t_ai) = sm_fix_cc); +m_fillmissingyears(f59_topsoilc_decay,"j,sPools59,w,tillage59"); + + +table f59_topsoilc_actualstate(j,sPools59,lutypes59) LPJ topsoil carbon for different pools and lu types(million tC) +$ondelim +$include "./modules/59_som/threepool_cell_apr25/input/f59_topsoilc_actualstate.cs3" +$offdelim +; + +table f59_topsoilc_naturalstate(j,sPools59,lutypes59) LPJ natural topsoil carbon for different pools and lu types(million tC) +$ondelim +$include "./modules/59_som/threepool_cell_apr25/input/f59_topsoilc_naturalstate.cs3" +$offdelim +; + +table f59_land_y1990(t_pre59,j,land) land use in y1990 (million ha) +$ondelim +$include "./modules/59_som/threepool_cell_apr25/input/f59_land_y1990.cs3" +$offdelim +; diff --git a/modules/59_som/threepool_cell_apr25/input/files b/modules/59_som/threepool_cell_apr25/input/files new file mode 100644 index 0000000000..683cbbe074 --- /dev/null +++ b/modules/59_som/threepool_cell_apr25/input/files @@ -0,0 +1,8 @@ +* list of files that are required here +f59_land_y1990.cs3 +f59_cinput_multiplier_residue.cs3 +f59_cinput_multiplier_manure.cs3 +f59_litter_input.cs3 +f59_topsoilc_decay.cs3 +f59_topsoilc_actualstate.cs3 +f59_topsoilc_naturalstate.cs3 diff --git a/modules/59_som/threepool_cell_apr25/not_used.txt b/modules/59_som/threepool_cell_apr25/not_used.txt new file mode 100644 index 0000000000..1d37eb479c --- /dev/null +++ b/modules/59_som/threepool_cell_apr25/not_used.txt @@ -0,0 +1,7 @@ +name,type,reason +fm_croparea,input,questionnaire +pm_climate_class,input,questionnaire +vm_fallow,input,questionnaire +vm_treecover,input,not_used +vm_land_other,input,not_used +pm_avl_cropland_iso,input,nou_used diff --git a/modules/59_som/threepool_cell_apr25/postsolve.gms b/modules/59_som/threepool_cell_apr25/postsolve.gms new file mode 100644 index 0000000000..51826b9c06 --- /dev/null +++ b/modules/59_som/threepool_cell_apr25/postsolve.gms @@ -0,0 +1,111 @@ +*** | (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 + +p59_topsoilc_actualstate(j, land, sPools59) = v59_topsoilc_actualstate.l(j, land, sPools59); +p59_topsoilc_density_post(t, j, land, sPools59)$(pcm_land(j,land) > 1e-10) = + p59_topsoilc_actualstate(j, land, sPools59) / pcm_land(j,land); +p59_land_before(j,land) = vm_land.l(j,land); + +**** natural stock calculations + +pc59_topsoilc_natural_steadystate(j, land, sPools59) = + f59_litter_input(t, j, sPools59) / + f59_topsoilc_decay(t, j, sPools59, "rainfed", "notill") * + vm_land.l(j, land); + +p59_topsoilc_naturalstate(t, j, land, sPools59) = + pc59_topsoilc_naturalstate_previous(j, land, sPools59) * + (1 - pc59_topsoilc_decay_timestep(j, sPools59, "rainfed", "notill")) + + pc59_topsoilc_natural_steadystate(j, land, sPools59) * + pc59_topsoilc_decay_timestep(j, sPools59, "rainfed", "notill"); + + +pc59_topsoilc_naturalstate_previous(j, land, sPools59) = + p59_topsoilc_naturalstate(t, j, land, sPools59); + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov59_topsoilc_crop_steadystate(t,j,sPools59,w,tillage59,"marginal") = v59_topsoilc_crop_steadystate.m(j,sPools59,w,tillage59); + ov59_topsoilc_noncrop_steadystate(t,j,noncropland59,sPools59,"marginal") = v59_topsoilc_noncrop_steadystate.m(j,noncropland59,sPools59); + ov59_topsoilc_crop_previousstate(t,j,sPools59,w,tillage59,"marginal") = v59_topsoilc_crop_previousstate.m(j,sPools59,w,tillage59); + ov59_cropland_transitions(t,j,tillage59,w,noncropland59,"marginal") = v59_cropland_transitions.m(j,tillage59,w,noncropland59); + ov59_topsoilc_noncrop_previousstate(t,j,noncropland59,sPools59,"marginal") = v59_topsoilc_noncrop_previousstate.m(j,noncropland59,sPools59); + ov59_topsoilc_actualstate(t,j,land,sPools59,"marginal") = v59_topsoilc_actualstate.m(j,land,sPools59); + ov_cost_scm(t,j,"marginal") = vm_cost_scm.m(j); + ov_nr_som(t,j,"marginal") = vm_nr_som.m(i); + ov_nr_som_fertilizer(t,j,"marginal") = vm_nr_som_fertilizer.m(i); + oq59_steadystate_term_crop(t,j,sPools59,w,tillage59,"marginal") = q59_steadystate_term_crop.m(j,sPools59,w,tillage59); + oq59_previousstate_term_crop(t,j,sPools59,w,tillage59,"marginal") = q59_previousstate_term_crop.m(j,sPools59,w,tillage59); + oq59_lutransitions_to_cropareas(t,j,noncropland59,"marginal") = q59_lutransitions_to_cropareas.m(j,noncropland59); + oq59_actualstate_crop(t,j,sPools59,"marginal") = q59_actualstate_crop.m(j,sPools59); + oq59_steadystate_term_noncrop(t,j,noncropland59,sPools59,"marginal") = q59_steadystate_term_noncrop.m(j,noncropland59,sPools59); + oq59_previousstate_term_noncrop(t,j,noncropland59,sPools59,"marginal") = q59_previousstate_term_noncrop.m(j,noncropland59,sPools59); + oq59_actualstate_noncrop(t,j,noncropland59,sPools59,"marginal") = q59_actualstate_noncrop.m(j,noncropland59,sPools59); + oq59_carbon_soil(t,j,land,stockType,"marginal") = q59_carbon_soil.m(j,land,stockType); + oq59_nr_som(t,j,"marginal") = q59_nr_som.m(i); + oq59_nr_som_fertilizer2(t,j,"marginal") = q59_nr_som_fertilizer2.m(i); + oq59_nr_som_fertilizer(t,j,"marginal") = q59_nr_som_fertilizer.m(i); + ov59_topsoilc_crop_steadystate(t,j,sPools59,w,tillage59,"level") = v59_topsoilc_crop_steadystate.l(j,sPools59,w,tillage59); + ov59_topsoilc_noncrop_steadystate(t,j,noncropland59,sPools59,"level") = v59_topsoilc_noncrop_steadystate.l(j,noncropland59,sPools59); + ov59_topsoilc_crop_previousstate(t,j,sPools59,w,tillage59,"level") = v59_topsoilc_crop_previousstate.l(j,sPools59,w,tillage59); + ov59_cropland_transitions(t,j,tillage59,w,noncropland59,"level") = v59_cropland_transitions.l(j,tillage59,w,noncropland59); + ov59_topsoilc_noncrop_previousstate(t,j,noncropland59,sPools59,"level") = v59_topsoilc_noncrop_previousstate.l(j,noncropland59,sPools59); + ov59_topsoilc_actualstate(t,j,land,sPools59,"level") = v59_topsoilc_actualstate.l(j,land,sPools59); + ov_cost_scm(t,j,"level") = vm_cost_scm.l(j); + ov_nr_som(t,j,"level") = vm_nr_som.l(i); + ov_nr_som_fertilizer(t,j,"level") = vm_nr_som_fertilizer.l(i); + oq59_steadystate_term_crop(t,j,sPools59,w,tillage59,"level") = q59_steadystate_term_crop.l(j,sPools59,w,tillage59); + oq59_previousstate_term_crop(t,j,sPools59,w,tillage59,"level") = q59_previousstate_term_crop.l(j,sPools59,w,tillage59); + oq59_lutransitions_to_cropareas(t,j,noncropland59,"level") = q59_lutransitions_to_cropareas.l(j,noncropland59); + oq59_actualstate_crop(t,j,sPools59,"level") = q59_actualstate_crop.l(j,sPools59); + oq59_steadystate_term_noncrop(t,j,noncropland59,sPools59,"level") = q59_steadystate_term_noncrop.l(j,noncropland59,sPools59); + oq59_previousstate_term_noncrop(t,j,noncropland59,sPools59,"level") = q59_previousstate_term_noncrop.l(j,noncropland59,sPools59); + oq59_actualstate_noncrop(t,j,noncropland59,sPools59,"level") = q59_actualstate_noncrop.l(j,noncropland59,sPools59); + oq59_carbon_soil(t,j,land,stockType,"level") = q59_carbon_soil.l(j,land,stockType); + oq59_nr_som(t,j,"level") = q59_nr_som.l(i); + oq59_nr_som_fertilizer2(t,j,"level") = q59_nr_som_fertilizer2.l(i); + oq59_nr_som_fertilizer(t,j,"level") = q59_nr_som_fertilizer.l(i); + ov59_topsoilc_crop_steadystate(t,j,sPools59,w,tillage59,"upper") = v59_topsoilc_crop_steadystate.up(j,sPools59,w,tillage59); + ov59_topsoilc_noncrop_steadystate(t,j,noncropland59,sPools59,"upper") = v59_topsoilc_noncrop_steadystate.up(j,noncropland59,sPools59); + ov59_topsoilc_crop_previousstate(t,j,sPools59,w,tillage59,"upper") = v59_topsoilc_crop_previousstate.up(j,sPools59,w,tillage59); + ov59_cropland_transitions(t,j,tillage59,w,noncropland59,"upper") = v59_cropland_transitions.up(j,tillage59,w,noncropland59); + ov59_topsoilc_noncrop_previousstate(t,j,noncropland59,sPools59,"upper") = v59_topsoilc_noncrop_previousstate.up(j,noncropland59,sPools59); + ov59_topsoilc_actualstate(t,j,land,sPools59,"upper") = v59_topsoilc_actualstate.up(j,land,sPools59); + ov_cost_scm(t,j,"upper") = vm_cost_scm.up(j); + ov_nr_som(t,j,"upper") = vm_nr_som.up(i); + ov_nr_som_fertilizer(t,j,"upper") = vm_nr_som_fertilizer.up(i); + oq59_steadystate_term_crop(t,j,sPools59,w,tillage59,"upper") = q59_steadystate_term_crop.up(j,sPools59,w,tillage59); + oq59_previousstate_term_crop(t,j,sPools59,w,tillage59,"upper") = q59_previousstate_term_crop.up(j,sPools59,w,tillage59); + oq59_lutransitions_to_cropareas(t,j,noncropland59,"upper") = q59_lutransitions_to_cropareas.up(j,noncropland59); + oq59_actualstate_crop(t,j,sPools59,"upper") = q59_actualstate_crop.up(j,sPools59); + oq59_steadystate_term_noncrop(t,j,noncropland59,sPools59,"upper") = q59_steadystate_term_noncrop.up(j,noncropland59,sPools59); + oq59_previousstate_term_noncrop(t,j,noncropland59,sPools59,"upper") = q59_previousstate_term_noncrop.up(j,noncropland59,sPools59); + oq59_actualstate_noncrop(t,j,noncropland59,sPools59,"upper") = q59_actualstate_noncrop.up(j,noncropland59,sPools59); + oq59_carbon_soil(t,j,land,stockType,"upper") = q59_carbon_soil.up(j,land,stockType); + oq59_nr_som(t,j,"upper") = q59_nr_som.up(i); + oq59_nr_som_fertilizer2(t,j,"upper") = q59_nr_som_fertilizer2.up(i); + oq59_nr_som_fertilizer(t,j,"upper") = q59_nr_som_fertilizer.up(i); + ov59_topsoilc_crop_steadystate(t,j,sPools59,w,tillage59,"lower") = v59_topsoilc_crop_steadystate.lo(j,sPools59,w,tillage59); + ov59_topsoilc_noncrop_steadystate(t,j,noncropland59,sPools59,"lower") = v59_topsoilc_noncrop_steadystate.lo(j,noncropland59,sPools59); + ov59_topsoilc_crop_previousstate(t,j,sPools59,w,tillage59,"lower") = v59_topsoilc_crop_previousstate.lo(j,sPools59,w,tillage59); + ov59_cropland_transitions(t,j,tillage59,w,noncropland59,"lower") = v59_cropland_transitions.lo(j,tillage59,w,noncropland59); + ov59_topsoilc_noncrop_previousstate(t,j,noncropland59,sPools59,"lower") = v59_topsoilc_noncrop_previousstate.lo(j,noncropland59,sPools59); + ov59_topsoilc_actualstate(t,j,land,sPools59,"lower") = v59_topsoilc_actualstate.lo(j,land,sPools59); + ov_cost_scm(t,j,"lower") = vm_cost_scm.lo(j); + ov_nr_som(t,j,"lower") = vm_nr_som.lo(i); + ov_nr_som_fertilizer(t,j,"lower") = vm_nr_som_fertilizer.lo(i); + oq59_steadystate_term_crop(t,j,sPools59,w,tillage59,"lower") = q59_steadystate_term_crop.lo(j,sPools59,w,tillage59); + oq59_previousstate_term_crop(t,j,sPools59,w,tillage59,"lower") = q59_previousstate_term_crop.lo(j,sPools59,w,tillage59); + oq59_lutransitions_to_cropareas(t,j,noncropland59,"lower") = q59_lutransitions_to_cropareas.lo(j,noncropland59); + oq59_actualstate_crop(t,j,sPools59,"lower") = q59_actualstate_crop.lo(j,sPools59); + oq59_steadystate_term_noncrop(t,j,noncropland59,sPools59,"lower") = q59_steadystate_term_noncrop.lo(j,noncropland59,sPools59); + oq59_previousstate_term_noncrop(t,j,noncropland59,sPools59,"lower") = q59_previousstate_term_noncrop.lo(j,noncropland59,sPools59); + oq59_actualstate_noncrop(t,j,noncropland59,sPools59,"lower") = q59_actualstate_noncrop.lo(j,noncropland59,sPools59); + oq59_carbon_soil(t,j,land,stockType,"lower") = q59_carbon_soil.lo(j,land,stockType); + oq59_nr_som(t,j,"lower") = q59_nr_som.lo(i); + oq59_nr_som_fertilizer2(t,j,"lower") = q59_nr_som_fertilizer2.lo(i); + oq59_nr_som_fertilizer(t,j,"lower") = q59_nr_som_fertilizer.lo(i); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/59_som/threepool_cell_apr25/preloop.gms b/modules/59_som/threepool_cell_apr25/preloop.gms new file mode 100644 index 0000000000..8313f47e2b --- /dev/null +++ b/modules/59_som/threepool_cell_apr25/preloop.gms @@ -0,0 +1,33 @@ +*** | (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 + + +***************************** +*** SOC initialisation *** +***************************** + +i59_subsoilc_density(t_all, j) = + fm_carbon_density(t_all, j, "secdforest", "soilc") - f59_topsoilc_density(t_all, j); + + +pcm_carbon_stock(j, land, "soilc", stockType) = + fm_carbon_density("y1995", j, land, "soilc") * pm_land_start(j, land); + +vm_carbon_stock.l(j, land, "soilc", stockType) = + pcm_carbon_stock(j, land, "soilc", stockType); + +p59_land_before(j,land) = pm_land_start(j,land); + +***************************** +*** parameter dummies *** +***************************** + +i59_cinput_multiplier_residue(j,sPools59,kcr) = + sum(kcr2$(sameas(kcr,kcr2)), + sum(kcr_tillage59(kcr2,tillage59), + f59_cinput_multiplier_residue(j,sPools59,kcr,tillage59))); + diff --git a/modules/59_som/threepool_cell_apr25/presolve.gms b/modules/59_som/threepool_cell_apr25/presolve.gms new file mode 100644 index 0000000000..b82c033dda --- /dev/null +++ b/modules/59_som/threepool_cell_apr25/presolve.gms @@ -0,0 +1,65 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +vm_cost_scm.fx(j) = 0; + +* For the first time steps: +* Initializating of SOC pools in the different land types using the input from mrsoil + +* For all other time steps: +* SOM pools and densities will be updated after natural regrowth and disturbance loss accounting. +* The secondary forest pool will receive carbon from primary forest (due to natural disturbance) +* and from other land (due to regrowth). +* Note: This will only account for transitions of primary forest to secondary forest and +* other land to secondary forest. See current version of 35_natveg to check consistency. +* The helper parameter `p59_topsoilc_actualstate` is used to update `p59_topsoilc_density_pre` + +i59_topsoilc_decay_max1(t, j, sPools59, w, tillage59) = + min(1, f59_topsoilc_decay(t, j, sPools59, w, tillage59)); + +pc59_topsoilc_decay_timestep(j, sPools59, w, tillage59) = + 1 - (1 - i59_topsoilc_decay_max1(t, j, sPools59, w, tillage59)) ** m_yeardiff_forestry(t); + +if((ord(t) = 1), + + p59_topsoilc_density_pre("y1995", j, land, sPools59) = + sum(lutypes59_land(land, lutypes59), + f59_topsoilc_actualstate(j, sPools59, lutypes59) / + sum(lutypes59_land2(land2,lutypes59), f59_land_y1990("y1990", j, land2))); + + p59_topsoilc_density_post(t, j, land, sPools59) = 0; + p59_topsoilc_actualstate(j, land, sPools59) = 0; + + pc59_topsoilc_naturalstate_previous(j, land, sPools59) = + sum(lutypes59_land(land, lutypes59), + f59_topsoilc_naturalstate(j, sPools59, lutypes59) / + sum(lutypes59_land2(land2,lutypes59), f59_land_y1990("y1990", j, land2))) * + f59_land_y1990("y1990", j, land); + +else + + p59_topsoilc_actualstate(j, "secdforest", sPools59) = + p59_topsoilc_actualstate(j, "secdforest", sPools59) + + (p59_land_before(j, "primforest") - pcm_land(j, "primforest")) * + p59_topsoilc_density_post(t-1, j, "primforest", sPools59) + + (p59_land_before(j, "other") - pcm_land(j, "other")) * + p59_topsoilc_density_post(t-1, j, "other", sPools59); + + p59_topsoilc_actualstate(j, "other", sPools59) = + p59_topsoilc_actualstate(j, "other", sPools59) - + (p59_land_before(j, "other") - pcm_land(j, "other")) * + p59_topsoilc_density_post(t-1, j, "other", sPools59); + + p59_topsoilc_actualstate(j, "primforest", sPools59) = + p59_topsoilc_actualstate(j, "primforest", sPools59) - + (p59_land_before(j, "primforest") - pcm_land(j, "primforest")) * + p59_topsoilc_density_post(t-1, j, "primforest", sPools59); + + p59_topsoilc_density_pre(t, j, land, sPools59)$(pcm_land(j,land) > 1e-20) = + p59_topsoilc_actualstate(j, land, sPools59) / pcm_land(j,land); + +); diff --git a/modules/59_som/threepool_cell_apr25/realization.gms b/modules/59_som/threepool_cell_apr25/realization.gms new file mode 100644 index 0000000000..ddea7638b1 --- /dev/null +++ b/modules/59_som/threepool_cell_apr25/realization.gms @@ -0,0 +1,27 @@ +*** | (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 +*' The threepool_may23 realization is based on the Tier 2 approach of the revised IPCC +*' Guidelines for National Greenhouse Gas Inventories 2019 (@calvo_buendia_ipcc_2019). +*' It calculates the stock of soil carbon for all land-use types based on a reduced complexity +*' soil model driven by carbon inputs and decay rates depending on management decisions. + +*' @limitations tba + +*' @authors Kristine Karstens + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/59_som/threepool_may23/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/59_som/threepool_may23/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/59_som/threepool_may23/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/59_som/threepool_may23/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/59_som/threepool_may23/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/59_som/threepool_may23/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/59_som/threepool_may23/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/59_som/threepool_may23/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/59_som/threepool_cell_apr25/scaling.gms b/modules/59_som/threepool_cell_apr25/scaling.gms new file mode 100644 index 0000000000..dc08cc3205 --- /dev/null +++ b/modules/59_som/threepool_cell_apr25/scaling.gms @@ -0,0 +1,12 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +v59_topsoilc_crop_steadystate.scale(j,sPools59,w,tillage59) = 10e4; +v59_topsoilc_noncrop_steadystate.scale(j,noncropland59,sPools59) = 10e4; +v59_topsoilc_crop_previousstate.scale(j,sPools59,w,tillage59) = 10e4; +v59_topsoilc_noncrop_previousstate.scale(j,noncropland59,sPools59) = 10e4; +v59_topsoilc_actualstate.scale(j,land,sPools59) = 10e4; diff --git a/modules/59_som/threepool_cell_apr25/sets.gms b/modules/59_som/threepool_cell_apr25/sets.gms new file mode 100644 index 0000000000..2d9698275e --- /dev/null +++ b/modules/59_som/threepool_cell_apr25/sets.gms @@ -0,0 +1,63 @@ +*** | (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 + +t_pre59 Year of the previous time step + / y1990 / + +sPools59 soil pools +/ active, slow, passive / + +noncropland59(land) Soil carbon conserving landuse types +/ past, forestry, primforest, secdforest, other, urban / + +tillage59 Tillage categories of IPCC +/ fulltill, reducedtill, notill / + +lutypes59 Land-use types +/ crop, natveg / + +kcr_tillage59(kcr,tillage59) Climate classification types + / + begr .(reducedtill) "reduced tillage" + betr .(reducedtill) "reduced tillage" + cassav_sp .(fulltill) "full tillage" + cottn_pro .(fulltill) "full tillage" + foddr .(fulltill) "full tillage" + groundnut .(fulltill) "full tillage" + maiz .(fulltill) "full tillage" + oilpalm .(reducedtill) "reduced tillage" + others .(reducedtill) "reduced tillage" + potato .(fulltill) "full tillage" + puls_pro .(fulltill) "full tillage" + rapeseed .(fulltill) "full tillage" + rice_pro .(fulltill) "full tillage" + soybean .(fulltill) "full tillage" + sugr_beet .(fulltill) "full tillage" + sugr_cane .(reducedtill) "reduced tillage" + sunflower .(fulltill) "full tillage" + tece .(fulltill) "full tillage" + trce .(fulltill) "full tillage" + / + +lutypes59_land(land,lutypes59) Mapping land to soil model land classes + / + crop .(crop) "cropland" + past .(natveg) "potential natural vegetation" + forestry .(natveg) "potential natural vegetation" + primforest .(natveg) "potential natural vegetation" + secdforest .(natveg) "potential natural vegetation" + other .(natveg) "potential natural vegetation" + urban .(natveg) "potential natural vegetation" + / +; + +alias(noncropland59,noncropland59_2); +alias(land,land2); +alias(lutypes59_land,lutypes59_land2); +alias(kcr,kcr2); diff --git a/modules/59_som/threepool_reg_may23/declarations.gms b/modules/59_som/threepool_reg_may23/declarations.gms new file mode 100644 index 0000000000..748dbde2ae --- /dev/null +++ b/modules/59_som/threepool_reg_may23/declarations.gms @@ -0,0 +1,74 @@ +*** | (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 + i59_cinput_multiplier_residue(i, sPools59, kcr) Carbon input to soil pool input multipliers (1) + i59_topsoilc_decay_max1(t, i, sPools59, w, tillage59) Soil decay rates for all SOC sub-pools per year cut at 1 (1) + pc59_topsoilc_decay_timestep(i, sPools59, w, tillage59) Soil decay rates for all SOC sub-pools per time steps length (1) + p59_topsoilc_density_pre(t_all, i, land, sPools59) Soil carbon density of the upper layer per hectare before solve (tC per ha) + p59_topsoilc_density_post(t_all, i, land, sPools59) Soil carbon density of the upper layer per hectare after solve (tC per ha) + p59_topsoilc_actualstate(i, land, sPools59) Actual soil carbon stock per land type (mio. tC) + p59_topsoilc_naturalstate(t_all, i, land, sPools59) Natural soil carbon stock per land type (mio. tC) + pc59_topsoilc_natural_steadystate(i, land, sPools59) Natural steady state soil carbon stpock (mio. tC) + pc59_topsoilc_naturalstate_previous(i, land, sPools59) Natural state of the time step before (mio. tC) + i59_subsoilc_density(t_all,j) Subsoil carbon density of per hectare (tC per ha) + p59_land_before(j,land) Land area in previous time step (mio. ha) +; + +equations + q59_steadystate_term_crop(i, sPools59, w, tillage59) Steady-state for SOC stock on cropland (mio. tC) + q59_previousstate_term_crop(i, sPools59, w, tillage59) bla + q59_lutransitions_to_cropareas(i, noncropland59) bla + q59_actualstate_crop(i, sPools59) bla + q59_steadystate_term_noncrop(i, noncropland59, sPools59) bla + q59_previousstate_term_noncrop(i, noncropland59, sPools59) Steady-state for SOC on various non-cropland types (mio. tC) + q59_actualstate_noncrop(i, noncropland59, sPools59) bla + q59_carbon_soil(i, land, stockType) bla + q59_nr_som(i) bla + q59_nr_som_fertilizer2(i) bla + q59_nr_som_fertilizer(i) bla +; + +positive variables + v59_topsoilc_crop_steadystate(i, sPools59, w, tillage59) bla + v59_topsoilc_noncrop_steadystate(i, noncropland59, sPools59) bla + v59_topsoilc_crop_previousstate(i, sPools59, w, tillage59) bla + v59_cropland_transitions(i, tillage59, w, noncropland59) bla + v59_topsoilc_noncrop_previousstate(i, noncropland59, sPools59) bla + v59_topsoilc_actualstate(i, land, sPools59) bla + vm_cost_scm(j) Recurring cost for soil carbon management on cropland (mio. USD17MER per yr) +; + +variables + vm_nr_som(i) Release of soil organic matter (Mt N per yr) + vm_nr_som_fertilizer(i) Uptake of soil organic matter from plants (Mt N per yr) +; + +*#################### R SECTION START (OUTPUT DECLARATIONS) #################### +parameters + ov59_topsoilc_crop_steadystate(t,i,sPools59,w,tillage59,type) bla + ov59_topsoilc_noncrop_steadystate(t,i,noncropland59,sPools59,type) bla + ov59_topsoilc_crop_previousstate(t,i,sPools59,w,tillage59,type) bla + ov59_cropland_transitions(t,i,tillage59,w,noncropland59,type) bla + ov59_topsoilc_noncrop_previousstate(t,i,noncropland59,sPools59,type) bla + ov59_topsoilc_actualstate(t,i,land,sPools59,type) bla + ov_cost_scm(t,j,type) Recurring cost for soil carbon management on cropland (mio. USD17MER per yr) + ov_nr_som(t,i,type) Release of soil organic matter (Mt N per yr) + ov_nr_som_fertilizer(t,i,type) Uptake of soil organic matter from plants (Mt N per yr) + oq59_steadystate_term_crop(t,i,sPools59,w,tillage59,type) Steady-state for SOC stock on cropland (mio. tC) + oq59_previousstate_term_crop(t,i,sPools59,w,tillage59,type) bla + oq59_lutransitions_to_cropareas(t,i,noncropland59,type) bla + oq59_actualstate_crop(t,i,sPools59,type) bla + oq59_steadystate_term_noncrop(t,i,noncropland59,sPools59,type) bla + oq59_previousstate_term_noncrop(t,i,noncropland59,sPools59,type) Steady-state for SOC on various non-cropland types (mio. tC) + oq59_actualstate_noncrop(t,i,noncropland59,sPools59,type) bla + oq59_carbon_soil(t,i,land,stockType,type) bla + oq59_nr_som(t,i,type) bla + oq59_nr_som_fertilizer2(t,i,type) bla + oq59_nr_som_fertilizer(t,i,type) bla +; +*##################### R SECTION END (OUTPUT DECLARATIONS) ##################### diff --git a/modules/59_som/threepool_reg_may23/equations.gms b/modules/59_som/threepool_reg_may23/equations.gms new file mode 100644 index 0000000000..6951ec9ecc --- /dev/null +++ b/modules/59_som/threepool_reg_may23/equations.gms @@ -0,0 +1,119 @@ +*** | (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 + +*' For every cell a new equilibrium value for the soil organic carbon pool +*' on cropland is calculated as the sum over all crop types and irrigation regimes via + +q59_steadystate_term_crop(i2, sPools59, w, tillage59) .. + v59_topsoilc_crop_steadystate(i2, sPools59, w, tillage59) =e= + sum(kcr_tillage59(kcr, tillage59), vm_res_recycling(i2, kcr, w, "c") * + i59_cinput_multiplier_residue(i2, sPools59, kcr)) / + sum(ct, f59_topsoilc_decay(ct, i2, sPools59, w, tillage59)); + +*' as well as for all non cropland via + +q59_steadystate_term_noncrop(i2, noncropland59, sPools59) .. + v59_topsoilc_noncrop_steadystate(i2, noncropland59, sPools59) =e= + sum(ct, f59_litter_input(ct, i2, sPools59) / + f59_topsoilc_decay(ct, i2, sPools59, "rainfed", "notill")) * + sum(cell(i2,j2), vm_land(j2, noncropland59)); + +*' To account for land-use transitions the previous carbon stocks has to be adjusted +*' to calculate the new actual carbon stocks. Previous stocks are thus given by +*' the carbons stocks of current cropland plus the carbon offset (plus or minus) +*' from area being non-cropland in the time step before. +*' For cropland the previous SOC state after accounting for transitions is given by + +q59_previousstate_term_crop(i2, sPools59, w, tillage59) .. + v59_topsoilc_crop_previousstate(i2, sPools59, w, tillage59) + =e= sum(ct, p59_topsoilc_density_pre(ct, i2, "crop", sPools59) * + sum((cell(i2, j2), kcr_tillage59(kcr, tillage59)), vm_area(j2, kcr, w))) + + sum((ct, noncropland59), (p59_topsoilc_density_pre(ct, i2, noncropland59, sPools59) - + p59_topsoilc_density_pre(ct, i2, "crop", sPools59)) * + v59_cropland_transitions(i2, tillage59, w, noncropland59)); + +*' with v59_cropland_transitions being a helper variable that translates cropland transitions +*' in to tillage- and irrigation-type-specific SOC transfers via + +q59_lutransitions_to_cropareas(i2, noncropland59) .. + sum((tillage59, w), v59_cropland_transitions(i2, tillage59, w, noncropland59)) =e= + sum(cell(i2,j2), vm_lu_transitions(j2, noncropland59, "crop")); + +*' The previous SOC state on non-cropland after accounting for land-use transition is not +*' tillage- and irrgations-type-specific and thus given by + +q59_previousstate_term_noncrop(i2, noncropland59, sPools59) .. + v59_topsoilc_noncrop_previousstate(i2, noncropland59, sPools59) + =e= sum((ct, land_from), p59_topsoilc_density_pre(ct, i2, land_from, sPools59) * + sum(cell(i2, j2), vm_lu_transitions(j2, land_from, noncropland59))); + +*' Following the 2019-Refinement of the IPCC guidelines 2006 for cropland the actual state +*' can be calculated via + +q59_actualstate_crop(i2, sPools59) .. + v59_topsoilc_actualstate(i2, "crop", sPools59) + =e= sum((tillage59, w), v59_topsoilc_crop_previousstate(i2, sPools59, w, tillage59) * + (1 - pc59_topsoilc_decay_timestep(i2, sPools59, w, tillage59))) + + sum((tillage59, w), v59_topsoilc_crop_steadystate(i2, sPools59, w, tillage59) * + pc59_topsoilc_decay_timestep(i2, sPools59, w, tillage59)) + ; + +*' for cropland and via + +q59_actualstate_noncrop(i2, noncropland59, sPools59) .. + v59_topsoilc_actualstate(i2, noncropland59, sPools59) + =e= v59_topsoilc_noncrop_previousstate(i2, noncropland59, sPools59) * + (1 - pc59_topsoilc_decay_timestep(i2, sPools59, "rainfed", "notill")) + + v59_topsoilc_noncrop_steadystate(i2, noncropland59, sPools59) * + pc59_topsoilc_decay_timestep(i2, sPools59, "rainfed", "notill") + ; + +*' for non-cropland. + +*' The soil carbon content of the whole soil profile is than calculated as sum of actual topsoil pool +*' and the reference soil carbon pool of the subsoil, that is assumed to be unaffected by human management: + +q59_carbon_soil(i2, land, stockType) .. + sum(cell(i2,j2), vm_carbon_stock(j2, land, "soilc", stockType)) + =e= sum(sPools59, v59_topsoilc_actualstate(i2, land, sPools59)) + + sum(cell(i2,j2), vm_land(j2, land) * sum(ct, i59_subsoilc_density(ct, j2))); + +*' Note, that as long as the three pool soil model is on regional scale, cluster scale soil carbon stocks +*' are not meaningful. + +*' The annual nitrogen release (or sink) for cropland soils is than +*' calculated by the loss of soil organic carbon given by + +q59_nr_som(i2) .. + vm_nr_som(i2) + =e= 1/m_timestep_length_forestry * 1/15 * sum((tillage59, w, sPools59), + (v59_topsoilc_crop_previousstate(i2, sPools59, w, tillage59) - + v59_topsoilc_crop_steadystate(i2, sPools59, w, tillage59)) + * pc59_topsoilc_decay_timestep(i2, sPools59, w, tillage59)) + ; + +*' with the carbon to nitrogen ratio of soils assumed to be 15:1. + +*' The amount of nitrogen that becomes available to cropland farming is +*' limited by loss of soil organic matter by + +q59_nr_som_fertilizer(i2) .. + vm_nr_som_fertilizer(i2) + =l= + vm_nr_som(i2); + +*' as well as by the amount that crops can take up + +q59_nr_som_fertilizer2(i2) .. + vm_nr_som_fertilizer(i2) + =l= + sum(cell(i2,j2), vm_landexpansion(j2,"crop")) * s59_nitrogen_uptake; + +*' Here we assume a maximum of 200 kg on the expanded area. diff --git a/modules/59_som/threepool_reg_may23/input.gms b/modules/59_som/threepool_reg_may23/input.gms new file mode 100644 index 0000000000..03387987b8 --- /dev/null +++ b/modules/59_som/threepool_reg_may23/input.gms @@ -0,0 +1,82 @@ +*** | (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 + s59_nitrogen_uptake Maximum plant available nitrogen from soil organic matter loss (tN per ha) / 0.2 / +; + +$setglobal c59_som_scenario cc +* options: cc (climate change) +* nocc (no climate change) +* nocc_hist (no climate change after year defined by sm_fix_cc) + +parameters f59_topsoilc_density(t_all,j) LPJ topsoil carbon density for natural vegetation (tC per ha) +/ +$ondelim +$include "./modules/59_som/input/lpj_carbon_topsoil.cs2b" +$offdelim +/ +; +$if "%c59_som_scenario%" == "nocc" f59_topsoilc_density(t_all,j) = f59_topsoilc_density("y1995",j); +$if "%c59_som_scenario%" == "nocc_hist" f59_topsoilc_density(t_all,j)$(m_year(t_all) > sm_fix_cc) = f59_topsoilc_density(t_all,j)$(m_year(t_ai) = sm_fix_cc); +m_fillmissingyears(f59_topsoilc_density,"j"); + + +table f59_cinput_multiplier_residue(i,sPools59,kcr,tillage59) LPJ topsoil carbon density for natural vegetation (tC per ha) +$ondelim +$include "./modules/59_som/threepool_reg_may23/input/f59_cinput_multiplier_residue.cs3" +$offdelim +; + +table f59_cinput_multiplier_manure(i,sPools59,kli,tillage59) LPJ topsoil carbon density for natural vegetation (tC per ha) +$ondelim +$include "./modules/59_som/threepool_reg_may23/input/f59_cinput_multiplier_manure.cs3" +$offdelim +; + + +table f59_litter_input(t_all,i,sPools59) LPJ topsoil carbon density for natural vegetation (tC per ha) +$ondelim +$include "./modules/59_som/threepool_reg_may23/input/f59_litter_input.cs3" +$offdelim +; +$if "%c59_som_scenario%" == "nocc" + f59_litter_input(t_all,i,sPools59) = f59_litter_input("y1995",i,sPools59); +$if "%c59_som_scenario%" == "nocc_hist" + f59_litter_input(t_all,i,sPools59)$(m_year(t_all) > sm_fix_cc) = f59_litter_input(t_all,i,sPools59)$(m_year(t_ai) = sm_fix_cc); +m_fillmissingyears(f59_litter_input,"i,sPools59"); + + +table f59_topsoilc_decay(t_all,i,sPools59,w,tillage59) Soil decay rates for all SOC sub-pools per year (1) +$ondelim +$include "./modules/59_som/threepool_reg_may23/input/f59_topsoilc_decay.cs3" +$offdelim +; +$if "%c59_som_scenario%" == "nocc" + f59_topsoilc_decay(t_all,i,sPools59,w,tillage59) = f59_topsoilc_decay("y1995",i,sPools59,w,tillage59); +$if "%c59_som_scenario%" == "nocc_hist" + f59_topsoilc_decay(t_all,i,sPools59,w,tillage59)$(m_year(t_all) > sm_fix_cc) = f59_topsoilc_decay(t_all,i,sPools59,w,tillage59)$(m_year(t_ai) = sm_fix_cc); +m_fillmissingyears(f59_topsoilc_decay,"i,sPools59,w,tillage59"); + + +table f59_topsoilc_actualstate(i,sPools59,lutypes59) LPJ topsoil carbon for different pools and lu types(million tC) +$ondelim +$include "./modules/59_som/threepool_reg_may23/input/f59_topsoilc_actualstate.cs3" +$offdelim +; + +table f59_topsoilc_naturalstate(i,sPools59,lutypes59) LPJ natural topsoil carbon for different pools and lu types(million tC) +$ondelim +$include "./modules/59_som/threepool_reg_may23/input/f59_topsoilc_naturalstate.cs3" +$offdelim +; + +table f59_land_y1990(t_pre59,i,land) land use in y1990 (million ha) +$ondelim +$include "./modules/59_som/threepool_reg_may23/input/f59_land_y1990.cs3" +$offdelim +; diff --git a/modules/59_som/threepool_reg_may23/input/files b/modules/59_som/threepool_reg_may23/input/files new file mode 100644 index 0000000000..683cbbe074 --- /dev/null +++ b/modules/59_som/threepool_reg_may23/input/files @@ -0,0 +1,8 @@ +* list of files that are required here +f59_land_y1990.cs3 +f59_cinput_multiplier_residue.cs3 +f59_cinput_multiplier_manure.cs3 +f59_litter_input.cs3 +f59_topsoilc_decay.cs3 +f59_topsoilc_actualstate.cs3 +f59_topsoilc_naturalstate.cs3 diff --git a/modules/59_som/threepool_reg_may23/not_used.txt b/modules/59_som/threepool_reg_may23/not_used.txt new file mode 100644 index 0000000000..1d37eb479c --- /dev/null +++ b/modules/59_som/threepool_reg_may23/not_used.txt @@ -0,0 +1,7 @@ +name,type,reason +fm_croparea,input,questionnaire +pm_climate_class,input,questionnaire +vm_fallow,input,questionnaire +vm_treecover,input,not_used +vm_land_other,input,not_used +pm_avl_cropland_iso,input,nou_used diff --git a/modules/59_som/threepool_reg_may23/postsolve.gms b/modules/59_som/threepool_reg_may23/postsolve.gms new file mode 100644 index 0000000000..320f2227ae --- /dev/null +++ b/modules/59_som/threepool_reg_may23/postsolve.gms @@ -0,0 +1,111 @@ +*** | (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 + +p59_topsoilc_actualstate(i, land, sPools59) = v59_topsoilc_actualstate.l(i, land, sPools59); +p59_topsoilc_density_post(t, i, land, sPools59)$(sum(cell(i,j), pcm_land(j,land)) > 1e-10) = + p59_topsoilc_actualstate(i, land, sPools59) / sum(cell(i,j), pcm_land(j,land)); +p59_land_before(j,land) = vm_land.l(j,land); + +**** natural stock calculations + +pc59_topsoilc_natural_steadystate(i, land, sPools59) = + f59_litter_input(t, i, sPools59) / + f59_topsoilc_decay(t, i, sPools59, "rainfed", "notill") * + sum(cell(i,j), vm_land.l(j, land)); + +p59_topsoilc_naturalstate(t, i, land, sPools59) = + pc59_topsoilc_naturalstate_previous(i, land, sPools59) * + (1 - pc59_topsoilc_decay_timestep(i, sPools59, "rainfed", "notill")) + + pc59_topsoilc_natural_steadystate(i, land, sPools59) * + pc59_topsoilc_decay_timestep(i, sPools59, "rainfed", "notill"); + + +pc59_topsoilc_naturalstate_previous(i, land, sPools59) = + p59_topsoilc_naturalstate(t, i, land, sPools59); + +*#################### R SECTION START (OUTPUT DEFINITIONS) ##################### + ov59_topsoilc_crop_steadystate(t,i,sPools59,w,tillage59,"marginal") = v59_topsoilc_crop_steadystate.m(i,sPools59,w,tillage59); + ov59_topsoilc_noncrop_steadystate(t,i,noncropland59,sPools59,"marginal") = v59_topsoilc_noncrop_steadystate.m(i,noncropland59,sPools59); + ov59_topsoilc_crop_previousstate(t,i,sPools59,w,tillage59,"marginal") = v59_topsoilc_crop_previousstate.m(i,sPools59,w,tillage59); + ov59_cropland_transitions(t,i,tillage59,w,noncropland59,"marginal") = v59_cropland_transitions.m(i,tillage59,w,noncropland59); + ov59_topsoilc_noncrop_previousstate(t,i,noncropland59,sPools59,"marginal") = v59_topsoilc_noncrop_previousstate.m(i,noncropland59,sPools59); + ov59_topsoilc_actualstate(t,i,land,sPools59,"marginal") = v59_topsoilc_actualstate.m(i,land,sPools59); + ov_cost_scm(t,j,"marginal") = vm_cost_scm.m(j); + ov_nr_som(t,i,"marginal") = vm_nr_som.m(i); + ov_nr_som_fertilizer(t,i,"marginal") = vm_nr_som_fertilizer.m(i); + oq59_steadystate_term_crop(t,i,sPools59,w,tillage59,"marginal") = q59_steadystate_term_crop.m(i,sPools59,w,tillage59); + oq59_previousstate_term_crop(t,i,sPools59,w,tillage59,"marginal") = q59_previousstate_term_crop.m(i,sPools59,w,tillage59); + oq59_lutransitions_to_cropareas(t,i,noncropland59,"marginal") = q59_lutransitions_to_cropareas.m(i,noncropland59); + oq59_actualstate_crop(t,i,sPools59,"marginal") = q59_actualstate_crop.m(i,sPools59); + oq59_steadystate_term_noncrop(t,i,noncropland59,sPools59,"marginal") = q59_steadystate_term_noncrop.m(i,noncropland59,sPools59); + oq59_previousstate_term_noncrop(t,i,noncropland59,sPools59,"marginal") = q59_previousstate_term_noncrop.m(i,noncropland59,sPools59); + oq59_actualstate_noncrop(t,i,noncropland59,sPools59,"marginal") = q59_actualstate_noncrop.m(i,noncropland59,sPools59); + oq59_carbon_soil(t,i,land,stockType,"marginal") = q59_carbon_soil.m(i,land,stockType); + oq59_nr_som(t,i,"marginal") = q59_nr_som.m(i); + oq59_nr_som_fertilizer2(t,i,"marginal") = q59_nr_som_fertilizer2.m(i); + oq59_nr_som_fertilizer(t,i,"marginal") = q59_nr_som_fertilizer.m(i); + ov59_topsoilc_crop_steadystate(t,i,sPools59,w,tillage59,"level") = v59_topsoilc_crop_steadystate.l(i,sPools59,w,tillage59); + ov59_topsoilc_noncrop_steadystate(t,i,noncropland59,sPools59,"level") = v59_topsoilc_noncrop_steadystate.l(i,noncropland59,sPools59); + ov59_topsoilc_crop_previousstate(t,i,sPools59,w,tillage59,"level") = v59_topsoilc_crop_previousstate.l(i,sPools59,w,tillage59); + ov59_cropland_transitions(t,i,tillage59,w,noncropland59,"level") = v59_cropland_transitions.l(i,tillage59,w,noncropland59); + ov59_topsoilc_noncrop_previousstate(t,i,noncropland59,sPools59,"level") = v59_topsoilc_noncrop_previousstate.l(i,noncropland59,sPools59); + ov59_topsoilc_actualstate(t,i,land,sPools59,"level") = v59_topsoilc_actualstate.l(i,land,sPools59); + ov_cost_scm(t,j,"level") = vm_cost_scm.l(j); + ov_nr_som(t,i,"level") = vm_nr_som.l(i); + ov_nr_som_fertilizer(t,i,"level") = vm_nr_som_fertilizer.l(i); + oq59_steadystate_term_crop(t,i,sPools59,w,tillage59,"level") = q59_steadystate_term_crop.l(i,sPools59,w,tillage59); + oq59_previousstate_term_crop(t,i,sPools59,w,tillage59,"level") = q59_previousstate_term_crop.l(i,sPools59,w,tillage59); + oq59_lutransitions_to_cropareas(t,i,noncropland59,"level") = q59_lutransitions_to_cropareas.l(i,noncropland59); + oq59_actualstate_crop(t,i,sPools59,"level") = q59_actualstate_crop.l(i,sPools59); + oq59_steadystate_term_noncrop(t,i,noncropland59,sPools59,"level") = q59_steadystate_term_noncrop.l(i,noncropland59,sPools59); + oq59_previousstate_term_noncrop(t,i,noncropland59,sPools59,"level") = q59_previousstate_term_noncrop.l(i,noncropland59,sPools59); + oq59_actualstate_noncrop(t,i,noncropland59,sPools59,"level") = q59_actualstate_noncrop.l(i,noncropland59,sPools59); + oq59_carbon_soil(t,i,land,stockType,"level") = q59_carbon_soil.l(i,land,stockType); + oq59_nr_som(t,i,"level") = q59_nr_som.l(i); + oq59_nr_som_fertilizer2(t,i,"level") = q59_nr_som_fertilizer2.l(i); + oq59_nr_som_fertilizer(t,i,"level") = q59_nr_som_fertilizer.l(i); + ov59_topsoilc_crop_steadystate(t,i,sPools59,w,tillage59,"upper") = v59_topsoilc_crop_steadystate.up(i,sPools59,w,tillage59); + ov59_topsoilc_noncrop_steadystate(t,i,noncropland59,sPools59,"upper") = v59_topsoilc_noncrop_steadystate.up(i,noncropland59,sPools59); + ov59_topsoilc_crop_previousstate(t,i,sPools59,w,tillage59,"upper") = v59_topsoilc_crop_previousstate.up(i,sPools59,w,tillage59); + ov59_cropland_transitions(t,i,tillage59,w,noncropland59,"upper") = v59_cropland_transitions.up(i,tillage59,w,noncropland59); + ov59_topsoilc_noncrop_previousstate(t,i,noncropland59,sPools59,"upper") = v59_topsoilc_noncrop_previousstate.up(i,noncropland59,sPools59); + ov59_topsoilc_actualstate(t,i,land,sPools59,"upper") = v59_topsoilc_actualstate.up(i,land,sPools59); + ov_cost_scm(t,j,"upper") = vm_cost_scm.up(j); + ov_nr_som(t,i,"upper") = vm_nr_som.up(i); + ov_nr_som_fertilizer(t,i,"upper") = vm_nr_som_fertilizer.up(i); + oq59_steadystate_term_crop(t,i,sPools59,w,tillage59,"upper") = q59_steadystate_term_crop.up(i,sPools59,w,tillage59); + oq59_previousstate_term_crop(t,i,sPools59,w,tillage59,"upper") = q59_previousstate_term_crop.up(i,sPools59,w,tillage59); + oq59_lutransitions_to_cropareas(t,i,noncropland59,"upper") = q59_lutransitions_to_cropareas.up(i,noncropland59); + oq59_actualstate_crop(t,i,sPools59,"upper") = q59_actualstate_crop.up(i,sPools59); + oq59_steadystate_term_noncrop(t,i,noncropland59,sPools59,"upper") = q59_steadystate_term_noncrop.up(i,noncropland59,sPools59); + oq59_previousstate_term_noncrop(t,i,noncropland59,sPools59,"upper") = q59_previousstate_term_noncrop.up(i,noncropland59,sPools59); + oq59_actualstate_noncrop(t,i,noncropland59,sPools59,"upper") = q59_actualstate_noncrop.up(i,noncropland59,sPools59); + oq59_carbon_soil(t,i,land,stockType,"upper") = q59_carbon_soil.up(i,land,stockType); + oq59_nr_som(t,i,"upper") = q59_nr_som.up(i); + oq59_nr_som_fertilizer2(t,i,"upper") = q59_nr_som_fertilizer2.up(i); + oq59_nr_som_fertilizer(t,i,"upper") = q59_nr_som_fertilizer.up(i); + ov59_topsoilc_crop_steadystate(t,i,sPools59,w,tillage59,"lower") = v59_topsoilc_crop_steadystate.lo(i,sPools59,w,tillage59); + ov59_topsoilc_noncrop_steadystate(t,i,noncropland59,sPools59,"lower") = v59_topsoilc_noncrop_steadystate.lo(i,noncropland59,sPools59); + ov59_topsoilc_crop_previousstate(t,i,sPools59,w,tillage59,"lower") = v59_topsoilc_crop_previousstate.lo(i,sPools59,w,tillage59); + ov59_cropland_transitions(t,i,tillage59,w,noncropland59,"lower") = v59_cropland_transitions.lo(i,tillage59,w,noncropland59); + ov59_topsoilc_noncrop_previousstate(t,i,noncropland59,sPools59,"lower") = v59_topsoilc_noncrop_previousstate.lo(i,noncropland59,sPools59); + ov59_topsoilc_actualstate(t,i,land,sPools59,"lower") = v59_topsoilc_actualstate.lo(i,land,sPools59); + ov_cost_scm(t,j,"lower") = vm_cost_scm.lo(j); + ov_nr_som(t,i,"lower") = vm_nr_som.lo(i); + ov_nr_som_fertilizer(t,i,"lower") = vm_nr_som_fertilizer.lo(i); + oq59_steadystate_term_crop(t,i,sPools59,w,tillage59,"lower") = q59_steadystate_term_crop.lo(i,sPools59,w,tillage59); + oq59_previousstate_term_crop(t,i,sPools59,w,tillage59,"lower") = q59_previousstate_term_crop.lo(i,sPools59,w,tillage59); + oq59_lutransitions_to_cropareas(t,i,noncropland59,"lower") = q59_lutransitions_to_cropareas.lo(i,noncropland59); + oq59_actualstate_crop(t,i,sPools59,"lower") = q59_actualstate_crop.lo(i,sPools59); + oq59_steadystate_term_noncrop(t,i,noncropland59,sPools59,"lower") = q59_steadystate_term_noncrop.lo(i,noncropland59,sPools59); + oq59_previousstate_term_noncrop(t,i,noncropland59,sPools59,"lower") = q59_previousstate_term_noncrop.lo(i,noncropland59,sPools59); + oq59_actualstate_noncrop(t,i,noncropland59,sPools59,"lower") = q59_actualstate_noncrop.lo(i,noncropland59,sPools59); + oq59_carbon_soil(t,i,land,stockType,"lower") = q59_carbon_soil.lo(i,land,stockType); + oq59_nr_som(t,i,"lower") = q59_nr_som.lo(i); + oq59_nr_som_fertilizer2(t,i,"lower") = q59_nr_som_fertilizer2.lo(i); + oq59_nr_som_fertilizer(t,i,"lower") = q59_nr_som_fertilizer.lo(i); +*##################### R SECTION END (OUTPUT DEFINITIONS) ###################### diff --git a/modules/59_som/threepool_reg_may23/preloop.gms b/modules/59_som/threepool_reg_may23/preloop.gms new file mode 100644 index 0000000000..a4b150d808 --- /dev/null +++ b/modules/59_som/threepool_reg_may23/preloop.gms @@ -0,0 +1,33 @@ +*** | (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 + + +***************************** +*** SOC initialisation *** +***************************** + +i59_subsoilc_density(t_all, j) = + fm_carbon_density(t_all, j, "secdforest", "soilc") - f59_topsoilc_density(t_all, j); + + +pcm_carbon_stock(j, land, "soilc", stockType) = + fm_carbon_density("y1995", j, land, "soilc") * pm_land_start(j, land); + +vm_carbon_stock.l(j, land, "soilc", stockType) = + pcm_carbon_stock(j, land, "soilc", stockType); + +p59_land_before(j,land) = pm_land_start(j,land); + +***************************** +*** parameter dummies *** +***************************** + +i59_cinput_multiplier_residue(i,sPools59,kcr) = + sum(kcr2$(sameas(kcr,kcr2)), + sum(kcr_tillage59(kcr2,tillage59), + f59_cinput_multiplier_residue(i,sPools59,kcr,tillage59))); + diff --git a/modules/59_som/threepool_reg_may23/presolve.gms b/modules/59_som/threepool_reg_may23/presolve.gms new file mode 100644 index 0000000000..0222b349e4 --- /dev/null +++ b/modules/59_som/threepool_reg_may23/presolve.gms @@ -0,0 +1,65 @@ +*** | (C) 2008-2023 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +vm_cost_scm.fx(j) = 0; + +* For the first time steps: +* Initializating of SOC pools in the different land types using the input from mrsoil + +* For all other time steps: +* SOM pools and densities will be updated after natural regrowth and disturbance loss accounting. +* The secondary forest pool will receive carbon from primary forest (due to natural disturbance) +* and from other land (due to regrowth). +* Note: This will only account for transitions of primary forest to secondary forest and +* other land to secondary forest. See current version of 35_natveg to check consistency. +* The helper parameter `p59_topsoilc_actualstate` is used to update `p59_topsoilc_density_pre` + +i59_topsoilc_decay_max1(t, i, sPools59, w, tillage59) = + min(1, f59_topsoilc_decay(t, i, sPools59, w, tillage59)); + +pc59_topsoilc_decay_timestep(i, sPools59, w, tillage59) = + 1 - (1 - i59_topsoilc_decay_max1(t, i, sPools59, w, tillage59)) ** m_yeardiff_forestry(t); + +if((ord(t) = 1), + + p59_topsoilc_density_pre("y1995", i, land, sPools59) = + sum(lutypes59_land(land, lutypes59), + f59_topsoilc_actualstate(i, sPools59, lutypes59) / + sum(lutypes59_land2(land2,lutypes59), f59_land_y1990("y1990", i, land2))); + + p59_topsoilc_density_post(t, i, land, sPools59) = 0; + p59_topsoilc_actualstate(i, land, sPools59) = 0; + + pc59_topsoilc_naturalstate_previous(i, land, sPools59) = + sum(lutypes59_land(land, lutypes59), + f59_topsoilc_naturalstate(i, sPools59, lutypes59) / + sum(lutypes59_land2(land2,lutypes59), f59_land_y1990("y1990", i, land2))) * + f59_land_y1990("y1990", i, land); + +else + + p59_topsoilc_actualstate(i, "secdforest", sPools59) = + p59_topsoilc_actualstate(i, "secdforest", sPools59) + + sum(cell(i,j), p59_land_before(j, "primforest") - pcm_land(j, "primforest")) * + p59_topsoilc_density_post(t-1, i, "primforest", sPools59) + + sum(cell(i,j), p59_land_before(j, "other") - pcm_land(j, "other")) * + p59_topsoilc_density_post(t-1, i, "other", sPools59); + + p59_topsoilc_actualstate(i, "other", sPools59) = + p59_topsoilc_actualstate(i, "other", sPools59) - + sum(cell(i,j), p59_land_before(j, "other") - pcm_land(j, "other")) * + p59_topsoilc_density_post(t-1, i, "other", sPools59); + + p59_topsoilc_actualstate(i, "primforest", sPools59) = + p59_topsoilc_actualstate(i, "primforest", sPools59) - + sum(cell(i,j), p59_land_before(j, "primforest") - pcm_land(j, "primforest")) * + p59_topsoilc_density_post(t-1, i, "primforest", sPools59); + + p59_topsoilc_density_pre(t, i, land, sPools59)$(sum(cell(i,j), pcm_land(j,land)) > 1e-20) = + p59_topsoilc_actualstate(i, land, sPools59) / sum(cell(i,j), pcm_land(j,land)); + +); diff --git a/modules/59_som/threepool_reg_may23/realization.gms b/modules/59_som/threepool_reg_may23/realization.gms new file mode 100644 index 0000000000..ddea7638b1 --- /dev/null +++ b/modules/59_som/threepool_reg_may23/realization.gms @@ -0,0 +1,27 @@ +*** | (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 +*' The threepool_may23 realization is based on the Tier 2 approach of the revised IPCC +*' Guidelines for National Greenhouse Gas Inventories 2019 (@calvo_buendia_ipcc_2019). +*' It calculates the stock of soil carbon for all land-use types based on a reduced complexity +*' soil model driven by carbon inputs and decay rates depending on management decisions. + +*' @limitations tba + +*' @authors Kristine Karstens + +*####################### R SECTION START (PHASES) ############################## +$Ifi "%phase%" == "sets" $include "./modules/59_som/threepool_may23/sets.gms" +$Ifi "%phase%" == "declarations" $include "./modules/59_som/threepool_may23/declarations.gms" +$Ifi "%phase%" == "input" $include "./modules/59_som/threepool_may23/input.gms" +$Ifi "%phase%" == "equations" $include "./modules/59_som/threepool_may23/equations.gms" +$Ifi "%phase%" == "scaling" $include "./modules/59_som/threepool_may23/scaling.gms" +$Ifi "%phase%" == "preloop" $include "./modules/59_som/threepool_may23/preloop.gms" +$Ifi "%phase%" == "presolve" $include "./modules/59_som/threepool_may23/presolve.gms" +$Ifi "%phase%" == "postsolve" $include "./modules/59_som/threepool_may23/postsolve.gms" +*######################## R SECTION END (PHASES) ############################### diff --git a/modules/59_som/threepool_reg_may23/scaling.gms b/modules/59_som/threepool_reg_may23/scaling.gms new file mode 100644 index 0000000000..0002b1eb7d --- /dev/null +++ b/modules/59_som/threepool_reg_may23/scaling.gms @@ -0,0 +1,12 @@ +*** | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) +*** | authors, and contributors see CITATION.cff file. This file is part +*** | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of +*** | AGPL-3.0, you are granted additional permissions described in the +*** | MAgPIE License Exception, version 1.0 (see LICENSE file). +*** | Contact: magpie@pik-potsdam.de + +v59_topsoilc_crop_steadystate.scale(i,sPools59,w,tillage59) = 10e4; +v59_topsoilc_noncrop_steadystate.scale(i,noncropland59,sPools59) = 10e4; +v59_topsoilc_crop_previousstate.scale(i,sPools59,w,tillage59) = 10e4; +v59_topsoilc_noncrop_previousstate.scale(i,noncropland59,sPools59) = 10e4; +v59_topsoilc_actualstate.scale(i,land,sPools59) = 10e4; diff --git a/modules/59_som/threepool_reg_may23/sets.gms b/modules/59_som/threepool_reg_may23/sets.gms new file mode 100644 index 0000000000..2d9698275e --- /dev/null +++ b/modules/59_som/threepool_reg_may23/sets.gms @@ -0,0 +1,63 @@ +*** | (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 + +t_pre59 Year of the previous time step + / y1990 / + +sPools59 soil pools +/ active, slow, passive / + +noncropland59(land) Soil carbon conserving landuse types +/ past, forestry, primforest, secdforest, other, urban / + +tillage59 Tillage categories of IPCC +/ fulltill, reducedtill, notill / + +lutypes59 Land-use types +/ crop, natveg / + +kcr_tillage59(kcr,tillage59) Climate classification types + / + begr .(reducedtill) "reduced tillage" + betr .(reducedtill) "reduced tillage" + cassav_sp .(fulltill) "full tillage" + cottn_pro .(fulltill) "full tillage" + foddr .(fulltill) "full tillage" + groundnut .(fulltill) "full tillage" + maiz .(fulltill) "full tillage" + oilpalm .(reducedtill) "reduced tillage" + others .(reducedtill) "reduced tillage" + potato .(fulltill) "full tillage" + puls_pro .(fulltill) "full tillage" + rapeseed .(fulltill) "full tillage" + rice_pro .(fulltill) "full tillage" + soybean .(fulltill) "full tillage" + sugr_beet .(fulltill) "full tillage" + sugr_cane .(reducedtill) "reduced tillage" + sunflower .(fulltill) "full tillage" + tece .(fulltill) "full tillage" + trce .(fulltill) "full tillage" + / + +lutypes59_land(land,lutypes59) Mapping land to soil model land classes + / + crop .(crop) "cropland" + past .(natveg) "potential natural vegetation" + forestry .(natveg) "potential natural vegetation" + primforest .(natveg) "potential natural vegetation" + secdforest .(natveg) "potential natural vegetation" + other .(natveg) "potential natural vegetation" + urban .(natveg) "potential natural vegetation" + / +; + +alias(noncropland59,noncropland59_2); +alias(land,land2); +alias(lutypes59_land,lutypes59_land2); +alias(kcr,kcr2); diff --git a/modules/80_optimization/lp_nlp_apr17/input.gms b/modules/80_optimization/lp_nlp_apr17/input.gms index 3945d0c594..8cec7331f5 100644 --- a/modules/80_optimization/lp_nlp_apr17/input.gms +++ b/modules/80_optimization/lp_nlp_apr17/input.gms @@ -7,7 +7,7 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / - s80_optfile switch to use specfied solver settings (1) / 0 / + s80_optfile switch to use specfied solver settings (1) / 1 / s80_add_cplex add cplex optimization after conopt4 (1) / 0 / s80_add_conopt3 add conopt3 optimization after conopt4 (1) / 0 / s80_secondsolve second solve statement (binary) / 0 / diff --git a/modules/80_optimization/nlp_apr17/input.gms b/modules/80_optimization/nlp_apr17/input.gms index 051075eec3..1486c3a2a0 100644 --- a/modules/80_optimization/nlp_apr17/input.gms +++ b/modules/80_optimization/nlp_apr17/input.gms @@ -7,6 +7,7 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / - s80_optfile switch to use specfied solver settings (1) / 0 / - s80_secondsolve second solve statement (binary) / 0 / + s80_optfile switch to use specfied solver settings (1) / 1 / + s80_secondsolve second solve statement (binary) / 0 / + s80_toloptimal value for CONOPT4 Tol_Optimality / 1e-08 / ; diff --git a/modules/80_optimization/nlp_apr17/solve.gms b/modules/80_optimization/nlp_apr17/solve.gms index ffdb6bfc0e..d9facfe83a 100644 --- a/modules/80_optimization/nlp_apr17/solve.gms +++ b/modules/80_optimization/nlp_apr17/solve.gms @@ -18,16 +18,12 @@ magpie.scaleopt = 1 ; magpie.solprint = 0 ; magpie.holdfixed = 1 ; -$onecho > conopt4.opt -Lim_Variable = 1.e25 -$offecho +put optfile; +put 'Tol_Optimality = ', s80_toloptimal:12:11 /; +putclose optfile; $onecho > conopt4.op2 -Flg_Prep = FALSE -$offecho - -$onecho > conopt4.op3 -Flg_NoDefc = TRUE +Lim_Variable = 1.e25 $offecho if(execerror > 0, @@ -62,14 +58,10 @@ if (magpie.modelstat > 2, option nlp = conopt4; magpie.optfile = 1; elseif s80_resolve_option = 3, - display "Modelstat > 2 | Retry solve with CONOPT4 w/o preprocessing"; + display "Modelstat > 2 | Retry solve with CONOPT4 increasing largest allowable value"; option nlp = conopt4; magpie.optfile = 2; elseif s80_resolve_option = 4, - display "Modelstat > 2 | Retry solve with CONOPT4 w/o search for definitional constraints"; - option nlp = conopt4; - magpie.optfile = 3; - elseif s80_resolve_option = 5, display "Modelstat > 2 | Retry solve with CONOPT3"; option nlp = conopt3; magpie.optfile = 0; @@ -94,7 +86,7 @@ if (magpie.modelstat > 2, * Otherwise, the repeat loop will never end. magpie.modelStat$(magpie.modelStat=NA) = 13; - s80_resolve_option$(s80_resolve_option >= 5) = 0; + s80_resolve_option$(s80_resolve_option >= 4) = 0; until (magpie.modelstat <= 2 or s80_counter >= s80_maxiter) ); diff --git a/modules/80_optimization/nlp_par/input.gms b/modules/80_optimization/nlp_par/input.gms index 39891d8b17..f3fbe6695c 100644 --- a/modules/80_optimization/nlp_par/input.gms +++ b/modules/80_optimization/nlp_par/input.gms @@ -7,6 +7,6 @@ scalars s80_maxiter maximal solve iterations if modelstat is > 2 (1) / 30 / - s80_optfile switch to use specfied solver settings (1) / 0 / + s80_optfile switch to use specfied solver settings (1) / 1 / s80_secondsolve second solve statement (binary) / 0 / ; diff --git a/scripts/start/compilation_check.R b/scripts/start/compilation_check.R index bdf61a0633..b6b20e5de8 100644 --- a/scripts/start/compilation_check.R +++ b/scripts/start/compilation_check.R @@ -14,5 +14,11 @@ source("scripts/start_functions.R") source("config/default.cfg") download_and_update(cfg) +# update all parameters which contain the levels and marginals +# of all variables and equations +gms::update_fulldataOutput() +# Update module paths in GAMS code +gms::update_modules_embedding() + # compile main.gms system("gams main.gms action=c") diff --git a/scripts/start/extra/soc-test.R b/scripts/start/extra/soc-test.R new file mode 100644 index 0000000000..c2ed7c28f6 --- /dev/null +++ b/scripts/start/extra/soc-test.R @@ -0,0 +1,135 @@ +# | (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: Test SOC und residues +# ---------------------------------------------------------- + + +###################################### +#### Script to start a MAgPIE run #### +###################################### + +## Load lucode2 and gms to use setScenario later +library(lucode2) +library(gms) +library(magclass) + +# Load start_run(cfg) function which is needed to start MAgPIE runs +source("scripts/start_functions.R") + +# Source default cfg. This loads the object "cfg" in R environment +source("config/default.cfg") + + +### THREEPOOL SOM ### +cfg$gms$som <- "threepool_may23" + +cfg$title <- "default3p_disAgg" +start_run(cfg) + +cfg$title <- "default3p_disAgg_off" +cfg$gms$disagg_lvst <- "off" +start_run(cfg) + +cfg$title <- "default3p_disAgg_old" +cfg$gms$disagg_lvst <- "foragebased_aug18" +start_run(cfg) +cfg$gms$disagg_lvst <- "foragebased_jul23" + +cfg$gms$nitrogen <- "off" +cfg$title <- "default3p_nitrogen_off" +start_run(cfg) +cfg$gms$nitrogen <- "rescaled_jan21" + +cfg$gms$methane <- "off" +cfg$title <- "default3p_methane_off" +start_run(cfg) +cfg$gms$methane <- "ipcc2006_aug22" + +cfg$gms$awms <- "off" +cfg$title <- "default3p_awms_off" +start_run(cfg) +cfg$gms$awms <- "ipcc2006_aug16" + +cfg$gms$c32_aff_policy <- "none" +cfg$gms$c35_aolc_policy <- "none" +cfg$gms$c56_pollutant_prices <- "none" +cfg$title <- "default3p_npi_off" +start_run(cfg) + + +### STATIC SOM ### +cfg$gms$som <- "static_jan19" + +cfg$title <- "default_disAgg" +start_run(cfg) + +cfg$title <- "default_disAgg_off" +cfg$gms$disagg_lvst <- "off" +start_run(cfg) + +cfg$title <- "default_disAgg_old" +cfg$gms$disagg_lvst <- "foragebased_aug18" +start_run(cfg) +cfg$gms$disagg_lvst <- "foragebased_jul23" + +cfg$gms$nitrogen <- "off" +cfg$title <- "default_nitrogen_off" +start_run(cfg) +cfg$gms$nitrogen <- "rescaled_jan21" + +cfg$gms$methane <- "off" +cfg$title <- "default_methane_off" +start_run(cfg) +cfg$gms$methane <- "ipcc2006_aug22" + +cfg$gms$awms <- "off" +cfg$title <- "default_awms_off" +start_run(cfg) +cfg$gms$awms <- "ipcc2006_aug16" + +cfg$gms$c32_aff_policy <- "none" +cfg$gms$c35_aolc_policy <- "none" +cfg$gms$c56_pollutant_prices <- "none" +cfg$title <- "default_npi_off" +start_run(cfg) + + + +#cfg <- setScenario(cfg,c("SSP2","NPI")) +#cfg$gms$c56_mute_ghgprices_until <- "y2150" +#cfg$gms$c56_pollutant_prices <- paste0("R21M42-SSP2-NPi") +#cfg$gms$c60_2ndgen_biodem <- paste0("R21M42-SSP2-NPi") + +#cfg$gms$som <- "threepool_may23" +#cfg$title <- "SSP2-REF-threepool" +#start_run(cfg, codeCheck = FALSE) + +#cfg <- setScenario(cfg,c("SSP2","NDC")) +#cfg$gms$c56_mute_ghgprices_until <- "y2030" +#cfg$gms$c56_pollutant_prices <- paste0("R21M42-SSP2-PkBudg900") +#cfg$gms$c60_2ndgen_biodem <- paste0("R21M42-SSP2-PkBudg900") + +#cfg$gms$som <- "threepool_may23" +#cfg$title <- "SSP2-PkBudg900-threepool" +#start_run(cfg, codeCheck = FALSE) + +#cfg$s60_scale_res2ndgenBE <- 0 +#cfg$gms$som <- "threepool_may23" +#cfg$title <- "SSP2-PkBudg900-threepool_0x2ndRes" +#start_run(cfg, codeCheck = FALSE) + +#cfg$s60_scale_res2ndgenBE <- 2 +#cfg$gms$som <- "threepool_may23" +#cfg$title <- "SSP2-PkBudg900-threepool_2x2ndRe" +#start_run(cfg, codeCheck = FALSE) + +#cfg$s60_scale_res2ndgenBE <- 5 +#cfg$gms$som <- "threepool_may23" +#cfg$title <- "SSP2-PkBudg900-threepool_5x2ndRe" +#start_run(cfg, codeCheck = FALSE)