Skip to content
Open
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
50 changes: 50 additions & 0 deletions cicecore/drivers/nuopc/cmeps/ice_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ module ice_comp_nuopc
#ifndef CESMCOUPLED
use shr_is_restart_fh_mod, only : init_is_restart_fh, is_restart_fh, is_restart_fh_type
#endif
#ifdef UFS_TRACING
use ufs_trace_mod
#endif

implicit none
private
Expand Down Expand Up @@ -116,6 +119,7 @@ module ice_comp_nuopc
character(*), parameter :: u_FILE_u = &
__FILE__

integer :: mype = -1
!=======================================================================
contains
!===============================================================================
Expand All @@ -127,12 +131,23 @@ subroutine SetServices(gcomp, rc)
integer, intent(out) :: rc

! Local variables
type(ESMF_VM) :: vm
character(len=*),parameter :: subname=trim(modName)//':(SetServices) '
!--------------------------------

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

call ESMF_GridCompGet(gcomp, vm=vm,rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call ESMF_VMGet(vm, localpet=mype, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return

#ifdef UFS_TRACING
if (mype == 0) call ufs_trace_init()
if (mype == 0) call ufs_trace("cice", "SetServices", "B")
#endif

! the NUOPC gcomp component will register the generic methods
call NUOPC_CompDerive(gcomp, model_routine_SS, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down Expand Up @@ -168,6 +183,9 @@ subroutine SetServices(gcomp, rc)

if (dbug > 5) call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO)

#ifdef UFS_TRACING
if (mype == 0) call ufs_trace("cice", "SetServices", "E")
#endif
end subroutine SetServices

!===============================================================================
Expand All @@ -186,6 +204,9 @@ subroutine InitializeP0(gcomp, importState, exportState, clock, rc)
!--------------------------------

rc = ESMF_SUCCESS
#ifdef UFS_TRACING
if (mype == 0) call ufs_trace("cice", "InitializeP0", "B")
#endif

! Switch to IPDv01 by filtering all other phaseMap entries
call NUOPC_CompFilterPhaseMap(gcomp, ESMF_METHOD_INITIALIZE, &
Expand All @@ -200,6 +221,9 @@ subroutine InitializeP0(gcomp, importState, exportState, clock, rc)
write(logmsg,*) profile_memory
call ESMF_LogWrite('CICE_cap:ProfileMemory = '//trim(logmsg), ESMF_LOGMSG_INFO)

#ifdef UFS_TRACING
if (mype == 0) call ufs_trace("cice", "InitializeP0", "E")
#endif
end subroutine InitializeP0

!===============================================================================
Expand Down Expand Up @@ -255,6 +279,10 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
character(len=*), parameter :: subname=trim(modName)//':(InitializeAdvertise) '
!--------------------------------

#ifdef UFS_TRACING
if (mype == 0) call ufs_trace("cice", "InitializeAdvertise", "B")
#endif

call ufs_settimer(wtime)

call NUOPC_CompAttributeGet(gcomp, name="ScalarFieldName", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc)
Expand Down Expand Up @@ -756,6 +784,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)

call t_stopf ('cice_init_total')
if (mastertask) call ufs_logtimer(nu_timer,msec,'InitializeAdvertise time: ',runtimelog,wtime)
#ifdef UFS_TRACING
if (mype == 0) call ufs_trace("cice", "InitializeAdvertise", "E")
#endif
end subroutine InitializeAdvertise

!===============================================================================
Expand Down Expand Up @@ -789,6 +820,10 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
!--------------------------------

rc = ESMF_SUCCESS
#ifdef UFS_TRACING
if (mype == 0) call ufs_trace("cice", "InitializeRealize", "B")
#endif

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

call ufs_settimer(wtime)
Expand Down Expand Up @@ -990,6 +1025,9 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
call flush_fileunit(nu_diag)

if (mastertask) call ufs_logtimer(nu_timer,msec,'InitializeRealize time: ',runtimelog,wtime)
#ifdef UFS_TRACING
if (mype == 0) call ufs_trace("cice", "InitializeRealize", "E")
#endif
end subroutine InitializeRealize

!===============================================================================
Expand Down Expand Up @@ -1038,6 +1076,9 @@ subroutine ModelAdvance(gcomp, rc)
!--------------------------------

rc = ESMF_SUCCESS
#ifdef UFS_TRACING
if (mype == 0) call ufs_trace("cice", "ModelAdvance", "B")
#endif
if (mastertask) call ufs_logtimer(nu_timer,msec,'ModelAdvance time since last step: ',runtimelog,wtime)
call ufs_settimer(wtime)

Expand Down Expand Up @@ -1278,6 +1319,9 @@ subroutine ModelAdvance(gcomp, rc)
if (dbug > 5) call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO)

if (mastertask) call ufs_logtimer(nu_timer,msec,'ModelAdvance time: ',runtimelog,wtime)
#ifdef UFS_TRACING
if (mype == 0) call ufs_trace("cice", "ModelAdvance", "E")
#endif
call ufs_settimer(wtime)

end subroutine ModelAdvance
Expand Down Expand Up @@ -1432,6 +1476,9 @@ subroutine ModelFinalize(gcomp, rc)
!--------------------------------

rc = ESMF_SUCCESS
#ifdef UFS_TRACING
if (mype == 0) call ufs_trace("cice", "ModelFinalize", "B")
#endif
call ufs_settimer(wtime)
if (dbug > 5) call ESMF_LogWrite(subname//' called', ESMF_LOGMSG_INFO)
if (my_task == master_task) then
Expand All @@ -1442,6 +1489,9 @@ subroutine ModelFinalize(gcomp, rc)
if (dbug > 5) call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO)

if(mastertask) call ufs_logtimer(nu_timer,msec,'ModelFinalize time: ',runtimelog,wtime)
#ifdef UFS_TRACING
if (mype == 0) call ufs_trace("cice", "ModelFinalize", "E")
#endif

end subroutine ModelFinalize

Expand Down