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

Added check for individual namelist variables #788

Closed
wants to merge 1 commit into from

Conversation

daveh150
Copy link
Contributor

@daveh150 daveh150 commented Nov 14, 2022

For detailed information about submitting Pull Requests (PRs) to the CICE-Consortium,
please refer to: https://github.com/CICE-Consortium/About-Us/wiki/Resource-Index#information-for-developers

PR checklist

  • Short (1 sentence) summary of your PR:
    Added check for namelist variables

  • Developer(s):
    David Hebert

  • Suggest PR reviewers from list in the column to the right.

  • Please copy the PR test results link or provide a summary of testing completed below.
    quick_suite passed. Only ran small test since this is a namliest check, not physics:
    16 measured results of 16 total results
    16 of 16 tests PASSED
    0 of 16 tests PENDING
    0 of 16 tests MISSING data
    0 of 16 tests FAILED

  • How much do the PR code changes differ from the unmodified code?

    • bit for bit
    • different at roundoff level
    • more substantial
  • Does this PR create or have dependencies on Icepack or any other models?

    • Yes
    • No
  • Does this PR update the Icepack submodule? If so, the Icepack submodule must point to a hash on Icepack's main branch.

    • Yes
    • No
  • Does this PR add any new test cases?

    • Yes
    • No
  • Is the documentation being updated? ("Documentation" includes information on the wiki or in the .rst files from doc/source/, which are used to create the online technical docs at https://readthedocs.org/projects/cice-consortium-cice/. A test build of the technical docs will be performed as part of the PR testing.)

    • Yes
    • No, does the documentation need to be updated at a later time?
      • Yes
      • No
  • Please provide any additional information or relevant details below:
    Issue Update CICE namelist implementation #677 changed how namelists were read to allow random reading, and removed previous namelist checks. I added namelist checks back with these updates. I ran quick_suite, then introduced errors in each of the namelists and re-ran. That worked with my gnu compiler, logs show results like this:

(abort_ice)ABORTED:
(abort_ice) called from /home/hebert/git/daveh150_new/cicecore/cicedynB/analysis/ice_histo
ry_drag.F90
(abort_ice) line number 107
(abort_ice) error = (init_hist_drag_2D)ERROR: icefields_drag_nml reading test_icefields_drag_nml = .true.

I think #677 was targed at NAG, does someone have NAG compiler to test with? Thanks!

@apcraig
Copy link
Contributor

apcraig commented Nov 14, 2022

Can you check your #667 reference, I think you're referring to a different PR/Issue.

@apcraig
Copy link
Contributor

apcraig commented Nov 14, 2022

It's #677.

@daveh150
Copy link
Contributor Author

Oh, yes, sorry, I updated the original PR text to say #677.

@apcraig
Copy link
Contributor

apcraig commented Nov 14, 2022

This implementation looks similar to #671. This will not work on the NAG compiler. Because we support namelist groups in any order in the namelist file, the new strategy will trap an error on NAG if it reads in the wrong namelist group, which is something we need to support. That's why we have a "do while (nml_error>0)" with an abort outside the do loop. It cycles until it finds the right namelist group in the file. Adding the "if (nml_error /=0)" in the middle of the loop is guaranteed to cause an abort if the next namelist group is not the right one.

Original implementation:

     nml_error =  1
     do while (nml_error > 0)
        read(nu_nml, nml=icefields_nml,iostat=nml_error)
     end do
     if (nml_error /= 0) then
        call abort_ice(subname//'ERROR: icefields_nml reading ', &
           file=__FILE__, line=__LINE__)
     endif

New implementation proposed here:

     nml_error =  1
     do while (nml_error > 0)
        read(nu_nml, nml=icefields_nml,iostat=nml_error)
        ! check if error
        if (nml_error /= 0) then
           ! backspace and re-read erroneous line
           backspace(nu_nml)
           read(nu_nml,fmt='(A)') tmpstr2

           call abort_ice(subname//'ERROR: icefields_nml reading ' // &
                trim(tmpstr2), &
                file=__FILE__, line=__LINE__)
        endif
     end do

I think this PR should be closed.

@daveh150
Copy link
Contributor Author

daveh150 commented Nov 14, 2022

Yes, true, the strategy is the same. I guess I misunderstood the additions with all the rewinds. I thought it was rewinding to the start of the file after every namelist read. Then reading the specified namelist, where the additional check was entered. I guess if that doesn't work with NAG then yea, this can be discarded. Thank you.

@apcraig
Copy link
Contributor

apcraig commented Nov 14, 2022

No problem, thanks @daveh150. I really wish there were a good way to do what you propose. It would be very helpful to have something like this. Lets keep exploring. I'll close this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants