Avoid in-code checks of PFT type
- Dominant language
- Fortran
- Stars
- 352
- Forks
- 361
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 7
Description
We have a bunch of integer variables in `pftconMod` that are unique IDs for each PFT ("vegetation type constants"):
https://github.com/ESCOMP/CTSM/blob/d6f950acd665d59d6342237fda95f5a2d3001fc6/src/main/pftconMod.F90#L19-L101
These are used throughout the code in checks like `veg_type == ndllf_evr_tmp_tree`. We should move to using the parameter file for this instead, to facilitate changing PFT characteristics and adding new ones. For example, the ISIMIP runs may require some unused PFTs to be replaced with different ones, which will necessitate not just changing the parameter file but also looking through the code for these manual checks. In addition, it would make the affected code easier to read.
This especially makes things hard for non-developers trying to develop new crops ([e.g.](https://bb.cgd.ucar.edu/cesm/threads/rainfed-corn-yield-underestimation-after-2000-and-activation-of-potato-crop-in-clm.11812/post-63140)). They have to scour the code for places where PFT integers might need to be used.
Although I think this would be an easy job, it wouldn't have to happen all at once. There's some very low-hanging fruit out there. For instance, this could be replaced with a `gdd20_type` parameter:
https://github.com/ESCOMP/CTSM/blob/d6f950acd665d59d6342237fda95f5a2d3001fc6/src/biogeochem/CNPhenologyMod.F90#L2878-L2896
Note that fully resolving this would also necessarily involve solving Issue #21.
Contributor guide
Assessment
This issue has not been assessed yet.