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

FATES doesn't work with MEGAN for normal FATES competitive modes #115

Closed
ekluzek opened this issue Dec 16, 2017 · 28 comments
Closed

FATES doesn't work with MEGAN for normal FATES competitive modes #115

ekluzek opened this issue Dec 16, 2017 · 28 comments
Labels
bug something is working incorrectly closed: wontfix We won't fix this issue, because it would be too difficult and/or isn't important enough to fix

Comments

@ekluzek
Copy link
Collaborator

ekluzek commented Dec 16, 2017

Erik Kluzek < erik > - 2015-05-11 16:17:41 -0600
Bugzilla Id: 2176
Bugzilla CC: rfisher, sacks,

MEGAN at least functioned before clm4_5_1_r106, but in clm4_5_1_r106, MEGAN fails here...
if ( (cisun_in .eq. cisun_in) .and. (cisha_in .eq. cisha_in) .and. (forc_pbot_in > 0._r8) .and. (fsun_in > 0._r8) ) then
ci = ( fsun_in*cisun_in + (1._r8-fsun_in)*cisha_in )/forc_pbot_in * 1.e6_r8

 gamma_ci = Ismax - ( (Ismax*ci**h)/(Cstar**h+ci**h) )

cisun_in and cisha_in are still set to missing value (-999.) and hence the calculation fails.

Definition of done: FATES works with MEGAN for standard FATES mode with competition

@ekluzek ekluzek added this to the future milestone Dec 16, 2017
@ekluzek
Copy link
Collaborator Author

ekluzek commented Dec 16, 2017

Erik Kluzek < erik > - 2015-05-12 15:19:59 -0600

These are the two tests that failed.

ERS_D_Mmpi-serial_Ld5.1x1_brazil.ICLM45ED.yellowstone_intel.clm-edTest
SMS_Ld5.f19_g16.ICLM45ED.yellowstone_gnu.clm-edTest

There are some tests that actually passed even with the issue. So it must be partially dependent on the compiler.

But, I'm having build-namelist to make sure MEGAN is off if ED is on, and the ED tests will now be with MEGAN off. And there was an issue in clm.buildnml that didn't allow MEGAN to be off, so I fixed that as well.

@ekluzek
Copy link
Collaborator Author

ekluzek commented Dec 16, 2017

Erik Kluzek < erik > - 2015-05-12 16:12:09 -0600

The SMS gnu test still fails with the following error...

   1: NetCDF: Numeric conversion not representable
   1: pio_support::pio_die:: myrank=          -1 : ERROR: pionfwrite_mod::write_nfdarray_double:         249 : NetCDF: Numeric conversion not representable
   1:Abort(1) on node 1 (rank 1 in comm 1140850688): application called MPI_Abort(MPI_COMM_WORLD, 1) - process 1

That is with MEGAN turned off.

@ekluzek
Copy link
Collaborator Author

ekluzek commented Dec 16, 2017

Erik Kluzek < erik > - 2015-05-14 10:50:41 -0600

By turning off a bunch of history fields, I got it to run further. Then it stopped in RTM, so I turned RTM off...

Change user_nl_clm hist_fincl1 to...

hist_fincl1 = 'GPP','BTRAN','H2OSOI','LITTER_IN',
'FIRE_AREA','FIRE_INTENSITY','FIRE_TFC_ROS'
'FIRE_NESTEROV_INDEX',
'FIRE_ROS','DISPVEGC','AREA_TREES','AREA_PLANT'

And make a bunch of those fields inactive...

Index: ../../components/clm/src/ED/main/EDCLMLinkMod.F90
===================================================================
--- ../../components/clm/src/ED/main/EDCLMLinkMod.F90	(revision 70648)
+++ ../../components/clm/src/ED/main/EDCLMLinkMod.F90	(working copy)
@@ -221,19 +221,23 @@
 
     call hist_addfld2d (fname='PFTbiomass',  units='kgC/m2', type2d='levgrnd', &
          avgflag='A', long_name='total PFT level biomass', &
-         ptr_patch=this%PFTbiomass_patch, set_lake=0._r8, set_urb=0._r8)
+         ptr_patch=this%PFTbiomass_patch, set_lake=0._r8, set_urb=0._r8, &
+         default='inactive' )
 
     call hist_addfld2d (fname='PFTleafbiomass',  units='kgC/m2', type2d='levgrnd', &
          avgflag='A', long_name='total PFT level biomass', &
-         ptr_patch=this%PFTleafbiomass_patch, set_lake=0._r8, set_urb=0._r8)
+         ptr_patch=this%PFTleafbiomass_patch, set_lake=0._r8, set_urb=0._r8, &
+         default='inactive' )
 
     call hist_addfld2d (fname='PFTstorebiomass',  units='kgC/m2', type2d='levgrnd', &
          avgflag='A', long_name='total PFT level biomass', &
-         ptr_patch=this%PFTstorebiomass_patch, set_lake=0._r8, set_urb=0._r8)
+         ptr_patch=this%PFTstorebiomass_patch, set_lake=0._r8, set_urb=0._r8, &
+         default='inactive' )
 
     call hist_addfld2d (fname='PFTnindivs',  units='kgC/m2', type2d='levgrnd', &
          avgflag='A', long_name='total PFT level biomass', &
-         ptr_patch=this%PFTnindivs_patch, set_lake=0._r8, set_urb=0._r8)
+         ptr_patch=this%PFTnindivs_patch, set_lake=0._r8, set_urb=0._r8, &
+         default='inactive' )
 
     call hist_addfld1d (fname='FIRE_NESTEROV_INDEX', units='none',  &
          avgflag='A', long_name='nesterov_fire_danger index', &
@@ -249,7 +253,8 @@
 
     call hist_addfld1d (fname='FIRE_TFC_ROS', units='none',  &
          avgflag='A', long_name='total fuel consumed', &
-         ptr_patch=this%TFC_ROS_patch, set_lake=0._r8, set_urb=0._r8)
+         ptr_patch=this%TFC_ROS_patch, set_lake=0._r8, set_urb=0._r8, &
+         default='inactive')
 
     call hist_addfld1d (fname='FIRE_INTENSITY', units='kJ/m/s',  &
          avgflag='A', long_name='spitfire fire intensity: kJ/m/s', &
@@ -261,27 +266,33 @@
 
     call hist_addfld1d (fname='SCORCH_HEIGHT', units='m',  &
          avgflag='A', long_name='spitfire fire area:m2', &
-         ptr_patch=this%scorch_height_patch, set_lake=0._r8, set_urb=0._r8)
+         ptr_patch=this%scorch_height_patch, set_lake=0._r8, set_urb=0._r8, &
+         default='inactive' )
 
     call hist_addfld1d (fname='fire_fuel_mef', units='m',  &
          avgflag='A', long_name='spitfire fuel moisture', &
-         ptr_patch=this%fire_fuel_mef_patch, set_lake=0._r8, set_urb=0._r8)
+         ptr_patch=this%fire_fuel_mef_patch, set_lake=0._r8, set_urb=0._r8, &
+         default='inactive' )
 
     call hist_addfld1d (fname='fire_fuel_bulkd', units='m',  &
          avgflag='A', long_name='spitfire fuel bulk density', &
-         ptr_patch=this%fire_fuel_bulkd_patch, set_lake=0._r8, set_urb=0._r8)
+         ptr_patch=this%fire_fuel_bulkd_patch, set_lake=0._r8, set_urb=0._r8, &
+         default='inactive' )
 
     call hist_addfld1d (fname='fire_fuel_eff_moist', units='m',  &
          avgflag='A', long_name='spitfire fuel moisture', &
-         ptr_patch=this%fire_fuel_eff_moist_patch, set_lake=0._r8, set_urb=0._r8)
+         ptr_patch=this%fire_fuel_eff_moist_patch, set_lake=0._r8, set_urb=0._r8, &
+         default='inactive' )
 
     call hist_addfld1d (fname='fire_fuel_sav', units='m',  &
          avgflag='A', long_name='spitfire fuel surface/volume ', &
-         ptr_patch=this%fire_fuel_sav_patch, set_lake=0._r8, set_urb=0._r8)
+         ptr_patch=this%fire_fuel_sav_patch, set_lake=0._r8, set_urb=0._r8, &
+         default='inactive' )
 
     call hist_addfld1d (fname='TFC_ROS', units='m',  &
          avgflag='A', long_name='spitfire fuel surface/volume ', &
-         ptr_patch=this%TFC_ROS_patch, set_lake=0._r8, set_urb=0._r8)
+         ptr_patch=this%TFC_ROS_patch, set_lake=0._r8, set_urb=0._r8, &
+         default='inactive')
 
     call hist_addfld1d (fname='SUM_FUEL', units=' KgC m-2 y-1',  &
          avgflag='A', long_name='Litter flux in leaves', &
@@ -293,7 +304,8 @@
 
     call hist_addfld1d (fname='LITTER_OUT', units=' KgC m-2 y-1',  &
          avgflag='A', long_name='Litter flux out leaves', &
-         ptr_patch=this%litter_out_patch, set_lake=0._r8, set_urb=0._r8)
+         ptr_patch=this%litter_out_patch, set_lake=0._r8, set_urb=0._r8, &
+         default='inactive')
 
     call hist_addfld1d (fname='SEED_BANK', units=' KgC m-2',  &
          avgflag='A', long_name='Total Seed Mass of all PFTs', &
@@ -347,7 +359,8 @@
     this%storvegc_patch(begp:endp) = spval
     call hist_addfld1d (fname='STORVEGC', units='gC/m^2', &
          avgflag='A', long_name='stored vegetation carbon, excluding cpool', &
-         ptr_patch=this%storvegc_patch)
+         ptr_patch=this%storvegc_patch, &
+         default='inactive')
 
     this%leafc_patch(begp:endp) = spval
     call hist_addfld1d (fname='LEAFC', units='gC/m^2', &
@@ -377,7 +390,7 @@
     this%npp_patch(begp:endp) = spval
     call hist_addfld1d (fname='NPP', units='gC/m^2/s', &
          avgflag='A', long_name='net primary production', &
-         ptr_patch=this%npp_patch)
+         ptr_patch=this%npp_patch, default='inactive')
 
   end subroutine InitHistory
 
Index: ../../components/clm/src/biogeophys/CanopyStateType.F90
===================================================================
--- ../../components/clm/src/biogeophys/CanopyStateType.F90	(revision 70648)
+++ ../../components/clm/src/biogeophys/CanopyStateType.F90	(working copy)
@@ -168,7 +168,7 @@
     this%tlai_patch(begp:endp) = spval
     call hist_addfld1d (fname='TLAI', units='none', &
          avgflag='A', long_name='total projected leaf area index', &
-         ptr_patch=this%tlai_patch)
+         ptr_patch=this%tlai_patch, default='inactive')
 
     this%tsai_patch(begp:endp) = spval
     call hist_addfld1d (fname='TSAI', units='none', &
Index: ../../components/clm/src/main/atm2lndType.F90
===================================================================
--- ../../components/clm/src/main/atm2lndType.F90	(revision 70648)
+++ ../../components/clm/src/main/atm2lndType.F90	(working copy)
@@ -255,7 +255,7 @@
     this%forc_wind_grc(begg:endg) = spval
     call hist_addfld1d (fname='WIND', units='m/s',  &
          avgflag='A', long_name='atmospheric wind velocity magnitude', &
-         ptr_lnd=this%forc_wind_grc)
+         ptr_lnd=this%forc_wind_grc, default='inactive')
     ! Rename of WIND for Urban intercomparision project
     call hist_addfld1d (fname='Wind', units='m/s',  &
          avgflag='A', long_name='atmospheric wind velocity magnitude', &

@ekluzek
Copy link
Collaborator Author

ekluzek commented Dec 16, 2017

Erik Kluzek < erik > - 2015-05-14 13:28:37 -0600

In clm4_5_1_r106 when ED is on, MEGAN is NOT allowed to be on in the build-namelist.

@ekluzek ekluzek changed the title ED doesn't work with MEGAN FATES doesn't work with MEGAN Aug 5, 2019
@ekluzek ekluzek removed this from the future milestone Aug 5, 2019
@ekluzek ekluzek added bug something is working incorrectly closed: wontfix We won't fix this issue, because it would be too difficult and/or isn't important enough to fix labels Aug 5, 2019
@ekluzek
Copy link
Collaborator Author

ekluzek commented Aug 5, 2019

I'm assigning this as a WONTFIX for now, and closing. This is a recognized problem that will take some effort to solve. Right now it doesn't seem needed, so we will wait until it does seem to be needed.

@ekluzek ekluzek closed this as completed Aug 5, 2019
@ekluzek ekluzek added the FATES A change needed for FATES that doesn't require a FATES API update. label Aug 5, 2019
@billsacks
Copy link
Member

Since there is discussion of moving to FATES as a default configuration, it seems like this will need to be worked on.

@ckoven @rosiealice @jkshuman @rgknox @glemieux

@billsacks billsacks reopened this Jun 12, 2020
@jkshuman
Copy link
Contributor

thanks for bringing this up @billsacks I will mention it in my "data" talk as a needed development

@billsacks billsacks removed the closed: wontfix We won't fix this issue, because it would be too difficult and/or isn't important enough to fix label Mar 22, 2021
@ekluzek
Copy link
Collaborator Author

ekluzek commented Jun 10, 2022

I'm adding a simple test for this so that we'll keep this in mind. It's now being setup so that turning MEGAN on with FATES is a warning that you can bypass, which will allow for us to test this.

@ekluzek
Copy link
Collaborator Author

ekluzek commented Jun 10, 2022

Similar to #1044 MEGAN is setup based on PFT types, so we should be able to get it to work with FATES-SP, but it will require more effort to get working for general FATES.

@rosiealice
Copy link
Contributor

In theory it should also work whenever theb NOCOMP switch is on, (which includes SP mode) since that forces one PFT per patch...

@ekluzek
Copy link
Collaborator Author

ekluzek commented Jun 11, 2022

@rosiealice thanks for pointing that out. The important thing there will be to update the Patch vegetation itype array (i.e. ivt), which other than SP mode is currently just wrong for FATES. But, it could be updated each time that FATES is called. As a matter of fact as a first pass for FATES you could fill it with whatever veg type was the dominant type in the patch, and then use that for these things that need ivt to be functional. In the end the right way to do it will be evaluate each veg type in the patch and then aggregate it up to the patch level. It's not completely clear how to that in FATES though since vegetation types overlap each other unlike in CTSM. Could you evaluate what percent of the patch each veg type covers in FATES looking down over the patch? One way to look at this would be to just use what veg types you can see when looking down over the patch.

@rosiealice
Copy link
Contributor

Hi Erik,

So, before we had SP mode, the intention with the FATES implementation we to reproduce everything the HLM indexes with ivt in FATES. I.e. there should be no instances where the host model needs to know the vegetation type in each patch because FATES should pass back the relevant quantities instead. That at least is the j te toon. So, it would be interesting to note if and where there are instances where patches having an IVT identity remains necessary.

I know this is the case for MEGAN, but have you noticed this elsewhere?

It's difficult to say we will map the identity of the dominant PFT back to the HLM as there is not a 1:1 correspondence between the fates and HLM PFTs. I.e. FATES might well include PFTs that do not exist in the HLM.

My experience has been that making the code pass back the relevant vegetation quantities is typically a matter of providing a weighted average of the property across PFTs, or something specifically tailored (as in the case of roughness length).

So yes, where were you thinking of that might need an IVT identity?

Thanks!

Rosie

@ekluzek ekluzek added next this should get some attention in the next week or two. Normally each Thursday SE meeting. and removed FATES A change needed for FATES that doesn't require a FATES API update. labels Jun 17, 2022
@ekluzek
Copy link
Collaborator Author

ekluzek commented Jun 17, 2022

@rosiealice thanks so much for the discussion.

As far as I can tell IVT is only needed for MEGAN and dry-deposition. I actually think it might be good to set IVT to bad values so that we can detect if it's used anywhere else.

The problem is that the algorithms for both of these (MEGAN and drydep) are very hardwired to only be dependent on vegetation type. They actually do another mapping of veg-type, which as you point out means we map from FATES to CLM to something else and like in language translations each of these steps could be wrong. I think the reason for this is that the whole basis of the work in MEGAN and drydeposition must have been very dependent on vegetation type. The datasets that are at the heart of each have data that is binned by their vegetation types. Since the current science was developed to be based on veg-type, it's a big science research project to base it on something else. But, you are right long-term FATES scientists need to sit down with CAM-Chem people as well as developers of MEGAN and dry-deposition and figure out a method that wouldn't be dependent on veg-type. I think that's a big project that likely requires funding though.

Also note that for nocomp mode this will be straightforward. And I think fixed biogeography is a bit simpler as well right?

Now, another part of this that we should think about is "what communities are going to be using MEGAN and dry-deposition"? It's required for the CAM-Chem community who could probably be happy with only running FATES-SP (at least to start with). I think they could also be OK if there are known limitations, errors and requirements for running with FATES when you want to output MEGAN and dry-deposition. This community is also not going to be messing with the FATES parameter file, so we could put restrictions on the parameter file to make sure the translation of veg-types is reasonable.

The other consideration is that we only need FATES and dry-deposition and MEGAN to all work together robustly is when FATES becomes the only way to run CTSM. Since that's at least a few years out, the schedule for this can be somewhat longterm.

All of this makes we want to suggest the following path forward (and I'd love to get feedback on this plan):

  • We set IVT for FATES (outside of FATES-SP) to something nonsensical to make sure it's not being used, and make sure it detects problems.
  • We get MEGAN and dry-deposition to work with FATES for nocomp mode (we add some restrictions on the FATES param file to make sure this will work)
  • Add some checks for FATES-SP mode to make sure the FATES param file is consistent
  • We move the calculation of PAR outside of MEGAN/DryDep so it's only in one place. The PAR averages can stay inside though
  • When CAM-CHEM people start running with FATES we meet with them (Louisa and Simone) meet to make sure the FATES-SP and FATES-nocomp version are working reasonably well.
  • We also start talking about better implementations that for example take into account that FATES has an understory which impacts PAR
  • Someone gets funding to do a better implementation or they are able to put effort into it
  • FATES and CAM-Chem people meet to figure out the right way to move forward with this

How does that sound for a plan for going forward? The first few steps could/should be done pretty soon. But, the final one is likely several years out (unless funding could be found sooner).

@rosiealice @wwieder @ckoven @jkshuman @dlawrenncar @danicalombardozzi and others do you want to give feedback on that plan? I also added "next" so we'd discuss at the next CTSM-Software meeting and the FATES community should also discuss as well.

@danicalombardozzi
Copy link
Contributor

I don't have many comments, other than to add that VOC emissions (in real life) vary by plant type. I'm not sure if this is included in MEGAN and if that is the reason why IVT is important. I am relatively confident that MEGAN uses LAI and stomatal conductance to calculate emissions, and I thought there was some new work by Alex Gunther's group to add in a photosynthesis component.

@ekluzek
Copy link
Collaborator Author

ekluzek commented Jun 17, 2022

The latest backtrace for how this is failing in what will be ctsm5.1.dev099 is as follows:

MPT: #6  0x00002ba478354089 in __libm_pow_e7 ()
MPT:    from /glade/p/cesmdata/cseg/PROGS/esmf/8.2.0b23/mpt/2.22/intel/19.1.1/lib/libg/Linux.intel.64.mpt.default/libesmf.so
MPT: #7  0x00000000031c3aed in vocemissionmod::get_gamma_c (cisun_in=-999, 
MPT:     cisha_in=-999, forc_pbot_in=98412.792115092408, 
MPT:     fsun_in=1.0270800753762532e-07, co2_ppmv=366.99999999999994)
MPT:     at /glade/work/erik/ctsm_worktrees/fates/src/biogeochem/VOCEmissionMod.F90:1090
MPT: #8  0x00000000031b9f7b in vocemissionmod::vocemission (bounds=..., 
MPT:     num_soilp=3, filter_soilp=..., atm2lnd_inst=..., canopystate_inst=..., 
MPT:     photosyns_inst=..., temperature_inst=..., vocemis_inst=...)
MPT:     at /glade/work/erik/ctsm_worktrees/fates/src/biogeochem/VOCEmissionMod.F90:610
MPT: #9  0x0000000000af6036 in clm_driver::clm_drv (doalb=4294967295, 
MPT:     nextsw_cday=1.4166666666666665, declinp1=-0.40246394669795638, 
MPT:     declin=-0.40246394669795638, rstwr=.FALSE., nlend=.FALSE., rdate=..., 
MPT:     rof_prognostic=.FALSE., .tmp.RDATE.len_V$1ec4d=32)
MPT:     at /glade/work/erik/ctsm_worktrees/fates/src/main/clm_driver.F90:805

@ekluzek
Copy link
Collaborator Author

ekluzek commented Jun 17, 2022

@danicalombardozzi MEGAN bins veg-types into broad classes, this is where the vegetation type comes into play. It also uses things like fraction that's sunlit, canopy temperature, LAI, and stomatal conductance as you point out. We can use FATES to get the averaged quantities for those things on each patch, the sticky part is the vegetation type bins that are used.

There is an update to use a newer version of MEGAN that adds more input variables into the mix see #1323

The type bins are:

crops,
grass,
shrubs,
broadleaf,
evergreen needleleaf
deciduous needleleaf

Also see NGEET/fates#879

@ekluzek
Copy link
Collaborator Author

ekluzek commented Jun 17, 2022

By the way I think what needs to happen to get this to work for FATES-SP is to add a "prep_megan" subroutine to clmfates_interface...

      if (use_fates) then
         call clm_fates%prep_meganfluxes(nc, fn, filterp, canopystate_inst, temperateure_inst, photosyns_inst )
      end if

that will fill the temperature, canopystate, and photosyns type arrays that are used for input with values from FATES. Once that is done I think FATES-SP should work with MEGAN.

@ekluzek
Copy link
Collaborator Author

ekluzek commented Jun 21, 2022

It looks like we'll get FATES to work with MEGAN when in FATES-SP mode in #1766. At least for a dead simple single point test we added. We should still look at the code to make sure that's correct and that it's creating reasonable output.

@ekluzek
Copy link
Collaborator Author

ekluzek commented Jun 23, 2022

@jkshuman and I met and talked about plans forward. I'm going to edit the plan above based on our conversation. We think that the near term things will be to do a little work with FatesSP and nocomp mode. We think we should hold off on getting this to work in general for FATES, and put it at a low priority until there are people that want to work on this (and possibly get funding for this as it's really a research question).

@billsacks billsacks removed the next this should get some attention in the next week or two. Normally each Thursday SE meeting. label Jun 23, 2022
@jkshuman
Copy link
Contributor

@ekluzek thanks for updating the plan in the comments above. We discussed this amongst the FATES folks today and, instead of limiting the FATES parameter file to match MEGAN, @rosiealice and @adrifoster suggested adding a FATES parameter that would associate the FATES PFT with a defined MEGAN emissions factor. This way users can modify the FATES file, and the emissions will be associated existing information in MEGAN. This does not address the reality that there are more emissions factors for specific plants, and so limits the association to what is defined in MEGAN.

@ekluzek do you see any problems with this approach of having FATES provide the MEGAN emission factor associated for a specific FATES PFT?

@ekluzek
Copy link
Collaborator Author

ekluzek commented Jul 11, 2022

@jkshuman in principle I like that idea. Then what you do is match the FATES parameter file with the MEGAN dataset for consistency checking. And as you point out you could expand both the FATES PFT types and MEGAN emission factor PFT types at the same time. But, I do see problems with actually doing that.

The two things I'm not sure about though is the need for this to also work with dry deposition, which has the same six large bins as done in MEGAN, but unfortunately the dry deposition bins are hardcoded in rather than in a dataset. But, I can check with @fvitt if they have an intention of getting away from that. Since, dry-deposition is something that only CAM-Chem people care about this difference might be OK as well, as long as we have default datasets that work together. I think what it means is that the consistency checking for FATES with dry-deposition would need to compare to a hardcoded list of PFT types So MEGAN and FATES can compare their lists and make sure they are the same, and then FATES could make sure it's list is the same as for the dry-deposition hard-coded list (which effectively means if you turn on both MEGAN, FATES, and dry-deposition that you'd need to use the default datasets). But, it does perhaps mean that MEGAN and FATES could be made to have custom veg-types that could work together.

The other thing I'm not sure about is in looking at the current MEGAN dataset, I see it uses the 78-PFT's Now, it still lumps the emission factors for 78 PFT's into the six broad veg classes that MEGAN uses internally. And it does for example make sure that the number of PFT types agrees with the 78 used in CTSM. And it assumes the PFT names are from the CTSM parameter file. So you couldn't immediately do the coordination of MEGAN and FATES as you want, but with some work we could be able to get it to work. What it probably needs is to move the six vegetation categories that MEGAN assumes to be described in the dataset rather than hard-coded into the MEGAN model.

Here's the current MEGAN file:

$DIN_LOC_ROOT/atm/cam/chem/trop_mozart/emis/megan21_emis_factors_78pft_c20161108.nc

@fvitt
Copy link
Contributor

fvitt commented Jul 11, 2022

@lkemmons should be able to provide advice on how MEGAN emissions should be implemented

@jkshuman
Copy link
Contributor

jkshuman commented Jul 11, 2022

@ekluzek ok. we can talk more about it, but it sounds like this should work. To be clear the intention is that in the FATES parameter file a new field (FATES_MEGAN_PFT or something descriptive that would also work with dry deposition) would be added that provide the MEGAN vegetation class for each FATES PFT. This can be whatever makes sense (an integer, the PFT name or abbreviation, etc) to pass to MEGAN for these calculations. The intention is that, similar to what it sounds your describe is happening with CTSM, there can be more PFTs but they are associated with MEGAN via the known vegetation categories.

@jkshuman
Copy link
Contributor

jkshuman commented Jul 12, 2022

@ekluzek ok. I understand better your comment after looking at the file. it looks like as you said the MEGAN file is created for the 78 CTSM pfts and as you indicated uses the "PFT_name" and "PFT_number". I add here the PFT names and then file details from this MEGAN file. We would need to confirm if these broad veg class categories are consistent across all the PFTs (there really are only 6 emissions classes) or if we should just associate a FATES PFT with an existing PFT in the MEGAN dataset.

For example, a user could have a simulation with PFTS for spruce and pine which would both be classified as FATES_MEGAN_PFT = needleleaf_evergreen_boreal_tree and be associated with that emissions profile

PFT_Name =
"needleleaf_evergreen_temperate_tree ",
"needleleaf_evergreen_boreal_tree ",
"needleleaf_deciduous_boreal_tree ",
"broadleaf_evergreen_tropical_tree ",
"broadleaf_evergreen_temperate_tree ",
"broadleaf_deciduous_tropical_tree ",
"broadleaf_deciduous_temperate_tree ",
"broadleaf_deciduous_boreal_tree ",
"broadleaf_evergreen_shrub ",
"broadleaf_deciduous_temperate_shrub ",
"broadleaf_deciduous_boreal_shrub ",
"c3_arctic_grass ",
"c3_non-arctic_grass ",
"c4_grass ",
"c3_crop ",
"c3_irrigated ",
and many more crops...>

netcdf megan21_emis_factors_78pft_c20161108 {
dimensions:
Class_Num = 20 ;
PFT_Num = 78 ;
char = 40 ;
Comp_Num = 150 ;
variables:
float Agro(Class_Num) ;
Agro:long_name = "growing leaf age factor" ;
float Amat(Class_Num) ;
Amat:long_name = "mature leaf age factor" ;
float Anew(Class_Num) ;
Anew:long_name = "new leaf age factor" ;
float Aold(Class_Num) ;
Aold:long_name = "old leaf age factor" ;
float Ceo(Class_Num) ;
Ceo:long_name = "emission optimum coefficient" ;
float Class_EF(PFT_Num, Class_Num) ;
Class_EF:long_name = "Emission factors at standard conditions for each class" ;
Class_EF:units = "ug/m2/h" ;
char Class_Name(Class_Num, char) ;
Class_Name:long_name = "Classes" ;
short Class_Num(Comp_Num) ;
Class_Num:long_name = "Class Number for each Compound" ;
float Comp_EF(PFT_Num, Comp_Num) ;
Comp_EF:long_name = "Scale factors for calculating emission factors for each compound" ;
Comp_EF:units = "fraction" ;
float Comp_MW(Comp_Num) ;
Comp_MW:long_name = "Molecular Weight for each Compound" ;
Comp_MW:units = "g/mole" ;
char Comp_Name(Comp_Num, char) ;
Comp_Name:long_name = "Compounds" ;
float LDF(Class_Num) ;
LDF:long_name = "light dependent fraction" ;
char PFT_Name(PFT_Num, char) ;
PFT_Name:long_name = "Plant Functional Types" ;
short PFT_Num(PFT_Num) ;
PFT_Num:long_name = "PFT Number" ;
float betaT(Class_Num) ;
betaT:long_name = "temperature factor" ;
float ct1(Class_Num) ;
ct1:long_name = "temperature coefficient 1" ;
float ct2(Class_Num) ;
ct2:long_name = "temperature coefficient 2" ;

// global attributes:
:description = "MEGAN2.1 emission factors table; updated for new crops (79 PFTs)" ;
:history = "Tue Nov 8 13:47:56 2016: ncks -d PFT_Num,1,78 /glade/p/cesmdata/cseg/inputdata/atm/cam/chem/trop_mozart/emis/megan21_emis_factors_79pft_c20150518.nc /glade/p/cesmdata/cseg/inputdata/atm/cam/chem/trop_mozart/emis/megan21_emis_factors_78pft_c20161108.nc\n",
"Created by Louisa Emmons from files provided by Alex Guenther" ;
:time = "Tue May 19 00:55:54 2015" ;
:NCO = ""4.5.5"" ;

@lkemmons
Copy link

I am happy to be part of this development - connecting FATES to MEGAN and dry dep.
We should have a discussion with Alex Guenther about the best implementation of MEGAN in FATES - he may have more information than can be used by FATES than just emission factors for PFTs.
We are definitely moving away from the hard-coded data for dry dep.

@jkshuman
Copy link
Contributor

thanks @lkemmons I will get in touch with you, and we can also set up a meeting with Alex Guenther. I will check in with a group of FATES folks to see who might join the call depending on availability. (@rosiealice @ckoven @adrifoster ?) It will be good to discuss a plan with existing data and resources and future capabilities with expanded information and additional funding.

@ekluzek
Copy link
Collaborator Author

ekluzek commented Jul 12, 2022

The conversion from the fine grained PFT categories (the 78 PFTs) to the six emission categories is here:

https://github.com/ESCOMP/CTSM/blob/master/src/biogeochem/VOCEmissionMod.F90#L700

Right now that is done based on the CTSM parameter PFT list, to make this more general we should move that mapping onto the MEGAN dataset. For FATES users will modify their list of PFT's on the FATES parameter file and we'll want to ensure that the PFT's on the FATES parameter file is what agrees with the MEGAN dataset. That would allow someone to make a custom list of FATES PFT's and still use the MEGAN file with it.

I think we also want to allow people to make a custom FATES parameter file to modify their PFT list, as well as a custom MEGAN dataset that goes along with it. That might be a bigger lift though, I think MEGAN might be pretty hard-coded to just handle those six vegetation classes.

And everything I say here also applies to dry-deposition, so when dry-deposition has a dataset (rather than hardcoded constants in the FORTRAN code) the same sort of thing could be done for it. So I'm glad that @lkemmons said you are getting away from the hard-coded constants for dry-deposition.

Also a couple of us are meeting Friday to go over this, which will be good to clarify some of this.

@ekluzek ekluzek changed the title FATES doesn't work with MEGAN FATES doesn't work with MEGAN for normal FATES competitive modes Aug 26, 2022
@ekluzek ekluzek added the closed: wontfix We won't fix this issue, because it would be too difficult and/or isn't important enough to fix label Aug 26, 2022
@ekluzek
Copy link
Collaborator Author

ekluzek commented Aug 26, 2022

To get this to work with competition in FATES is going to be a long term goal, and will require science support and research. We have this working for FATES-SP mode. And I will create a new issue for no-comp mode.

@ekluzek ekluzek closed this as completed Aug 26, 2022
@jkshuman jkshuman moved this to In Progress in CTSM-FATES priorities Dec 15, 2022
@jkshuman jkshuman moved this from In Progress to Close for now, won't fix in CTSM-FATES priorities Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something is working incorrectly closed: wontfix We won't fix this issue, because it would be too difficult and/or isn't important enough to fix
Projects
Archived in project
Development

No branches or pull requests

7 participants