Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AgroForestry: treecover on cropland and betr #644

Merged
merged 147 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
367222a
tree cover cropland
flohump Mar 9, 2024
aecdaff
treecover and betr scenario
flohump Mar 11, 2024
3ea3246
code revisions
flohump Mar 12, 2024
aa676cf
new module 61_agroforestry. reverted code in 30_crop
flohump Mar 13, 2024
39738df
missing code
flohump Mar 13, 2024
41cdffe
bugfix
flohump Mar 13, 2024
6725072
bugfix
flohump Mar 15, 2024
9c34926
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump Mar 15, 2024
f8c5e21
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump Apr 10, 2024
d2e21ce
partial commit to save work
flohump Apr 11, 2024
afb8831
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump Apr 12, 2024
ed34c5e
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump Apr 15, 2024
531ffad
partial commit to save work
flohump Apr 16, 2024
cc47972
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump Apr 16, 2024
9467984
partial commit to save work
flohump Apr 19, 2024
20e42a2
partial commit to save work
flohump Apr 19, 2024
f96fbb0
partial commit to save work
flohump Apr 19, 2024
9b4b009
partial commit to save work
flohump Apr 20, 2024
3845262
partial commit to save work
flohump Apr 20, 2024
e7f8e40
partial commit to save work
flohump Apr 20, 2024
3923e34
partial commit to save work
flohump Apr 21, 2024
350667a
partial commit to save work
flohump Apr 21, 2024
abdc8c8
partial commit to save work
flohump Apr 21, 2024
67b57fc
partial commit to save work
flohump Apr 21, 2024
495bf03
Merge branch 'f_fix' of github.com:flohump/magpie into f_AFS
flohump Apr 21, 2024
a0b0e15
bugfix
flohump Apr 21, 2024
43fd4fd
bugfix
flohump Apr 21, 2024
8333584
balance variable NPI NDC reforestation
flohump Apr 22, 2024
1014226
bugfixes
flohump Apr 22, 2024
ec92cc6
bugfix
flohump Apr 22, 2024
876fc9d
bugfix
flohump Apr 22, 2024
8063487
bugfix
flohump Apr 22, 2024
a26ece2
bugfixes
flohump Apr 22, 2024
3feb873
partial commit to save work
flohump Apr 22, 2024
629a809
bugfix
flohump Apr 22, 2024
670e825
bugfixes
flohump Apr 23, 2024
6b48d9e
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump Apr 23, 2024
eea0d5f
bugfix
flohump Apr 23, 2024
b44171c
bugfixes
flohump Apr 23, 2024
abd5d8a
bugfixes
flohump Apr 23, 2024
500c08f
bugfix
flohump Apr 23, 2024
4f4fbf4
bugfixes
flohump Apr 23, 2024
c082921
bugfixes
flohump Apr 23, 2024
5c455ed
bugfixes
flohump Apr 24, 2024
34e0c6b
bugfixes
flohump Apr 24, 2024
6279d34
test without boundfix
flohump Apr 24, 2024
274542d
bugfixes
flohump Apr 24, 2024
a3eb576
reverting back
flohump Apr 24, 2024
34b830b
check again with other bounds
flohump Apr 24, 2024
41d1deb
test different boundfix values
flohump Apr 24, 2024
a179129
revert q29_avl_cropland
flohump Apr 24, 2024
9d3b74a
additional test runs
flohump Apr 24, 2024
960767e
scaling for age-class variables
flohump Apr 24, 2024
5b89eee
scaling for age-class variables
flohump Apr 24, 2024
0bdde4d
bugfixes
flohump Apr 25, 2024
37a8b37
bugfixes
flohump Apr 25, 2024
65f8202
move of shifting from other land to secondary before age-class growth…
flohump Apr 25, 2024
560b736
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump Apr 25, 2024
a755ee5
bugfixes
flohump Apr 26, 2024
b6fb489
bugfix
flohump Apr 27, 2024
c6c4756
bugfix
flohump Apr 28, 2024
f22f736
bugfix
flohump Apr 28, 2024
14eea42
bugfix
flohump Apr 28, 2024
a723bd9
bugfix
flohump Apr 28, 2024
f80ee75
scaling
flohump Apr 28, 2024
ea597be
scaleopt
flohump Apr 28, 2024
d0c8388
revert
flohump Apr 29, 2024
2143ba2
updates
flohump Apr 29, 2024
0b74f68
lines
flohump Apr 29, 2024
8d3df52
bugfix
flohump Apr 29, 2024
b406498
bugfix
flohump Apr 29, 2024
29ec05a
bugfix
flohump Apr 30, 2024
176fa1c
bugfix
flohump Apr 30, 2024
ccaf380
bugfix
flohump Apr 30, 2024
1745fcd
update calibration
flohump Apr 30, 2024
4d2b2e3
highres
flohump May 1, 2024
584aac5
nlp par update
flohump May 2, 2024
6c23a00
update
flohump May 2, 2024
444eaaf
update
flohump May 2, 2024
d4f25ff
update
flohump May 2, 2024
8e61949
bugfix
flohump May 2, 2024
518c25d
bugfix
flohump May 2, 2024
9d7befc
update
flohump May 2, 2024
d8eb4e9
bugfix
flohump May 2, 2024
9f2acf4
bugfix
flohump May 2, 2024
f7125ac
bugfix
flohump May 2, 2024
46e2285
update
flohump May 3, 2024
286d9c5
bugfix
flohump May 3, 2024
ac4c249
update
flohump May 3, 2024
bc4c3cf
bugfix
flohump May 3, 2024
4ff9834
bugfix
flohump May 3, 2024
09535ff
updates
flohump May 4, 2024
4e94659
update
flohump May 4, 2024
2f79c13
bugfix
flohump May 4, 2024
8fa3217
test
flohump May 4, 2024
fdbbc1c
test
flohump May 4, 2024
47256b8
bugfix
flohump May 4, 2024
ce923a3
update
flohump May 4, 2024
3747457
update
flohump May 4, 2024
b4a596d
update
flohump May 5, 2024
9e175b4
bugfix
flohump May 6, 2024
72ce77e
updates
flohump May 7, 2024
2ce5f4b
bugfix
flohump May 7, 2024
7be483e
update optfile
flohump May 7, 2024
1d7b333
update additional data
flohump May 7, 2024
574f54d
bugfix
flohump May 8, 2024
95c0f43
reverting back faders
flohump May 9, 2024
893cbfd
bugfix
flohump May 9, 2024
d1ca47d
start script peatlandTax
flohump May 10, 2024
2c61aa6
update
flohump May 11, 2024
02af343
adde s30_betr_start
flohump May 13, 2024
be4d767
sync
flohump May 16, 2024
40b7ddf
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump May 16, 2024
a11c5ea
bugfix
flohump May 16, 2024
2beac3f
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump May 17, 2024
47b3982
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump May 29, 2024
404be5c
bugfix
flohump May 29, 2024
f9be6ac
revisions
flohump May 29, 2024
f56a0c1
bugfix carbon density
flohump May 30, 2024
85e6fe5
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump May 30, 2024
dce8e0d
cleanup and consistency 32_forestry
flohump May 30, 2024
6119e52
revision 59_som
flohump Jun 1, 2024
442a7ab
bugfix disaggregation
flohump Jun 2, 2024
a9904f0
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump Jun 9, 2024
1774fcf
Merge branch 'f_pForest' of github.com:pvjeetze/magpie into f_AFS
flohump Jun 9, 2024
cb0294f
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump Jun 10, 2024
604baa6
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump Jun 11, 2024
07b187b
fix
flohump Jun 11, 2024
6496d8f
fix changelog
flohump Jun 11, 2024
b42d809
fix changelog
flohump Jun 11, 2024
58d5ef8
test
flohump Jun 12, 2024
6db3dcb
accuracy in conditions changed to avoid very small numbers
flohump Jun 14, 2024
1d64e11
bugfix land restoration and country switches for agroforestry
flohump Jun 14, 2024
4b703be
added EUR
flohump Jun 14, 2024
560138b
magpie4 version + peatland input files
flohump Jun 15, 2024
4ac78c6
Changelog
flohump Jun 15, 2024
1050681
changelog
flohump Jun 15, 2024
7c47023
bugfix
flohump Jun 15, 2024
d789ea6
update main.gms
flohump Jun 15, 2024
e807eb5
update default.cfg
flohump Jun 17, 2024
6f55c1d
code cleanup
flohump Jun 17, 2024
2924193
bugfix fixing 2025 44_biodiverstiy
flohump Jun 17, 2024
25cbd4f
update input data
flohump Jun 17, 2024
96b833e
update input data revision
flohump Jun 17, 2024
38d34ea
update input data
flohump Jun 17, 2024
57638fc
changelog
flohump Jun 18, 2024
8334590
Merge branch 'develop' of github.com:magpiemodel/magpie into f_AFS
flohump Jun 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/macros.gms
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ $macro m_linear_cell_data_interpol(output,x,input_x1,input_x2,input_y1,input_y2)
* macro for simple carbon stocks
$macro m_carbon_stock(land,carbon_density,item) \
(land(j2,item) * sum(ct,carbon_density(ct,j2,item,ag_pools)))$(sameas(stockType,"actual")) + \
(land(j2,item) * sum(ct,carbon_density(ct,j2,item,ag_pools)))$(sameas(stockType,"actualNoAcEst"));
(land(j2,item) * sum(ct,carbon_density(ct,j2,item,ag_pools)))$(sameas(stockType,"actualNoAcEst"))

* macro for carbon stocks with age classes
$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"));
sum((&&sets_sub), land(j2,&&sets_sub) * sum(ct, carbon_density(ct,j2,&&sets_sub,ag_pools)))$(sameas(stockType,"actualNoAcEst"))
flohump marked this conversation as resolved.
Show resolved Hide resolved

* macros for peatland module
$macro m58_LandMerge(land,landForestry,set) \
Expand Down
22 changes: 22 additions & 0 deletions modules/30_crop/endo_apr21/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: [email protected]

scalars
s30_shift number of 5-year age-classes corresponding to current time step length (1)
;

parameters
p30_avl_cropland(t,j) Total available land for crop cultivation (mio. ha)
p30_country_snv_weight(i) SNV policy country weight per region (1)
Expand All @@ -16,13 +20,22 @@ parameters
i30_avl_cropland_iso(iso) Available land area for cropland at ISO level (mio. ha)
p30_snv_scenario_fader(t_all) SNV scenario fader (1)
p30_rotation_scenario_fader(t_all) Crop rotation scenario fader (1)
p30_treecover(t,j,ac) Cropland tree cover per age class (mio. ha)
pc30_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha)
p30_carbon_density_ac(t,j,ac,ag_pools) Carbon density cropland tree cover (tC per ha)
p30_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1)
p30_treecover_min_shr(t,j) Minimum share of treecover on cropland (1)
p30_treecover_scenario_fader(t_all) Cropland treecover scenario fader (1)
p30_betr_min_shr(t,j) Minimum share of bioenergy trees on cropland (1)
p30_betr_scenario_fader(t_all) Bioenergy trees scenario fader (1)
;

positive variables
* Fallow land is cropland which is temporarily fallow. Croparea+fallow=cropland
vm_fallow(j) Fallow land (mio. ha)
vm_area(j,kcr,w) Agricultural production area (mio. ha)
vm_rotation_penalty(i) Penalty for violating rotational constraints (USD05MER)
v30_treecover(j,ac) Cropland tree cover per age class (mio. ha)
;

equations
Expand All @@ -36,13 +49,18 @@ equations
q30_bv_per(j,potnatveg) Biodiversity value of perennial cropland (mio. ha)
q30_land_snv(j) Land constraint for the SNV policy in cropland areas (mio. ha)
q30_land_snv_trans(j) Land transition constraint for SNV policy in cropland areas (mio. ha)
q30_treecover(j) Land constraint cropland treecover (mio. ha)
q30_treecover_est(j,ac) Land constraint cropland treecover (mio. ha)
q30_betr(j) Land constraint betr (mio. ha)
q30_bv_treecover(j,potnatveg) Biodiversity value for cropland treecover (Mha)
;

*#################### R SECTION START (OUTPUT DECLARATIONS) ####################
parameters
ov_fallow(t,j,type) Fallow land (mio. ha)
ov_area(t,j,kcr,w,type) Agricultural production area (mio. ha)
ov_rotation_penalty(t,i,type) Penalty for violating rotational constraints (USD05MER)
ov30_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha)
oq30_cropland(t,j,type) Total cropland calculation (mio. ha)
oq30_avl_cropland(t,j,type) Available cropland constraint (mio. ha)
oq30_rotation_max(t,j,crp30,w,type) Local maximum rotational constraints (mio. ha)
Expand All @@ -53,6 +71,10 @@ parameters
oq30_bv_per(t,j,potnatveg,type) Biodiversity value of perennial cropland (mio. ha)
oq30_land_snv(t,j,type) Land constraint for the SNV policy in cropland areas (mio. ha)
oq30_land_snv_trans(t,j,type) Land transition constraint for SNV policy in cropland areas (mio. ha)
oq30_treecover(t,j,type) Land constraint cropland treecover (mio. ha)
oq30_treecover_est(t,j,ac,type) Land constraint cropland treecover (mio. ha)
oq30_betr(t,j,type) Land constraint betr (mio. ha)
oq30_bv_treecover(t,j,potnatveg,type) Biodiversity value for cropland treecover (Mha)
;
*##################### R SECTION END (OUTPUT DECLARATIONS) #####################

Expand Down
23 changes: 21 additions & 2 deletions modules/30_crop/endo_apr21/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*' the sum of crop and water supply type specific land requirements:

q30_cropland(j2) ..
sum((kcr,w), vm_area(j2,kcr,w)) =e= vm_land(j2,"crop");
sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + sum(ac, v30_treecover(j2,ac)) =e= vm_land(j2,"crop");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now you introduced fallow into the endo_apr realization. Was that on purpose?
As long as it is fixed to 0, probably doesnt matter...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for consistency because fallow land and treecover will show up in this equation in the other realizations.

flohump marked this conversation as resolved.
Show resolved Hide resolved

*' We assume that crop production can only take place on suitable cropland area.
*' We use a suitability index (SI) map from @zabel_global_2014 to exclude areas
Expand Down Expand Up @@ -40,6 +40,19 @@
q30_land_snv_trans(j2) ..
sum(land_snv, vm_lu_transitions(j2,"crop",land_snv)) =g= sum(ct, p30_snv_relocation(ct,j2));

q30_treecover(j2) ..
sum(ac, v30_treecover(j2,ac)) =g= sum(ct, p30_treecover_min_shr(ct,j2)) * vm_land(j2,"crop");

q30_betr(j2) ..
sum(w, vm_area(j2,"betr",w)) =g=
vm_land(j2,"crop") * sum(ct, p30_betr_min_shr(ct,j2));

*' This constraint distributes additions to forestry land over ac_est,
*' which depends on the time step length (e.g. ac0 and ac5 for a 10 year time step).

q30_treecover_est(j2,ac_est) ..
v30_treecover(j2,ac_est) =e= sum(ac_est2, v30_treecover(j2,ac_est2))/card(ac_est2);

*' As additional constraints minimum and maximum rotational constraints limit
*' the placing of crops. On the one hand, these rotational constraints reflect
*' crop rotations limiting the share a specific crop can cover of the total area
Expand Down Expand Up @@ -68,7 +81,8 @@

q30_carbon(j2,ag_pools,stockType) ..
vm_carbon_stock(j2,"crop",ag_pools,stockType) =e=
m_carbon_stock(vm_land,fm_carbon_density,"crop");
m_carbon_stock(vm_land,fm_carbon_density,"crop") +
m_carbon_stock_ac(v30_treecover,p30_carbon_density_ac,"ac","ac_sub");

*' The biodiversity value for cropland is calculated separately for annual and perennial crops:
q30_bv_ann(j2,potnatveg) .. vm_bv(j2,"crop_ann",potnatveg)
Expand All @@ -79,3 +93,8 @@
=e=
(vm_land(j2,"crop") - sum((crop_ann30,w), vm_area(j2,crop_ann30,w)))
* fm_bii_coeff("crop_per",potnatveg) * fm_luh2_side_layers(j2,potnatveg);

q30_bv_treecover(j2,potnatveg) .. vm_bv(j2,"crop_tree",potnatveg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the set potnatveg doing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bii coefficients are defined for two layers: forested and non-forested biomes.

=e=
sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v30_treecover(j2,ac)) *
p30_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg);
21 changes: 21 additions & 0 deletions modules/30_crop/endo_apr21/input.gms
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ s30_snv_relocation_data_x1 First reference value in SNV target cropland dat
s30_snv_relocation_data_x2 Second reference value in SNV target cropland data (1) / 0.5 /
s30_rotation_scenario_start Rotation scenario start year / 2020 /
s30_rotation_scenario_target Rotation scenario target year / 2050 /
s30_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 /
s30_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 /
s30_treecover_min_shr Share of treecover on cropland (1) / 0 /
s30_treecover_min_shr_noselect Share of treecover on cropland (1) / 0 /
s30_treecover_scenario_start Cropland treecover scenario start year / 2020 /
s30_treecover_scenario_target Cropland treecover scenario target year / 2030 /
s30_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 /
s30_betr_min_shr Minimum share of bioenergy trees on cropland (1) / 0 /
s30_betr_min_shr_noselect Minimum share of bioenergy trees on cropland (1) / 0 /
s30_betr_scenario_start Bioenergy trees scenario start year / 2020 /
s30_betr_scenario_target Bioenergy trees scenario target year / 2050 /
;

* Set-switch for countries affected by regional SNV policy
Expand Down Expand Up @@ -122,3 +133,13 @@ $ondelim
$include "./modules/30_crop/endo_apr21/input/SNVTargetCropland.cs3"
$offdelim
;

********* Cropland tree cover *******************************************

parameter f30_treecover(j) Tree cover on cropland in 2019 (mio. ha)
/
$ondelim
$include "./modules/30_crop/endo_apr21/input/CroplandTreecover.cs2"
$offdelim
/
;
2 changes: 2 additions & 0 deletions modules/30_crop/endo_apr21/input/files
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ f30_croparea_w_initialisation.cs3
avl_cropland_iso.cs3
SNVTargetCropland.cs3
SNVTargetCropland_0.5.mz
CroplandTreecover.cs2
CroplandTreecover_0.5.mz
21 changes: 21 additions & 0 deletions modules/30_crop/endo_apr21/postsolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: [email protected]

pc30_treecover(j,ac) = v30_treecover.l(j,ac);

*#################### R SECTION START (OUTPUT DEFINITIONS) #####################
ov_fallow(t,j,"marginal") = vm_fallow.m(j);
ov_area(t,j,kcr,w,"marginal") = vm_area.m(j,kcr,w);
ov_rotation_penalty(t,i,"marginal") = vm_rotation_penalty.m(i);
ov30_treecover(t,j,ac,"marginal") = v30_treecover.m(j,ac);
oq30_cropland(t,j,"marginal") = q30_cropland.m(j);
oq30_avl_cropland(t,j,"marginal") = q30_avl_cropland.m(j);
oq30_rotation_max(t,j,crp30,w,"marginal") = q30_rotation_max.m(j,crp30,w);
Expand All @@ -20,9 +22,14 @@
oq30_bv_per(t,j,potnatveg,"marginal") = q30_bv_per.m(j,potnatveg);
oq30_land_snv(t,j,"marginal") = q30_land_snv.m(j);
oq30_land_snv_trans(t,j,"marginal") = q30_land_snv_trans.m(j);
oq30_treecover(t,j,"marginal") = q30_treecover.m(j);
oq30_treecover_est(t,j,ac,"marginal") = q30_treecover_est.m(j,ac);
oq30_betr(t,j,"marginal") = q30_betr.m(j);
oq30_bv_treecover(t,j,potnatveg,"marginal") = q30_bv_treecover.m(j,potnatveg);
ov_fallow(t,j,"level") = vm_fallow.l(j);
ov_area(t,j,kcr,w,"level") = vm_area.l(j,kcr,w);
ov_rotation_penalty(t,i,"level") = vm_rotation_penalty.l(i);
ov30_treecover(t,j,ac,"level") = v30_treecover.l(j,ac);
oq30_cropland(t,j,"level") = q30_cropland.l(j);
oq30_avl_cropland(t,j,"level") = q30_avl_cropland.l(j);
oq30_rotation_max(t,j,crp30,w,"level") = q30_rotation_max.l(j,crp30,w);
Expand All @@ -33,9 +40,14 @@
oq30_bv_per(t,j,potnatveg,"level") = q30_bv_per.l(j,potnatveg);
oq30_land_snv(t,j,"level") = q30_land_snv.l(j);
oq30_land_snv_trans(t,j,"level") = q30_land_snv_trans.l(j);
oq30_treecover(t,j,"level") = q30_treecover.l(j);
oq30_treecover_est(t,j,ac,"level") = q30_treecover_est.l(j,ac);
oq30_betr(t,j,"level") = q30_betr.l(j);
oq30_bv_treecover(t,j,potnatveg,"level") = q30_bv_treecover.l(j,potnatveg);
ov_fallow(t,j,"upper") = vm_fallow.up(j);
ov_area(t,j,kcr,w,"upper") = vm_area.up(j,kcr,w);
ov_rotation_penalty(t,i,"upper") = vm_rotation_penalty.up(i);
ov30_treecover(t,j,ac,"upper") = v30_treecover.up(j,ac);
oq30_cropland(t,j,"upper") = q30_cropland.up(j);
oq30_avl_cropland(t,j,"upper") = q30_avl_cropland.up(j);
oq30_rotation_max(t,j,crp30,w,"upper") = q30_rotation_max.up(j,crp30,w);
Expand All @@ -46,9 +58,14 @@
oq30_bv_per(t,j,potnatveg,"upper") = q30_bv_per.up(j,potnatveg);
oq30_land_snv(t,j,"upper") = q30_land_snv.up(j);
oq30_land_snv_trans(t,j,"upper") = q30_land_snv_trans.up(j);
oq30_treecover(t,j,"upper") = q30_treecover.up(j);
oq30_treecover_est(t,j,ac,"upper") = q30_treecover_est.up(j,ac);
oq30_betr(t,j,"upper") = q30_betr.up(j);
oq30_bv_treecover(t,j,potnatveg,"upper") = q30_bv_treecover.up(j,potnatveg);
ov_fallow(t,j,"lower") = vm_fallow.lo(j);
ov_area(t,j,kcr,w,"lower") = vm_area.lo(j,kcr,w);
ov_rotation_penalty(t,i,"lower") = vm_rotation_penalty.lo(i);
ov30_treecover(t,j,ac,"lower") = v30_treecover.lo(j,ac);
oq30_cropland(t,j,"lower") = q30_cropland.lo(j);
oq30_avl_cropland(t,j,"lower") = q30_avl_cropland.lo(j);
oq30_rotation_max(t,j,crp30,w,"lower") = q30_rotation_max.lo(j,crp30,w);
Expand All @@ -59,4 +76,8 @@
oq30_bv_per(t,j,potnatveg,"lower") = q30_bv_per.lo(j,potnatveg);
oq30_land_snv(t,j,"lower") = q30_land_snv.lo(j);
oq30_land_snv_trans(t,j,"lower") = q30_land_snv_trans.lo(j);
oq30_treecover(t,j,"lower") = q30_treecover.lo(j);
oq30_treecover_est(t,j,ac,"lower") = q30_treecover_est.lo(j,ac);
oq30_betr(t,j,"lower") = q30_betr.lo(j);
oq30_bv_treecover(t,j,potnatveg,"lower") = q30_bv_treecover.lo(j,potnatveg);
*##################### R SECTION END (OUTPUT DEFINITIONS) ######################
22 changes: 22 additions & 0 deletions modules/30_crop/endo_apr21/preloop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* sigmoidal interpolation between start year and target year
m_sigmoid_time_interpol(p30_snv_scenario_fader,s30_snv_scenario_start,s30_snv_scenario_target,0,1);
m_sigmoid_time_interpol(p30_rotation_scenario_fader,s30_rotation_scenario_start,s30_rotation_scenario_target,0,1);
m_sigmoid_time_interpol(p30_treecover_scenario_fader,s30_treecover_scenario_start,s30_treecover_scenario_target,0,1);
m_sigmoid_time_interpol(p30_betr_scenario_fader,s30_betr_scenario_start,s30_betr_scenario_target,0,1);

* linear interpolation to estimate the cropland that
* requires relocation due to SNV policy
Expand Down Expand Up @@ -37,3 +39,23 @@ p30_country_dummy(policy_countries30) = 1;
* Countries are weighted by available cropland area.
i30_avl_cropland_iso(iso) = f30_avl_cropland_iso(iso,"%c30_marginal_land%");
p30_country_snv_weight(i) = sum(i_to_iso(i,iso), p30_country_dummy(iso) * i30_avl_cropland_iso(iso)) / sum(i_to_iso(i,iso), i30_avl_cropland_iso(iso));

* Initial tree cover on cropland is assumed to be equally distributed among all age-classes
pc30_treecover(j,ac) = f30_treecover(j)/card(ac);

*' Switch for tree cover on cropland:
*' 0 = Use natveg growth curve towards LPJmL natural vegetation
*' 1 = Use plantation growth curve (faster than natveg) towards LPJmL natural vegetation
if(s30_treecover_plantation = 0,
p30_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac(t,j,ac,ag_pools);
elseif s30_treecover_plantation = 1,
p30_carbon_density_ac(t,j,ac,ag_pools) = pm_carbon_density_ac_forestry(t,j,ac,ag_pools);
);

** set bii coefficients
p30_treecover_bii_coeff(bii_class_secd,potnatveg) = 0;
if(s30_treecover_bii_coeff = 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, now i see, this is just a switch!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it can be choosen flexibly. In analogy to re-/afforestation.

p30_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff(bii_class_secd,potnatveg)
elseif s30_treecover_bii_coeff = 1,
p30_treecover_bii_coeff(bii_class_secd,potnatveg) = fm_bii_coeff("timber",potnatveg)
);
40 changes: 40 additions & 0 deletions modules/30_crop/endo_apr21/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,43 @@ p30_snv_relocation(t,j)$(p30_snv_relocation(t, j) > p30_max_snv_relocation(t,j))
*' Area potentially available for cropping
p30_avl_cropland(t,j) = f30_avl_cropland(j,"%c30_marginal_land%") * (1 - p30_snv_shr(t,j));
*' @stop

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i guess this is copy paste from a previous implementation, right? only reviewing it shortly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Adapted from 35_natveg.

* Growth of trees on cropland is modelled by shifting age-classes according to time step length.
s30_shift = m_timestep_length_forestry/5;
* example: ac10 in t = ac5 (ac10-1) in t-1 for a 5 yr time step (s30_shift = 1)
p30_treecover(t,j,ac)$(ord(ac) > s30_shift) = pc30_treecover(j,ac-s30_shift);
* account for cases at the end of the age class set (s30_shift > 1) which are not shifted by the above calculation
p30_treecover(t,j,"acx") = p30_treecover(t,j,"acx")
+ sum(ac$(ord(ac) > card(ac)-s30_shift), pc30_treecover(j,ac));

pc30_treecover(j,ac) = p30_treecover(t,j,ac);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking. Here we go from 3 dimensions (t,j,ac) to 2 dimensions (j,ac). Is this right?

v30_treecover.l(j,ac) = p30_treecover(t,j,ac);

p30_treecover_min_shr(t,j) = p30_treecover_scenario_fader(t) *
(s30_treecover_min_shr * sum(cell(i,j), p30_country_snv_weight(i))
+ s30_treecover_min_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i)));

*define ac_est and ac_sub
ac_est(ac) = no;
ac_est(ac) = yes$(ord(ac) <= (m_yeardiff_forestry(t)/5));

ac_sub(ac) = no;
ac_sub(ac) = yes$(ord(ac) > (m_yeardiff_forestry(t)/5));

* fix before s30_treecover_scenario_start to pc30_treecover(j,ac)?
if(m_year(t) <= s30_treecover_scenario_start,
v30_treecover.fx(j,ac) = pc30_treecover(j,ac);
else
v30_treecover.lo(j,ac_est) = 0;
v30_treecover.up(j,ac_est) = Inf;
if(s30_treecover_decrease = 1,
v30_treecover.lo(j,ac_sub) = 0;
v30_treecover.up(j,ac_sub) = pc30_treecover(j,ac_sub);
else
v30_treecover.fx(j,ac_sub) = pc30_treecover(j,ac_sub);
);
);

p30_betr_min_shr(t,j) = p30_betr_scenario_fader(t) *
(s30_betr_min_shr * sum(cell(i,j), p30_country_snv_weight(i))
+ s30_betr_min_shr_noselect * sum(cell(i,j), 1-p30_country_snv_weight(i)));
7 changes: 0 additions & 7 deletions modules/32_forestry/dynamic_feb21/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: [email protected]

*define ac_est and ac_sub
ac_est(ac) = no;
ac_est(ac) = yes$(ord(ac) <= (m_yeardiff_forestry(t)/5));

ac_sub(ac) = no;
ac_sub(ac) = yes$(ord(ac) > (m_yeardiff_forestry(t)/5));

*Reduction of ac_est is not possible.
v32_hvarea_forestry.fx(j,ac_est) = 0;
v32_land_reduction.fx(j,type32,ac_est) = 0;
Expand Down
4 changes: 2 additions & 2 deletions modules/44_biodiversity/bii_target/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
sets

landcover44 land cover classes used in bii calculation
/ crop_ann, crop_per, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant /
/ crop_ann, crop_per, crop_tree, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant /

bii_class44 bii coefficent land cover classes
/ crop_ann, crop_per, manpast, rangeland, urban, primary, secd_mature, secd_young, timber /
/ crop_ann, crop_per, crop_tree, manpast, rangeland, urban, primary, secd_mature, secd_young, timber /

bii_class_secd(bii_class44) bii coefficent land cover classes secondary vegetation
/ secd_mature, secd_young /
Expand Down
4 changes: 2 additions & 2 deletions modules/44_biodiversity/bv_btc_mar21/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
sets

landcover44 land cover classes used in bii calculation
/ crop_ann, crop_per, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant /
/ crop_ann, crop_per, crop_tree, manpast, rangeland, urban, aff_ndc, aff_co2p, primforest, secdforest, other, plant /

bii_class44 bii coefficent land cover classes
/ crop_ann, crop_per, manpast, rangeland, urban, primary, secd_mature, secd_young, timber /
/ crop_ann, crop_per, crop_tree, manpast, rangeland, urban, primary, secd_mature, secd_young, timber /

bii_class_secd(bii_class44) bii coefficent land cover classes secondary vegetation
/ secd_mature, secd_young /
Expand Down
Loading