Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move from depricated shr_file to shr_log #2627

Merged
merged 4 commits into from
Oct 8, 2024
Merged
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
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
Loading