Skip to content

Conversation

@mvertens
Copy link
Collaborator

@mvertens mvertens commented Dec 31, 2025

Description of changes

This PR fixes a CDEPS bug that was found using stream input ne16pg3 with 58 vertical levels using NorESM. CDEPS aborted trying to read this in.

Specific notes

This PR also does the following:

  • new error checking for most allocations
  • cleanup of stdout formatting
  • replacement of character(*) with character(len=*)
  • introduction logunit and mainproc in shr_strdata_type and both logunit and mainproc in shr_stream_streamType. This is needed since the inline interface was not always writing all log output consistently.
  • new expanded API for setting stream pointers with optional arguments in dshr_strdata_mod.F90 for
    shr_strdata_get_stream_pointer_1d and shr_strdata_get_stream_pointer_2d
 subroutine shr_strdata_get_stream_pointer_1d(sdat, strm_fld, strm_ptr, rc, requirePointer, errmsg) 
    type(shr_strdata_type)     , intent(in)    :: sdat
    character(len=*)           , intent(in)    :: strm_fld
    real(r8)                   , pointer       :: strm_ptr(:)
    integer                    , intent(out)   :: rc
    logical,          optional , intent(in)    :: requirePointer
    character(len=*), optional , intent(in)    :: errmsg

and

 subroutine shr_strdata_get_stream_pointer_2d(sdat, strm_fld, strm_ptr, rc, requirePointer, errmsg) 
    type(shr_strdata_type)     , intent(in)    :: sdat
    character(len=*)           , intent(in)    :: strm_fld
    real(r8)                   , pointer       :: strm_ptr(:,:)
    integer                    , intent(out)   :: rc
    logical,          optional , intent(in)    :: requirePointer
    character(len=*), optional , intent(in)    :: errmsg

If requirePointer is not provided - then if the pointer is not found, the subroutine returns without an error. If requirePointer is an argument and is true, than normally an errmsg is provided that describes why the pointer is required. Also - now if the pointer is required and is found - then the pointer is initialized to NaN.
The new setting of NaNs in the stream and state pointers resulted in the following additional changes that needed to be brought in:

  • refactored dlnd code to remove presence of present nans in stream pointers
  • fixed problem in drof that came up due to presence of presence of nans
  • fixed problem in datm/cplhist that cam up due to presence of nans

Contributors other than yourself, if any: None

CDEPS Issues Fixed:

Are there dependencies on other component PRs: None

Are changes expected to change answers (bfb, different to roundoff, more substantial): bfb

Any User Interface Changes (namelist or namelist defaults changes): None

Copy link
Contributor

@jedwards4b jedwards4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a couple of minor comments, but this looks good overall. Thank you.

new_lines.append(new_line)
else:
print(f" WARNING:not adding missing file {new_file}")
print(f" WARNING:not adding missing file {new_line}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this message be changed from "missing file" to "missing line"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually should be new_line - where new_line actually represents the file that is looked for. I can try to update this more generally in the next cdeps PR coming up soon.

integer :: mpicom ! mpi communicator
integer :: my_task ! my task in mpi communicator mpicom
logical :: mainproc ! true if my_task == main_task
logical :: mainproc ! true of my_task == main_task
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be 'true if' not 'true of'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants