Skip to content

Develop new CLM / MEGANv2.1 interface#1425

Merged
jordanschnell merged 17 commits intowrf-model:developfrom
davegill:develop+clm
Mar 4, 2021
Merged

Develop new CLM / MEGANv2.1 interface#1425
jordanschnell merged 17 commits intowrf-model:developfrom
davegill:develop+clm

Conversation

@davegill
Copy link
Copy Markdown
Contributor

@davegill davegill commented Mar 3, 2021

TYPE: new feature

KEYWORDS: CLM surface scheme, MEGANv2.1 biogenic emissions

SOURCE: Brian Gaudet (PNNL)

DESCRIPTION OF CHANGES:
The CLM surface scheme and associated subroutines in the physics and chemistry packages were modified to be made consistent with the MEGANv2.1 biogenic emission model, as opposed to earlier code which uses MEGANv2.0. This upgrade to WRF-CLM parallels the use of MEGANv2.1 in CLM4.0, as described in Guenther et al. (2012, GMD). Within module_sf_clm.F, the emissions for 150 species are computed, and then mapped to the chemistry packages (e.g., SARPC99) in WRF-Chem. Emissions are a function of plant functional type (PFT) and emission factors that depend on temperature, light, and LAI.

Among the key changes to module_sf_clm.F are:

  • a MEGANv2.1 emissions factor file containing standard emissions as a function of PFT and 20 classes of compounds is read in
  • new modules for handling the MEGAN categories are created (and the use of these modules by other modules necessitated the re-ordering of the subroutines in the source file)
  • the environmental emissions factors are tracked through running averaged variables
  • PFTs can now be determined from a geographical mapping in the wrfinput file rather than from an internal vegetation type-based table - the code is looking for a variable of name 'PCT_PFT' in the wrfinput file; it is up to the user to use external software to insert the variable containing the percentages for each CLM PFT
  • mappings of MEGAN species to WRF-Chem species packages are included.

An option ('bio_emiss_opt = 4') to invoke MEGANv2.1 biogenic emissions is included in the &chem namelist section; the user retains the option of using old MEGAN emissions (bio_emiss_opt = 3). When a user runs the new CLM but without selecting bio_emiss_opt = 4, the old CLM method of mapping land use to PFTs is used, in order to reproduce the meteorology of previous versions of the model.

LIST OF MODIFIED FILES:
M Registry/Registry.EM_COMMON
M Registry/Registry.NMM
M Registry/registry.chem
M Registry/registry.clm
M Registry/registry.dimspec
M chem/KPP/mechanisms/saprc99/saprc99.eqn
M chem/KPP/mechanisms/saprc99/saprc99.spc
M chem/chem_driver.F
M chem/chemics_init.F
M chem/emissions_driver.F
M chem/module_dep_simple.F
M chem/module_emissions_anthropogenics.F
M chem/module_ftuv_driver.F
M dyn_em/module_first_rk_step_part1.F
M dyn_em/start_em.F
M. dyn_nmm/module_PHYSICS_CALLS.F
M frame/module_driver_constants.F
M phys/module_physics_init.F
M phys/module_sf_clm.F
M phys/module_surface_driver.F
M share/module_check_a_mundo.F

TESTS CONDUCTED:

  1. Jenkins testing is OK.
  2. Tests with the changes merged into the develop branch reproduced the meteorology of the pure develop branch when bio_emiss_opt = 4 was not selected.
  3. When bio_emiss_opt = 4 was selected, the meteorology and emissions of PNNL reference simulations was reproduced.
  4. Tests of code merged with the up-to-moment version of develop are pending.

Examples of a meteorological tests and a chemistry test are attached.

NewPNNL4 2chem_5h
NewPNNL4 2met_12h_newMEGAN
NewPNNL4 2met_12h_oldMEGAN

RELEASE NOTE: The CLM surface scheme and associated subroutines in the physics and chemistry packages have been modified to be made consistent with the MEGANv2.1 biogenic emission model, as opposed to earlier code which used MEGANv2.0. This upgrade to WRF-CLM parallels the use of MEGANv2.1 in CLM4.0, as described in Guenther et al. (2012, GMD). Within module_sf_clm.F, the emissions for 150 species are computed, and then mapped to the chemistry packages
(e.g., SARPC99) in WRF-Chem. Emissions are a function of plant functional type (PFT) and emission factors that depend on temperature, light, and LAI.

brigaudet and others added 17 commits May 30, 2019 12:48
…eeded

modifications to use the MEGANv2.1-enabled CLM model, and which should
be needed in later releases of WRF, for the most part.  Subroutines in
phys compute the emission rates, while chemistry / transport are handled
in the SAPRC99_KPP package.
        Resolved conflicts by retaining both sets of dimensions in Registry/registry.dimspec,
        and both sets of lsm package modifications in Registry/registry.dimspec.  In
        chem/module_ftuv_driver.F, implemented bug fix in loop index bounds, but kept
        commented for now. In module_dep_simple.F, merged in use of param_first_scalar.

Merge branch 'v3.8.1_newclmmin' into develop_newclmmin

Conflicts:
	Registry/Registry.EM_COMMON
	Registry/registry.dimspec
	chem/module_dep_simple.F
        chem/module_ftuv_driver.F
…e, so the declaration in the new MEGANv2.

1 CLM package under SAPRC99 is redundant and causes a compilation error.  So the declaration under SAPRC99 has been r
emoved.
… it needed

        to be removed from the new MEGANv2.1-CLM section.
4.1.2.

Merge branch 'develop' into develop_newclmmin
this version.

Merge branch 'v3.8.1_newclmmin' into develop_newclmmin
another minor ifdef
nmm  - update NMM registry for num_pft, add arguments to surface driver call from NMM, change others to optional
…into develop+clm

 Changes to be committed:
	modified:   Registry/Registry.EM_COMMON
	modified:   Registry/Registry.NMM
	modified:   Registry/registry.chem
	modified:   Registry/registry.clm
	modified:   Registry/registry.dimspec
	modified:   chem/KPP/mechanisms/saprc99/saprc99.eqn
	modified:   chem/KPP/mechanisms/saprc99/saprc99.spc
	modified:   chem/chem_driver.F
	modified:   chem/chemics_init.F
	modified:   chem/emissions_driver.F
	modified:   chem/module_dep_simple.F
	modified:   chem/module_emissions_anthropogenics.F
	modified:   chem/module_ftuv_driver.F
	modified:   dyn_em/module_first_rk_step_part1.F
	modified:   dyn_em/start_em.F
	modified:   dyn_nmm/module_PHYSICS_CALLS.F
	modified:   frame/module_driver_constants.F
	modified:   phys/module_physics_init.F
	modified:   phys/module_sf_clm.F
	modified:   phys/module_surface_driver.F
	modified:   share/module_check_a_mundo.F
modified:   phys/module_sf_clm.F
@davegill davegill requested review from a team as code owners March 3, 2021 20:29
@davegill davegill changed the base branch from master to develop March 3, 2021 20:29
@davegill davegill changed the title develop+clm Develop new CLM / MEGANv2.1 interface Mar 3, 2021
@davegill
Copy link
Copy Markdown
Contributor Author

davegill commented Mar 3, 2021

This is intended to replace #932 "Develop new CLM / MEGANv2.1 interface"

@davegill
Copy link
Copy Markdown
Contributor Author

davegill commented Mar 3, 2021

@jordanschnell @brigaudet
Would you please test this PR to see if it is working correctly. The regression tests are OK, but a quick verification of the CLM + MEGAN would be great.

@davegill
Copy link
Copy Markdown
Contributor Author

davegill commented Mar 3, 2021

@jordanschnell @brigaudet

Tests of code merged with the up-to-moment version of develop are pending.

This is the line that we want to address in the PR commit message.

@davegill
Copy link
Copy Markdown
Contributor Author

davegill commented Mar 3, 2021

jenkins

Please find result of the WRF regression test cases in the attachment. This build is for Commit ID: dee0b59d839c95b185833c00e2b3f1aacbf4bacc, requested by: davegill for PR: https://github.com/wrf-model/WRF/pull/1425. For any query please send e-mail to David Gill.

    Test Type              | Expected  | Received |  Failed
    = = = = = = = = = = = = = = = = = = = = = = = =  = = = =
    Number of Tests        : 19           18
    Number of Builds       : 48           46
    Number of Simulations  : 163           161        0
    Number of Comparisons  : 103           102        0

    Failed Simulations are: 
    None
    Which comparisons are not bit-for-bit: 
    None

@davegill
Copy link
Copy Markdown
Contributor Author

davegill commented Mar 3, 2021

@jordanschnell
If this PR is OK (determined after your validation testing), would you please close #932 and reference this new PR in the Close with comment box.

@davegill
Copy link
Copy Markdown
Contributor Author

davegill commented Mar 3, 2021

@brigaudet

PFTs can now be determined from a geographical mapping in the wrfinput file rather than from an internal
vegetation type-based table

Brian,
Would you expand on this a bit - what variable in the wrfinput file is used in this capacity?

@brigaudet
Copy link
Copy Markdown
Contributor

brigaudet commented Mar 3, 2021 via email

@davegill
Copy link
Copy Markdown
Contributor Author

davegill commented Mar 3, 2021

@brigaudet

However, at this point it is up to the user to use external software to insert a variable of that name, containing the percentages of each CLM PFT at each grid point

What happens if you set input_pft = true, AND you do not have the new field?

@brigaudet
Copy link
Copy Markdown
Contributor

brigaudet commented Mar 3, 2021 via email

Copy link
Copy Markdown
Contributor

@jordanschnell jordanschnell left a comment

Choose a reason for hiding this comment

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

Approved by Chem

@jordanschnell jordanschnell merged commit d24be28 into wrf-model:develop Mar 4, 2021
state real FSD240 i4j misc 1 Z rhd=(interp_mask_field:lu_index,iswater)u=(copy_fcnm) "FSD240" "10D DIRECT SOLAR RADIATION" "W m-2"
state real FSI24 i4j misc 1 Z rhd=(interp_mask_field:lu_index,iswater)u=(copy_fcnm) "FSI24" "24H INDIRECT SOLAR RADIATION" "W m-2"
state real FSI240 i4j misc 1 Z rhd=(interp_mask_field:lu_index,iswater)u=(copy_fcnm) "FSI240" "10D INDIRECT SOLAR RADIATION" "W m-2"
state real LAIP i4j misc 1 Z rhd=(interp_mask_field:lu_index,iswater)u=(copy_fcnm) "LAIP" "PRIOR TIMESTEP LEAF AREA INDEX" "area/area"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@brigaudet Can you see if you can package these new arrays (with a new PR)? Thanks.

@naser521369
Copy link
Copy Markdown

Hi Dave

I heard MEGAN V2.1 is the last version of MEGAN.
I wonder can I use bio_emiss_opt=4 for WRF-chem 3.9.1.1?
if not, bio_emiss_opt=3 use which version of MEGAN?
Thank you
Naser

@weiwangncar
Copy link
Copy Markdown
Collaborator

@jordanschnell @brigaudet Do you think you can provide a quick answer to this question?

@brigaudet
Copy link
Copy Markdown
Contributor

Hello -- to try to answer your questions: 1) MEGANv2.1 is the latest version of MEGAN that was implemented in WRF. More recent developments to MEGAN are being performed elsewhere but have not been ported to my knowledge; 2) bio_emiss_opt=3 uses MEGANv2 but is structured quite differently (most of the relevant subroutines are in the chemistry). In theory bio_emiss_opt=4 should work with WRF-Chem version 3.9.1.1 since it was initially incorporated there pre-pull request. But since 3.91.1. is prior to what was in the original MEGANv2.1 pull request, you would have to do some hand porting / merging.

@daniel7choi
Copy link
Copy Markdown

Hi Dave,

Regarding the term below:
Among the key changes to module_sf_clm.F are:

  • a MEGANv2.1 emissions factor file containing standard emissions as a function of PFT and 20 classes of compounds is read in
    -> Is the emission factor file (megan_emis_factors.nc) needed to be prepared by each user or can it be released by the developer?

When I run the wrf-chem v4.5 with clm-megan2.1 coupling, the error occurs like below (rsl.out.0000);

megan_factors_file

clminit: B4 call to megan_factors_init
megan_factors_init: failed to open file
NetCDF: Malformed URL

netcdf.inc cannot find the appropriate nc file which seems to be the emission factor file.
./module_sf_clm.f90:4103: subroutine megan_factors_init( filename )
./module_sf_clm.f90:4142: err_msg = 'megan_factors_init: failed to open file ' // trim(filename)

Would you please suggest how to deal with this matter?

With regards,
Daniel

@naser521369
Copy link
Copy Markdown

Hello -- to try to answer your questions: 1) MEGANv2.1 is the latest version of MEGAN that was implemented in WRF. More recent developments to MEGAN are being performed elsewhere but have not been ported to my knowledge; 2) bio_emiss_opt=3 uses MEGANv2 but is structured quite differently (most of the relevant subroutines are in the chemistry). In theory bio_emiss_opt=4 should work with WRF-Chem version 3.9.1.1 since it was initially incorporated there pre-pull request. But since 3.91.1. is prior to what was in the original MEGANv2.1 pull request, you would have to do some hand porting / merging.

Hello dear @brigaudet and Dave;

Thank you very much for your kind reply.
As a beginner in this field, I understand from your explanation that it is better to update my WRF to the latest version, or at least version 4, in order to use MEGAN 2.1. Am I right?
Thank you

Yours Sincerely,
Naser

vlakshmanan-scala pushed a commit to scala-computing/WRF that referenced this pull request Apr 4, 2024
TYPE: new feature 

KEYWORDS: CLM surface scheme, MEGANv2.1 biogenic emissions

SOURCE: Brian Gaudet (PNNL) 

DESCRIPTION OF CHANGES:  
The CLM surface scheme and associated subroutines in the physics and chemistry packages were modified to be 
made consistent with the MEGANv2.1 biogenic emission model, as opposed to earlier code which uses MEGANv2.0.  
This upgrade to WRF-CLM parallels the use of MEGANv2.1 in CLM4.0, as described in Guenther et al. (2012, GMD).  
Within module_sf_clm.F, the emissions for 150 species are computed, and then mapped to the chemistry packages 
(e.g., SARPC99) in WRF-Chem.  Emissions are a function of plant functional type (PFT) and emission factors that 
depend on temperature, light, and LAI.  

Among the key changes to module_sf_clm.F are:  
   * a MEGANv2.1 emissions factor file containing standard emissions as a function of PFT and 20 classes of compounds 
is read in
   * new modules for handling the MEGAN categories are created (and the use of these modules by other modules 
necessitated the re-ordering of the subroutines in the source file)
   * the environmental emissions factors are tracked through running averaged variables
   * PFTs can now be determined from a geographical mapping in the wrfinput file rather than from an internal 
vegetation type-based table - the code is looking for a variable of name 'PCT_PFT' in the wrfinput file; it is up to 
the user to use external software to insert the variable containing the percentages for each CLM PFT 
   * mappings of MEGAN species to WRF-Chem species packages are included.  

An option ('bio_emiss_opt = 4') to invoke MEGANv2.1 biogenic emissions is included in the `&chem` namelist section; 
the user retains the option of using old MEGAN emissions (`bio_emiss_opt = 3`).  When a user runs the new CLM but 
without selecting `bio_emiss_opt = 4`, the old CLM method of mapping land use to PFTs is used, in order to reproduce 
the meteorology of previous versions of the model.

LIST OF MODIFIED FILES: 
M       Registry/Registry.EM_COMMON
M       Registry/Registry.NMM
M       Registry/registry.chem
M       Registry/registry.clm
M       Registry/registry.dimspec
M       chem/KPP/mechanisms/saprc99/saprc99.eqn
M       chem/KPP/mechanisms/saprc99/saprc99.spc
M       chem/chem_driver.F
M       chem/chemics_init.F
M       chem/emissions_driver.F
M       chem/module_dep_simple.F
M       chem/module_emissions_anthropogenics.F
M       chem/module_ftuv_driver.F
M       dyn_em/module_first_rk_step_part1.F
M       dyn_em/start_em.F
M.      dyn_nmm/module_PHYSICS_CALLS.F
M       frame/module_driver_constants.F
M       phys/module_physics_init.F
M       phys/module_sf_clm.F
M       phys/module_surface_driver.F
M       share/module_check_a_mundo.F

TESTS CONDUCTED: 
1. Jenkins testing is OK.
2. Tests with the changes merged into the develop branch reproduced the meteorology of the pure develop branch 
when bio_emiss_opt = 4 _was not_ selected.  
3. When bio_emiss_opt = 4 _was_ selected, the meteorology and emissions of PNNL reference simulations was 
reproduced.  
4. Tests of code merged with the up-to-moment version of develop are pending.

Examples of a meteorological tests and a chemistry test are attached.

![NewPNNL4 2chem_5h](https://user-images.githubusercontent.com/48535869/59543191-85b9fd80-8ebe-11e9-9145-2594e1e03e53.png)
![NewPNNL4 2met_12h_newMEGAN](https://user-images.githubusercontent.com/48535869/59543119-35db3680-8ebe-11e9-96fe-1821a361c40b.png)
![NewPNNL4 2met_12h_oldMEGAN](https://user-images.githubusercontent.com/48535869/59543130-3e337180-8ebe-11e9-8652-0e36f6adc51e.png)

RELEASE NOTE: The CLM surface scheme and associated subroutines in the physics and chemistry packages have been modified to be made consistent with the MEGANv2.1 biogenic emission model, as opposed to earlier code which used MEGANv2.0.  This upgrade to WRF-CLM parallels the use of MEGANv2.1 in CLM4.0, as described in Guenther et al. (2012, GMD).  Within module_sf_clm.F, the emissions for 150 species are computed, and then mapped to the chemistry packages 
(e.g., SARPC99) in WRF-Chem.  Emissions are a function of plant functional type (PFT) and emission factors that depend on temperature, light, and LAI.
@HanwGeek
Copy link
Copy Markdown

Dear @davegill and @brigaudet. Thank you very much for your contribution to the PR. After several attempts, I haven’t been able to produce a file that the code accepts as a MEGANv2.1 emissions factor file containing standard emissions as a function of PFT and 20 classes of compounds is read in. , so I’m hoping you could either share the file you used or provide the precise file-format specification. Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants