Skip to content

Commit

Permalink
Merge pull request ESCOMP#2627 from jedwards4b/shr_file_to_shr_log
Browse files Browse the repository at this point in the history
move from depricated shr_file to shr_log
  • Loading branch information
samsrabin authored Oct 8, 2024
2 parents 98e42fb + 7964509 commit cbea138
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions src/cpl/nuopc/lnd_comp_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module lnd_comp_nuopc
use NUOPC_Model , only : NUOPC_ModelGet
use shr_kind_mod , only : r8 => shr_kind_r8, cl=>shr_kind_cl
use shr_sys_mod , only : shr_sys_abort
use shr_file_mod , only : shr_file_getlogunit, shr_file_setlogunit
use shr_log_mod , only : shr_log_setLogUnit, shr_log_getLogUnit
use shr_orb_mod , only : shr_orb_decl, shr_orb_params, SHR_ORB_UNDEF_REAL, SHR_ORB_UNDEF_INT
use shr_cal_mod , only : shr_cal_noleap, shr_cal_gregorian, shr_cal_ymd2date
use spmdMod , only : masterproc, mpicom, spmd_init
Expand Down Expand Up @@ -66,7 +66,7 @@ module lnd_comp_nuopc
private :: clm_orbital_init ! Initialize the orbital information
private :: clm_orbital_update ! Update the orbital information
private :: CheckImport

!--------------------------------------------------------------------------
! Private module data
!--------------------------------------------------------------------------
Expand Down Expand Up @@ -333,8 +333,7 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
!----------------------------------------------------------------------------
! reset shr logging to original values
!----------------------------------------------------------------------------

call shr_file_setLogUnit (shrlogunit)
call shr_log_setLogUnit(shrlogunit)
call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO)

end subroutine InitializeAdvertise
Expand Down Expand Up @@ -497,8 +496,8 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
! Reset shr logging to my log file
!----------------------------------------------------------------------------

call shr_file_getLogUnit (shrlogunit)
call shr_file_setLogUnit (iulog)
call shr_log_getLogUnit (shrlogunit)
call shr_log_setLogUnit (iulog)
#if (defined _MEMTRACE)
if (masterproc) then
lbnum=1
Expand Down Expand Up @@ -683,7 +682,7 @@ subroutine InitializeRealize(gcomp, importState, exportState, clock, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
endif

call shr_file_setLogUnit (shrlogunit)
call shr_log_setLogUnit (shrlogunit)

#if (defined _MEMTRACE)
if(masterproc) then
Expand Down Expand Up @@ -774,8 +773,8 @@ subroutine ModelAdvance(gcomp, rc)
! Reset share log units
!--------------------------------

call shr_file_getLogUnit (shrlogunit)
call shr_file_setLogUnit (iulog)
call shr_log_getLogUnit (shrlogunit)
call shr_log_setLogUnit (iulog)

#if (defined _MEMTRACE)
if(masterproc) then
Expand Down Expand Up @@ -864,7 +863,7 @@ subroutine ModelAdvance(gcomp, rc)
rstwr = .false.
if (nlend .and. write_restart_at_endofrun) then
rstwr = .true.
else
else
call ESMF_ClockGetAlarm(clock, alarmname='alarm_restart', alarm=alarm, rc=rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
if (ESMF_AlarmIsCreated(alarm, rc=rc)) then
Expand Down Expand Up @@ -964,7 +963,7 @@ subroutine ModelAdvance(gcomp, rc)
! Reset shr logging to my original values
!--------------------------------

call shr_file_setLogUnit (shrlogunit)
call shr_log_setLogUnit (shrlogunit)

call ESMF_LogWrite(subname//' done', ESMF_LOGMSG_INFO)

Expand Down Expand Up @@ -1289,14 +1288,14 @@ subroutine CheckImport(gcomp, rc)
type(ESMF_GridComp) :: gcomp
integer, intent(out) :: rc
character(len=*) , parameter :: subname = "("//__FILE__//":CheckImport)"

! This is the routine that enforces the explicit time dependence on the
! import fields. This simply means that the timestamps on the Fields in the
! importState are checked against the currentTime on the Component's
! importState are checked against the currentTime on the Component's
! internalClock. Consequenty, this model starts out with forcing fields
! at the current time as it does its forward step from currentTime to
! at the current time as it does its forward step from currentTime to
! currentTime + timeStep.

! local variables
type(ESMF_Clock) :: clock
type(ESMF_Time) :: time
Expand All @@ -1320,19 +1319,19 @@ subroutine CheckImport(gcomp, rc)
! query the component for info
call NUOPC_CompGet(gcomp, name=name, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

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

! get the current time out of the clock
call ESMF_ClockGet(clock, currTime=time, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

! check that Fields in the importState show correct timestamp
allCurrent = NUOPC_IsAtTime(importState, time, fieldList=fieldList, rc=rc)
if (chkerr(rc,__LINE__,u_FILE_u)) return

if (.not.allCurrent) then
!TODO: introduce and use INCOMPATIBILITY return codes!!!!
do i=1, size(fieldList)
Expand All @@ -1354,6 +1353,6 @@ subroutine CheckImport(gcomp, rc)
rcToReturn=rc)
return ! bail out
endif

end subroutine CheckImport
end module lnd_comp_nuopc

0 comments on commit cbea138

Please sign in to comment.