Open samsrabin opened 2 months ago
The user_nl_clm file is handled in cime_config/buildnml and uses cime python code (CIME/buildnml.py (create_namelist_infile) )which uses readlines to read in the file. @adrifoster found some references for this where certain languages have this behavior. @adrifoster could you post what you found here?
I'll file a bug in CIME once we've done a bit more exploration.
@cacraigucar from looking on cam_development it looks like the same problem applies to CAM. I don't know if you also have user-mods and/or test-mods usernl* files that don't have a blank line at the end, but we do see that in CTSM, so I'd check in CAM as well.
@nusbaume is our CAM expert on buildnml. I just tried with a user_nl_cam on a code I just committed, and the last line in my user_nl_cam got put into my atm_in file. I did not have a blank line at the end.
@cacraigucar thanks for checking, glad it worked correctly for you in CAM. We'll look into this more to make sure we understand it to fix it in a robust way.
Brief summary of bug
@adrifoster and I have noticed that, if you specify something in the very last line of a
user_nl_clm
file, it's not actually incorporated into the built namelist. This could quietly cause major problems if a user puts something behavior-changing there that gets ignored.General bug information
CTSM version you are using: All
Does this bug cause significantly incorrect results in the model's science? Potentially
Configurations affected: All
Details of bug
Resolving this bug will require a fix to the build-namelist script. In the meantime, we should (a) fix the testmods that don't have a blank line at the bottom of
user_nl_clm
and (b) add a Github action that ensures new testmoduser_nl_clm
files have a blank last line.