Skip to content
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
80 changes: 1 addition & 79 deletions GEOS_OceanGridComp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ module GEOS_OceanGridCompMod
!
!EOP

type :: T_PrivateState
type(ESMF_Clock) :: CLOCK
end type T_PrivateState

type :: T_PrivateState_Wrap
type(T_PrivateState), pointer :: ptr
end type T_PrivateState_Wrap

integer :: OCN
integer :: OCNd
logical :: DUAL_OCEAN
Expand Down Expand Up @@ -261,8 +253,6 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC )

type (MAPL_MetaComp), pointer :: State
type (ESMF_Grid) :: Grid
type (T_PrivateState), pointer :: PrivateSTATE
type (T_PrivateState_Wrap) :: WRAP
integer :: IM, JM, LM
real :: DT

Expand Down Expand Up @@ -304,30 +294,6 @@ subroutine Initialize ( GC, IMPORT, EXPORT, CLOCK, RC )

call MAPL_Get(STATE, GIM=GIM, GEX=GEX, _RC)

! Allocate the private state...
!------------------------------

allocate( PrivateSTATE, __STAT__)
wrap%ptr => PrivateState

! And put it in the GC
!---------------------

CALL ESMF_UserCompSetInternalState( GC, TRIM(OCEAN_NAME)//'_internal_state', WRAP, STATUS )
VERIFY_(status)

! Initialize the PrivateState. First the time...
!-----------------------------------------------
call MAPL_GetResource(STATE,DT, Label="RUN_DT:", _RC) ! Get AGCM Heartbeat
call MAPL_GetResource(STATE,DT, Label="OCEAN_DT:", DEFAULT=DT, _RC) ! set Default OCEAN_DT to AGCM Heartbeat

CALL ESMF_TimeIntervalSet(timeStep, S=NINT(DT), _RC)
call ESMF_ClockGet(CLOCK, currTIME=currTime, _RC)

!ALT: check with Max about moving the clock 1 step forward
PrivateState%clock = ESMF_ClockCreate(NAME = TRIM(OCEAN_NAME)//"Clock", &
timeStep=timeStep, startTime=currTime, _RC)

! Initialize the Ocean Model.
!
! This verifies the Grid and the Time against the private restarts.
Expand Down Expand Up @@ -403,10 +369,6 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
! Local derived type aliases

type (MAPL_MetaComp), pointer :: STATE
type (ESMF_Time) :: EndTime
type (ESMF_Time) :: MyTime,ct
type (T_PrivateState), pointer :: PrivateSTATE
type (T_PrivateState_Wrap) :: WRAP
type (ESMF_GridComp ), pointer :: GCS(:)
type (ESMF_State ), pointer :: GIM(:)
type (ESMF_State ), pointer :: GEX(:)
Expand Down Expand Up @@ -553,34 +515,6 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
_RC)


! Check the clocks to set set-up the "run-to" time
!-------------------------------------------------

call ESMF_ClockGet( CLOCK, currTime=endTime, _RC)

! Get ocean model's private internal state
!---------------------------------

CALL ESMF_UserCompGetInternalState( GC, TRIM(OCEAN_NAME)//'_internal_state', WRAP, STATUS )
VERIFY_(STATUS)

PrivateSTATE => WRAP%PTR

call ESMF_ClockGet( PrivateState%CLOCK, currTime=myTime, _RC)

if (myTime > EndTime) then
call ESMF_ClockSet(PrivateState%Clock,direction=ESMF_DIRECTION_REVERSE, _RC)
do
call ESMF_ClockAdvance(PrivateState%Clock, _RC)
call ESMF_ClockGet(PrivateState%Clock,currTime=ct, _RC)
if (ct==endTime) exit
enddo
call ESMF_ClockSet(PrivateState%Clock, direction=ESMF_DIRECTION_FORWARD, _RC)
call ESMF_ClockGet(PrivateState%CLOCK, currTime=myTime, _RC)
end if

if( MyTime <= EndTime ) then ! Time to run

! We get the ocean-land mask (now computed in Initialize of Plug)
! ---------------------------------------------------------------
if(DO_DATASEA==0) then
Expand Down Expand Up @@ -793,8 +727,6 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
! Loop the ocean model
!---------------------

NUM = 0
do while ( MyTime <= endTime )

! Run ocean for one time step (DT)
!---------------------------------
Expand All @@ -803,7 +735,7 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
call MAPL_TimerOn (STATE,"--ModRun")

if (.not. DUAL_OCEAN) then
call MAPL_GenericRunChildren(GC, IMPORT, EXPORT, PrivateState%CLOCK, _RC)
call MAPL_GenericRunChildren(GC, IMPORT, EXPORT, CLOCK, _RC)
else
if (PHASE == 1) then
! corrector
Expand Down Expand Up @@ -858,14 +790,6 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
call MAPL_TimerOff(STATE,"--ModRun")
call MAPL_TimerOn (STATE,"TOTAL")

! Bump the time in the internal state
!------------------------------------

call ESMF_ClockAdvance( PrivateState%clock, _RC)
call ESMF_ClockGet ( PrivateState%clock, currTime= myTime , _RC)

NUM = NUM + 1
end do

if(associated(SS_FOUND)) then
SS_FOUND = OrphanSalinity
Expand Down Expand Up @@ -931,8 +855,6 @@ subroutine Run ( GC, IMPORT, EXPORT, CLOCK, RC )
deallocate(MASK, __STAT__)
end if

end if ! Time to run

! Profilers
!----------

Expand Down
Loading