Skip to content

Commit

Permalink
bugfix vm_carbon_stock.l in equations
Browse files Browse the repository at this point in the history
  • Loading branch information
flohump committed Dec 2, 2024
1 parent 87428b9 commit 41624b5
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **32_forestry** added option s32_npi_ndc_reversal
- **35_natveg** added option s35_npi_ndc_reversal
- **58_peatland** added option for exogenous peatland rewetting
- **56_ghg_policy** added new interface pcm_carbon_stock to avoid use of vm_carbon_stock.l in equations

### removed
- **31_past** removed `grasslands_apr22` realization
Expand Down
1 change: 1 addition & 0 deletions modules/44_biodiversity/bv_btc_mar21/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

parameters
p44_price_bv_loss(t_all) Price (subsidy) for biodiversity stock loss (gain) (USD17MER per ha)
pc44_bv_weighted(j) Range-rarity weighted biodiversity stock (Mha)
;

variables
Expand Down
2 changes: 1 addition & 1 deletion modules/44_biodiversity/bv_btc_mar21/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*' Change in biodiversity stock compared to previous time step, divided by time step length.
q44_bv_loss(j2) .. v44_bv_loss(j2)
=e=
(v44_bv_weighted.l(j2) - v44_bv_weighted(j2))/m_timestep_length;
(pc44_bv_weighted(j2) - v44_bv_weighted(j2))/m_timestep_length;

*' Biodiversity stock weighted by range-rarity restoration prioritization layer (`f44_rr_layer`)
q44_bv_weighted(j2) .. v44_bv_weighted(j2)
Expand Down
2 changes: 2 additions & 0 deletions modules/44_biodiversity/bv_btc_mar21/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: [email protected]

pc44_bv_weighted(j) = v44_bv_weighted.l(j)

*#################### R SECTION START (OUTPUT DEFINITIONS) #####################
ov44_bv_loss(t,j,"marginal") = v44_bv_loss.m(j);
ov_cost_bv_loss(t,j,"marginal") = vm_cost_bv_loss.m(j);
Expand Down
2 changes: 1 addition & 1 deletion modules/44_biodiversity/bv_btc_mar21/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: [email protected]

v44_bv_weighted.l(j) = 0.3;
pc44_bv_weighted(j) = 0.3;
m_linear_time_interpol(p44_price_bv_loss,s44_start_year,s44_target_year,s44_start_price,s44_target_price);
p44_price_bv_loss(t_all)$(m_year(t_all) < s44_start_year) = 0;
display p44_price_bv_loss;
2 changes: 1 addition & 1 deletion modules/52_carbon/normal_dec17/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
q52_emis_co2_actual(i2,emis_oneoff) ..
vm_emissions_reg(i2,emis_oneoff,"co2_c") =e=
sum((cell(i2,j2),emis_land(emis_oneoff,land,c_pools)),
(vm_carbon_stock.l(j2,land,c_pools,"actual") - vm_carbon_stock(j2,land,c_pools,"actual"))/m_timestep_length);
(pcm_carbon_stock(j2,land,c_pools,"actual") - vm_carbon_stock(j2,land,c_pools,"actual"))/m_timestep_length);
1 change: 1 addition & 0 deletions modules/56_ghg_policy/price_aug22/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ parameters
p56_country_dummy2(iso) Dummy parameter indicating whether country is affected by selected GHG policy fader (1)
p56_fader(t_all) GHG policy fader (1)
p56_fader_reg(t_all,i) Regional GHG policy fader (1)
pcm_carbon_stock(j,land,c_pools,stockType) Carbon stock in vegetation soil and litter for different land types (mio. tC)
;

equations
Expand Down
2 changes: 1 addition & 1 deletion modules/56_ghg_policy/price_aug22/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
q56_emis_pricing_co2(i2,emis_oneoff) ..
v56_emis_pricing(i2,emis_oneoff,"co2_c") =e=
sum((cell(i2,j2),emis_land(emis_oneoff,land,c_pools)),
(vm_carbon_stock.l(j2,land,c_pools,"actual") - vm_carbon_stock(j2,land,c_pools,"%c56_carbon_stock_pricing%"))/m_timestep_length);
(pcm_carbon_stock(j2,land,c_pools,"actual") - vm_carbon_stock(j2,land,c_pools,"%c56_carbon_stock_pricing%"))/m_timestep_length);

*** Emission costs

Expand Down
2 changes: 2 additions & 0 deletions modules/56_ghg_policy/price_aug22/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: [email protected]

pcm_carbon_stock(j,land,ag_pools,stockType) = vm_carbon_stock.l(j,land,ag_pools,stockType);

*#################### R SECTION START (OUTPUT DEFINITIONS) #####################
ov_carbon_stock(t,j,land,c_pools,stockType,"marginal") = vm_carbon_stock.m(j,land,c_pools,stockType);
ov_emission_costs(t,i,"marginal") = vm_emission_costs.m(i);
Expand Down
3 changes: 2 additions & 1 deletion modules/56_ghg_policy/price_aug22/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

* starting value of above ground carbon stocks 1995 is only an estimate.
* ATTENTION: emissions in 1995 are not meaningful
vm_carbon_stock.l(j,land,ag_pools,stockType) = fm_carbon_density("y1995",j,land,ag_pools)*pcm_land(j,land);
pcm_carbon_stock(j,land,ag_pools,stockType) = fm_carbon_density("y1995",j,land,ag_pools)*pcm_land(j,land);
vm_carbon_stock.l(j,land,ag_pools,stockType) = pcm_carbon_stock(j,land,ag_pools,stockType);

v56_emis_pricing.fx(i,emis_oneoff,pollutants)$(not sameas(pollutants,"co2_c")) = 0;

Expand Down
6 changes: 4 additions & 2 deletions modules/59_som/cellpool_aug16/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ pc59_som_pool(j,noncropland59) =
* starting value of carbon stocks 1995 is only an estimate.
* ATTENTION: emissions in 1995 are not meaningful

vm_carbon_stock.l(j,"crop","soilc",stockType) =
pcm_carbon_stock(j,"crop","soilc",stockType) =
pc59_som_pool(j,"crop") + i59_subsoilc_density("y1995",j) * pm_land_start(j,"crop");
vm_carbon_stock.l(j,noncropland59,"soilc",stockType) =
vm_carbon_stock.l(j,"crop","soilc",stockType) = pcm_carbon_stock(j,"crop","soilc",stockType);
pcm_carbon_stock(j,noncropland59,"soilc",stockType) =
fm_carbon_density("y1995",j,noncropland59,"soilc") * pm_land_start(j,noncropland59);
vm_carbon_stock.l(j,noncropland59,"soilc",stockType) = pcm_carbon_stock(j,noncropland59,"soilc",stockType);

*****************************
*** cshare calculation ***
Expand Down
6 changes: 4 additions & 2 deletions modules/59_som/cellpool_jan23/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ pc59_som_pool(j,noncropland59) =
* starting value of carbon stocks 1995 is only an estimate.
* ATTENTION: emissions in 1995 are not meaningful

vm_carbon_stock.l(j,"crop","soilc",stockType) =
pcm_carbon_stock(j,"crop","soilc",stockType) =
pc59_som_pool(j,"crop") + i59_subsoilc_density("y1995",j) * pm_land_start(j,"crop");
vm_carbon_stock.l(j,noncropland59,"soilc",stockType) =
vm_carbon_stock.l(j,"crop","soilc",stockType) = pcm_carbon_stock(j,"crop","soilc",stockType);
pcm_carbon_stock(j,noncropland59,"soilc",stockType) =
fm_carbon_density("y1995",j,noncropland59,"soilc") * pm_land_start(j,noncropland59);
vm_carbon_stock.l(j,noncropland59,"soilc",stockType) = pcm_carbon_stock(j,noncropland59,"soilc",stockType);

*****************************
*** cshare calculation ***
Expand Down
4 changes: 2 additions & 2 deletions modules/59_som/static_jan19/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

* starting value of carbon stocks 1995 is only an estimate.
* ATTENTION: emissions in 1995 are not meaningful
vm_carbon_stock.l(j,land,"soilc","actual") = fm_carbon_density("y1995",j,land,"soilc") * pcm_land(j,land);
*pcm_carbon_stock(j,land,"soilc") = vm_carbon_stock.l(j,land,"soilc");
pcm_carbon_stock(j,land,"soilc","actual") = fm_carbon_density("y1995",j,land,"soilc") * pcm_land(j,land);
vm_carbon_stock.l(j,land,"soilc","actual") = pcm_carbon_stock(j,land,"soilc","actual");

* Soilc is not different for all non cropland vegetated land types
* No age-class soil carbon density distribution is nessessary
Expand Down

0 comments on commit 41624b5

Please sign in to comment.