Closed GilbertCloud closed 5 months ago
@GilbertCloud Thank you for providing this issue and for the fix. However, as this is a cam component issue, it should be opened in the cam repository and not cesm. Also I notice you are using cesm2.1.3, please confirm that the bug you are reporting hasn't already been addressed in the latest code in that series - cesm2.1.5.
Brief summary of bug
When the CAM namelist option
spectralflux
is turned on, CESM should return the spectral flux in addition to broadband fluxes and it doesn't. When I included the output fields for the spectral flux in the fincl1 namelist (LD, LU, SD, SU),General bug information
CESM version you are using: cesm2.1.3
Machine you are using: My personal computer where I am running SCAM
Have you modified the code? (If so, please point us to you changes.): Yes, I have produced modified code that fixes the bug. The files are at
/glade/u/home/glydia/mods/fixedspectral/
.Details of bug
The buggy files,
radiation.F90
andradconstants.F90
are located in cesm2.2.2/components/cam/src/physics/rrtmg/. I have checked the same files in the versions of CESM I used on Cheyenne and Derecho (cesm2.2.0 and release-cesm2.2.2, respectively) and this bug is still present, so to my knowledge it hasn't been fixed.I found the bug when I set the
spectralflux
namelist option to true (and not give the output fields to the history list fincl1). CESM didn't include the LD, LU, SD, SU fields in the history file and did not throw an error when running or record one in the atm.log file. When I did add the output fields, they did not show up in the atm.log as being in the master history file list. When the model tried to write the history fields, it stopped with an error because it couldn't find the LD, LU, SD, SU fields.Fixes
In the radconstants file, I added the longwave and shortwave band midpoints as variables, as well as functions to retrieve them, similar to existing functions in the file to retrieve the band boundaries. I included the midpoints so that the history file has them and the boundaries as dimensions for the spectral fluxes.
In the radiation file, I added the longwave and shortwave boundaries and midpoints as variables and added the LD, LU, SD, SU fields to the history master field list. I added the longwave and shortwave bands to the history file coordinates and added calls to the pbuf in the longwave and shortwave output functions to output the spectral fluxes to the history file.