Skip to content

Fix ic_name_len not accounting for registry constituent IC names#499

Open
jimmielin wants to merge 1 commit into
ESCOMP:developmentfrom
jimmielin:hplin/init_cnst_len_fix
Open

Fix ic_name_len not accounting for registry constituent IC names#499
jimmielin wants to merge 1 commit into
ESCOMP:developmentfrom
jimmielin:hplin/init_cnst_len_fix

Conversation

@jimmielin
Copy link
Copy Markdown
Member

@jimmielin jimmielin commented May 14, 2026

Tag name (required for release branches):
Originator(s): @jimmielin
AI tools used (if applicable; please also add the "AI-generated code" label to the PR):
What: claude-opus:4.6[1m]
How: identified the bug, proposed the fix

Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number):

  • write_ic_params in write_init_files.py computes max_loclen (which sets ic_name_len and the character(len=...) for input_var_names) only from host model variables, not registry constituents. If a constituent's IC name is longer than any host variable's IC name, the generated Fortran array declaration is too short, producing a compile error:
Error: Different CHARACTER lengths (12/14) in array constructor at (1)

This only happened now because most SDFs pull in host variables with long IC names (e.g., inverse_exner_function_wrt_surface_pressure, 43 chars) that mask this bug which only happens with very tiny SDFs.

The existing sample file, incidentally, was already non-buildable because of this issue. It has now been updated.

Describe any changes made to build system: N/A

Describe any changes made to the namelist: N/A

List any changes to the defaults for the input datasets (e.g. boundary datasets): N/A

List all files eliminated and why: N/A

List all files added and what they do: N/A

List all existing files that have been modified, and describe the changes:

M  src/data/write_init_files.py
  - also check registry_constituents to extend max_loclen with constituent IC name lengths
M  test/unit/python/sample_files/write_init_files/phys_vars_init_check_cnst.F90
  - Update reference file: ic_name_len 12 -> 13, input_var_names padded accordingly

If there are new failures (compared to the test/existing-test-failures.txt file),
have them OK'd by the gatekeeper, note them here, and add them to the file.
If there are baseline differences, include the test and the reason for the
diff. What is the nature of the change? Roundoff?

derecho/intel/aux_sima:

derecho/gnu/aux_sima:

derecho/nvhpc/aux_sima (test is run via Github workflow. Only run the test manually if we need to save new baselines):

If this changes climate describe any run(s) done to evaluate the new
climate in enough detail that it(they) could be reproduced:

CAM-SIMA date used for the baseline comparison tests if different than latest:

…or in array len calculation for write_init_files

Assisted-by: claude-opus:4.6[1m]
@jimmielin jimmielin requested a review from peverwhee May 14, 2026 16:46
@jimmielin jimmielin self-assigned this May 14, 2026
@jimmielin jimmielin added the bug-fix This PR was created to fix a specific bug. label May 14, 2026
@jimmielin jimmielin temporarily deployed to CI-tests-on-CIRRUS May 14, 2026 16:46 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix This PR was created to fix a specific bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant