2 !==============================================================================
4 ! ESMF Alarm-Clock Module
5 module WRF_ESMF_AlarmClockMod
7 !==============================================================================
9 ! This file contains the AlarmCreate method.
11 !------------------------------------------------------------------------------
13 #include <ESMF_TimeMgr.inc>
15 !===============================================================================
18 ! !MODULE: WRF_ESMF_AlarmClockMod
21 ! Separate module that uses both WRF_ESMF_AlarmMod and WRF_ESMF_ClockMod.
22 ! Separation is needed to avoid cyclic dependence.
24 ! Defines F90 wrapper entry points for corresponding
25 ! C++ class {\tt ESMC\_Alarm}
27 ! See {\tt ../include/ESMC\_Alarm.h} for complete description
29 !------------------------------------------------------------------------------
31 ! inherit ESMF_Alarm and ESMF_Clock
32 use WRF_ESMF_AlarmMod, only : ESMF_Alarm, ESMF_AlarmSet
33 use WRF_ESMF_ClockMod, only : ESMF_Clock, ESMF_ClockAddAlarm
35 ! associated derived types
36 use WRF_ESMF_TimeIntervalMod, only : ESMF_TimeInterval
37 use WRF_ESMF_TimeMod, only : ESMF_Time
41 !------------------------------------------------------------------------------
44 !------------------------------------------------------------------------------
46 ! !PUBLIC MEMBER FUNCTIONS:
47 public ESMF_AlarmCreate
49 !==============================================================================
53 !==============================================================================
56 ! Create ESMF_Alarm using ESMF 2.1.0+ semantics
57 FUNCTION ESMF_AlarmCreate( clock, RingTime, RingInterval, &
58 StopTime, Enabled, rc )
61 type(ESMF_Alarm) :: ESMF_AlarmCreate
63 type(ESMF_Clock), intent(inout), optional :: clock
64 type(ESMF_Time), intent(in), optional :: RingTime
65 type(ESMF_TimeInterval), intent(in), optional :: RingInterval
66 type(ESMF_Time), intent(in), optional :: StopTime
67 logical, intent(in), optional :: Enabled
68 integer, intent(out), optional :: rc
70 type(ESMF_Alarm) :: alarmtmp
71 ! TBH: ignore allocate errors, for now
72 ALLOCATE( alarmtmp%alarmint )
73 CALL ESMF_AlarmSet( alarmtmp, &
75 RingInterval=RingInterval, &
79 IF ( PRESENT ( clock ) ) THEN
80 CALL ESMF_ClockAddAlarm( clock, alarmtmp, rc )
82 ESMF_AlarmCreate = alarmtmp
83 END FUNCTION ESMF_AlarmCreate
86 !------------------------------------------------------------------------------
88 end module WRF_ESMF_AlarmClockMod