Skip to content

Commit

Permalink
Esmf810bs21 (#160)
Browse files Browse the repository at this point in the history
* add esmf810 VMEpoch change and iau restart timing change
  • Loading branch information
junwang-noaa committed Aug 25, 2020
1 parent 5dbea25 commit 0975bb6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
7 changes: 5 additions & 2 deletions atmos_model.F90
Original file line number Diff line number Diff line change
Expand Up @@ -688,8 +688,11 @@ subroutine atmos_model_init (Atmos, Time_init, Time, Time_step)
diag_time = Time - real_to_time_type(mod(int((first_kdt - 1)*dt_phys/3600.),6)*3600.0)
endif
if (Atmos%iau_offset > zero) then
diag_time = Atmos%Time_init
diag_time_fhzero = Atmos%Time
call get_time (Atmos%Time - Atmos%Time_init, sec)
if (sec < Atmos%iau_offset*3600) then
diag_time = Atmos%Time_init
diag_time_fhzero = Atmos%Time
endif
endif

!---- print version number to logfile ----
Expand Down
37 changes: 28 additions & 9 deletions fv3_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
integer,dimension(:), allocatable :: petList, originPetList, targetPetList
character(20) :: cwrtcomp
character(160) :: msg
integer :: isrctermprocessing
integer :: isrcTermProcessing

character(len=*),parameter :: subname='(fv3_cap:InitializeAdvertise)'
integer nfmout, nfsout , nfmout_hf, nfsout_hf
Expand Down Expand Up @@ -344,8 +344,13 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
label ='app_domain:',rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

CALL ESMF_ConfigGetAttribute(config=CF,value=isrcTermProcessing, default=0, &
label ='isrcTermProcessing:',rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

if(mype == 0) print *,'af nems config,quilting=',quilting,'write_groups=', &
write_groups,wrttasks_per_group,'calendar=',trim(calendar),'calendar_type=',calendar_type
write_groups,wrttasks_per_group,'calendar=',trim(calendar),'calendar_type=',calendar_type, &
'isrcTermProcessing=', isrcTermProcessing
!
CALL ESMF_ConfigGetAttribute(config=CF,value=num_files, &
label ='num_files:',rc=rc)
Expand Down Expand Up @@ -733,11 +738,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
! this is a Store() for the first wrtComp -> must do the Store()
timewri = mpi_wtime()

isrctermprocessing = 1
call ESMF_FieldBundleRegridStore(fcstFB(j), wrtFB(j,i), &
regridMethod=regridmethod, routehandle=routehandle(j,i), &
unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, &
srcTermProcessing=isrctermprocessing, rc=rc)
srcTermProcessing=isrcTermProcessing, rc=rc)

! if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
if (rc /= ESMF_SUCCESS) then
Expand Down Expand Up @@ -799,6 +803,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
alarm_output_hf_ring = startTime + (nhf+1_ESMF_KIND_I4)*output_interval_hf
if(iau_offset > 0) then
alarm_output_hf_ring = startTime + IAU_offsetTI
if( currtime > alarm_output_hf_ring ) then
alarm_output_hf_ring = startTime + (nhf+1_ESMF_KIND_I4)*output_interval_hf
endif
endif
alarm_output_hf = ESMF_AlarmCreate(clock_fv3,name='ALARM_OUTPUT_HF', &
ringTime =alarm_output_hf_ring, &
Expand All @@ -819,6 +826,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
alarm_output_ring = startTime + (nrg+1_ESMF_KIND_I4) * output_interval
if(iau_offset > 0) then
alarm_output_ring = startTime + IAU_offsetTI
if( currtime > alarm_output_ring ) then
alarm_output_ring = startTime + (nrg+1_ESMF_KIND_I4) * output_interval
endif
endif
endif

Expand Down Expand Up @@ -1120,20 +1130,26 @@ subroutine ModelAdvance(gcomp, rc)

timerhi = mpi_wtime()
! if (mype == 0 .or. mype == lead_wrttask(1)) print *,' aft fcst run alarm is on, na=',na,'mype=',mype

call ESMF_VMEpochEnter(epoch=ESMF_VMEpoch_Buffer, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

do i=1, FBCount
!
! get fcst fieldbundle
!
call ESMF_FieldBundleRegrid(fcstFB(i), wrtFB(i,n_group), &
routehandle=routehandle(i, n_group), &
termorderflag=(/ESMF_TERMORDER_SRCSEQ/), rc=rc)
timerh = mpi_wtime()
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
!
!end FBcount
enddo
! if (mype == 0 .or. mype == lead_wrttask(n_group)) print *,'aft fieldbundleregrid,na=',na, &
! ' time=', timerh- timerhi
enddo
call ESMF_VMEpochExit(rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
timerh = mpi_wtime()
if (mype == 0 .or. mype == lead_wrttask(n_group)) print *,'aft fieldbundleregrid,na=',na, &
' time=', timerh- timerhi

! if(mype==0 .or. mype==lead_wrttask(1)) print *,'on wrt bf wrt run, na=',na
call ESMF_LogWrite('Model Advance: before wrtcomp run ', ESMF_LOGMSG_INFO, rc=rc)
Expand Down Expand Up @@ -1410,17 +1426,20 @@ subroutine ModelAdvance_phase2(gcomp, rc)
output: IF(lalarm .or. na==first_kdt ) then

timerhi = mpi_wtime()
call ESMF_VMEpochEnter(epoch=ESMF_VMEpoch_Buffer, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
do i=1, FBCount
!
! get fcst fieldbundle
!
call ESMF_FieldBundleRegrid(fcstFB(i), wrtFB(i,n_group), &
routehandle=routehandle(i, n_group), rc=rc)
timerh = mpi_wtime()
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
!
!end FBcount
enddo
call ESMF_VMEpochExit(rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
if (mype == 0 .or. mype == lead_wrttask(n_group)) print *,'aft fieldbundleregrid,na=',na, &
' time=', timerh- timerhi

Expand Down

0 comments on commit 0975bb6

Please sign in to comment.