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

Getting MEGAN to work in FATES #36

Open
rosiealice opened this issue Sep 15, 2023 · 2 comments
Open

Getting MEGAN to work in FATES #36

rosiealice opened this issue Sep 15, 2023 · 2 comments
Assignees
Milestone

Comments

@rosiealice
Copy link
Collaborator

rosiealice commented Sep 15, 2023

This is a copy of this issue on CTSM.

MEGAN doesn't work with FATES, just because it never was plugged in.
This will be the subject of Adele's PhD so we at CICERO likely have an interest in making this work.

ESCOMP#1784

@rosiealice rosiealice self-assigned this Sep 15, 2023
@rosiealice
Copy link
Collaborator Author

Just going to flesh out some background on this while my head is in a coding space...

MEGAN code for CTSM currently lives here:

https://github.com/NorESMhub/CTSM/blob/clm-Nor-dev/src/biogeochem/VOCEmissionMod.F90

The basic form of the model is that there is an emission factor, defined by PFT and location, which is multiplied by a series of 'gamma' factors, representing the limitation on emission from a bunch of daily averaged conditions, (e.g. light, co2, lai, temperature, soil moisture). These factors are fed averaged drivers from CTSM.

The model itself is almost one line, and most of the code is dedicated to the calculation of the factors and the extraction of the correct emissions factor.

In essence, we face here the same dilemma as for the fire emissions code.
E.g.

  • 'option 1': rework the basics of MEGAN inside of FATES
  • 'Option 2': pass a patch level 'MEGAN-PFT' mapping variable from FATES into the CTSM MEGAN code.

All the same arguments apply as before. E.g.

  • FATES should handle all plant functions.
  • Duplication of code is ugly but perhaps necessary for this
  • FATES has to work in more than one HLM, so having internally consistent functions is good

A couple of additional considerations apply in addition. In favour of #2...

    1. The MEGAN code is a lot more stuff to move into FATES than the fire emissions.
    1. MEGAN emission factors only exist for a MEGAN-centric PFT structure. FATES can never be in charge of that and there will likely always need to be a mapping.

And in favour of #1

  • The MEGAN code is super ugly and it would be cathartic to rewrite it in a way that was cleaner.
  • There are other ways of calculating emissions (e,g, that from LPJGUESS). Having a more sane codebase would help with future experimentation
  • Leaf age is a massively important factor in MEGAN. FATES (not by default) calculates leaf age and so this facility would open up genuinely new science avenues.

Lastly, MEGAN III is under development. We should communicate with them to get a handle on how this would affect our path...

@rosiealice
Copy link
Collaborator Author

So, I have made a v0 attempt to get MEGAN and FATES to work together, using 'option 2' above (passing a MEGAN PFT index into FATES).

The FATES side changes are here;
https://github.com/rosiealice/fates/tree/megan_branch_from_ffe
and the CTSM changes are here:
https://github.com/rosiealice/ctsm/tree/megan_ctsm

Both of these are forked from the NorESMhub fates-fire-emissions feature branches, because I couldnt figure out how to create branches from the beginnings of those branches and I wanted to work in the same codebase. Hence we might have to pull the fire emissions changes in first?

https://github.com/NorESMhub/fates/tree/feature/fates-fire-emission

Here is the comparison of the fire branch with the fates megan branch
NorESMhub/fates@feature/fates-fire-emission...rosiealice:fates:megan_branch_from_ffe

and here is the mapping between the PFTs:
https://docs.google.com/spreadsheets/d/1GlCReDhTAUf7sOYRO_bvKr66mx8qe9l5OVj8B-TcgHY/edit#gid=0

This code compiles and runs and produces MEGAN output (for which I had to remove the 'no-megan' option in the env_run.xml file. So we might need to change how fates compsets work with megan?

This is potentially NOT our intended long term solution for MEGAN and FATES, as it breaks the FATES logic that all PFT parameters should be in the PFT file, but it will allow for NorESM to do the coupled chemistry experiments in the NOCOMP configuration.

Interactions with MEGAN3, full competitive FATES mode and potential modifications to the physioology of MEGAN are all possible in future iterations, more likely in the event that @adelezaini is interested in pursuing any of those leads later in her thesis :)

@kjetilaas kjetilaas added this to the NorESM2.5 milestone Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

2 participants