📄 alarm_fex.tex
字号:
% $Id: Alarm_fex.tex,v 1.1.6.1 2002/04/24 03:25:47 erik Exp $The example below demonstrates basic usage of the {\tt Alarm} class.We initialize a monthly {\tt Alarm} for use with a {\tt TimeMgr}. As the {\tt TimeMgr} advances the model calendar, the {\tt Alarm} is triggered on monthly boundaries. It is up to the user to reset the {\tt Alarm} to an ``off'' state once it has been triggered. Advancementstops when the {\tt TimeMgr} recognizes that it is on the last timestep. Since no memory is allocated from the heap when an {\tt Alarm} is initialized, there is no need to deallocate an {\tt Alarm} object.\begin{verbatim} use ESMF_TimeMgmtMod type(ESMF_Time) :: stepSize type(ESMF_Date) :: startDate, endDate type(ESMF_TimeMgr) :: timeMgr type(ESMF_Alarm) :: alarm!------------------------------------------------------------------------------- ! Initialize the model timestep to 1 day, 1800 seconds; the start date to ! December 1, 2001 and 0 seconds and the end date to March 14, 2003 and ! 0 seconds. Dates are represented in a YYYYMMDD format. A Gregorian ! calendar is used.!------------------------------------------------------------------------------- stepSize = ESMF_TimeInit(1, 1800) startDate = ESMF_DateInit(ESMF_GREGORIAN, 20011201, 0) endDate = ESMF_DateInit(ESMF_GREGORIAN, 20030314, 0) !------------------------------------------------------------------------------- ! Initialize the time manager and alarm.!------------------------------------------------------------------------------- alarm = ESMF_AlarmInitMonthly(); timeMgr = ESMF_TimeMgrInit(stepSize, startDate, stopDate)!------------------------------------------------------------------------------- ! Advance the model until the end date, triggering the alarm at monthly bounds.! The alarm is reset at each iteration.!------------------------------------------------------------------------------- do while (.NOT. ESMF_TimeMgrLastStep(timeMgr)) call ESMF_TimeMgrAdvance(timeMgr) if(ESMF_AlarmIsOn(alarm, timeMgr)) then ! Perform triggered activity end if call ESMF_AlarmSet(alarm, .FALSE.) end do\end{verbatim}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -