Index out of bound error for `rhol` when FATES patches requested is above 16
While testing #5760, I ran into an issue in which setting the FATES fates_maxpatches_by_landuse such that the total number is greater than 16 causes a failure in the SurfaceAlbedo subroutine here:
https://github.com/E3SM-Project/E3SM/blob/589f08cb54f99fb5f50960d247f35e2782a7c50c/components/elm/src/biogeophys/SurfaceAlbedoMod.F90#L760
The run failure mode is:
195: At line 761 of file /global/u1/g/glemieux/E3SM-project/e3sm/components/elm/src/biogeophys/SurfaceAlbedoMod.F90
195: Fortran runtime error: Index '17' of dimension 1 of array 'rhol' above upper bound of 16
195:
195: Error termination. Backtrace:
195: #0 0x1169753 in __surfacealbedomod_MOD_surfacealbedo
195: at /global/u1/g/glemieux/E3SM-project/e3sm/components/elm/src/biogeophys/SurfaceAlbedoMod.F90:761
195: #1 0x6888d5 in __elm_driver_MOD_elm_drv
195: at /global/u1/g/glemieux/E3SM-project/e3sm/components/elm/src/main/elm_driver.F90:1353
195: #2 0x650987 in __lnd_comp_mct_MOD_lnd_run_mct
195: at /global/u1/g/glemieux/E3SM-project/e3sm/components/elm/src/cpl/lnd_comp_mct.F90:514
195: #3 0x4810ab in __component_mod_MOD_component_run
195: at /global/u1/g/glemieux/E3SM-project/e3sm/driver-mct/main/component_mod.F90:734
195: #4 0x464de1 in __cime_comp_mod_MOD_cime_run
195: at /global/u1/g/glemieux/E3SM-project/e3sm/driver-mct/main/cime_comp_mod.F90:2916
195: #5 0x47e7a5 in cime_driver
195: at /global/u1/g/glemieux/E3SM-project/e3sm/driver-mct/main/cime_driver.F90:153
195: #6 0x47e808 in main
195: at /global/u1/g/glemieux/E3SM-project/e3sm/driver-mct/main/cime_driver.F90:23
The resolution to the issue seems like it would be to have FATES override the numpft, which defines the allocation bounds for rhol (and other values). That said, in discussion with @rgknox and @ckoven, they noted that this part of the code isn't relevant to the fates code and likely should be avoided.
My take is that this calculation should be avoided on fates columns and patches since its not relevant or used, perhaps bounding it inside a use_fates or a patch level fates filter.