Skip to content

Commit

Permalink
Peatland. removed on realisation. Update v2
Browse files Browse the repository at this point in the history
  • Loading branch information
flohump committed Dec 1, 2023
1 parent fc969ad commit e2dc646
Show file tree
Hide file tree
Showing 28 changed files with 165 additions and 728 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **scripts** For the emulator scripts select a different bioenergy demand variable that excludes bioenergy sources other than second generation bioenergy crops. Set the minimal bioenergy demand to zero. Both avoid artificial clustering of data points and allow for better fits.
- **31_past** in grasslands_apr22 realization: changed structure of f31_pastr_suitability to align with ssp-rcp specific input data formulation. Changed input filename from cs3 to cs2. Added `cc`, `nocc` and `nocc_hist` options for `i31_manpast_suit` and changed input gams code from table to parameter. Climate scenario assignment moved from preloop.gms to input.gms. Removed pastSuit set in sets.gms as not needed anymore. Adjusted not_used.txt in both grasslands_apr22 and static realizations.
- **36_employment** regression between hourly labor regression and GDP pc changed from linear to log-log
- **default.cfg** Default for cfg$gms$peatland changed from `on` to `v2`

### added
- **18_residues** Included cluster-level residue realization, for cluster-level production of residues (but balancing of recycling and burning budgets remains at region-level, for computational lightness)
- **14_yields/config** Added option for considering impacts of land degradation on yields. If `s14_degradation` is switched to 1, MAgPIE will include cluster-specific information on the state of nature's contributions to people relevant for yields `./modules/14_yields/input/f14_yld_ncp_report.cs3`.
- **58_peatland** added realization "v2" with updated peatland map and GHG emission factors
- **32_forestry** new interfaces `vm_landexpansion_forestry` and `vm_landreduction_forestry`
- **32_forestry** new interfaces `vm_forestry`, `pcm_land_forestry` `vm_landexpansion_forestry` and `vm_landreduction_forestry`
- **scripts** added peatland to output/extra/disaggregation.R

### removed
- **default.cfg** Removed description of cfg$gms$c31_past_suit_scen since no longer needed due to changes in 31_past described below. Its function is now done by cfg$gms$c31_grassl_yld_scenario.
- **58_peatland** removed realization "on"

### fixed
- **inputdata** There was another bug (terra default na.rm changed) in the inputdata that was fixed with rev4.93
Expand Down
26 changes: 7 additions & 19 deletions config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1532,15 +1532,12 @@ cfg$gms$s57_maxmac_ch4_awms <- -1 # def = -1

# ***--------------------- 58_peatland ------------------------------------
# * (off): Peatland area and associated GHG emissions are assumed zero
# * (on): Peatland area is initialized with degraded and intact peatland for the year 2015,
# * and projected into the future based on changes in managed land.
# * GHG emissions are calculated using IPCC Tier 1 emission factors (2013 Wetland supplement).
# * (v2): Peatland area is initialized with degraded and intact peatland area for the year 2020,
# * (v2): Peatland area is initialized with degraded and intact peatland area for the year 2022,
# * and projected into the future based on changes in managed land.
# * For boreal and tropical climates, GHG emissions are calculated using emission
# * factors from the IPCC 2013 Wetland supplement. For temperate climates, more recent
# * estimates from Tiemeyer et al 2020 are used.
cfg$gms$peatland <- "on" # def = on
cfg$gms$peatland <- "v2" # def = v2

# * peatland rewetting
# * options: 0 (off)
Expand All @@ -1552,26 +1549,17 @@ cfg$gms$s58_cost_rewet_onetime <- 7000 # def = 7000
cfg$gms$s58_cost_rewet_recur <- 200 # def = 200

# * One-time and recurring costs for peatland degradation (USD05MER per ha)
# * Can be used to test area-based incentives for peatland protection and restoration,
# * complementary or in addition to pricing GHG emissions from degraded peatlands (see s56_peatland_policy).
# * One-time costs apply on the conversion of intact (and rewetted) peatland to degraded peatland.
# * Therefore, one-time costs can used to incentivize the protection of intact peatlands.
# * Recurring costs apply on the level of degraded peatland. Therefore, recurring costs,
# * in combination with one-time costs, can be used to incentivize peatland restoration.
# * Recurring costs apply on the level of degraded peatland.
cfg$gms$s58_cost_degrad_onetime <- 0 # def = 0
cfg$gms$s58_cost_degrad_recur <- 0 # def = 0

# * Artificial cost for balance variables (USD05MER per ha)
# * The balance variables in the peatland module avoid infeasibilities due to
# * differences in accuracy between parameters and variables in GAMS.
# * High costs make sure that the balance variables are only used as a last resort.
cfg$gms$s58_cost_balance <- 1e+06 # def = 1e+06

# * Switch for fixing peatland area between 1995 and the year given by s58_fix_peatland
# * Note: Depending on the realisation, the initial peatland area is only available for the year 2015 (`on`) or 2020 (`v2`).
# * Switch for fixing peatland area until the year given by s58_fix_peatland to historic levels (not available in `off`).
# * Note: In the realisation `v2`, historic peatland area is only available for the year 2022.
# * Due to the 5-year time step limitation in MAgPIE, the suggested default is 2020.
# * Fixing peatland area in previous time steps provides a better
# * proxy for GHG emissions from peatlands than assuming no peatland area.
cfg$gms$s58_fix_peatland <- 2015 # def = 2015
cfg$gms$s58_fix_peatland <- 2020 # def = 2020

# ***------------------------- 59_som -------------------------------------
# * (static_jan19): static soil carbon loss for cropland
Expand Down
21 changes: 11 additions & 10 deletions core/macros.gms
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,14 @@ $macro m_carbon_stock_ac(land,carbon_density,sets,sets_sub) \
sum((&&sets), land(j2,&&sets) * sum(ct, carbon_density(ct,j2,&&sets,ag_pools)))$(sameas(stockType,"actual")) + \
sum((&&sets_sub), land(j2,&&sets_sub) * sum(ct, carbon_density(ct,j2,&&sets_sub,ag_pools)))$(sameas(stockType,"actualNoAcEst"));

* macros for peatland scaling factors
* expansion: (maxPeat - totManPeat) / (maxLand - totManLand)
$macro m_peatland_scaling_factor_exp(peatland,pcm_land) \
((sum(land58, peatland(j,land58)) - sum(manPeat58, peatland(j,manPeat58))) / (sum(land, pcm_land(j,land)) - sum(manLand58, pcm_land(j,manLand58))) )\
$(sum(land58, peatland(j,land58)) > 1e-10 AND sum(land, pcm_land(j,land)) > 1e-10)\
+ 0$(sum(land58, peatland(j,land58)) <= 1e-10 OR sum(land, pcm_land(j,land)) <= 1e-10)
* reduction: totManPeat / totManLand
$macro m_peatland_scaling_factor_red(peatland,pcm_land) \
(sum(manPeat58, peatland(j,manPeat58)) / sum(manLand58, pcm_land(j,manLand58)))$(sum(manPeat58, peatland(j,manPeat58)) > 1e-10 AND sum(manLand58, pcm_land(j,manLand58)) > 1e-10) \
+ 0$(sum(manPeat58, peatland(j,manPeat58)) <= 1e-10 OR sum(manLand58, pcm_land(j,manLand58)) <= 1e-10)
* macro for merging managed land area into peatland categories
$macro m_peatLandMerge(land,landForestry,set) \
land(&&set,"crop")$(sameas(manPeat58,"crop")) \
+ land(&&set,"past")$(sameas(manPeat58,"past")) \
+ landForestry(&&set,"plant")$(sameas(manPeat58,"forestry"))

* macro for peatland expansion factor
$macro m_peatLandLeft(pclandFull,setFull,vland,pcland) \
(sum(&&setFull,pclandFull(j2,&&setFull)) \
- sum(manPeat58_alias$(not sameas(manPeat58_alias,manPeat58)),vland(j2,manPeat58_alias)) \
- sum(manPeat58_alias$(sameas(manPeat58_alias,manPeat58)),pcland(j2,manPeat58_alias)))
2 changes: 1 addition & 1 deletion main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ $setglobal phosphorus off
$setglobal awms ipcc2006_aug16
$setglobal ghg_policy price_aug22
$setglobal maccs on_aug22
$setglobal peatland on
$setglobal peatland v2
$setglobal som static_jan19

$setglobal bioenergy 1stgen_priced_dec18
Expand Down
5 changes: 5 additions & 0 deletions modules/32_forestry/dynamic_feb21/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ parameters
p32_bii_coeff(type32,bii_class_secd,potnatveg) bii coeff (1)
p32_c_density_ac_fast_forestry(t_all,j,ac) Carbon densities in plantations based on Braakhekke et al (tC per ha)
p32_disturbance_loss_ftype32(t,j,type32,ac) Loss due to disturbances in all plantation type forests (mio. ha)
pcm_land_forestry(j,type32) Forestry land pools (mio. ha)
;

positive variables
Expand All @@ -75,6 +76,7 @@ positive variables
vm_prod_forestry(j,kforestry) Production of woody biomass from commercial plantations (mio. tDM per yr)
vm_landexpansion_forestry(j,type32) Forestry land expansion (mio. ha)
vm_landreduction_forestry(j,type32) Forestry land reduction (mio. ha)
vm_land_forestry(j,type32) Forestry land pools (mio. ha)
;

variables
Expand All @@ -84,6 +86,7 @@ variables
equations
q32_cost_total(i) Total forestry costs constraint (mio. USD)
q32_land(j) Land constraint (mio. ha)
q32_land_type32(j,type32) Land constraint (mio. ha)
q32_cdr_aff(j,ac) Calculation of CDR from afforestation (mio. tC)
q32_carbon(j,ag_pools,stockType) Forestry carbon stock calculation (mio. tC)
q32_land_diff Aggregated difference in forestry land compared to previous timestep (mio. ha)
Expand Down Expand Up @@ -126,9 +129,11 @@ parameters
ov_prod_forestry(t,j,kforestry,type) Production of woody biomass from commercial plantations (mio. tDM per yr)
ov_landexpansion_forestry(t,j,type32,type) Forestry land expansion (mio. ha)
ov_landreduction_forestry(t,j,type32,type) Forestry land reduction (mio. ha)
ov_land_forestry(t,j,type32,type) Forestry land pools (mio. ha)
ov_cdr_aff(t,j,ac,aff_effect,type) Expected bgc (CDR) and local bph effects of afforestation depending on planning horizon (mio. tC)
oq32_cost_total(t,i,type) Total forestry costs constraint (mio. USD)
oq32_land(t,j,type) Land constraint (mio. ha)
oq32_land_type32(t,j,type32,type) Land constraint (mio. ha)
oq32_cdr_aff(t,j,ac,type) Calculation of CDR from afforestation (mio. tC)
oq32_carbon(t,j,ag_pools,stockType,type) Forestry carbon stock calculation (mio. tC)
oq32_land_diff(t,type) Aggregated difference in forestry land compared to previous timestep (mio. ha)
Expand Down
3 changes: 3 additions & 0 deletions modules/32_forestry/dynamic_feb21/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum(
q32_land(j2) ..
vm_land(j2,"forestry") =e= sum((type32,ac), v32_land(j2,type32,ac));

q32_land_type32(j2,type32) ..
vm_land_forestry(j2,type32) =e= sum(ac, v32_land(j2,type32,ac));

q32_land_expansion_forestry(j2,type32) ..
vm_landexpansion_forestry(j2,type32) =e= sum(ac_est, v32_land_expansion(j2,type32,ac_est));

Expand Down
8 changes: 8 additions & 0 deletions modules/32_forestry/dynamic_feb21/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac);
ov_prod_forestry(t,j,kforestry,"marginal") = vm_prod_forestry.m(j,kforestry);
ov_landexpansion_forestry(t,j,type32,"marginal") = vm_landexpansion_forestry.m(j,type32);
ov_landreduction_forestry(t,j,type32,"marginal") = vm_landreduction_forestry.m(j,type32);
ov_land_forestry(t,j,type32,"marginal") = vm_land_forestry.m(j,type32);
ov_cdr_aff(t,j,ac,aff_effect,"marginal") = vm_cdr_aff.m(j,ac,aff_effect);
oq32_cost_total(t,i,"marginal") = q32_cost_total.m(i);
oq32_land(t,j,"marginal") = q32_land.m(j);
oq32_land_type32(t,j,type32,"marginal") = q32_land_type32.m(j,type32);
oq32_cdr_aff(t,j,ac,"marginal") = q32_cdr_aff.m(j,ac);
oq32_carbon(t,j,ag_pools,stockType,"marginal") = q32_carbon.m(j,ag_pools,stockType);
oq32_land_diff(t,"marginal") = q32_land_diff.m;
Expand Down Expand Up @@ -63,9 +65,11 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac);
ov_prod_forestry(t,j,kforestry,"level") = vm_prod_forestry.l(j,kforestry);
ov_landexpansion_forestry(t,j,type32,"level") = vm_landexpansion_forestry.l(j,type32);
ov_landreduction_forestry(t,j,type32,"level") = vm_landreduction_forestry.l(j,type32);
ov_land_forestry(t,j,type32,"level") = vm_land_forestry.l(j,type32);
ov_cdr_aff(t,j,ac,aff_effect,"level") = vm_cdr_aff.l(j,ac,aff_effect);
oq32_cost_total(t,i,"level") = q32_cost_total.l(i);
oq32_land(t,j,"level") = q32_land.l(j);
oq32_land_type32(t,j,type32,"level") = q32_land_type32.l(j,type32);
oq32_cdr_aff(t,j,ac,"level") = q32_cdr_aff.l(j,ac);
oq32_carbon(t,j,ag_pools,stockType,"level") = q32_carbon.l(j,ag_pools,stockType);
oq32_land_diff(t,"level") = q32_land_diff.l;
Expand Down Expand Up @@ -103,9 +107,11 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac);
ov_prod_forestry(t,j,kforestry,"upper") = vm_prod_forestry.up(j,kforestry);
ov_landexpansion_forestry(t,j,type32,"upper") = vm_landexpansion_forestry.up(j,type32);
ov_landreduction_forestry(t,j,type32,"upper") = vm_landreduction_forestry.up(j,type32);
ov_land_forestry(t,j,type32,"upper") = vm_land_forestry.up(j,type32);
ov_cdr_aff(t,j,ac,aff_effect,"upper") = vm_cdr_aff.up(j,ac,aff_effect);
oq32_cost_total(t,i,"upper") = q32_cost_total.up(i);
oq32_land(t,j,"upper") = q32_land.up(j);
oq32_land_type32(t,j,type32,"upper") = q32_land_type32.up(j,type32);
oq32_cdr_aff(t,j,ac,"upper") = q32_cdr_aff.up(j,ac);
oq32_carbon(t,j,ag_pools,stockType,"upper") = q32_carbon.up(j,ag_pools,stockType);
oq32_land_diff(t,"upper") = q32_land_diff.up;
Expand Down Expand Up @@ -143,9 +149,11 @@ p32_land(t,j,type32,ac) = v32_land.l(j,type32,ac);
ov_prod_forestry(t,j,kforestry,"lower") = vm_prod_forestry.lo(j,kforestry);
ov_landexpansion_forestry(t,j,type32,"lower") = vm_landexpansion_forestry.lo(j,type32);
ov_landreduction_forestry(t,j,type32,"lower") = vm_landreduction_forestry.lo(j,type32);
ov_land_forestry(t,j,type32,"lower") = vm_land_forestry.lo(j,type32);
ov_cdr_aff(t,j,ac,aff_effect,"lower") = vm_cdr_aff.lo(j,ac,aff_effect);
oq32_cost_total(t,i,"lower") = q32_cost_total.lo(i);
oq32_land(t,j,"lower") = q32_land.lo(j);
oq32_land_type32(t,j,type32,"lower") = q32_land_type32.lo(j,type32);
oq32_cdr_aff(t,j,ac,"lower") = q32_cdr_aff.lo(j,ac);
oq32_carbon(t,j,ag_pools,stockType,"lower") = q32_carbon.lo(j,ag_pools,stockType);
oq32_land_diff(t,"lower") = q32_land_diff.lo;
Expand Down
1 change: 1 addition & 0 deletions modules/32_forestry/dynamic_feb21/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ pc32_land(j,type32,ac) = v32_land.l(j,type32,ac);
p32_land_before(t,j,type32,ac) = p32_land(t,j,type32,ac);
vm_land.l(j,"forestry") = sum((type32,ac), v32_land.l(j,type32,ac));
pcm_land(j,"forestry") = sum((type32,ac), v32_land.l(j,type32,ac));
pcm_land_forestry(j,type32) = sum(ac, v32_land.l(j,type32,ac));

** reset all bounds
v32_land.lo(j,type32,ac) = 0;
Expand Down
1 change: 0 additions & 1 deletion modules/58_peatland/module.gms
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@

*###################### R SECTION START (MODULETYPES) ##########################
$Ifi "%peatland%" == "off" $include "./modules/58_peatland/off/realization.gms"
$Ifi "%peatland%" == "on" $include "./modules/58_peatland/on/realization.gms"
$Ifi "%peatland%" == "v2" $include "./modules/58_peatland/v2/realization.gms"
*###################### R SECTION END (MODULETYPES) ############################
2 changes: 2 additions & 0 deletions modules/58_peatland/off/not_used.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name, type, reason
vm_land, input, not used
pcm_land, input, not used
vm_land_forestry, input, not used
pcm_land_forestry, input, not used
pm_interest, input, not used
pm_climate_class, input, not used
vm_landexpansion, input, not used
Expand Down
Loading

0 comments on commit e2dc646

Please sign in to comment.