Main menu

Navigation

CESM1.2.1 and earlier - lon-lat history file from multi-instance CAM-SE: bug and fix

3 posts / 0 new
Last post
raeder
CESM1.2.1 and earlier - lon-lat history file from multi-instance CAM-SE: bug and fix

Affected releases - CESM1.2.1 and earlier
UPDATED - fixed in CESM1.2.2 (release target 01-June-2014)

(Bugzilla 1954) - used fix proposed by santos in #2 below

CAM-SE has code to interpolate the cubed sphere grid to a choice of rectangular lon-lat grids
and write the results to the h0 history file.
The namelist variables to control it appeared in cesm1_1_1 http documentation, but there was no
description there. In the cesm1_2_1 documentation the variables do not even appear.
&analysis_nl
interp_gridtype = 3
interp_nlat = 192
interp_nlon = 288
interp_type = 1
interpolate_analysis = .true.
/

The software works in the limited tests I did with a single instance of CAM-SE,
but fails in a multi-instance run. The problem is that
/atm/cam/src/dynamics/homme/interp_mod.F90 calls
pio_subsystem => shr_pio_getiosys('ATM') but
shr_pio_getiosys compares 'ATM' against a list with entries like 'ATM0001','ATM0002',...

I've modified interp_mod.F90 to use the inst_index from
models/atm/cam/src/control/cam_instance.F90
in new calls to shr_pio_getiosys:

old>
pio_subsystem => shr_pio_getiosys('ATM')

new>
if (inst_index > 0 .and. inst_index < 10000) then
! 4 digit version of inst_index, padded with 0s
write(compinst,'(A3,I4.4)') 'ATM',inst_index
else
compinst(1:3) = 'ATM'
end if
pio_subsystem => shr_pio_getiosys(trim(compinst))

This probably violates some CESM coding standard, but it does work.
The whole modified subroutine can be found in
/glade/p/work/raeder/Models/cesm1_1_1/SourceMods/src.cam/interp_mod.F90

santos

Hmm, the original code certainly does seem to be wrong.

In theory, I believe that this code should be getting pio_subsystem (and possibly other things) from cam_pio_utils. I'm not sure if there's a reason why that wasn't done (e.g. due to circular dependencies), or if this was just an oversight.

The second best solution would be this:

use cam_instance, only: atm_id

pio_subsystem => shr_pio_getiosys(atm_id)

It is not necessary to convert the instance index into a string; as shown above, you can simply use the atm_id from cam_instance to get the pio subsystem.

Sean Patrick Santos

CESM Software Engineering Group

eaton

Thanks Sean.  I've copied this discussion to CAM's internal bug tracking.

 

Log in or register to post comments

Who's new

  • Nicholas.Davis@...
  • numarsanifa@...
  • bingdian_46@...
  • mxy2832029@...
  • nthg2000@...