Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build-namelist logic to find the finidat file is fragile and needs to be redone #2169

Open
1 of 6 tasks
ekluzek opened this issue Sep 22, 2023 · 4 comments
Open
1 of 6 tasks
Assignees
Labels
code health improving internal code structure to make easier to maintain (sustainability) enhancement new capability or improved behavior of existing capability

Comments

@ekluzek
Copy link
Collaborator

ekluzek commented Sep 22, 2023

In working on #2008 I'm finding that the logic to fine the finidat file is: complex, hard to understand, fragile, and will require a bunch of duplication. This is another reason for doing #585 which is the long term solution. Although there we should make sure the redesign in python has a better method of getting the finidat files.

This is similar to #549, but slightly different and focussed on just the namelist logic and the namelist default settings for: use_init_interp and init_interp_attributes. This is also related to #2149, as we need to have duplicated lnd_tuning_mode options for all the different clm physics options, as well as the cam options. Right now this is going to require a bunch of duplication.

Definition of Done:

  • Improve the error message so it at least gives you a clue on what's wrong...
  • Add testing for finidat files to the build-namelist unit tester
  • Fix case of finidat files with do_transient_pfts=.true. (example 1979 or 2000 files) so that use_init_interp doesn't need to be true
  • Reduce the required attributes to specify each file (see below)
  • Implement a better solution inside of the current buildnml or build-namelist?
  • Long term: Reimplement build-namelist as in Move CLMBuildNamelist.pm perl code into the python buildnml #585
@ekluzek ekluzek added the code health improving internal code structure to make easier to maintain (sustainability) label Sep 22, 2023
@ekluzek ekluzek self-assigned this Sep 22, 2023
@ekluzek ekluzek added the enhancement new capability or improved behavior of existing capability label Sep 22, 2023
@ekluzek
Copy link
Collaborator Author

ekluzek commented Sep 22, 2023

What the error looks like when it happens is this:

Create namelist for component clm
   Calling /glade/work/erik/ctsm_worktrees/ctsm5.2.mksurfdata/cime_config/buildnml
ERROR: Command /glade/work/erik/ctsm_worktrees/ctsm5.2.mksurfdata/bld/build-namelist failed rc=255
out=
err=ERROR : CLM build-namelist::CLMBuildNamelist::setup_logic_initial_conditions() : use_init_interp is NOT synchronized with init_interp_attributes

Which just isn't helpful enough.

@ekluzek
Copy link
Collaborator Author

ekluzek commented Sep 22, 2023

The other error that can happen is:

use_init_interp is set BUT finidat is NOT, need to set both

which can happen because the user explicitly set use_init_interp and didn't set finidat on their own. Or it can happen because the default settings aren't setup correctly. This should be improved as well.

@ekluzek
Copy link
Collaborator Author

ekluzek commented May 11, 2024

Working on this now as part of #2501 I see some improvements that could be made:

  • Remove glc_nec and ic_tod (they are all 10 and 0)
  • Possibly use one of ic_ymd and sim_year
  • Replace bgc (sp, bgc, fates) for use_cn, use_cndv, use_fates) use_cndv can be removed as part of Start removing BGCDV mode #2141
  • use one of use_crop and maxpft

This would reduce the number of attributes needed to specify a finidat file from 15 to 9.

Another part is to remove the duplication of the filenames in the XML and make sure that it's only the init_interp_attributes that are duplicated. In general removing duplication in the XML is a good goal and especially in duplicating the full path name to the files.

@ekluzek
Copy link
Collaborator Author

ekluzek commented Oct 11, 2024

Adding to this: https://github.com/ESCOMP/CTSM/pull/2821/files#r1797496942

so that 1979 and 2000 finidat files will work with do_transient_pfts=.true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health improving internal code structure to make easier to maintain (sustainability) enhancement new capability or improved behavior of existing capability
Projects
None yet
Development

No branches or pull requests

1 participant