Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advertise import fields even with noevolve #86

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions drivers/cpl/nuopc/glc_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
! Set filenames which depend on instance information
call set_filenames()

! Determine if cism will evolve - if not will not import any fields from the mediator
! Determine if cism will evolve
call NUOPC_CompAttributeGet(gcomp, name="cism_evolve", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
Expand All @@ -214,7 +214,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
end if

! Advertise fields
call advertise_fields(gcomp, cism_evolve, num_icesheets_from_mediator, rc)
call advertise_fields(gcomp, num_icesheets_from_mediator, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

if (dbug > 5) then
Expand Down
42 changes: 21 additions & 21 deletions drivers/cpl/nuopc/glc_import_export.F90
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,12 @@ module glc_import_export
contains
!===============================================================================

subroutine advertise_fields(gcomp, cism_evolve, num_icesheets_in, rc)
subroutine advertise_fields(gcomp, num_icesheets_in, rc)

use glc_constants, only : glc_smb

! input/output variables
type(ESMF_GridComp) :: gcomp
logical , intent(in) :: cism_evolve
integer , intent(in) :: num_icesheets_in
integer , intent(out) :: rc

Expand Down Expand Up @@ -201,25 +200,26 @@ subroutine advertise_fields(gcomp, cism_evolve, num_icesheets_in, rc)
! Advertise import fields
!--------------------------------

if (cism_evolve) then
call fldlist_add(fldsToGlc_num, fldsToGlc, trim(flds_scalar_name))
call fldlist_add(fldsToGlc_num, fldsToGlc, field_in_tsrf)
call fldlist_add(fldsToGlc_num, fldsToGlc, field_in_qice)

! Now advertise import fields
do ns = 1,num_icesheets
do nf = 1,fldsToGlc_num
call NUOPC_Advertise(NStateImp(ns), standardName=fldsToGlc(nf)%stdname, &
TransferOfferGeomObject='will provide', rc=rc)
if (chkErr(rc,__LINE__,u_FILE_u)) return
if (my_task == master_task) then
write(cnum,'(i0)') ns
write(stdout,'(a)') 'Advertised import field: '//trim(fldsToGlc(nf)%stdname)//' for ice sheet '//trim(cnum)
end if
call ESMF_LogWrite(subname//'Import field'//': '//trim(fldsToGlc(nf)%stdname), ESMF_LOGMSG_INFO)
end do
enddo
end if
! Note that we advertise the import fields even if running with a non-evolving ice
! sheet; this is needed for the MED -> GLC mapping to work (which we do even for a
! non-evolving ice sheet).
call fldlist_add(fldsToGlc_num, fldsToGlc, trim(flds_scalar_name))
call fldlist_add(fldsToGlc_num, fldsToGlc, field_in_tsrf)
call fldlist_add(fldsToGlc_num, fldsToGlc, field_in_qice)

! Now advertise import fields
do ns = 1,num_icesheets
do nf = 1,fldsToGlc_num
call NUOPC_Advertise(NStateImp(ns), standardName=fldsToGlc(nf)%stdname, &
TransferOfferGeomObject='will provide', rc=rc)
if (chkErr(rc,__LINE__,u_FILE_u)) return
if (my_task == master_task) then
write(cnum,'(i0)') ns
write(stdout,'(a)') 'Advertised import field: '//trim(fldsToGlc(nf)%stdname)//' for ice sheet '//trim(cnum)
end if
call ESMF_LogWrite(subname//'Import field'//': '//trim(fldsToGlc(nf)%stdname), ESMF_LOGMSG_INFO)
end do
enddo

! Set glc_smb
! true => get surface mass balance from land model via coupler (in multiple elev classes)
Expand Down