Skip to content

Commit

Permalink
Enable Data Atmosphere Coupling of GFDL Land Model (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinPerket authored Oct 10, 2024
1 parent dc977bc commit 24e9eed
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions mediator/esmFldsExchange_ufs_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ subroutine esmFldsExchange_ufs(gcomp, phase, rc)
character(len=CS) :: fldname
character(len=CS), allocatable :: flds(:), oflds(:), aflds(:), iflds(:)
character(len=*) , parameter :: subname='(esmFldsExchange_ufs)'

! component name
character(len=CS) :: lnd_name = ''
!--------------------------------------

rc = ESMF_SUCCESS
Expand All @@ -76,6 +79,13 @@ subroutine esmFldsExchange_ufs(gcomp, phase, rc)
write(msgString,'(A,i6,A)') trim(subname)//': maptype is ',maptype,', '//mapnames(maptype)
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)

! determine which land model is present
if (is_local%wrap%comp_present(complnd)) then
call NUOPC_CompAttributeGet(gcomp, name="LND_model", value=cvalue, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
lnd_name = trim(cvalue)
end if

if (trim(coupling_mode) == 'ufs.nfrac.aoflux' .or. trim(coupling_mode) == 'ufs.frac.aoflux') then
med_aoflux_to_ocn = .true.
else
Expand Down Expand Up @@ -773,6 +783,28 @@ subroutine esmFldsExchange_ufs(gcomp, phase, rc)
end do
deallocate(flds)


if (lnd_name == 'lm4') then
allocate(flds(4))
flds = (/'Faxa_swndr', 'Faxa_swndf', 'Faxa_swvdr', 'Faxa_swvdf' /)
do n = 1,size(flds)
fldname = trim(flds(n))
if (phase == 'advertise') then
if (is_local%wrap%comp_present(compatm) .and. is_local%wrap%comp_present(complnd)) then
call addfld_from(compatm , fldname)
call addfld_to(complnd , fldname)
end if
else
if ( fldchk(is_local%wrap%FBexp(complnd) , fldname, rc=rc) .and. &
fldchk(is_local%wrap%FBImp(compatm,compatm), fldname, rc=rc)) then
call addmap_from(compatm, fldname, complnd, maptype, 'one', 'unset')
call addmrg_to(complnd, fldname, mrg_from=compatm, mrg_fld=fldname, mrg_type='copy')
end if
end if
end do
deallocate(flds)
end if ! lm4

end subroutine esmFldsExchange_ufs

end module esmFldsExchange_ufs_mod

0 comments on commit 24e9eed

Please sign in to comment.