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

New forest recovery based on potential forest area #676

Merged
merged 43 commits into from
May 28, 2024

Conversation

pvjeetze
Copy link
Contributor

@pvjeetze pvjeetze commented May 17, 2024

🐦 Description of this PR 🐦

Up to now, we used the average carbon density per cluster to determine whether other land would transform into secdforest over time. Also forestry could be expanded in all clusters, regardless of the forest potential and carbon density.

With this PR, forest expansion is only constrained to 0.5° grid cells with a carbon density of >20t/ha (which creates an area per cluster that can be used for forest expansion). This also means that carbon densities for forest are not anymore calculated based on all grid cells of a cluster but only consider cells where forest can potentially grow.

The forest potential is derived from LPJmL data and can therefore change across different RCPs.

potForest_cluster

image

image

image

image

image

🔧 Checklist for PR creator 🔧

  • Label pull request from the label list.

    • Low risk: Simple bugfixes (missing files, updated documentation, typos) or changes in start or output scripts
    • Medium risk: Uncritical changes in the model core (e.g. moderate modifications in non-default realizations)
    • High risk: Critical changes in model core or default settings (e.g. changing a model default or adjusting a core mechanic in the model)
  • Self-review own code

    • No hard coded numbers and cluster/country/region names.
    • The new code doesn't contain declared but unused parameters or variables.
    • magpie4 R library has been updated accordingly and backwards compatible where necessary.
    • scenario_config.csv has been updated accordingly (important if default.cfg has been updated)
  • Document changes

    • Add changes to CHANGELOG.md
    • Where relevant, put In-code documentation comments
    • Properly address updates in interfaces in the module documentations
    • run goxygen::goxygen() and verify the modified code is properly documented
  • Perform test runs

    • Low risk:
      • Run a compilation check via Rscript start.R --> "compilation check"
    • Medium risk:
      • Run test runs via Rscript start.R --> "test runs"
      • Check logs for errors/warnings
    • High risk:
      • Run test runs via Rscript start.R --> "test runs"
      • Check logs for errors/warnings
      • Default run from the PR target branch for comparison
      • Provide relevant comparison plots (land-use, emissions, food prices, land-use intensity,...)

📉 Performance changes 📈

  • Current develop branch default : ** mins
  • This PR's default : ** mins

🚨 Checklist for reviewer 🚨

  • PR is labeled correctly
  • Code changes look reasonable
    • No hard coded numbers and cluster/country/region names.
    • No unnecessary increase in module interfaces
    • model behavior/performance is satisfactory.
  • Changes are properly documented
    • CHANGELOG is updated correctly
    • Updates in interfaces have been properly addressed in the module documentations
    • In-code documentation looks appropriate
  • content review done (at least 1)
  • RSE review done (at least 1)

@pvjeetze pvjeetze changed the title New forest recovery based on potential forest areaF p forest New forest recovery based on potential forest area May 17, 2024
@pvjeetze pvjeetze added High risk Higher risk enhancement New feature or request data update Major Substantial modifications labels May 22, 2024
Copy link
Contributor

@weindl weindl left a comment

Choose a reason for hiding this comment

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

Many thanks for this development!

Copy link
Member

@tscheypidi tscheypidi left a comment

Choose a reason for hiding this comment

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

changes look good to me and a quick check in shinyresults suggested to me that the new implementation might be even slightly faster. Nice work!

Copy link
Contributor

@flohump flohump left a comment

Choose a reason for hiding this comment

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

Looks very good overall. Thanks for these improvements.
I left some minor comments, mostly for clarification.
Do your test runs including the forestry sector?
It would be important to check if the new constraint for forest/forestry area expansion has major implications on plantation establishment.


q35_carbon_other(j2,ag_pools,stockType) ..
vm_carbon_stock(j2,"other",ag_pools,stockType) =e=
m_carbon_stock_ac(v35_other,pm_carbon_density_ac,"ac","ac_sub");
m_carbon_stock_ac(v35_other,pm_carbon_density_other_ac,"ac","ac_sub")
+ m_carbon_stock_ac(v35_youngsecdf,pm_carbon_density_secdforest_ac,"ac","ac_sub");

*' The biodiversity value (BV) of primary forest, secondary forest and other land is computed by multiplying their respective land area with bii coefficients, which depend on the age class and whether the potential natural vegetation forest or non-forest (luh2 side layers).

Copy link
Contributor

Choose a reason for hiding this comment

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

in the constraint q35_min_forest(j2) further below you can make use of the new set land_forest

Copy link
Contributor Author

@pvjeetze pvjeetze May 23, 2024

Choose a reason for hiding this comment

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

thanks for spotting this. Changed the equation accordingly!

@@ -47,25 +47,25 @@ if (magpie.modelstat > 2,
if(s80_resolve_option = 1,
display "Modelstat > 2 | Retry solve with CONOPT4 default setting";
option nlp = conopt4;
magpie.optfile = 0;
elseif s80_resolve_option = 2,
magpie.optfile = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

This file seems content-wise unchanged. Only formatting has changed. Consider reverting.
For future work it would be good to find out why this happens and if it can be avoided.
It might be an inconsistency between editors used by different users
maybe @tscheypidi can help to sort this out for future work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My editor seems to remove trailing white spaces by default.

*' the potential natural forest area minus the recovering secondary
*' forest area.

q35_max_forest_establishment(j2)..
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the core constraint of the new imlementation, which also includes "forestry", i.e. plant, aff and npi.
Consider adding this detail in the above comment to make it clear that not only land in 35_natveg but also land in 32_forestry is affected by this constraint.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

pc35_other(j,ac) Other land per age class in current time step (mio. ha)
p35_min_forest(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha)
p35_min_other(t,j) Minimum forest and other stock based on NPI or NDC targets (mio. ha)
p35_damage_fader(t_all) Fader for forest damage (1)
p35_forest_recovery_shr(j) Forest share in natveg recovery (1)
p35_recovered_forest(t,j,ac) Recovered forest (mio. ha)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove if no longer needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

p35_recovered_forest is still used to separated what goes into v35_other and v35_youngsecdf

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tom remove any ambiguity in the reporting ,p35_recovered_forest is now renamed to p35_forest_recovery_area.

@pvjeetze pvjeetze requested a review from flohump May 23, 2024 11:31
Copy link
Contributor

@flohump flohump left a comment

Choose a reason for hiding this comment

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

GAMS code looks good.
magpie4 R library still needs to be updated.

@pvjeetze pvjeetze merged commit 58cc585 into magpiemodel:develop May 28, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data update enhancement New feature or request High risk Higher risk Major Substantial modifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants