Skip to content

Commit 13ed059

Browse files
authored
Updates for component land model (#98)
1 parent f8f7ba7 commit 13ed059

7 files changed

+397
-354
lines changed

cesm/driver/ensemble_driver.F90

+1-3
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ subroutine SetModelServices(ensemble_driver, rc)
145145
integer :: pio_asyncio_stride
146146
integer :: pio_asyncio_rootpe
147147
integer :: Global_Comm
148-
character(len=CL) :: start_type ! Type of startup
148+
character(len=CL) :: start_type ! Type of startup
149149
character(len=7) :: drvrinst
150150
character(len=5) :: inst_suffix
151151
character(len=CX) :: msgstr
@@ -377,10 +377,8 @@ subroutine SetModelServices(ensemble_driver, rc)
377377
endif
378378
call shr_log_setLogUnit (logunit)
379379
! Create a clock for each driver instance
380-
381380
call esm_time_clockInit(ensemble_driver, driver, logunit, localpet==petList(1), rc)
382381
if (chkerr(rc,__LINE__,u_FILE_u)) return
383-
384382
enddo
385383
inst = localPet/(ntasks_per_member+pio_asyncio_ntasks) + 1
386384

cesm/driver/esm.F90

+1
Original file line numberDiff line numberDiff line change
@@ -1517,6 +1517,7 @@ subroutine esm_finalize(driver, rc)
15171517

15181518
call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO)
15191519
rc = ESMF_SUCCESS
1520+
15201521
call shr_log_setLogunit(logunit)
15211522
call ESMF_GridCompGet(driver, vm=vm, rc=rc)
15221523
if (chkerr(rc,__LINE__,u_FILE_u)) return

cesm/driver/esm_time_mod.F90

-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,6 @@ subroutine esm_time_clockInit(ensemble_driver, instance_driver, logunit, maintas
282282
call ESMF_TimeSet( RefTime, yy=yr, mm=mon, dd=day, s=ref_tod, rc=rc)
283283
if (ChkErr(rc,__LINE__,u_FILE_u)) return
284284

285-
286285
call ESMF_TimeIntervalSet( TimeStep, s=dtime_drv, rc=rc )
287286
if (ChkErr(rc,__LINE__,u_FILE_u)) return
288287

mediator/esmFldsExchange_ufs_mod.F90

+44-18
Original file line numberDiff line numberDiff line change
@@ -234,18 +234,46 @@ subroutine esmFldsExchange_ufs(gcomp, phase, rc)
234234
end if
235235
end if
236236

237-
! to atm: unmerged surface temperatures from lnd
238-
if (phase == 'advertise') then
239-
if (is_local%wrap%comp_present(complnd) .and. is_local%wrap%comp_present(compatm)) then
240-
call addfld_from(complnd , 'Sl_t')
241-
call addfld_to(compatm , 'Sl_t')
237+
! to atm: unmerged flux components from lnd
238+
if (is_local%wrap%comp_present(complnd) .and. is_local%wrap%comp_present(compatm)) then
239+
allocate(flds(6))
240+
flds = (/ 'lat ', 'sen ', 'evap', 'gflx', 'roff', 'soff' /)
241+
if (phase == 'advertise') then
242+
do n = 1,size(flds)
243+
call addfld_from(complnd, 'Fall_'//trim(flds(n)))
244+
call addfld_to(compatm, 'Fall_'//trim(flds(n)))
245+
end do
246+
else
247+
do n = 1,size(flds)
248+
if ( fldchk(is_local%wrap%FBexp(compatm) , 'Fall_'//trim(flds(n)), rc=rc) .and. &
249+
fldchk(is_local%wrap%FBImp(complnd,complnd), 'Fall_'//trim(flds(n)), rc=rc)) then
250+
call addmap_from(complnd, 'Fall_'//trim(flds(n)), compatm, maptype, 'lfrac', 'unset')
251+
call addmrg_to(compatm, 'Fall_'//trim(flds(n)), mrg_from=complnd, mrg_fld='Fall_'//trim(flds(n)), mrg_type='copy')
252+
end if
253+
end do
242254
end if
243-
else
244-
if ( fldchk(is_local%wrap%FBexp(compatm) , 'Sl_t', rc=rc) .and. &
245-
fldchk(is_local%wrap%FBImp(complnd,complnd), 'Sl_t', rc=rc)) then
246-
call addmap_from(complnd, 'Sl_t', compatm, maptype, 'lfrin', 'unset')
247-
call addmrg_to(compatm, 'Sl_t', mrg_from=complnd, mrg_fld='Sl_t', mrg_type='copy')
255+
deallocate(flds)
256+
end if
257+
258+
! to atm: unmerged state variables from lnd
259+
if (is_local%wrap%comp_present(complnd) .and. is_local%wrap%comp_present(compatm)) then
260+
allocate(flds(7))
261+
flds = (/ 'sfrac', 'tref ', 'qref ', 'q ', 'cmm ', 'chh ', 'zvfun' /)
262+
if (phase == 'advertise') then
263+
do n = 1,size(flds)
264+
call addfld_from(complnd, 'Sl_'//trim(flds(n)))
265+
call addfld_to(compatm, 'Sl_'//trim(flds(n)))
266+
end do
267+
else
268+
do n = 1,size(flds)
269+
if ( fldchk(is_local%wrap%FBexp(compatm) , 'Sl_'//trim(flds(n)), rc=rc) .and. &
270+
fldchk(is_local%wrap%FBImp(complnd,complnd), 'Sl_'//trim(flds(n)), rc=rc)) then
271+
call addmap_from(complnd, 'Sl_'//trim(flds(n)), compatm, maptype, 'lfrac', 'unset')
272+
call addmrg_to(compatm, 'Sl_'//trim(flds(n)), mrg_from=complnd, mrg_fld='Sl_'//trim(flds(n)), mrg_type='copy')
273+
end if
274+
end do
248275
end if
276+
deallocate(flds)
249277
end if
250278

251279
! to atm: unmerged from mediator, merge will be done under FV3/CCPP composite step
@@ -716,18 +744,16 @@ subroutine esmFldsExchange_ufs(gcomp, phase, rc)
716744
if ( trim(coupling_mode) == 'ufs.nfrac.aoflux') then
717745
allocate(flds(21))
718746
flds = (/'Sa_z ', 'Sa_topo ', 'Sa_tbot ', 'Sa_pbot ', &
719-
'Sa_shum ', 'Sa_u ', 'Sa_v ', 'Faxa_lwdn ', &
720-
'Sa_ptem ', 'Sa_dens ', 'Faxa_swdn ', 'Sa_pslv ', &
721-
'Faxa_snowc', 'Faxa_snowl', 'Faxa_rainc', 'Faxa_rainl', &
722-
'Faxa_swndr', 'Faxa_swndf', 'Faxa_swvdr', 'Faxa_swvdf', &
723-
'Faxa_swnet'/)
747+
'Sa_shum ', 'Sa_u ', 'Sa_v ', 'Sa_pslv ', &
748+
'Faxa_lwdn ', 'Faxa_swdn ', 'Faxa_snowc', 'Faxa_snowl', &
749+
'Faxa_rainc', 'Faxa_rainl', 'Faxa_rain ', 'Faxa_swnet'/)
724750
else
725751
allocate(flds(18))
726752
flds = (/'Sa_z ', 'Sa_ta ', 'Sa_pslv ', 'Sa_qa ', &
727-
'Sa_ua ', 'Sa_va ', 'Faxa_swdn ', 'Faxa_lwdn ', &
728-
'Faxa_swnet', 'Faxa_rain ', 'Sa_prsl ', 'vfrac ', &
753+
'Sa_u ', 'Sa_v ', 'Faxa_swdn ', 'Faxa_lwdn ', &
754+
'Faxa_swnet', 'Faxa_rain ', 'Sa_prsl ', 'Sa_vfrac ', &
729755
'Faxa_snow ', 'Faxa_rainc', 'Sa_tskn ', 'Sa_exner ', &
730-
'Sa_ustar ', 'zorl ' /)
756+
'Sa_ustar ', 'Sa_zorl ' /)
731757
end if
732758
do n = 1,size(flds)
733759
fldname = trim(flds(n))

mediator/med.F90

-3
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,6 @@ subroutine ModifyDecompofMesh(gcomp, importState, exportState, clock, rc)
10231023
type(InternalState) :: is_local
10241024
integer :: n1
10251025
character(len=*), parameter :: subname = '('//__FILE__//':ModifyDecompofMesh)'
1026-
10271026
!-----------------------------------------------------------
10281027

10291028
call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO)
@@ -1352,7 +1351,6 @@ subroutine RealizeFieldsWithTransferAccept(gcomp, importState, exportState, cloc
13521351
type(InternalState) :: is_local
13531352
integer :: n1
13541353
character(len=*), parameter :: subname = '('//__FILE__//':RealizeFieldsWithTransferAccept)'
1355-
13561354
!-----------------------------------------------------------
13571355

13581356
call ESMF_LogWrite(trim(subname)//": called", ESMF_LOGMSG_INFO)
@@ -2222,7 +2220,6 @@ subroutine SetRunClock(gcomp, rc)
22222220
integer :: stop_n, stop_ymd
22232221
logical, save :: stopalarmcreated=.false.
22242222
character(len=*), parameter :: subname = '('//__FILE__//':SetRunClock)'
2225-
22262223
!-----------------------------------------------------------
22272224

22282225
rc = ESMF_SUCCESS

mediator/med_map_mod.F90

+1
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,7 @@ subroutine med_map_field_packed(FBSrc, FBDst, FBFracSrc, field_normOne, packed_d
10491049
trim(packed_data(mapindex)%mapnorm) /= 'none') then
10501050

10511051
! Normalized mapping - assume that each packed field has only one normalization type
1052+
call ESMF_LogWrite(trim(subname)//": FB get "//trim(packed_data(mapindex)%mapnorm), ESMF_LOGMSG_INFO)
10521053
call ESMF_FieldBundleGet(FBFracSrc, packed_data(mapindex)%mapnorm, field=field_fracsrc, rc=rc)
10531054
if (chkerr(rc,__LINE__,u_FILE_u)) return
10541055
call med_map_field_normalized(&

0 commit comments

Comments
 (0)