From 94163820d22a2666e1fc50564168dee2b6afd6f7 Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Thu, 12 Nov 2020 14:23:03 -0500 Subject: [PATCH 1/9] add ocean fraction exported back to mediator --- atmos_model.F90 | 14 ++++++++++++++ cpl/module_cplfields.F90 | 11 ++++++----- fv3_cap.F90 | 8 ++++---- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/atmos_model.F90 b/atmos_model.F90 index 860079949..ae34dd697 100644 --- a/atmos_model.F90 +++ b/atmos_model.F90 @@ -2704,6 +2704,20 @@ subroutine setup_exportdata (rc) enddo enddo endif + + ! oceanfrac used by atm to calculate fluxes + idx = queryfieldlist(exportFieldsList,'oceanfrac_in_atm') + if (idx > 0 ) then +!$omp parallel do default(shared) private(i,j,nb,ix) + do j=jsc,jec + do i=isc,iec + nb = Atm_block%blkno(i,j) + ix = Atm_block%ixp(i,j) + exportData(i,j,idx) = IPD_Data(nb)%Sfcprop%oceanfrac(ix) + enddo + enddo + endif + endif !cplflx !--- diff --git a/cpl/module_cplfields.F90 b/cpl/module_cplfields.F90 index 3690731ea..90bf1d834 100644 --- a/cpl/module_cplfields.F90 +++ b/cpl/module_cplfields.F90 @@ -13,7 +13,7 @@ module module_cplfields private ! Export Fields ---------------------------------------- - integer, public, parameter :: NexportFields = 71 + integer, public, parameter :: NexportFields = 72 type(ESMF_Field), target, public :: exportFields(NexportFields) character(len=*), public, parameter :: exportFieldsList(NexportFields) = (/ & "inst_pres_interface ", & @@ -86,7 +86,8 @@ module module_cplfields "inst_merid_wind_height_lowest ", & "inst_pres_height_lowest ", & "inst_height_lowest ", & - "mean_fprec_rate " & + "mean_fprec_rate ", & + "oceanfrac_in_atm " & ! "northward_wind_neutral ", & ! "eastward_wind_neutral ", & ! "upward_wind_neutral ", & @@ -112,7 +113,7 @@ module module_cplfields "s","s","s","s","s","s","s","s", & "s","s","s","s","s","s","s","s", & "s","s","s","s","s","s","s","s", & - "s","s","s","s","s" & + "s","s","s","s","s","s" & ! "l","l","l","l","l","l","l","s", & /) ! Set exportFieldShare to .true. if field is provided as memory reference @@ -132,7 +133,7 @@ module module_cplfields .false.,.false.,.false.,.false.,.false., & .false.,.false.,.false.,.true. ,.false., & .false.,.false.,.false.,.false.,.false., & - .false. & + .false.,.false. & ! .false.,.false.,.false.,.false.,.false., & ! .false.,.false.,.false. & /) @@ -212,7 +213,7 @@ subroutine fillExportFields(data_a2oi, rc) isCreated = ESMF_FieldIsCreated(exportFields(n), rc=localrc) if (ESMF_LogFoundError(rcToCheck=localrc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__, rcToReturn=rc)) return if (isCreated) then -! set data +! set data call ESMF_FieldGet(exportFields(n), name=fieldname, dimCount=dimCount, typekind=datatype, rc=localrc) if (ESMF_LogFoundError(rcToCheck=localrc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__, rcToReturn=rc)) return !print *,'in fillExportFields, field created n=',n,size(exportFields),'name=', trim(fieldname) diff --git a/fv3_cap.F90 b/fv3_cap.F90 index 29b7c361a..e38d80c8c 100644 --- a/fv3_cap.F90 +++ b/fv3_cap.F90 @@ -1086,10 +1086,10 @@ subroutine ModelAdvance(gcomp, rc) if ( cpl ) then ! assign import_data called during phase=1 if( dbug > 0 .or. cplprint_flag ) then - if( mype < num_pes_fcst ) then + !if( mype < num_pes_fcst ) then call diagnose_cplFields(gcomp, importState, exportstate, clock_fv3, & cplprint_flag, dbug, 'import', import_timestr) - endif + !endif endif endif @@ -1215,10 +1215,10 @@ subroutine ModelAdvance(gcomp, rc) !jw for coupled, check clock and dump import and export state if ( cpl ) then if( dbug > 0 .or. cplprint_flag ) then - if( mype < num_pes_fcst ) then + !if( mype < num_pes_fcst ) then call diagnose_cplFields(gcomp, importState, exportstate, clock_fv3, & cplprint_flag, dbug, 'export', export_timestr) - endif + !endif end if endif From f25c9b06d5adae176091f34aa35328c809226e01 Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Fri, 13 Nov 2020 13:04:15 +0000 Subject: [PATCH 2/9] try fixing dumpfield hang --- cpl/module_cap_cpl.F90 | 13 +++++++------ fv3_cap.F90 | 28 ++++++++++++++-------------- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/cpl/module_cap_cpl.F90 b/cpl/module_cap_cpl.F90 index f5427c791..8232c9e21 100644 --- a/cpl/module_cap_cpl.F90 +++ b/cpl/module_cap_cpl.F90 @@ -194,7 +194,7 @@ subroutine realizeConnectedCplFields(state, grid, call NUOPC_Realize(state, field=field, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - ! -- zero out field + ! -- zero out field call ESMF_FieldFill(field, dataFillScheme="const", const1=0._ESMF_KIND_R8, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return @@ -216,16 +216,17 @@ end subroutine realizeConnectedCplFields !----------------------------------------------------------------------------- subroutine diagnose_cplFields(gcomp, importState, exportstate, clock_fv3, & - statewrite_flag, stdiagnose_flag, state_tag, timestr) + fcstpe, statewrite_flag, stdiagnose_flag, state_tag, timestr) type(ESMF_GridComp), intent(in) :: gcomp type(ESMF_State) :: importState, exportstate type(ESMF_Clock),intent(in) :: clock_fv3 + logical, intent(in) :: fcstpe logical, intent(in) :: statewrite_flag integer, intent(in) :: stdiagnose_flag character(len=*), intent(in) :: state_tag !< Import or export. character(len=*), intent(in) :: timestr !< Import or export. - integer :: timeslice = 1 + integer :: timeslice = 1 ! character(len=160) :: nuopcMsg character(len=160) :: filename @@ -244,11 +245,11 @@ subroutine diagnose_cplFields(gcomp, importState, exportstate, clock_fv3, & unit=nuopcMsg) ! call ESMF_LogWrite(nuopcMsg, ESMF_LOGMSG_INFO) - if(trim(state_tag) .eq. 'import')then + if(trim(state_tag) .eq. 'import')then call ESMF_GridCompGet(gcomp, importState=importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - if(stdiagnose_flag > 0)then + if(stdiagnose_flag > 0 .and. fcstpe)then call state_diagnose(importState, ':IS', rc=rc) end if @@ -264,7 +265,7 @@ subroutine diagnose_cplFields(gcomp, importState, exportstate, clock_fv3, & call ESMF_GridCompGet(gcomp, exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - if(stdiagnose_flag > 0)then + if(stdiagnose_flag > 0 .and. fcstpe)then call state_diagnose(exportState, ':ES', rc=rc) end if diff --git a/fv3_cap.F90 b/fv3_cap.F90 index e38d80c8c..4a755fc8c 100644 --- a/fv3_cap.F90 +++ b/fv3_cap.F90 @@ -30,7 +30,7 @@ module fv3gfs_cap_mod calendar, calendar_type, cpl, & force_date_from_configure, & cplprint_flag,output_1st_tstep_rst, & - first_kdt,num_restart_interval + first_kdt,num_restart_interval use module_fv3_io_def, only: num_pes_fcst,write_groups,app_domain, & num_files, filename_base, & @@ -63,7 +63,7 @@ module fv3gfs_cap_mod queryFieldList, fillExportFields, & exportData use module_cap_cpl, only: realizeConnectedCplFields, & - clock_cplIntval, diagnose_cplFields + clock_cplIntval, diagnose_cplFields implicit none @@ -649,7 +649,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) allocate(petList(wrttasks_per_group)) if(mype == 0) print *,'af allco wrtComp,write_groups=',write_groups -! set up ESMF time interval at center of iau window +! set up ESMF time interval at center of iau window call ESMF_TimeIntervalSet(IAU_offsetTI, h=iau_offset, rc=rc) ! allocate(originPetList(num_pes_fcst+wrttasks_per_group)) @@ -813,7 +813,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call ESMF_TimeIntervalSet(output_interval_hf, h=nfhout_hf, m=nfmout_hf, & s=nfsout_hf, rc=rc) call ESMF_TimeIntervalSet(output_hfmax, h=nfhmax_hf, m=0, s=0, rc=rc) - alarm_output_hf_stop = starttime + output_hfmax + output_interval_hf + alarm_output_hf_stop = starttime + output_hfmax + output_interval_hf if (currtime <= starttime+output_hfmax) then nhf = (currtime-starttime)/output_interval_hf alarm_output_hf_ring = startTime + (nhf+1_ESMF_KIND_I4)*output_interval_hf @@ -975,6 +975,7 @@ subroutine ModelAdvance(gcomp, rc) integer(ESMF_KIND_I8) :: n_interval, time_elapsed_sec ! integer :: na, i, urc + logical :: fcstpe logical :: isAlarmEnabled, isAlarmRinging, lalarm, reconcileFlag character(len=*),parameter :: subname='(fv3_cap:ModelAdvance)' character(240) :: msgString @@ -995,13 +996,16 @@ subroutine ModelAdvance(gcomp, rc) if (profile_memory) call ESMF_VMLogMemInfo("Entering FV3 Model_ADVANCE: ") timeri = mpi_wtime() -! +! call ESMF_GridCompGet(gcomp, name=name, localpet=mype, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + fcstpe = .false. + if( mype < num_pes_fcst ) fcstpe = .true. + ! Because of the way that the internal Clock was set in SetClock(), ! its timeStep is likely smaller than the parent timeStep. As a consequence - ! the time interval covered by a single parent timeStep will result in + ! the time interval covered by a single parent timeStep will result in ! multiple calls to the ModelAdvance() routine. Every time the currTime ! will come in by one internal timeStep advanced. This goes until the ! stopTime of the internal Clock has been reached. @@ -1086,10 +1090,8 @@ subroutine ModelAdvance(gcomp, rc) if ( cpl ) then ! assign import_data called during phase=1 if( dbug > 0 .or. cplprint_flag ) then - !if( mype < num_pes_fcst ) then call diagnose_cplFields(gcomp, importState, exportstate, clock_fv3, & - cplprint_flag, dbug, 'import', import_timestr) - !endif + fcstpe, cplprint_flag, dbug, 'import', import_timestr) endif endif @@ -1215,10 +1217,8 @@ subroutine ModelAdvance(gcomp, rc) !jw for coupled, check clock and dump import and export state if ( cpl ) then if( dbug > 0 .or. cplprint_flag ) then - !if( mype < num_pes_fcst ) then call diagnose_cplFields(gcomp, importState, exportstate, clock_fv3, & - cplprint_flag, dbug, 'export', export_timestr) - !endif + fcstpe, cplprint_flag, dbug, 'export', export_timestr) end if endif @@ -1260,13 +1260,13 @@ subroutine ModelAdvance_phase1(gcomp, rc) rc = ESMF_SUCCESS if(profile_memory) call ESMF_VMLogMemInfo("Entering FV3 Model_ADVANCE phase1: ") -! +! call ESMF_GridCompGet(gcomp, name=name, localpet=mype, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! Expecting to be called by NUOPC run method exactly once for every coupling ! step. - ! Also expecting the coupling step to be identical to the timeStep for + ! Also expecting the coupling step to be identical to the timeStep for ! clock_fv3. call ESMF_ClockPrint(clock_fv3, options="currTime", & From 6cef1107d4eb23ad2d28e6fdb35da38329985315 Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Fri, 13 Nov 2020 07:43:02 -0700 Subject: [PATCH 3/9] multiply ifrac*ofrac before export --- atmos_model.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atmos_model.F90 b/atmos_model.F90 index ae34dd697..aecee9566 100644 --- a/atmos_model.F90 +++ b/atmos_model.F90 @@ -2713,7 +2713,7 @@ subroutine setup_exportdata (rc) do i=isc,iec nb = Atm_block%blkno(i,j) ix = Atm_block%ixp(i,j) - exportData(i,j,idx) = IPD_Data(nb)%Sfcprop%oceanfrac(ix) + exportData(i,j,idx) = IPD_Data(nb)%Sfcprop%fice(ix)*IPD_Data(nb)%Sfcprop%oceanfrac(ix) enddo enddo endif From 4e636bab550de6510bf23437ec9a97d91628b3d5 Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Mon, 16 Nov 2020 14:59:58 -0500 Subject: [PATCH 4/9] add frac restart fix from Shan fix_frac_rst_20201114 --- atmos_model.F90 | 1 - io/FV3GFS_io.F90 | 47 +++++++++++++++++++++++++++++------------------ 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/atmos_model.F90 b/atmos_model.F90 index aecee9566..7e132d3fc 100644 --- a/atmos_model.F90 +++ b/atmos_model.F90 @@ -1761,7 +1761,6 @@ subroutine assign_importdata(rc) nb = Atm_block%blkno(i,j) ix = Atm_block%ixp(i,j) - IPD_Data(nb)%Sfcprop%fice(ix) = zero IPD_Data(nb)%Coupling%slimskin_cpl(ix) = IPD_Data(nb)%Sfcprop%slmsk(ix) ofrac = IPD_Data(nb)%Sfcprop%oceanfrac(ix) if (ofrac > zero) then diff --git a/io/FV3GFS_io.F90 b/io/FV3GFS_io.F90 index 07018ba05..ad3ce3fc9 100644 --- a/io/FV3GFS_io.F90 +++ b/io/FV3GFS_io.F90 @@ -1059,14 +1059,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) endif if(Model%frac_grid) then ! obtain slmsk from landfrac -!! next 5 lines are temporary till lake model is available - if (Sfcprop(nb)%lakefrac(ix) > zero) then -! Sfcprop(nb)%lakefrac(ix) = nint(Sfcprop(nb)%lakefrac(ix)) - Sfcprop(nb)%landfrac(ix) = one - Sfcprop(nb)%lakefrac(ix) - if (Sfcprop(nb)%lakefrac(ix) == zero) Sfcprop(nb)%fice(ix) = zero - endif - Sfcprop(nb)%slmsk(ix) = ceiling(Sfcprop(nb)%landfrac(ix)) - if (Sfcprop(nb)%fice(ix) > Model%min_lakeice .and. Sfcprop(nb)%landfrac(ix) == zero) Sfcprop(nb)%slmsk(ix) = 2 ! land dominates ice if co-exist +! Sfcprop(nb)%slmsk(ix) = floor(Sfcprop(nb)%landfrac(ix)) ! floor is default; nint/ceiling are options else ! obtain landfrac from slmsk if (Sfcprop(nb)%slmsk(ix) > 1.9_r8) then Sfcprop(nb)%landfrac(ix) = zero @@ -1077,16 +1070,34 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) if (Sfcprop(nb)%lakefrac(ix) > zero) then Sfcprop(nb)%oceanfrac(ix) = zero ! lake & ocean don't coexist in a cell -! if (Sfcprop(nb)%fice(ix) < Model%min_lakeice) then -! Sfcprop(nb)%fice(ix) = zero -! if (Sfcprop(nb)%slmsk(ix) == 2) Sfcprop(nb)%slmsk(ix) = 0 -! endif + if (Sfcprop(nb)%slmsk(ix) /= one) then + if (Sfcprop(nb)%fice(ix) >= Model%min_lakeice) then + if (Sfcprop(nb)%slmsk(ix) /= 2) & + write(*,'(a,2i3,3f6.2)') 'reset lake slmsk=2 at nb,ix=' & + ,nb,ix,Sfcprop(nb)%fice(ix),Sfcprop(nb)%slmsk(ix),Sfcprop(nb)%lakefrac(ix) + Sfcprop(nb)%slmsk(ix) = 2 + else + if (Sfcprop(nb)%slmsk(ix) /= 0) & + write(*,'(a,2i3,3f6.2)') 'reset lake slmsk=0 at nb,ix=' & + ,nb,ix,Sfcprop(nb)%fice(ix),Sfcprop(nb)%slmsk(ix),Sfcprop(nb)%lakefrac(ix) + Sfcprop(nb)%slmsk(ix) = 0 + end if + end if else Sfcprop(nb)%oceanfrac(ix) = one - Sfcprop(nb)%landfrac(ix) -! if (Sfcprop(nb)%fice(ix) < Model%min_seaice) then -! Sfcprop(nb)%fice(ix) = zero -! if (Sfcprop(nb)%slmsk(ix) == 2) Sfcprop(nb)%slmsk(ix) = 0 -! endif + if (Sfcprop(nb)%slmsk(ix) /= one) then + if (Sfcprop(nb)%fice(ix) >= Model%min_seaice) then + if (Sfcprop(nb)%slmsk(ix) /= 2) & + write(*,'(a,2i3,3f6.2)') 'reset ice slmsk=2 at nb,ix=' & + ,nb,ix,Sfcprop(nb)%fice(ix),Sfcprop(nb)%slmsk(ix),Sfcprop(nb)%landfrac(ix) + Sfcprop(nb)%slmsk(ix) = 2 + else + if (Sfcprop(nb)%slmsk(ix) /= 0) & + write(*,'(a,2i3,4f6.2)') 'reset ice slmsk=0 at nb,ix=' & + ,nb,ix,Sfcprop(nb)%fice(ix),Sfcprop(nb)%slmsk(ix),Sfcprop(nb)%landfrac(ix) + Sfcprop(nb)%slmsk(ix) = 0 + end if + end if endif ! !--- NSSTM variables @@ -1329,7 +1340,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) endif if (sfc_var2(i,j,nvar_s2m) < -9990.0_r8) then - if (Model%me == Model%master ) call mpp_error(NOTE, 'gfs_driver::surface_props_input - computing zorli') + if (Model%me == Model%master ) call mpp_error(NOTE, 'gfs_driver::surface_props_input - computing zorlw') !$omp parallel do default(shared) private(nb, ix) do nb = 1, Atm_block%nblks do ix = 1, Atm_block%blksz(nb) @@ -1344,7 +1355,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) !$omp parallel do default(shared) private(nb, ix, tem, tem1) do nb = 1, Atm_block%nblks do ix = 1, Atm_block%blksz(nb) - Sfcprop(nb)%tsfco(ix) = max(con_tice, Sfcprop(nb)%tsfco(ix)) + if( Model%phour < 1.e-7) Sfcprop(nb)%tsfco(ix) = max(con_tice, Sfcprop(nb)%tsfco(ix)) ! this may break restart reproducibility tem1 = one - Sfcprop(nb)%landfrac(ix) tem = tem1 * Sfcprop(nb)%fice(ix) ! tem = ice fraction wrt whole cell Sfcprop(nb)%zorl(ix) = Sfcprop(nb)%zorll(ix) * Sfcprop(nb)%landfrac(ix) & From 8d3f100c68dba5514686063a4f87e1c8e46120e6 Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Tue, 17 Nov 2020 06:58:31 -0500 Subject: [PATCH 5/9] Add shan's latest fix to sfcprop slmsk --- io/FV3GFS_io.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io/FV3GFS_io.F90 b/io/FV3GFS_io.F90 index ad3ce3fc9..afe69704e 100644 --- a/io/FV3GFS_io.F90 +++ b/io/FV3GFS_io.F90 @@ -1059,7 +1059,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain) endif if(Model%frac_grid) then ! obtain slmsk from landfrac -! Sfcprop(nb)%slmsk(ix) = floor(Sfcprop(nb)%landfrac(ix)) ! floor is default; nint/ceiling are options + Sfcprop(nb)%slmsk(ix) = ceiling(Sfcprop(nb)%landfrac(ix)) else ! obtain landfrac from slmsk if (Sfcprop(nb)%slmsk(ix) > 1.9_r8) then Sfcprop(nb)%landfrac(ix) = zero From 57bd7a7aff09ecb4b41310c954e756ac4b30c81b Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Thu, 14 Jan 2021 07:31:11 -0600 Subject: [PATCH 6/9] make export the ocean fraction --- atmos_model.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atmos_model.F90 b/atmos_model.F90 index 7369a285c..8c2254d38 100644 --- a/atmos_model.F90 +++ b/atmos_model.F90 @@ -2724,7 +2724,7 @@ subroutine setup_exportdata (rc) do i=isc,iec nb = Atm_block%blkno(i,j) ix = Atm_block%ixp(i,j) - exportData(i,j,idx) = IPD_Data(nb)%Sfcprop%fice(ix)*IPD_Data(nb)%Sfcprop%oceanfrac(ix) + exportData(i,j,idx) = one - IPD_Data(nb)%Sfcprop%fice(ix)*IPD_Data(nb)%Sfcprop%oceanfrac(ix) enddo enddo endif From 13d34f7374cde83de8d3a72813ed9467b5e3963b Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Mon, 18 Jan 2021 11:09:59 -0700 Subject: [PATCH 7/9] change alias for Sa_ofrac; correct field for export --- atmos_model.F90 | 4 ++-- cpl/module_cplfields.F90 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/atmos_model.F90 b/atmos_model.F90 index 4d0f4d803..2e7a92d79 100644 --- a/atmos_model.F90 +++ b/atmos_model.F90 @@ -2622,14 +2622,14 @@ subroutine setup_exportdata (rc) endif ! oceanfrac used by atm to calculate fluxes - idx = queryfieldlist(exportFieldsList,'oceanfrac_in_atm') + idx = queryfieldlist(exportFieldsList,'openwater_frac_in_atm') if (idx > 0 ) then !$omp parallel do default(shared) private(i,j,nb,ix) do j=jsc,jec do i=isc,iec nb = Atm_block%blkno(i,j) ix = Atm_block%ixp(i,j) - exportData(i,j,idx) = one - IPD_Data(nb)%Sfcprop%fice(ix)*IPD_Data(nb)%Sfcprop%oceanfrac(ix) + exportData(i,j,idx) = (one - GFS_Data(nb)%Sfcprop%fice(ix))*GFS_Data(nb)%Sfcprop%oceanfrac(ix) enddo enddo endif diff --git a/cpl/module_cplfields.F90 b/cpl/module_cplfields.F90 index 90bf1d834..cb941bf0b 100644 --- a/cpl/module_cplfields.F90 +++ b/cpl/module_cplfields.F90 @@ -87,7 +87,7 @@ module module_cplfields "inst_pres_height_lowest ", & "inst_height_lowest ", & "mean_fprec_rate ", & - "oceanfrac_in_atm " & + "openwater_frac_in_atm " & ! "northward_wind_neutral ", & ! "eastward_wind_neutral ", & ! "upward_wind_neutral ", & From 0a76011b5cb3abb16404938a477ec2151611c19c Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Thu, 25 Feb 2021 08:45:40 -0500 Subject: [PATCH 8/9] add changes from upd_for_esmf81bs30 *test bs47 w/ current fv3 develop code --- fv3_cap.F90 | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/fv3_cap.F90 b/fv3_cap.F90 index 29b7c361a..556b48285 100644 --- a/fv3_cap.F90 +++ b/fv3_cap.F90 @@ -235,7 +235,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) ! ! local variables - type(ESMF_VM) :: vm + type(ESMF_VM) :: vm, fcstVM type(ESMF_Time) :: CurrTime, starttime, StopTime type(ESMF_Time) :: alarm_output_hf_ring, alarm_output_ring type(ESMF_Time) :: alarm_output_hf_stop, alarm_output_stop @@ -250,7 +250,6 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) integer :: i, j, k, io_unit, urc, ierr integer :: petcount, mype integer :: num_output_file - logical :: isPetLocal logical :: OPENED character(ESMF_MAXSTR) :: name logical :: fcstpe @@ -589,6 +588,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__, rcToReturn=rc)) return +! obtain fcst VM + call ESMF_GridCompGet(fcstComp, vm=fcstVM, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! create fcst state fcstState = ESMF_StateCreate(rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return @@ -601,7 +603,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__, rcToReturn=rc)) return ! ! reconcile the fcstComp's import state - call ESMF_StateReconcile(fcstState, attreconflag= ESMF_ATTRECONCILE_ON, rc=rc) + call ESMF_StateReconcile(fcstState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! ! determine number elements in fcstState @@ -871,21 +873,16 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if( cpl ) then - isPetLocal = ESMF_GridCompIsPetLocal(fcstComp, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - - if (isPetLocal) then - ! importable fields: do i = 1, size(ImportFieldsList) if (importFieldShare(i)) then call NUOPC_Advertise(importState, & StandardName=trim(ImportFieldsList(i)), & - SharePolicyField="share", rc=rc) + SharePolicyField="share", vm=fcstVM, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return else call NUOPC_Advertise(importState, & - StandardName=trim(ImportFieldsList(i)), rc=rc) + StandardName=trim(ImportFieldsList(i)), vm=fcstVM, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return end if end do @@ -895,16 +892,15 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) if (exportFieldShare(i)) then call NUOPC_Advertise(exportState, & StandardName=trim(exportFieldsList(i)), & - SharePolicyField="share", rc=rc) + SharePolicyField="share", vm=fcstVM, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return else call NUOPC_Advertise(exportState, & - StandardName=trim(exportFieldsList(i)), rc=rc) + StandardName=trim(exportFieldsList(i)), vm=fcstVM, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return end if end do - endif if(mype==0) print *,'in fv3_cap, aft import, export fields in atmos' endif From 6ac245fd6ee7d06178b24cf037531fd4e9490695 Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Thu, 25 Feb 2021 15:08:20 -0500 Subject: [PATCH 9/9] add missing code from cpl/module_cap_cpl --- cpl/module_cap_cpl.F90 | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/cpl/module_cap_cpl.F90 b/cpl/module_cap_cpl.F90 index f5427c791..0bac2f515 100644 --- a/cpl/module_cap_cpl.F90 +++ b/cpl/module_cap_cpl.F90 @@ -139,50 +139,45 @@ subroutine realizeConnectedCplFields(state, grid, isConnected = NUOPC_IsConnected(state, fieldName=trim(fieldNames(item)), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return if (isConnected) then + call ESMF_StateGet(state, field=field, itemName=trim(fieldNames(item)), rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + call ESMF_FieldEmptySet(field, grid=grid, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return select case (fieldTypes(item)) case ('l','layer') - field = ESMF_FieldCreate(grid, typekind=ESMF_TYPEKIND_R8, & - name=trim(fieldNames(item)), & + call ESMF_FieldEmptyComplete(field, typekind=ESMF_TYPEKIND_R8, & ungriddedLBound=(/1/), ungriddedUBound=(/numLevels/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return case ('i','interface') - field = ESMF_FieldCreate(grid, typekind=ESMF_TYPEKIND_R8, & - name=trim(fieldNames(item)), & + call ESMF_FieldEmptyComplete(field, typekind=ESMF_TYPEKIND_R8, & ungriddedLBound=(/1/), ungriddedUBound=(/numLevels+1/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return case ('t','tracer') - field = ESMF_FieldCreate(grid, typekind=ESMF_TYPEKIND_R8, & - name=trim(fieldNames(item)), & + call ESMF_FieldEmptyComplete(field, typekind=ESMF_TYPEKIND_R8, & ungriddedLBound=(/1, 1/), ungriddedUBound=(/numLevels, numTracers/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return case ('u','tracer_up_flux') - field = ESMF_FieldCreate(grid, typekind=ESMF_TYPEKIND_R8, & - name=trim(fieldNames(item)), & + call ESMF_FieldEmptyComplete(field, typekind=ESMF_TYPEKIND_R8, & ungriddedLBound=(/1/), ungriddedUBound=(/num_diag_sfc_emis_flux/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return case ('d','tracer_down_flx') - field = ESMF_FieldCreate(grid, typekind=ESMF_TYPEKIND_R8, & - name=trim(fieldNames(item)), & + call ESMF_FieldEmptyComplete(field, typekind=ESMF_TYPEKIND_R8, & ungriddedLBound=(/1, 1/), & ungriddedUBound=(/num_diag_down_flux, num_diag_type_down_flux/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return case ('b','tracer_anth_biom_emission') - field = ESMF_FieldCreate(grid, typekind=ESMF_TYPEKIND_R8, & - name=trim(fieldNames(item)), & + call ESMF_FieldEmptyComplete(field, typekind=ESMF_TYPEKIND_R8, & ungriddedLBound=(/1/), ungriddedUBound=(/num_diag_burn_emis_flux/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return case ('c','tracer_column_mass_density') - field = ESMF_FieldCreate(grid, typekind=ESMF_TYPEKIND_R8, & - name=trim(fieldNames(item)), & + call ESMF_FieldEmptyComplete(field, typekind=ESMF_TYPEKIND_R8, & ungriddedLBound=(/1/), ungriddedUBound=(/num_diag_cmass/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return case ('s','surface') - field = ESMF_FieldCreate(grid, typekind=ESMF_TYPEKIND_R8, & - name=trim(fieldNames(item)), rc=rc) + call ESMF_FieldEmptyComplete(field, typekind=ESMF_TYPEKIND_R8, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return case ('g','soil') - field = ESMF_FieldCreate(grid, typekind=ESMF_TYPEKIND_R8, & - name=trim(fieldNames(item)), & + call ESMF_FieldEmptyComplete(field, typekind=ESMF_TYPEKIND_R8, & ungriddedLBound=(/1/), ungriddedUBound=(/numSoilLayers/), rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return case default