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 8 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
1 change: 1 addition & 0 deletions main.gms
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ $setglobal peatland v2
$setglobal som static_jan19

$setglobal bioenergy 1stgen_priced_dec18
$setglobal agroforestry off
$setglobal material exo_flexreg_apr16
$setglobal livestock fbask_jan16

Expand Down
2 changes: 2 additions & 0 deletions modules/10_land/input/files
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ avl_land_t.cs3
avl_land_t_0.5.mz
luh2_side_layers.cs3
avl_land_t_iso.cs3
CroplandTreecover.cs2
Copy link
Member

Choose a reason for hiding this comment

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

should these files be read in in module 29_cropland?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for spotting. removed.

CroplandTreecover_0.5.mz
1 change: 1 addition & 0 deletions modules/10_land/landmatrix_dec18/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
parameters
pm_land_start(j,land) Land initialization area (mio. ha)
pcm_land(j,land) Land area in previous time step including possible changes after optimization (mio. ha)
pm_treecover_shr(j) Cropland tree cover share (1)
;

variables
Expand Down
15 changes: 15 additions & 0 deletions modules/10_land/landmatrix_dec18/input.gms
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ $ondelim
$include "./modules/10_land/input/avl_land_t.cs3"
$offdelim
;
*due to some rounding errors the input data currently may contain in some cases
Copy link
Member

Choose a reason for hiding this comment

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

Really? - than this should be rather tackled than bugfixes here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not related to this PR. I just moved the code from preloop to input.gms.
I fully agree that the problem should be adressed (if still persistent) but in a different stream of work.

*very small, negative numbers. These numbers have to be set to 0 as area
*cannot be smaller than 0!
f10_land(t_ini10,j,land)$(f10_land(t_ini10,j,land)<0) = 0;


table fm_luh2_side_layers(j,luh2_side_layers10) luh2 side layers (grid cell share)
$ondelim
Expand All @@ -26,3 +31,13 @@ $ondelim
$include "./modules/10_land/input/avl_land_t_iso.cs3"
$offdelim
;

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

parameter f10_treecover(j) Tree cover on cropland in 2019 (mio. ha)
/
$ondelim
$include "./modules/10_land/input/CroplandTreecover.cs2"
$offdelim
/
;
8 changes: 4 additions & 4 deletions modules/10_land/landmatrix_dec18/start.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: [email protected]

*due to some rounding errors the input data currently may contain in some cases
*very small, negative numbers. These numbers have to be set to 0 as area
*cannot be smaller than 0!
pm_land_start(j,land) = f10_land("y1995",j,land);
pm_land_start(j,land)$(pm_land_start(j,land)<0) = 0;

pcm_land(j,land) = pm_land_start(j,land);
vm_land.l(j,land) = pcm_land(j,land);

pm_treecover_shr(j) = 0;
pm_treecover_shr(j)$(f10_land("y2015",j,"crop") > 1e-10) =
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be more consistent to compute the treecover share in the agroforestry module. I think the existing interface pcm_land could be used for it (instead of making f10_land a new interface).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need the historic numbers for 2015. pcm_land is the model outcome. Alternatively, we could add a time dimension to pm_land_start (currently on 1995)

(f10_treecover(j)/f10_land("y2015",j,"crop"));

*** EOF pre.gms ***
1 change: 1 addition & 0 deletions modules/11_costs/default/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
+ vm_costs_additional_mon(i2)
+ sum(cell(i2,j2),vm_cost_land_transition(j2))
+ sum(cell(i2,j2), vm_peatland_cost(j2))
+ sum(cell(i2,j2), vm_cost_agroforestry(j2))
+ sum(cell(i2,j2),vm_cost_bv_loss(j2))
+ sum(cell(i2,j2),vm_cost_urban(j2))
+ sum(cell(i2,j2),vm_water_cost(i2))
Expand Down
13 changes: 13 additions & 0 deletions modules/29_ageclass/feb21/presolve.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*** | (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: [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));
Copy link
Member

Choose a reason for hiding this comment

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

what happens here and why? A new set but no other changes in the module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved from 32_forestry module.
This fits better into the ageclass module

1 change: 1 addition & 0 deletions modules/29_ageclass/feb21/realization.gms
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ $Ifi "%phase%" == "sets" $include "./modules/29_ageclass/feb21/sets.gms"
$Ifi "%phase%" == "declarations" $include "./modules/29_ageclass/feb21/declarations.gms"
$Ifi "%phase%" == "input" $include "./modules/29_ageclass/feb21/input.gms"
$Ifi "%phase%" == "preloop" $include "./modules/29_ageclass/feb21/preloop.gms"
$Ifi "%phase%" == "presolve" $include "./modules/29_ageclass/feb21/presolve.gms"
*######################## R SECTION END (PHASES) ###############################
6 changes: 3 additions & 3 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) + vm_treecover_area(j2) =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.

why is now fallow coming in here? this will change the default behavior of the realization, right? If so, it should be also labelled differently I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

vm_fallow is fixed to zero in this realization. Therefore, it will not change the default. I added it only for consistency with the other realizations.


*' 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 @@ -67,8 +67,8 @@
*' for all cropland :

q30_carbon(j2,ag_pools,stockType) ..
vm_carbon_stock(j2,"crop",ag_pools,stockType) =e=
m_carbon_stock(vm_land,fm_carbon_density,"crop");
vm_carbon_stock(j2,"crop",ag_pools,stockType) =e=
m_carbon_stock(vm_land,fm_carbon_density,"crop") + vm_treecover_carbon(j2,ag_pools,stockType);

*' 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 Down
6 changes: 3 additions & 3 deletions modules/30_crop/penalty_apr22/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*' the land area for crops vm_land and the croparea vm_area

q30_cropland(j2) ..
sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) =e= vm_land(j2,"crop");
sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + vm_treecover_area(j2) =e= vm_land(j2,"crop");

*' 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 @@ -95,8 +95,8 @@ q30_rotation_penalty(i2) ..
*' for all cropland :

q30_carbon(j2,ag_pools,stockType) ..
vm_carbon_stock(j2,"crop",ag_pools,stockType) =e=
m_carbon_stock(vm_land,fm_carbon_density,"crop");
vm_carbon_stock(j2,"crop",ag_pools,stockType) =e=
m_carbon_stock(vm_land,fm_carbon_density,"crop") + vm_treecover_carbon(j2,ag_pools,stockType);

*' The biodiversity value for cropland is calculated separately for annual and perennial crops:
q30_bv_ann(j2,potnatveg) ..
Expand Down
6 changes: 3 additions & 3 deletions modules/30_crop/rotation_apr22/equations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*' the land area for crops vm_land and the croparea vm_area

q30_cropland(j2) ..
sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) =e= vm_land(j2,"crop");
sum((kcr,w), vm_area(j2,kcr,w)) + vm_fallow(j2) + vm_treecover_area(j2) =e= vm_land(j2,"crop");

*' 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 @@ -76,8 +76,8 @@
*' for all cropland :

q30_carbon(j2,ag_pools,stockType) ..
vm_carbon_stock(j2,"crop",ag_pools,stockType) =e=
m_carbon_stock(vm_land,fm_carbon_density,"crop");
vm_carbon_stock(j2,"crop",ag_pools,stockType) =e=
m_carbon_stock(vm_land,fm_carbon_density,"crop") + vm_treecover_carbon(j2,ag_pools,stockType);

*' The biodiversity value for cropland is calculated separately for annual and perennial crops:
q30_bv_ann(j2,potnatveg) ..
Expand Down
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
67 changes: 67 additions & 0 deletions modules/61_agroforestry/endo/declarations.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
*** | (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: [email protected]

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

parameters
p61_treecover_bii_coeff(bii_class_secd,potnatveg) BII coefficient for cropland treecover (1)
p61_carbon_density_ac(t,j,ac,ag_pools) Carbon density for ac and ag_pools (tC per ha)
p61_treecover(t,j,ac) Cropland tree cover per age class (mio. ha)
pc61_treecover(j,ac) Cropland tree cover per age class in current time step (mio. ha)
i61_reward_treecover Area reward for cropland treecover (USD per ha)
i61_reward_betr Area reward for bioenergy trees (USD per ha)
;

equations
q61_cost_agroforestry(j) Costs and benefits related to agroforestry (mio. USD05MER per yr)
q61_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr)
q61_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr)
q61_treecover_area(j) Cropland treecover interface (mio. ha)
q61_reward_treecover(j) Reward for cropland treecover (mio. USD05MER per yr)
q61_reward_betr(j) Reward for bioenergy trees (mio. USD05MER per yr)
q61_treecover_est(j,ac) Cropland treecover establishment (mio. ha)
q61_treecover_carbon(j,ag_pools,stockType) Cropland tree cover above ground carbon content (mio. tC)
q61_treecover_bv(j,potnatveg) Biodiversity value for cropland treecover (Mha)
;

variables
vm_cost_agroforestry(j) Cost and rewards related to agroforestry (mio. USD05MER per yr)
;

positive variables
v61_cost_treecover_est(j) Establishment cost for cropland tree cover (mio. USD05MER per yr)
v61_cost_treecover_recur(j) Recurring cost for cropland tree cover (mio. USD05MER per yr)
v61_reward_treecover(j) Reward for cropland treecover (mio. USD05MER per yr)
v61_reward_betr(j) Reward for bioenergy trees (mio. USD05MER per yr)
vm_treecover_area(j) Cropland tree cover (mio. ha)
v61_treecover(j,ac) Cropland tree cover per age class (mio. ha)
vm_treecover_carbon(j,ag_pools,stockType) Cropland tree cover above ground carbon content (mio. tC)
;

*#################### R SECTION START (OUTPUT DECLARATIONS) ####################
parameters
ov_cost_agroforestry(t,j,type) Cost and rewards related to agroforestry (mio. USD05MER per yr)
ov61_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr)
ov61_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr)
ov61_reward_treecover(t,j,type) Reward for cropland treecover (mio. USD05MER per yr)
ov61_reward_betr(t,j,type) Reward for bioenergy trees (mio. USD05MER per yr)
ov_treecover_area(t,j,type) Cropland tree cover (mio. ha)
ov61_treecover(t,j,ac,type) Cropland tree cover per age class (mio. ha)
ov_treecover_carbon(t,j,ag_pools,stockType,type) Cropland tree cover above ground carbon content (mio. tC)
oq61_cost_agroforestry(t,j,type) Costs and benefits related to agroforestry (mio. USD05MER per yr)
oq61_cost_treecover_est(t,j,type) Establishment cost for cropland tree cover (mio. USD05MER per yr)
oq61_cost_treecover_recur(t,j,type) Recurring cost for cropland tree cover (mio. USD05MER per yr)
oq61_treecover_area(t,j,type) Cropland treecover interface (mio. ha)
oq61_reward_treecover(t,j,type) Reward for cropland treecover (mio. USD05MER per yr)
oq61_reward_betr(t,j,type) Reward for bioenergy trees (mio. USD05MER per yr)
oq61_treecover_est(t,j,ac,type) Cropland treecover establishment (mio. ha)
oq61_treecover_carbon(t,j,ag_pools,stockType,type) Cropland tree cover above ground carbon content (mio. tC)
oq61_treecover_bv(t,j,potnatveg,type) Biodiversity value for cropland treecover (Mha)
;
*##################### R SECTION END (OUTPUT DECLARATIONS) #####################
55 changes: 55 additions & 0 deletions modules/61_agroforestry/endo/equations.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
*** | (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: [email protected]

*' @equations

*' Total agroforestry cost.
*' Cost for bioenergy trees are accounted for in the [30_crop] module.
Copy link
Member

Choose a reason for hiding this comment

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

Please have a look at the resulting documenation. I would at least use full sentences to describe the methodology. The documentation page should read as a real documentation of the realization

q61_cost_agroforestry(j2) ..
vm_cost_agroforestry(j2) =e=
v61_cost_treecover_est(j2) + v61_cost_treecover_recur(j2)
- v61_reward_treecover(j2) - v61_reward_betr(j2);

*' Tree cover establishment cost
q61_cost_treecover_est(j2) ..
v61_cost_treecover_est(j2) =e=
sum(ac_est, v61_treecover(j2,ac_est)) * s61_cost_treecover_est *
sum((cell(i2,j2),ct),pm_interest(ct,i2)/(1+pm_interest(ct,i2)));

*' Tree cover recurring cost
q61_cost_treecover_recur(j2) ..
v61_cost_treecover_recur(j2) =e=
sum(ac_sub, v61_treecover(j2,ac_sub)) * s61_cost_treecover_recur;

*' Tree cover reward
q61_reward_treecover(j2) ..
v61_reward_treecover(j2) =e=
sum(ac, v61_treecover(j2,ac)) * i61_reward_treecover;

*' Bioenergy tree reward
q61_reward_betr(j2) ..
v61_reward_betr(j2) =e=
sum(w, vm_area(j2,"betr",w)) * i61_reward_betr;

*' Tree cover establishment
q61_treecover_est(j2,ac_est) ..
v61_treecover(j2,ac_est) =e= sum(ac_est2, v61_treecover(j2,ac_est2))/card(ac_est2);

*' Tree cover area interface
q61_treecover_area(j2) ..
vm_treecover_area(j2) =e= sum(ac, v61_treecover(j2,ac));

*' Tree cover carbon stock interface
q61_treecover_carbon(j2,ag_pools,stockType) ..
vm_treecover_carbon(j2,ag_pools,stockType) =e=
m_carbon_stock_ac(v61_treecover,p61_carbon_density_ac,"ac","ac_sub");

*' Tree cover biodiversity value
q61_treecover_bv(j2,potnatveg) ..
vm_bv(j2,"crop_tree",potnatveg) =e=
sum(bii_class_secd, sum(ac_to_bii_class_secd(ac,bii_class_secd), v61_treecover(j2,ac)) *
p61_treecover_bii_coeff(bii_class_secd,potnatveg)) * fm_luh2_side_layers(j2,potnatveg);
18 changes: 18 additions & 0 deletions modules/61_agroforestry/endo/input.gms
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
*** | (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: [email protected]

scalars
s61_cost_treecover_est Tree cover establishment cost (USD per ha) / 2000 /
s61_cost_treecover_recur Tree cover recurring cost (USD per ha) / 500 /
s61_treecover_plantation Growth curve switch for tree cover on cropland 0=natveg 1=plantations (1) / 0 /
s61_treecover_bii_coeff BII coefficent to be used for tree cover on cropland 0=secondary vegetation 1=timber plantations (1) / 0 /
s61_treecover_decrease Cropland treecover can decrease (1) or not (0) / 0 /
s61_reward_treecover Area reward for cropland treecover (USD per ha) / 0 /
s61_reward_betr Area reward for bioenergy trees on cropland (USD per ha) / 0 /
s61_treecover_scenario_start Cropland treecover scenario start year / 2020 /
s61_betr_scenario_start Bioenergy trees scenario start year / 2020 /
;
2 changes: 2 additions & 0 deletions modules/61_agroforestry/endo/not_used.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name,type,reason
vm_land,input,not used
Loading
Loading