Skip to content

Commit

Permalink
update + bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
flohump committed Nov 28, 2023
1 parent b354839 commit 53a6a10
Show file tree
Hide file tree
Showing 15 changed files with 394 additions and 325 deletions.
14 changes: 10 additions & 4 deletions core/macros.gms
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ $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"));

* macro for peatland dynamics
$macro m_peatland(peatland,peatland_item,vm_land,pcm_land,land_item,scaling_factor) \
peatland(j2,peatland_item) + ((vm_land(j2,land_item)-pcm_land(j2,land_item)) * scaling_factor(j2)) * \
(scaling_factor(j2) * vm_land(j2,land_item) - peatland(j2,peatland_item)) / ((vm_land(j2,land_item) - pcm_land(j2,land_item)) * scaling_factor(j2) + 1e-6)
* 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)
97 changes: 50 additions & 47 deletions modules/32_forestry/dynamic_feb21/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ parameters
p32_bii_coeff(type32,bii_class_secd,potnatveg) bii coeff (1)
p32_c_density_ac_fast_forestry(t_all,j,ac) Carbon densities in plantations based on Braakhekke et al (tC per ha)
p32_disturbance_loss_ftype32(t,j,type32,ac) Loss due to disturbances in all plantation type forests (mio. ha)
pcm_land_forestry(j,type32) Forestry land (mio. ha)
;

positive variables
Expand All @@ -74,81 +73,85 @@ positive variables
v32_cost_establishment(i) Cost of establishment calculated at the current time step (mio. USD)
v32_hvarea_forestry(j,ac) Harvested area from timber plantations (mio. ha)
vm_prod_forestry(j,kforestry) Production of woody biomass from commercial plantations (mio. tDM per yr)
vm_land_forestry(j,type32) Forestry land (mio. ha)
;
vm_landexpansion_forestry(j,type32) Forestry land expansion (mio. ha)
vm_landreduction_forestry(j,type32) Forestry land reduction (mio. ha)
;

variables
vm_cdr_aff(j,ac,aff_effect) Expected bgc (CDR) and local bph effects of afforestation depending on planning horizon (mio. tC)
;
;

equations
q32_cost_total(i) Total forestry costs constraint (mio. USD)
q32_land(j) 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)
q32_max_aff Maximum total global afforestation (mio. ha)
q32_max_aff Maximum total global afforestation (mio. ha)
q32_max_aff_reg(i) Maximum total regional afforestation (mio. ha)
q32_aff_pol(j) Afforestation policy constraint (mio. ha)
q32_aff_est(j) Afforestation constraint for establishment age classes (mio. ha)
q32_hvarea_forestry(j,ac) Plantations area harvest (mio. ha)
q32_cost_recur(i) Recurruing costs (mio. USD)
q32_establishment_dynamic(i) Establishment in current time step for future demand (mio. ha)
q32_establishment_dynamic_yield(i) Regional timber yield (tDM per ha)
q32_establishment_dynamic_yield(i) Regional timber yield (tDM per ha)
q32_establishment_fixed(j) Establishment in current time step for future demand (mio. ha)
q32_land_expansion(j,type32,ac) Land expansion (mio. ha)
q32_land_reduction(j,type32,ac) Land contraction (mio. ha)
q32_cost_establishment(i) Present value of cost of establishment (mio. USD)
q32_bgp_aff(j,ac) Biophysical afforestation calculation (mio. tCeq)
q32_forestry_est(j,type32,ac) Distribution of forestry establishment over ac_est (mio. ha)
q32_cost_hvarea(i) Cost of harvesting timber from forests (mio. USD per yr)
q32_prod_forestry(j) Production of woody biomass from commercial plantations (mio. tDM per yr)
q32_cost_hvarea(i) Cost of harvesting timber from forests (mio. USD per yr)
q32_prod_forestry(j) Production of woody biomass from commercial plantations (mio. tDM per yr)
q32_bv_aff(j,potnatveg) Biodiversity value for aff forestry land (Mha)
q32_bv_ndc(j,potnatveg) Biodiversity value for ndc forestry land (Mha)
q32_bv_plant(j,potnatveg) Biodiversity value for plantations (Mha)
q32_land_forestry(j,type32) Forestry land (Mha)
q32_land_expansion_forestry(j,type32) Forestry land expansion (mio. ha)
q32_land_reduction_forestry(j,type32) Forestry land reduction (mio. ha)
;


*#################### R SECTION START (OUTPUT DECLARATIONS) ####################
parameters
ov_cost_fore(t,i,type) Forestry costs (Mio USD)
ov32_cost_hvarea(t,i,type) Cost of harvesting timber from forests (mio. USD per yr)
ov32_land(t,j,type32,ac,type) Forestry land pools (mio. ha)
ov32_land_missing(t,j,type) Forestry land which can be used at extrmemly high costs in case not enough area is available for new establishment (mio. ha)
ov_landdiff_forestry(t,type) Aggregated difference in forestry land compared to previous timestep (mio. ha)
ov32_cost_recur(t,i,type) Recurring forest management costs (USD per ha)
ov32_land_expansion(t,j,type32,ac,type) Forestry land expansion (mio. ha)
ov32_land_reduction(t,j,type32,ac,type) Forestry land reduction (mio. ha)
ov32_cost_establishment(t,i,type) Cost of establishment calculated at the current time step (mio. USD)
ov32_hvarea_forestry(t,j,ac,type) Harvested area from timber plantations (mio. ha)
ov_prod_forestry(t,j,kforestry,type) Production of woody biomass from commercial plantations (mio. tDM per yr)
ov_land_forestry(t,j,type32,type) Forestry land (mio. ha)
ov_cdr_aff(t,j,ac,aff_effect,type) Expected bgc (CDR) and local bph effects of afforestation depending on planning horizon (mio. tC)
oq32_cost_total(t,i,type) Total forestry costs constraint (mio. USD)
oq32_land(t,j,type) Land constraint (mio. ha)
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)
oq32_max_aff(t,type) Maximum total global afforestation (mio. ha)
oq32_max_aff_reg(t,i,type) Maximum total regional afforestation (mio. ha)
oq32_aff_pol(t,j,type) Afforestation policy constraint (mio. ha)
oq32_aff_est(t,j,type) Afforestation constraint for establishment age classes (mio. ha)
oq32_hvarea_forestry(t,j,ac,type) Plantations area harvest (mio. ha)
oq32_cost_recur(t,i,type) Recurruing costs (mio. USD)
oq32_establishment_dynamic(t,i,type) Establishment in current time step for future demand (mio. ha)
oq32_establishment_dynamic_yield(t,i,type) Regional timber yield (tDM per ha)
oq32_establishment_fixed(t,j,type) Establishment in current time step for future demand (mio. ha)
oq32_land_expansion(t,j,type32,ac,type) Land expansion (mio. ha)
oq32_land_reduction(t,j,type32,ac,type) Land contraction (mio. ha)
oq32_cost_establishment(t,i,type) Present value of cost of establishment (mio. USD)
oq32_bgp_aff(t,j,ac,type) Biophysical afforestation calculation (mio. tCeq)
oq32_forestry_est(t,j,type32,ac,type) Distribution of forestry establishment over ac_est (mio. ha)
oq32_cost_hvarea(t,i,type) Cost of harvesting timber from forests (mio. USD per yr)
oq32_prod_forestry(t,j,type) Production of woody biomass from commercial plantations (mio. tDM per yr)
oq32_bv_aff(t,j,potnatveg,type) Biodiversity value for aff forestry land (Mha)
oq32_bv_ndc(t,j,potnatveg,type) Biodiversity value for ndc forestry land (Mha)
oq32_bv_plant(t,j,potnatveg,type) Biodiversity value for plantations (Mha)
oq32_land_forestry(t,j,type32,type) Forestry land (Mha)
ov_cost_fore(t,i,type) Forestry costs (Mio USD)
ov32_cost_hvarea(t,i,type) Cost of harvesting timber from forests (mio. USD per yr)
ov32_land(t,j,type32,ac,type) Forestry land pools (mio. ha)
ov32_land_missing(t,j,type) Forestry land which can be used at extrmemly high costs in case not enough area is available for new establishment (mio. ha)
ov_landdiff_forestry(t,type) Aggregated difference in forestry land compared to previous timestep (mio. ha)
ov32_cost_recur(t,i,type) Recurring forest management costs (USD per ha)
ov32_land_expansion(t,j,type32,ac,type) Forestry land expansion (mio. ha)
ov32_land_reduction(t,j,type32,ac,type) Forestry land reduction (mio. ha)
ov32_cost_establishment(t,i,type) Cost of establishment calculated at the current time step (mio. USD)
ov32_hvarea_forestry(t,j,ac,type) Harvested area from timber plantations (mio. ha)
ov_prod_forestry(t,j,kforestry,type) Production of woody biomass from commercial plantations (mio. tDM per yr)
ov_landexpansion_forestry(t,j,type32,type) Forestry land expansion (mio. ha)
ov_landreduction_forestry(t,j,type32,type) Forestry land reduction (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_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)
oq32_max_aff(t,type) Maximum total global afforestation (mio. ha)
oq32_max_aff_reg(t,i,type) Maximum total regional afforestation (mio. ha)
oq32_aff_pol(t,j,type) Afforestation policy constraint (mio. ha)
oq32_aff_est(t,j,type) Afforestation constraint for establishment age classes (mio. ha)
oq32_hvarea_forestry(t,j,ac,type) Plantations area harvest (mio. ha)
oq32_cost_recur(t,i,type) Recurruing costs (mio. USD)
oq32_establishment_dynamic(t,i,type) Establishment in current time step for future demand (mio. ha)
oq32_establishment_dynamic_yield(t,i,type) Regional timber yield (tDM per ha)
oq32_establishment_fixed(t,j,type) Establishment in current time step for future demand (mio. ha)
oq32_land_expansion(t,j,type32,ac,type) Land expansion (mio. ha)
oq32_land_reduction(t,j,type32,ac,type) Land contraction (mio. ha)
oq32_cost_establishment(t,i,type) Present value of cost of establishment (mio. USD)
oq32_bgp_aff(t,j,ac,type) Biophysical afforestation calculation (mio. tCeq)
oq32_forestry_est(t,j,type32,ac,type) Distribution of forestry establishment over ac_est (mio. ha)
oq32_cost_hvarea(t,i,type) Cost of harvesting timber from forests (mio. USD per yr)
oq32_prod_forestry(t,j,type) Production of woody biomass from commercial plantations (mio. tDM per yr)
oq32_bv_aff(t,j,potnatveg,type) Biodiversity value for aff forestry land (Mha)
oq32_bv_ndc(t,j,potnatveg,type) Biodiversity value for ndc forestry land (Mha)
oq32_bv_plant(t,j,potnatveg,type) Biodiversity value for plantations (Mha)
oq32_land_expansion_forestry(t,j,type32,type) Forestry land expansion (mio. ha)
oq32_land_reduction_forestry(t,j,type32,type) Forestry land reduction (mio. ha)
;
*##################### R SECTION END (OUTPUT DECLARATIONS) #####################
7 changes: 5 additions & 2 deletions modules/32_forestry/dynamic_feb21/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ sum(ac_est, v32_land(j2,"aff",ac_est)) =l= sum(ac, v32_land(j2,"aff",ac)) - sum(
q32_land(j2) ..
vm_land(j2,"forestry") =e= sum((type32,ac), v32_land(j2,type32,ac));

q32_land_forestry(j2,type32) ..
vm_land_forestry(j2,type32) =e= sum(ac, v32_land(j2,type32,ac));
q32_land_expansion_forestry(j2,type32) ..
vm_landexpansion_forestry(j2,type32) =e= sum(ac_est, v32_land_expansion(j2,type32,ac_est));

q32_land_reduction_forestry(j2,type32) ..
vm_landreduction_forestry(j2,type32) =e= sum(ac_sub, v32_land_reduction(j2,type32,ac_sub));

*' The constraint `q32_aff_pol` accounts for the exogenous afforestation prescribed by NPI/NDC policies.

Expand Down
Loading

0 comments on commit 53a6a10

Please sign in to comment.