bug in esmFlds.F90
mvertens opened this issue · comments
There are several calls esmFlds.F90 that use the wrong field index to initialize a mapping type:
As an example below - the fldindex n2 only applies to the compocn component but is being used in adding a map to the compatm component. The !BUG identifies the problem lines that will be removed and the !NEW specifies the fix that will be implemented.
longname = 'Downward longwave heat flux'
stdname = 'downwelling_longwave_flux'
units = 'W m-2'
call shr_nuopc_fldList_AddMetadata(fldname='Faxa_lwdn', longname=longname, stdname=stdname, units=units)
call shr_nuopc_fldList_AddMetadata(fldname='Foxx_lwdn', longname=longname, stdname=stdname, units=units)
call shr_nuopc_fldList_AddFld(fldListFr(compatm)%flds, 'Faxa_lwdn', fldindex=n1)
call shr_nuopc_fldList_AddFld(fldListTo(complnd)%flds, 'Faxa_lwdn')
call shr_nuopc_fldList_AddFld(fldListTo(compice)%flds, 'Faxa_lwdn')
!BUG call shr_nuopc_fldList_AddFld(fldListTo(compocn)%flds, 'Foxx_lwdn', fldindex=n2)
!NEW call shr_nuopc_fldList_AddFld(fldListTo(compocn)%flds, 'Foxx_lwdn')
call shr_nuopc_fldList_AddMap(fldListFr(compatm)%flds(n1), compatm, complnd, mapconsf, 'one', atm2lnd_fmapname)
call shr_nuopc_fldList_AddMap(fldListFr(compatm)%flds(n1), compatm, compice, mapconsf, 'one', atm2ice_fmapname)
call shr_nuopc_fldList_AddMap(fldListFr(compatm)%flds(n1), compatm, compocn, mapconsf, 'one', atm2ocn_fmapname)
!BUG call shr_nuopc_fldList_AddMap(fldListFr(compatm)%flds(n2), compatm, compocn, mapconsf, 'one', atm2ocn_fmapname)