From b47ad4485804416b34c3b2694bfe649ee2f18af9 Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Fri, 6 Mar 2020 21:08:17 +0000 Subject: [PATCH 1/5] Explicitly label each field dump with timestamp --- cpl/module_cap_cpl.F90 | 38 +++++++++++++++++++++++++------------- fv3_cap.F90 | 8 +++++++- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/cpl/module_cap_cpl.F90 b/cpl/module_cap_cpl.F90 index 073f7defd..8d143b338 100644 --- a/cpl/module_cap_cpl.F90 +++ b/cpl/module_cap_cpl.F90 @@ -214,49 +214,61 @@ end subroutine realizeConnectedCplFields !----------------------------------------------------------------------------- subroutine Dump_cplFields(gcomp, importState, exportstate, clock_fv3, & - statewrite_flag, timeslice) + statewrite_flag, state_tag) type(ESMF_GridComp), intent(in) :: gcomp type(ESMF_State) :: importState, exportstate type(ESMF_Clock),intent(in) :: clock_fv3 logical, intent(in) :: statewrite_flag - integer :: timeslice + character(len=*), intent(in) :: state_tag !< Import or export. + integer :: timeslice = 1 ! + type(ESMF_Time) :: currTime + type(ESMF_TimeInterval) :: timeStep + character(len=160) :: nuopcMsg character(len=160) :: filename + character(240) :: import_timestr, export_timestr integer :: rc ! call ESMF_ClockPrint(clock_fv3, options="currTime", & preString="leaving FV3_ADVANCE with clock_fv3 current: ", & unit=nuopcMsg) - call ESMF_LogWrite(nuopcMsg, ESMF_LOGMSG_INFO) + !call ESMF_LogWrite(nuopcMsg, ESMF_LOGMSG_INFO) call ESMF_ClockPrint(clock_fv3, options="startTime", & preString="leaving FV3_ADVANCE with clock_fv3 start: ", & unit=nuopcMsg) - call ESMF_LogWrite(nuopcMsg, ESMF_LOGMSG_INFO) + !call ESMF_LogWrite(nuopcMsg, ESMF_LOGMSG_INFO) call ESMF_ClockPrint(clock_fv3, options="stopTime", & preString="leaving FV3_ADVANCE with clock_fv3 stop: ", & unit=nuopcMsg) - call ESMF_LogWrite(nuopcMsg, ESMF_LOGMSG_INFO) + !call ESMF_LogWrite(nuopcMsg, ESMF_LOGMSG_INFO) + + call ESMF_ClockGet(clock_fv3, currTime=currTime, timeStep=timeStep, rc=rc) + call ESMF_TimeGet(currTime, timestring=import_timestr, rc=rc) + call ESMF_TimeGet(currTime+timestep, timestring=export_timestr, rc=rc) ! Dumping Fields out if (statewrite_flag) then - timeslice = timeslice + 1 call ESMF_GridCompGet(gcomp, importState=importState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! replace with tiled field dumps !call ESMFPP_RegridWriteState(importState, "fv3_cap_import_", timeslice, rc=rc) - write(filename,'(a,i6.6)') 'fv3_cap_import_',timeslice - call State_RWFields_tiles(importState,trim(filename), timeslice, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if(trim(state_tag) .eq. 'import')then + write(filename,'(a,a,a)') 'fv3_cap_import_'//trim(import_timestr)//'_' + call State_RWFields_tiles(importState,trim(filename), timeslice, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + end if + call ESMF_GridCompGet(gcomp, exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return - ! replace with tiled field dumps !call ESMFPP_RegridWriteState(exportState, "fv3_cap_export_", timeslice, rc=rc) - write(filename,'(a,i6.6)') 'fv3_cap_export_',timeslice - call State_RWFields_tiles(exportState,trim(filename), timeslice, rc=rc) - if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if(trim(state_tag) .eq. 'export')then + write(filename,'(a,a,a)') 'fv3_cap_export_'//trim(export_timestr)//'_' + call State_RWFields_tiles(exportState,trim(filename), timeslice, rc=rc) + if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + end if endif ! end subroutine Dump_cplFields diff --git a/fv3_cap.F90 b/fv3_cap.F90 index 0a352846f..dce69fa45 100644 --- a/fv3_cap.F90 +++ b/fv3_cap.F90 @@ -1046,6 +1046,12 @@ subroutine ModelAdvance(gcomp, rc) phase=1, userRc=urc, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return + if ( cpl ) then + ! assign import_data called during phase=1 + call Dump_cplFields(gcomp, importState, exportstate, clock_fv3, & + cplprint_flag, 'import') + endif + if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__, rcToReturn=rc)) return call ESMF_GridCompRun(fcstComp, exportState=fcstState, clock=clock_fv3, & @@ -1164,7 +1170,7 @@ subroutine ModelAdvance(gcomp, rc) !jw for coupled, check clock and dump import and export state if ( cpl ) then call Dump_cplFields(gcomp, importState, exportstate, clock_fv3, & - cplprint_flag, timeslice) + cplprint_flag, 'export') endif if (mype==0) print *,'fv3_cap,end integrate,na=',na,' time=',mpi_wtime()- timeri From 1af9bc77c51c23c9af9405c73668a7ac104f8bdb Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Sat, 7 Mar 2020 13:03:05 +0000 Subject: [PATCH 2/5] remove vtk print; adjust if loops in dump_cplfields --- cpl/module_cap_cpl.F90 | 4 ++-- module_fcst_grid_comp.F90 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cpl/module_cap_cpl.F90 b/cpl/module_cap_cpl.F90 index 8d143b338..11e5ded37 100644 --- a/cpl/module_cap_cpl.F90 +++ b/cpl/module_cap_cpl.F90 @@ -250,21 +250,21 @@ subroutine Dump_cplFields(gcomp, importState, exportstate, clock_fv3, & ! Dumping Fields out if (statewrite_flag) 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 ! replace with tiled field dumps !call ESMFPP_RegridWriteState(importState, "fv3_cap_import_", timeslice, rc=rc) - if(trim(state_tag) .eq. 'import')then write(filename,'(a,a,a)') 'fv3_cap_import_'//trim(import_timestr)//'_' call State_RWFields_tiles(importState,trim(filename), timeslice, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return end if + if(trim(state_tag) .eq. 'export')then call ESMF_GridCompGet(gcomp, exportState=exportState, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! replace with tiled field dumps !call ESMFPP_RegridWriteState(exportState, "fv3_cap_export_", timeslice, rc=rc) - if(trim(state_tag) .eq. 'export')then write(filename,'(a,a,a)') 'fv3_cap_export_'//trim(export_timestr)//'_' call State_RWFields_tiles(exportState,trim(filename), timeslice, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return diff --git a/module_fcst_grid_comp.F90 b/module_fcst_grid_comp.F90 index fef9698ab..813258130 100644 --- a/module_fcst_grid_comp.F90 +++ b/module_fcst_grid_comp.F90 @@ -532,8 +532,8 @@ subroutine fcst_initialize(fcst_comp, importState, exportState, clock, rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! print *,'call addLsmask2grid after fcstgrid, rc=',rc if( cplprint_flag ) then - call ESMF_GridWriteVTK(fcstgrid, staggerloc=ESMF_STAGGERLOC_CENTER, & - filename='fv3cap_fv3Grid', rc=rc) + !call ESMF_GridWriteVTK(fcstgrid, staggerloc=ESMF_STAGGERLOC_CENTER, & + ! filename='fv3cap_fv3Grid', rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return endif endif From 11afe4cf5fc1e4c2693d2cf177fae748f6771173 Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Sat, 7 Mar 2020 22:58:44 +0000 Subject: [PATCH 3/5] fix cap timestrings --- cpl/module_cap_cpl.F90 | 12 ++++-------- fv3_cap.F90 | 9 +++++++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cpl/module_cap_cpl.F90 b/cpl/module_cap_cpl.F90 index 11e5ded37..a3d0fd9b4 100644 --- a/cpl/module_cap_cpl.F90 +++ b/cpl/module_cap_cpl.F90 @@ -214,13 +214,14 @@ end subroutine realizeConnectedCplFields !----------------------------------------------------------------------------- subroutine Dump_cplFields(gcomp, importState, exportstate, clock_fv3, & - statewrite_flag, state_tag) + statewrite_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) :: statewrite_flag character(len=*), intent(in) :: state_tag !< Import or export. + character(len=*), intent(in) :: timestr !< Import or export. integer :: timeslice = 1 ! type(ESMF_Time) :: currTime @@ -228,7 +229,6 @@ subroutine Dump_cplFields(gcomp, importState, exportstate, clock_fv3, & character(len=160) :: nuopcMsg character(len=160) :: filename - character(240) :: import_timestr, export_timestr integer :: rc ! call ESMF_ClockPrint(clock_fv3, options="currTime", & @@ -244,10 +244,6 @@ subroutine Dump_cplFields(gcomp, importState, exportstate, clock_fv3, & unit=nuopcMsg) !call ESMF_LogWrite(nuopcMsg, ESMF_LOGMSG_INFO) - call ESMF_ClockGet(clock_fv3, currTime=currTime, timeStep=timeStep, rc=rc) - call ESMF_TimeGet(currTime, timestring=import_timestr, rc=rc) - call ESMF_TimeGet(currTime+timestep, timestring=export_timestr, rc=rc) - ! Dumping Fields out if (statewrite_flag) then if(trim(state_tag) .eq. 'import')then @@ -255,7 +251,7 @@ subroutine Dump_cplFields(gcomp, importState, exportstate, clock_fv3, & if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! replace with tiled field dumps !call ESMFPP_RegridWriteState(importState, "fv3_cap_import_", timeslice, rc=rc) - write(filename,'(a,a,a)') 'fv3_cap_import_'//trim(import_timestr)//'_' + write(filename,'(a,a,a)') 'fv3_cap_import_'//trim(timestr)//'_' call State_RWFields_tiles(importState,trim(filename), timeslice, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return end if @@ -265,7 +261,7 @@ subroutine Dump_cplFields(gcomp, importState, exportstate, clock_fv3, & if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! replace with tiled field dumps !call ESMFPP_RegridWriteState(exportState, "fv3_cap_export_", timeslice, rc=rc) - write(filename,'(a,a,a)') 'fv3_cap_export_'//trim(export_timestr)//'_' + write(filename,'(a,a,a)') 'fv3_cap_export_'//trim(timestr)//'_' call State_RWFields_tiles(exportState,trim(filename), timeslice, rc=rc) if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return end if diff --git a/fv3_cap.F90 b/fv3_cap.F90 index dce69fa45..5772ec1f3 100644 --- a/fv3_cap.F90 +++ b/fv3_cap.F90 @@ -949,6 +949,7 @@ subroutine ModelAdvance(gcomp, rc) logical :: isAlarmEnabled, isAlarmRinging, lalarm, reconcileFlag character(len=*),parameter :: subname='(fv3_cap:ModelAdvance)' character(240) :: msgString + character(240) :: import_timestr, export_timestr !jw debug character(ESMF_MAXSTR) :: name integer :: mype,date(6), fieldcount, fcst_nfld @@ -1027,6 +1028,10 @@ subroutine ModelAdvance(gcomp, rc) ! if(mype==0) print *,'af clock,timestep date=',date ! if(mype==lead_wrttask(1)) print *,'on wrt lead,af clock,timestep date=',date ! + call ESMF_ClockGet(clock_fv3, currTime=currTime, timeStep=timeStep, rc=rc) + call ESMF_TimeGet(currTime, timestring=import_timestr, rc=rc) + call ESMF_TimeGet(currTime+timestep, timestring=export_timestr, rc=rc) + !----------------------------------------------------------------------------- !*** integration loop @@ -1049,7 +1054,7 @@ subroutine ModelAdvance(gcomp, rc) if ( cpl ) then ! assign import_data called during phase=1 call Dump_cplFields(gcomp, importState, exportstate, clock_fv3, & - cplprint_flag, 'import') + cplprint_flag, 'import', import_timestr) endif if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__, rcToReturn=rc)) return @@ -1170,7 +1175,7 @@ subroutine ModelAdvance(gcomp, rc) !jw for coupled, check clock and dump import and export state if ( cpl ) then call Dump_cplFields(gcomp, importState, exportstate, clock_fv3, & - cplprint_flag, 'export') + cplprint_flag, 'export', export_timestr) endif if (mype==0) print *,'fv3_cap,end integrate,na=',na,' time=',mpi_wtime()- timeri From aa46589db2ecde2fb831ef0572a4d61efb0c58f6 Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Fri, 13 Mar 2020 08:29:32 -0400 Subject: [PATCH 4/5] change two field names for CMEPS --- atmos_model.F90 | 4 ++-- cpl/module_cplfields.F90 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/atmos_model.F90 b/atmos_model.F90 index ea336a100..68374c5e4 100644 --- a/atmos_model.F90 +++ b/atmos_model.F90 @@ -1998,7 +1998,7 @@ subroutine setup_exportdata (rc) if (IPD_Control%cplflx) then ! MEAN Zonal compt of momentum flux (N/m**2) - idx = queryfieldlist(exportFieldsList,'mean_zonal_moment_flx') + idx = queryfieldlist(exportFieldsList,'mean_zonal_moment_flx_atm') if (idx > 0 ) then !$omp parallel do default(shared) private(i,j,nb,ix) do j=jsc,jec @@ -2011,7 +2011,7 @@ subroutine setup_exportdata (rc) endif ! MEAN Merid compt of momentum flux (N/m**2) - idx = queryfieldlist(exportFieldsList,'mean_merid_moment_flx') + idx = queryfieldlist(exportFieldsList,'mean_merid_moment_flx_atm') if (idx > 0 ) then !$omp parallel do default(shared) private(i,j,nb,ix) do j=jsc,jec diff --git a/cpl/module_cplfields.F90 b/cpl/module_cplfields.F90 index 3b0b0be16..713f83064 100644 --- a/cpl/module_cplfields.F90 +++ b/cpl/module_cplfields.F90 @@ -39,8 +39,8 @@ module module_cplfields "vegetation_type ", & "inst_vegetation_area_frac ", & "inst_surface_roughness ", & - "mean_zonal_moment_flx ", & - "mean_merid_moment_flx ", & + "mean_zonal_moment_flx_atm ", & + "mean_merid_moment_flx_atm ", & "mean_sensi_heat_flx ", & "mean_laten_heat_flx ", & "mean_down_lw_flx ", & From b1d903712089946eedf44fad7d4685014f3069ad Mon Sep 17 00:00:00 2001 From: "denise.worthen" Date: Mon, 23 Mar 2020 11:02:22 -0600 Subject: [PATCH 5/5] turn off ugwp print messages --- fv3_cap.F90 | 2 +- gfsphysics/physics/ugwp_driver_v0.f | 36 ++++++++++++++--------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/fv3_cap.F90 b/fv3_cap.F90 index 5772ec1f3..00012b705 100644 --- a/fv3_cap.F90 +++ b/fv3_cap.F90 @@ -703,7 +703,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc) call ESMF_StateGet(wrtState(i), & itemName="mirror_"//trim(fcstItemNameList(j)), & fieldbundle=wrtFB(j,i), rc=rc) - if(mype == 0) print *,'af get wrtfb=',"mirror_"//trim(fcstItemNameList(j)),'rc=',rc + if(mype == 0) print *,'af get wrtfb=',"mirror_"//trim(fcstItemNameList(j)),' rc=',rc if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return ! determine regridmethod diff --git a/gfsphysics/physics/ugwp_driver_v0.f b/gfsphysics/physics/ugwp_driver_v0.f index 41193aad0..98cdfe34b 100644 --- a/gfsphysics/physics/ugwp_driver_v0.f +++ b/gfsphysics/physics/ugwp_driver_v0.f @@ -90,13 +90,13 @@ subroutine cires_ugwp_driver_v0(me, master, ! switches for GW-effects: pogw=1 (OGWs) pngw=1 (NGWs) pked=1 (eddy mixing) ! if (me == master .and. kdt < 2) then - print * - write(6,*) 'FV3GFS execute ugwp_driver_v0 ' +! print * +! write(6,*) 'FV3GFS execute ugwp_driver_v0 ' ! write(6,*) 'FV3GFS execute ugwp_driver_v0 nmtvr=', nmtvr - write(6,*) ' COORDE EXPER pogw = ' , pogw - write(6,*) ' COORDE EXPER pgwd = ' , pgwd - write(6,*) ' COORDE EXPER pgwd4 = ', pgwd4 - print * +! write(6,*) ' COORDE EXPER pogw = ' , pogw +! write(6,*) ' COORDE EXPER pgwd = ' , pgwd +! write(6,*) ' COORDE EXPER pgwd4 = ', pgwd4 +! print * endif do i=1,im @@ -119,9 +119,9 @@ subroutine cires_ugwp_driver_v0(me, master, & du3dt_mtb, du3dt_ogw, du3dt_tms) ! if (me == master .and. kdt < 2) then - print * - write(6,*) 'FV3GFS finished gwdps_v0 in ugwp_driver_v0 ' - print * + !print * + !write(6,*) 'FV3GFS finished gwdps_v0 in ugwp_driver_v0 ' + !print * endif else ! calling old GFS gravity wave drag as is do k=1,levs @@ -191,10 +191,10 @@ subroutine cires_ugwp_driver_v0(me, master, & tau_ngw, me, master, kdt) if (me == master .and. kdt < 2) then - print * - write(6,*)'FV3GFS finished fv3_ugwp_v0 in ugwp_driver_v0 ' - write(6,*) ' non-stationary GWs with GMAO/MERRA GW-forcing ' - print * + !print * + !write(6,*)'FV3GFS finished fv3_ugwp_v0 in ugwp_driver_v0 ' + !write(6,*) ' non-stationary GWs with GMAO/MERRA GW-forcing ' + !print * endif do k=1,levs do i=1,im @@ -1831,12 +1831,12 @@ subroutine fv3_ugwp_solv2_v0(klon, klev, dtime, !--------------------------------------------------------------------------- ! if (kdt == 1 .and. mpi_id == master) then - print *, 'vgw done ' + !print *, 'vgw done ' ! - print *, maxval(pdudt)*86400., minval(pdudt)*86400, 'vgw ax' - print *, maxval(pdvdt)*86400., minval(pdvdt)*86400, 'vgw ay' - print *, maxval(dked)*1., minval(dked)*1, 'vgw keddy m2/sec' - print *, maxval(pdtdt)*86400., minval(pdtdt)*86400,'vgw eps' + !print *, maxval(pdudt)*86400., minval(pdudt)*86400, 'vgw ax' + !print *, maxval(pdvdt)*86400., minval(pdvdt)*86400, 'vgw ay' + !print *, maxval(dked)*1., minval(dked)*1, 'vgw keddy m2/sec' + !print *, maxval(pdtdt)*86400., minval(pdtdt)*86400,'vgw eps' ! ! print *, ' ugwp -heating rates ' endif