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

Fix format for nlmaps_exclude_fields in seq_infodata_print #6167

Merged
merged 2 commits into from
Jan 30, 2024

Conversation

jonbob
Copy link
Contributor

@jonbob jonbob commented Jan 23, 2024

The format for printing out nlmaps_exclude_fields in seq_infodata_print is currently F0I (for an integer value) but the variable is a character array. This type mismatch causes a failure when the seq_infodata_print subroutine is called, from cime_comp_mod.F90 when info_debug > 1. This PR uses a formatting suggested by Andrew Bradley to more elegantly print out this array.

Fixes #6165
[BFB]

@jonbob jonbob added bug fix PR Coupler BFB PR leaves answers BFB labels Jan 23, 2024
@jonbob jonbob requested review from rljacob and ambrad January 23, 2024 19:59
@jonbob jonbob self-assigned this Jan 23, 2024
Copy link

github-actions bot commented Jan 23, 2024

PR Preview Action v1.4.6
🚀 Deployed preview to https://E3SM-Project.github.io/E3SM/pr-preview/pr-6167/
on branch gh-pages at 2024-01-24 17:13 UTC

@jonbob
Copy link
Contributor Author

jonbob commented Jan 23, 2024

Please note that the F0A format is fine for character variables, but this is a character array. The corresponding output looks like:

(seq_infodata_print) mct_usevector            =   F
(seq_infodata_print) nlmaps_verbosity         =          0
(seq_infodata_print) nlmaps_exclude_fields    = Faxa_rainc
Faxa_rainl                                                                      Faxa_snowc                                                                      Faxa_snowl                           











(seq_infodata_print) info_debug               =    2
(seq_infodata_print) bfbflag                  =   T

I also tried a slightly more elegant solution to fill a temporary character variable with the excluded fields, and the corresponding output looks like:

(seq_infodata_print) mct_usevector            =   F
(seq_infodata_print) nlmaps_verbosity         =          0
(seq_infodata_print) nlmaps_exclude_fields    = Faxa_rainc, Faxa_rainl, Faxa_snowc, Faxa_snowl,
(seq_infodata_print) info_debug               =    2
(seq_infodata_print) bfbflag                  =   T

if it matters

@mahf708 mahf708 linked an issue Jan 23, 2024 that may be closed by this pull request
@ambrad
Copy link
Member

ambrad commented Jan 24, 2024

Thanks. Sorry I missed that in my original PR.

@ambrad
Copy link
Member

ambrad commented Jan 24, 2024

What do others think of this approach, which doesn't require a temporary character array:

    write(logunit,'(2A)',advance='no') subname,'nlmaps_exclude_fields    = '
    do i = 1, size(infodata%nlmaps_exclude_fields)
       if (len(trim(infodata%nlmaps_exclude_fields(i))) == 0) cycle
       write(logunit,'(3A)',advance='no') ' ', trim(infodata%nlmaps_exclude_fields(i))
    end do
    write(logunit,'(A)') ''

It produces

(seq_infodata_print) nlmaps_exclude_fields    =  Faxa_rainc Faxa_rainl Faxa_snowc Faxa_snowl

@jonbob
Copy link
Contributor Author

jonbob commented Jan 24, 2024

@ambrad - That's some pretty elegant Fortran for a C++ programmer! And very much like what I had played with, though I had been loading a temporary string. I'll implement it and change my branch to match -- thanks

jonbob added a commit that referenced this pull request Jan 29, 2024
Fix format for nlmaps_exclude_fields in seq_infodata_print

The format for printing out nlmaps_exclude_fields in seq_infodata_print
is currently F0I (for an integer value) but the variable is a character
array. This type mismatch causes a failure when the seq_infodata_print
subroutine is called, from cime_comp_mod.F90 when info_debug > 1. This
PR uses a formatting suggested by Andrew Bradley to more elegantly print
out this array.

Fixes #6165
[BFB
@jonbob
Copy link
Contributor Author

jonbob commented Jan 29, 2024

passes sanity testing and re-confirmed the format change

merged to next

@jonbob jonbob merged commit 104a202 into master Jan 30, 2024
3 checks passed
@jonbob jonbob deleted the jonbob/coupler/fix-infodata-format branch January 30, 2024 18:49
@jonbob
Copy link
Contributor Author

jonbob commented Jan 30, 2024

merged to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BFB PR leaves answers BFB bug fix PR Coupler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Model crashes when INFO_DBUG > 1
3 participants