Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/emc/develop' into emc/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
DeniseWorthen committed Aug 12, 2020
2 parents 88cc2fd + bdf1a1f commit 5ecde75
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 47 deletions.
3 changes: 1 addition & 2 deletions cicecore/cicedynB/general/ice_init.F90
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ subroutine input_data
dt, npt, ndtd, numin, &
runtype, runid, bfbflag, numax, &
ice_ic, restart, restart_dir, restart_file, &
restart_ext, restart_coszen, use_restart_time, restart_format, &
lcdf64, &
restart_ext, use_restart_time, restart_format, lcdf64, &
pointer_file, dumpfreq, dumpfreq_n, dump_last, &
diagfreq, diag_type, diag_file, history_format,&
print_global, print_points, latpnt, lonpnt, &
Expand Down
8 changes: 7 additions & 1 deletion cicecore/drivers/nuopc/cmeps/CICE_RunMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ subroutine coupling_prep (iblk)
alvdf_ai, alidf_ai, alvdr_ai, alidr_ai, fhocn_ai, &
fresh_ai, fsalt_ai, fsalt, &
fswthru_ai, fhocn, fswthru, scale_factor, snowfrac, &
fswthru_vdr, fswthru_vdf, fswthru_idr, fswthru_idf, &
swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyT, &
fsens, flat, fswabs, flwout, evap, Tref, Qref, &
scale_fluxes, frzmlt_init, frzmlt, Uref, wind
Expand Down Expand Up @@ -543,7 +544,12 @@ subroutine coupling_prep (iblk)
evap (:,:,iblk), &
Tref (:,:,iblk), Qref (:,:,iblk), &
fresh (:,:,iblk), fsalt (:,:,iblk), &
fhocn (:,:,iblk), fswthru (:,:,iblk), &
fhocn (:,:,iblk), &
fswthru (:,:,iblk), &
fswthru_vdr(:,:,iblk), &
fswthru_vdf(:,:,iblk), &
fswthru_idr(:,:,iblk), &
fswthru_idf(:,:,iblk), &
faero_ocn(:,:,:,iblk), &
alvdr (:,:,iblk), alidr (:,:,iblk), &
alvdf (:,:,iblk), alidf (:,:,iblk), &
Expand Down
48 changes: 45 additions & 3 deletions cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ module ice_comp_nuopc
character(len=*),parameter :: shr_cal_noleap = 'NO_LEAP'
character(len=*),parameter :: shr_cal_gregorian = 'GREGORIAN'

integer , parameter :: dbug = 10
integer :: dbug = 0
integer , parameter :: debug_import = 0 ! internal debug level
integer , parameter :: debug_export = 0 ! internal debug level
character(*), parameter :: modName = "(ice_comp_nuopc)"
Expand Down Expand Up @@ -236,6 +236,14 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif

call NUOPC_CompAttributeGet(gcomp, name='dbug_flag', value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (isPresent .and. isSet) then
read(cvalue,*) dbug
end if
write(logmsg,'(i6)') dbug
call ESMF_LogWrite('CICE_cap: dbug = '//trim(logmsg), ESMF_LOGMSG_INFO)

call ice_advertise_fields(gcomp, importState, exportState, flds_scalar_name, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

Expand Down Expand Up @@ -539,6 +547,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
!----------------------------------------------------------------------------

call icepack_query_parameters(ktherm_out=ktherm)
call icepack_query_parameters(tfrz_option_out=tfrz_option)
call icepack_warnings_flush(nu_diag)
if (icepack_warnings_aborted()) call abort_ice(error_message=subname, &
file=__FILE__, line=__LINE__)
Expand Down Expand Up @@ -602,13 +611,15 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
write(nu_diag,*) trim(subname),' cice calendar_type = ',trim(calendar_type)
endif

#ifdef CESMCOUPLED
if (calendar_type == "GREGORIAN" .or. &
calendar_type == "Gregorian" .or. &
calendar_type == "gregorian") then
call time2sec(iyear-(year_init-1),month,mday,time)
else
call time2sec(iyear-year_init,month,mday,time)
endif
#endif
time = time+start_tod
end if

Expand Down Expand Up @@ -874,8 +885,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
! diagnostics
!--------------------------------

if (dbug > 1) then
call State_diagnose(exportState,subname//':ES',rc=rc)
if (dbug > 0) then
call state_diagnose(exportState,subname//':ES',rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif

Expand Down Expand Up @@ -905,8 +916,10 @@ subroutine ModelAdvance(gcomp, rc)
! Local variables
type(ESMF_Clock) :: clock
type(ESMF_Alarm) :: alarm
type(ESMF_Time) :: startTime
type(ESMF_Time) :: currTime
type(ESMF_Time) :: nextTime
type(ESMF_TimeInterval) :: timeStep
type(ESMF_State) :: importState, exportState
character(ESMF_MAXSTR) :: cvalue
real(dbl_kind) :: eccen, obliqr, lambm0, mvelpp
Expand All @@ -928,11 +941,31 @@ subroutine ModelAdvance(gcomp, rc)
logical :: isPresent, isSet
character(*) , parameter :: F00 = "('(ice_comp_nuopc) ',2a,i8,d21.14)"
character(len=*),parameter :: subname=trim(modName)//':(ModelAdvance) '
character(char_len_long) :: msgString
!--------------------------------

rc = ESMF_SUCCESS
if (dbug > 5) call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO)

! query the Component for its clock, importState and exportState
call ESMF_GridCompGet(gcomp, clock=clock, importState=importState, &
exportState=exportState, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call ESMF_ClockPrint(clock, options="currTime", &
preString="------>Advancing ICE from: ", unit=msgString, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_LogWrite(subname//trim(msgString), ESMF_LOGMSG_INFO)

call ESMF_ClockGet(clock, startTime=startTime, currTime=currTime, &
timeStep=timeStep, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

call ESMF_TimePrint(currTime + timeStep, &
preString="--------------------------------> to: ", unit=msgString, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_LogWrite(trim(msgString), ESMF_LOGMSG_INFO)

!--------------------------------
! Turn on timers
!--------------------------------
Expand Down Expand Up @@ -1050,6 +1083,10 @@ subroutine ModelAdvance(gcomp, rc)
idate, sec, nu_diag, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if
if (dbug > 0) then
call state_diagnose(importState,subname//':IS',rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if

!--------------------------------
! Advance cice and timestep update
Expand All @@ -1067,11 +1104,16 @@ subroutine ModelAdvance(gcomp, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call t_stopf ('cice_run_export')

! write Debug output
if (debug_export > 0 .and. my_task==master_task) then
call State_fldDebug(exportState, flds_scalar_name, 'cice_export:', &
idate, sec, nu_diag, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if
if (dbug > 0) then
call state_diagnose(exportState,subname//':ES',rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
end if

! reset shr logging to my original values
call shr_file_setLogUnit (shrlogunit)
Expand Down
Loading

0 comments on commit 5ecde75

Please sign in to comment.