Use cnst_ and pbuf_ alternative ic names when reading constituents not in the registry; try no cnst_ names for constituent-dimensioned input fields - #438
Conversation
…t in the registry
|
fcdba17 is a cherry-pick from ongoing work in UW PBL |
|
Once #439 is merged we could try using this PR and then removing the extra entries in <variable local_name="CH4"
standard_name="CH4"
units="kg kg-1" type="real" constituent="true">
<ic_file_input_names>CH4 cnst_CH4</ic_file_input_names>
</variable>
<variable local_name="CFC12"
standard_name="CFC12"
units="kg kg-1" type="real" constituent="true">
<ic_file_input_names>CFC12 cnst_CFC12</ic_file_input_names>
</variable>
<variable local_name="CFC11"
standard_name="CFC11"
units="kg kg-1" type="real" constituent="true">
<ic_file_input_names>CFC11STAR pbuf_CFC11STAR</ic_file_input_names>
</variable>if it works we could remove the new entries from #439 in this PR as well when this is merged (and passes all the tests) |
peverwhee
left a comment
There was a problem hiding this comment.
one small comment request, but nothing that holds up my approval!
| units="kg kg-1" type="real" constituent="true"> | ||
| <ic_file_input_names>Q cnst_Q</ic_file_input_names> | ||
| </variable> | ||
| <variable local_name="CO2" |
There was a problem hiding this comment.
Can we add a comment to the top of the constituents section that says something about how only constituents with standard names that differ from the ic_file_input_name need to be listed in the registry?
|
The following example has been tested to work with program test_typed_char_constructor
!----------------------------------------------------------------------
! Minimal test of an F2003 typed array constructor for character
! arrays whose elements have differing lengths. The [type-spec :: ...]
! syntax forces all elements to be padded/truncated to len=std_name_len.
!
! Build on Derecho:
! module load intel-oneapi ! provides ifx
! ifx -o test_tc test_typed_char_constructor.f90
! ./test_tc
!
! (Optionally also try the classic compiler for comparison:)
! module load intel ! provides ifort
! ifort -o test_tc_ifort test_typed_char_constructor.f90
!----------------------------------------------------------------------
implicit none
integer, parameter :: std_name_len = 64
character(len=std_name_len) :: std_name
character(len=std_name_len), allocatable :: names(:)
integer :: i
std_name = 'temperature'
! The construct under review: mixed-length elements unified to
! len=std_name_len via the type-spec.
names = [character(len=std_name_len) :: std_name, &
'cnst_'//trim(std_name), &
'pbuf_'//trim(std_name)]
write(*,'(a,i0)') 'Number of elements: ', size(names)
write(*,'(a,i0)') 'Element length: ', len(names)
do i = 1, size(names)
write(*,'(a,i0,3a)') 'names(', i, ') = "', trim(names(i)), '"'
end do
! Sanity checks
if (len(names) /= std_name_len) then
write(*,'(a)') 'FAIL: element length /= std_name_len'
stop 1
end if
if (size(names) /= 3) then
write(*,'(a)') 'FAIL: wrong number of elements'
stop 1
end if
if (trim(names(2)) /= 'cnst_temperature' .or. &
trim(names(3)) /= 'pbuf_temperature') then
write(*,'(a)') 'FAIL: concatenation/padding incorrect'
stop 1
end if
write(*,'(a)') 'PASS'
end program test_typed_char_constructor |
nusbaume
left a comment
There was a problem hiding this comment.
Thanks @jimmielin! I had one request to increase the length of the declared strings to include the length of the prefixes, but otherwise this PR looks good to me (assuming @peverwhee's comment request is also included). Thanks again!
Co-authored-by: Jesse Nusbaumer <nusbaume@ucar.edu>
Co-authored-by: Jesse Nusbaumer <nusbaume@ucar.edu>
Tag name (required for release branches):
Originator(s): @jimmielin
Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number):
cnst_andpbuf_(prescribed fields from CAM) when reading input files for constituents when they are not in the registry; this is to avoid unnecessary entries in the registry for constituents if the sole purpose is to specifyic_file_input_namesfor them;cam_in_cflx_<name>) from snapshot, try to use the name without thecnst_prefix that SIMA adds, e.g.,cam_in_cflx_num_a4instead of justcam_in_cflx_cnst_num_a4right now.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:
(Helpful git command:
git diff --name-status development...<your_branch_name>)If there are new failures (compared to the
test/existing-test-failures.txtfile),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: All PASS
derecho/gnu/aux_sima: FADIAB pre-existing failure.
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: