<p><b>croesch@ucar.edu</b> 2011-09-06 18:23:57 -0600 (Tue, 06 Sep 2011)</p><p>Bring over time manager from trunk and integrate with non-hydrostatic core<br>
<br>
Also begin using time manager in sst update initialization code (test case 8) to loop through multiple intermediate files<br>
<br>
<br>
M src/core_hyd_atmos/module_mpas_core.F<br>
M src/core_hyd_atmos/Registry<br>
M src/core_hyd_atmos/module_time_integration.F<br>
M src/core_hyd_atmos/Makefile<br>
M src/core_init_nhyd_atmos/module_mpas_core.F<br>
M src/core_init_nhyd_atmos/module_test_cases.F<br>
M src/core_init_nhyd_atmos/Registry<br>
M src/core_init_nhyd_atmos/Makefile<br>
M src/core_sw/module_mpas_core.F<br>
M src/core_sw/Registry<br>
M src/core_sw/module_time_integration.F<br>
M src/core_sw/Makefile<br>
A + src/external/esmf_time_f90<br>
A + src/external/esmf_time_f90/ESMF_AlarmClock.F90<br>
A + src/external/esmf_time_f90/ESMF_Calendar.F90<br>
A + src/external/esmf_time_f90/ESMF_Base.F90<br>
A + src/external/esmf_time_f90/Meat.F90<br>
A + src/external/esmf_time_f90/testall.csh<br>
A + src/external/esmf_time_f90/ESMF_Mod.F90<br>
A + src/external/esmf_time_f90/ESMF_TimeMgr.inc<br>
A + src/external/esmf_time_f90/module_symbols_util.F90<br>
A + src/external/esmf_time_f90/Test1.F90<br>
A + src/external/esmf_time_f90/ESMF_BaseTime.F90<br>
A + src/external/esmf_time_f90/ESMF_Clock.F90<br>
A + src/external/esmf_time_f90/ESMF_Alarm.F90<br>
A + src/external/esmf_time_f90/module_utility.F90<br>
A + src/external/esmf_time_f90/ESMF_Time.F90<br>
A + src/external/esmf_time_f90/Test1.out.correct<br>
A + src/external/esmf_time_f90/ESMF_Macros.inc<br>
A + src/external/esmf_time_f90/ESMF_Stubs.F90<br>
A + src/external/esmf_time_f90/ESMF_TimeInterval.F90<br>
A + src/external/esmf_time_f90/ESMF_Fraction.F90<br>
A + src/external/esmf_time_f90/Makefile<br>
M src/external/Makefile<br>
M src/registry/gen_inc.c<br>
M src/registry/parse.c<br>
M src/core_physics/module_driver_microphysics.F<br>
M src/core_physics/module_physics_driver.F<br>
M src/core_physics/module_physics_landuse.F<br>
M src/core_physics/module_driver_radiation_sw.F<br>
M src/core_physics/module_physics_manager.F<br>
M src/core_physics/Makefile<br>
M src/core_physics/module_physics_interface_nhyd.F<br>
M src/driver/Makefile<br>
M src/driver/module_mpas_subdriver.F<br>
M src/core_nhyd_atmos/module_mpas_core.F<br>
M src/core_nhyd_atmos/Registry<br>
M src/core_nhyd_atmos/module_time_integration.F<br>
M src/core_nhyd_atmos/Makefile<br>
M src/core_ocean/module_global_diagnostics.F<br>
M src/core_ocean/module_mpas_core.F<br>
M src/core_ocean/Registry<br>
M src/core_ocean/module_time_integration.F<br>
M src/core_ocean/Makefile<br>
M src/framework/module_io_input.F<br>
M src/framework/module_io_output.F<br>
M src/framework/module_grid_types.F<br>
M src/framework/module_mpas_framework.F<br>
A + src/framework/module_mpas_timekeeping.F<br>
M src/framework/Makefile<br>
M src/Makefile<br>
M namelist.input.ocean<br>
M namelist.input.hyd_atmos<br>
M namelist.input.init_nhyd_atmos<br>
M namelist.input.sw<br>
M Makefile<br>
M namelist.input.nhyd_atmos<br>
</p><hr noshade><pre><font color="gray">
Property changes on: branches/atmos_physics
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/time_manager:924-962
/trunk/mpas:924-968
Modified: branches/atmos_physics/Makefile
===================================================================
--- branches/atmos_physics/Makefile        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/Makefile        2011-09-07 00:23:57 UTC (rev 979)
@@ -62,7 +62,7 @@
        "CC = mpicc" \
        "SFC = pgf90" \
        "SCC = pgcc" \
-        "FFLAGS = -r8 -O3 -byteswapio" \
+        "FFLAGS = -r8 -O3 -byteswapio -Mfree" \
        "CFLAGS = -O3" \
        "LDFLAGS = -O3" \
        "CORE = $(CORE)" \
@@ -86,7 +86,7 @@
        "CC = pgcc" \
        "SFC = pgf90" \
        "SCC = pgcc" \
-        "FFLAGS = -r8 -O0 -g -Mbounds -Mchkptr -byteswapio" \
+        "FFLAGS = -r8 -O0 -g -Mbounds -Mchkptr -byteswapio -Mfree" \
        "CFLAGS = -O0 -g" \
        "LDFLAGS = -O0 -g -Mbounds -Mchkptr" \
        "CORE = $(CORE)" \
@@ -98,7 +98,7 @@
        "CC = gcc" \
        "SFC = ifort" \
        "SCC = gcc" \
-        "FFLAGS = -real-size 64 -O3 -convert big_endian" \
+        "FFLAGS = -real-size 64 -O3 -convert big_endian -FR" \
        "CFLAGS = -O3 -m64" \
        "LDFLAGS = -O3" \
        "CORE = $(CORE)" \
@@ -110,7 +110,7 @@
        "CC = mpicc" \
        "SFC = gfortran" \
        "SCC = gcc" \
-        "FFLAGS = -O3 -m64 -ffree-line-length-none -fdefault-real-8 -fconvert=big-endian" \
+        "FFLAGS = -O3 -m64 -ffree-line-length-none -fdefault-real-8 -fconvert=big-endian -ffree-form" \
        "CFLAGS = -O3 -m64" \
        "LDFLAGS = -O3 -m64" \
        "CORE = $(CORE)" \
@@ -122,7 +122,7 @@
        "CC = gcc" \
        "SFC = gfortran" \
        "SCC = gcc" \
-        "FFLAGS = -O3 -m64 -ffree-line-length-none -fdefault-real-8 -fconvert=big-endian" \
+        "FFLAGS = -O3 -m64 -ffree-line-length-none -fdefault-real-8 -fconvert=big-endian -ffree-form" \
        "CFLAGS = -O3 -m64" \
        "LDFLAGS = -O3 -m64" \
        "CORE = $(CORE)" \
Modified: branches/atmos_physics/namelist.input.hyd_atmos
===================================================================
--- branches/atmos_physics/namelist.input.hyd_atmos        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/namelist.input.hyd_atmos        2011-09-07 00:23:57 UTC (rev 979)
@@ -2,8 +2,8 @@
config_test_case = 2
config_time_integration = 'SRK3'
config_dt = 3600
- config_ntimesteps = 240
- config_output_interval = 24
+ config_start_time = '0000-01-01_00:00:00'
+ config_run_duration = '10_00:00:00'
config_number_of_sub_steps = 4
config_h_mom_eddy_visc2 = 0.0
config_h_mom_eddy_visc4 = 0.0
@@ -24,12 +24,13 @@
config_input_name = 'grid.nc'
config_output_name = 'output.nc'
config_restart_name = 'restart.nc'
+ config_output_interval = '1_00:00:00'
+ config_frames_per_outfile = 0
/
&restart
- config_restart_interval = 3000
+ config_restart_interval = '1000_00:00:00'
config_do_restart = .false.
- config_restart_time = 1036800.0
/
&physics
Modified: branches/atmos_physics/namelist.input.init_nhyd_atmos
===================================================================
--- branches/atmos_physics/namelist.input.init_nhyd_atmos        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/namelist.input.init_nhyd_atmos        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,5 +1,7 @@
&nhyd_model
- config_test_case = 7
+ config_test_case = 8
+ config_start_time = '2011-08-12_12:00:00'
+ config_stop_time = '2011-08-14_12:00:00'
config_theta_adv_order = 3
/
@@ -10,9 +12,9 @@
/
&data_sources
- config_geog_data_path = '/mmm/users/wrfhelp/WPS_GEOG/'
+ config_geog_data_path = '/data3/mp/wrfhelp/WPS_GEOG/'
config_met_prefix = 'FILE'
- config_init_date = '2010-10-23_00'
+ config_fg_interval = 43200
/
&vertical_grid
@@ -29,6 +31,7 @@
&io
config_input_name = 'x1.40962.static.nc'
+ config_sfc_update_name = 'sst.nc'
config_output_name = 'x1.40962.init.nc'
config_restart_name = 'restart.nc'
/
Modified: branches/atmos_physics/namelist.input.nhyd_atmos
===================================================================
--- branches/atmos_physics/namelist.input.nhyd_atmos        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/namelist.input.nhyd_atmos        2011-09-07 00:23:57 UTC (rev 979)
@@ -2,9 +2,8 @@
config_test_case = 2
config_time_integration = 'SRK3'
config_dt = 1800
- config_ntimesteps = 480
- config_output_interval = 48
- config_sfc_update_interval = 0
+ config_start_time = '0000-01-01_00:00:00'
+ config_run_duration = '10_00:00:00'
config_number_of_sub_steps = 6
config_h_mom_eddy_visc2 = 0000.
config_h_mom_eddy_visc4 = 0.
@@ -21,6 +20,8 @@
config_h_ScaleWithMesh = .false.
config_newpx = .true.
/
+ config_stop_time = '0000-01-16_00:00:00'
+ config_sfc_update_interval = "0:00:00"
&damping
config_zd = 22000.0
@@ -36,12 +37,13 @@
config_sfc_update_name = 'sfc_update.nc'
config_output_name = 'output.nc'
config_restart_name = 'restart.nc'
+ config_output_interval = '1_00:00:00'
+ config_frames_per_outfile = 0
/
&restart
- config_restart_interval = 3000
+ config_restart_interval = '15_00:00:00'
config_do_restart = .false.
- config_restart_time = 1036800.0
/
&physics
Modified: branches/atmos_physics/namelist.input.ocean
===================================================================
--- branches/atmos_physics/namelist.input.ocean        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/namelist.input.ocean        2011-09-07 00:23:57 UTC (rev 979)
@@ -2,21 +2,22 @@
config_test_case = 0
config_time_integration = 'RK4'
config_dt = 90.0
- config_ntimesteps = 1920000
- config_output_interval = 19200
+ config_start_time = '0000-01-01_00:00:00'
+ config_run_duration = '2000_00:00:00'
config_stats_interval = 1920
/
&io
- config_input_name = grid.nc
- config_output_name = output.nc
- config_restart_name = restart.nc
+ config_input_name = 'grid.nc'
+ config_output_name = 'output.nc'
+ config_restart_name = 'restart.nc'
+ config_output_interval = '20_00:00:00'
+ config_frames_per_outfile = 0
/
&restart
- config_restart_interval = 115200
+ config_restart_interval = '120_00:00:00'
config_do_restart = .false.
- config_restart_time = 31104000
/
&grid
Modified: branches/atmos_physics/namelist.input.sw
===================================================================
--- branches/atmos_physics/namelist.input.sw        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/namelist.input.sw        2011-09-07 00:23:57 UTC (rev 979)
@@ -2,8 +2,8 @@
config_test_case = 5
config_time_integration = 'RK4'
config_dt = 172.8
- config_ntimesteps = 7500
- config_output_interval = 500
+ config_start_time = '0000-01-01_00:00:00'
+ config_run_duration = '15_00:00:00'
config_stats_interval = 0
config_h_ScaleWithMesh = .false.
config_h_mom_eddy_visc2 = 0.0
@@ -17,15 +17,17 @@
config_wind_stress = .false.
config_bottom_drag = .false.
/
+ config_stop_time = '0000-01-16_00:00:00'
&io
config_input_name = 'grid.nc'
config_output_name = 'output.nc'
config_restart_name = 'restart.nc'
+ config_output_interval = '1_00:00:00'
+ config_frames_per_outfile = 0
/
&restart
- config_restart_interval = 3000
+ config_restart_interval = '15_00:00:00'
config_do_restart = .false.
- config_restart_time = 1036800.0
/
Modified: branches/atmos_physics/src/Makefile
===================================================================
--- branches/atmos_physics/src/Makefile        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/Makefile        2011-09-07 00:23:57 UTC (rev 979)
@@ -3,14 +3,14 @@
all: mpas
mpas: reg_includes externals frame ops dycore drver
-        $(FC) $(LDFLAGS) -o $(CORE)_model.exe driver/*.o -L. -ldycore -lops -lframework $(LIBS)
+        $(FC) $(LDFLAGS) -o $(CORE)_model.exe driver/*.o -L. -ldycore -lops -lframework $(LIBS) -I./external/esmf_time_f90 -L./external/esmf_time_f90 -lesmf_time
reg_includes:
        ( cd registry; make CC="$(SCC)" )
        ( cd inc; ../registry/parse ../core_$(CORE)/Registry )
externals:
-        ( cd external; make FC="$(FC)" SFC="$(SFC)" CC="$(CC)" SCC="$(SCC)" FFLAGS="$(FFLAGS)" CFLAGS="$(CFLAGS)" CPP="$(CPP)" RANLIB="$(RANLIB)" NETCDF="$(NETCDF)" CORE="$(CORE)" )
+        ( cd external; make FC="$(FC)" SFC="$(SFC)" CC="$(CC)" SCC="$(SCC)" FFLAGS="$(FFLAGS)" CFLAGS="$(CFLAGS)" CPP="$(CPP)" NETCDF="$(NETCDF)" CORE="$(CORE)" )
frame:
        ( cd framework; make all )
Modified: branches/atmos_physics/src/core_hyd_atmos/Makefile
===================================================================
--- branches/atmos_physics/src/core_hyd_atmos/Makefile        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_hyd_atmos/Makefile        2011-09-07 00:23:57 UTC (rev 979)
@@ -13,7 +13,10 @@
physcore:
        ( cd ../core_physics; make all )
        ( mkdir phys; cd phys; ar -x ../../core_physics/libphys.a )
+        ( cd ../..; ln -sf ./src/core_physics/physics_wrf/files/*TBL .)
+        ( cd ../..; ln -sf ./src/core_physics/physics_wrf/files/*DBL .)
+
core_hyd: $(OBJS)
        ar -ru libdycore.a $(OBJS) phys/*.o
@@ -27,10 +30,12 @@
clean:
        ( cd ../core_physics; make clean )
+        ( cd ../..; rm -f *TBL )
+        ( cd ../..; rm -f *DBL )
        $(RM) -r phys
        $(RM) *.o *.mod *.f90 libdycore.a
.F.o:
        $(RM) $@ $*.mod
        $(CPP) $(CPPFLAGS) $(PHYSICS) $(CPPINCLUDES) $< > $*.f90
-        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I../core_physics -I../core_physics/physics_wrf
+        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I../core_physics -I../core_physics/physics_wrf -I../external/esmf_time_f90
Modified: branches/atmos_physics/src/core_hyd_atmos/Registry
===================================================================
--- branches/atmos_physics/src/core_hyd_atmos/Registry        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_hyd_atmos/Registry        2011-09-07 00:23:57 UTC (rev 979)
@@ -4,8 +4,10 @@
namelist integer sw_model config_test_case 5
namelist character sw_model config_time_integration SRK3
namelist real sw_model config_dt 172.8
-namelist integer sw_model config_ntimesteps 7500
-namelist integer sw_model config_output_interval 500
+namelist integer sw_model config_calendar_type MPAS_360DAY
+namelist character sw_model config_start_time 0000-01-01_00:00:00
+namelist character sw_model config_stop_time none
+namelist character sw_model config_run_duration none
namelist real sw_model config_h_mom_eddy_visc2 0.0
namelist real sw_model config_h_mom_eddy_visc4 0.0
namelist real sw_model config_v_mom_eddy_visc2 0.0
@@ -23,10 +25,11 @@
namelist character io config_input_name grid.nc
namelist character io config_output_name output.nc
namelist character io config_restart_name restart.nc
+namelist character io config_output_interval 06:00:00
+namelist integer io config_frames_per_outfile 0
namelist character io config_decomp_file_prefix graph.info.part.
-namelist integer restart config_restart_interval 0
namelist logical restart config_do_restart false
-namelist real restart config_restart_time 172800.0
+namelist character restart config_restart_interval none
#
# dim type name_in_file name_in_code
@@ -50,7 +53,7 @@
#
# var persistence type name_in_file ( dims ) time_levs iro- name_in_code struct super-array array_class
#
-var persistent real xtime ( Time ) 2 ro xtime state - -
+var persistent text xtime ( Time ) 2 ro xtime state - -
var persistent real latCell ( nCells ) 0 iro latCell mesh - -
var persistent real lonCell ( nCells ) 0 iro lonCell mesh - -
Modified: branches/atmos_physics/src/core_hyd_atmos/module_mpas_core.F
===================================================================
--- branches/atmos_physics/src/core_hyd_atmos/module_mpas_core.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_hyd_atmos/module_mpas_core.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,15 +1,22 @@
module mpas_core
use mpas_framework
+ use mpas_timekeeping
type (io_output_object) :: restart_obj
integer :: restart_frame
-
+ integer :: current_outfile_frames
+
+ type (MPAS_Clock_type) :: clock
+
+ integer, parameter :: outputAlarmID = 1
+ integer, parameter :: restartAlarmID = 2
+
contains
- subroutine mpas_core_init(domain)
+ subroutine mpas_core_init(domain, startTimeStamp)
use configure
use grid_types
@@ -18,6 +25,7 @@
implicit none
type (domain_type), intent(inout) :: domain
+ character(len=*), intent(out) :: startTimeStamp
real (kind=RKIND) :: dt
type (block_type), pointer :: block
@@ -29,18 +37,73 @@
! Initialize core
!
dt = config_dt
+
+ call simulation_clock_init(domain, dt, startTimeStamp)
+
block => domain % blocklist
do while (associated(block))
call mpas_init_block(domain % dminfo, block, block % mesh, dt)
+ block % state % time_levs(1) % state % xtime % scalar = startTimeStamp
block => block % next
end do
restart_frame = 1
+ current_outfile_frames = 0
end subroutine mpas_core_init
-
- subroutine mpas_init_block(dminfo, block, mesh, dt)
+
+ subroutine simulation_clock_init(domain, dt, startTimeStamp)
+
+ implicit none
+
+ type (domain_type), intent(inout) :: domain
+ real (kind=RKIND), intent(in) :: dt
+ character(len=*), intent(out) :: startTimeStamp
+
+ type (MPAS_Time_Type) :: startTime, stopTime, alarmStartTime
+ type (MPAS_TimeInterval_type) :: runDuration, timeStep, alarmTimeStep
+ integer :: ierr
+
+ call MPAS_setTime(curr_time=startTime, dateTimeString=config_start_time, ierr=ierr)
+ call MPAS_setTimeInterval(timeStep, dt=dt, ierr=ierr)
+
+ if (trim(config_run_duration) /= "none") then
+ call MPAS_setTimeInterval(runDuration, timeString=config_run_duration, ierr=ierr)
+ call MPAS_createClock(clock, startTime=startTime, timeStep=timeStep, runDuration=runDuration, ierr=ierr)
+
+ if (trim(config_stop_time) /= "none") then
+ call MPAS_setTime(curr_time=stopTime, dateTimeString=config_stop_time, ierr=ierr)
+ if(startTime + runduration /= stopTime) then
+ write(0,*) 'Warning: config_run_duration and config_stop_time are inconsitent: using config_run_duration.'
+ end if
+ end if
+ else if (trim(config_stop_time) /= "none") then
+ call MPAS_setTime(curr_time=stopTime, dateTimeString=config_stop_time, ierr=ierr)
+ call MPAS_createClock(clock, startTime=startTime, timeStep=timeStep, stopTime=stopTime, ierr=ierr)
+ else
+ write(0,*) 'Error: Neither config_run_duration nor config_stop_time were specified.'
+ call dmpar_abort(domain % dminfo)
+ end if
+
+ ! set output alarm
+ call MPAS_setTimeInterval(alarmTimeStep, timeString=config_output_interval, ierr=ierr)
+ alarmStartTime = startTime + alarmTimeStep
+ call MPAS_addClockAlarm(clock, outputAlarmID, alarmStartTime, alarmTimeStep, ierr=ierr)
+
+ ! set restart alarm, if necessary
+ if (trim(config_restart_interval) /= "none") then
+ call MPAS_setTimeInterval(alarmTimeStep, timeString=config_restart_interval, ierr=ierr)
+ alarmStartTime = startTime + alarmTimeStep
+ call MPAS_addClockAlarm(clock, restartAlarmID, alarmStartTime, alarmTimeStep, ierr=ierr)
+ end if
+
+ call MPAS_getTime(curr_time=startTime, dateTimeString=startTimeStamp, ierr=ierr)
+
+ end subroutine simulation_clock_init
+
+
+ subroutine mpas_init_block(block, mesh, dt)
use grid_types
use advection
@@ -84,7 +147,6 @@
endif
#endif
- if (.not. config_do_restart) block % state % time_levs(1) % state % xtime % scalar = 0.0
end subroutine mpas_init_block
@@ -104,34 +166,52 @@
integer :: ntimesteps, itimestep
real (kind=RKIND) :: dt
type (block_type), pointer :: block_ptr
+
+ type (MPAS_Time_Type) :: currTime
+ character(len=32) :: timeStamp
+ integer :: ierr
! Eventually, dt should be domain specific
dt = config_dt
- ntimesteps = config_ntimesteps
-
+
+ currTime = MPAS_getClockTime(clock, MPAS_NOW, ierr)
+ call MPAS_getTime(curr_time=currTime, dateTimeString=timeStamp, ierr=ierr)
+ write(0,*) 'Initial time ', timeStamp
+
call write_output_frame(output_obj, output_frame, domain)
! During integration, time level 1 stores the model state at the beginning of the
! time step, and time level 2 stores the state advanced dt in time by timestep(...)
- do itimestep = 1,ntimesteps
- write(0,*) 'Doing timestep ', itimestep
+ do while (.not. MPAS_isClockStopTime(clock))
+
+ call MPAS_advanceClock(clock)
+
+ currTime = MPAS_getClockTime(clock, MPAS_NOW, ierr)
+ call MPAS_getTime(curr_time=currTime, dateTimeString=timeStamp, ierr=ierr)
+ write(0,*) 'Doing timestep ', timeStamp
+
call timer_start("time integration")
- call mpas_timestep(domain, itimestep, dt)
+ call mpas_timestep(domain, dt, timeStamp)
call timer_stop("time integration")
! Move time level 2 fields back into time level 1 for next time step
call shift_time_levels_state(domain % blocklist % state)
- if (mod(itimestep, config_output_interval) == 0) then
+ if (MPAS_isAlarmRinging(clock, outputAlarmID, ierr=ierr)) then
+ call MPAS_resetClockAlarm(clock, outputAlarmID, ierr=ierr)
+ if(output_frame == 1) call output_state_init(output_obj, domain, "OUTPUT", trim(timeStamp)) ! output_frame will always be > 1 here unless it is reset after the output file is finalized
call write_output_frame(output_obj, output_frame, domain)
end if
- if (mod(itimestep, config_restart_interval) == 0 .and. config_restart_interval > 0) then
+
+ if (MPAS_isAlarmRinging(clock, restartAlarmID, ierr=ierr)) then
+ call MPAS_resetClockAlarm(clock, restartAlarmID, ierr=ierr)
if (restart_frame == 1) call output_state_init(restart_obj, domain, "RESTART")
call output_state_for_domain(restart_obj, domain, restart_frame)
restart_frame = restart_frame + 1
end if
+
end do
-
+
end subroutine mpas_core_run
@@ -164,7 +244,17 @@
call output_state_for_domain(output_obj, domain, output_frame)
output_frame = output_frame + 1
-
+
+ ! if the maximum number of frames per outfile has been reached, finalize outfile and reset frame
+ if (config_frames_per_outfile > 0) then
+ current_outfile_frames = current_outfile_frames + 1
+ if(current_outfile_frames >= config_frames_per_outfile) then
+ current_outfile_frames = 0
+ call output_state_finalize(output_obj, domain % dminfo)
+ output_frame = 1
+ end if
+ end if
+
end subroutine write_output_frame
@@ -191,7 +281,7 @@
end subroutine compute_output_diagnostics
- subroutine mpas_timestep(domain, itimestep, dt)
+ subroutine mpas_timestep(domain, dt, timeStamp)
use grid_types
use time_integration
@@ -204,8 +294,8 @@
implicit none
type (domain_type), intent(inout) :: domain
- integer, intent(in) :: itimestep
real (kind=RKIND), intent(in) :: dt
+ character(len=*), intent(in) :: timeStamp
#ifdef DO_PHYSICS
!proceed with physics if moist_physics is set to true:
@@ -214,7 +304,7 @@
if(l_physics) call physics_driver(domain,itimestep)
endif
#endif
- call timestep(domain, dt, itimestep)
+ call timestep(domain, dt, timeStamp)
end subroutine mpas_timestep
@@ -224,11 +314,15 @@
use grid_types
implicit none
-
+
+ integer :: ierr
+
type (domain_type), intent(inout) :: domain
if (restart_frame > 1) call output_state_finalize(restart_obj, domain % dminfo)
-
+
+ call MPAS_destroyClock(clock, ierr)
+
end subroutine mpas_core_finalize
end module mpas_core
Modified: branches/atmos_physics/src/core_hyd_atmos/module_time_integration.F
===================================================================
--- branches/atmos_physics/src/core_hyd_atmos/module_time_integration.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_hyd_atmos/module_time_integration.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -14,7 +14,7 @@
contains
- subroutine timestep(domain, dt, itimestep)
+ subroutine timestep(domain, dt, timeStamp)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Advance model state forward in time by the specified time step
!
@@ -27,8 +27,8 @@
implicit none
type (domain_type), intent(inout) :: domain
- integer, intent(in):: itimestep
real (kind=RKIND), intent(in) :: dt
+ character(len=*), intent(in) :: timeStamp
type (block_type), pointer :: block
@@ -42,14 +42,14 @@
block => domain % blocklist
do while (associated(block))
- block % state % time_levs(2) % state % xtime % scalar = block % state % time_levs(1) % state % xtime % scalar + dt
+ block % state % time_levs(2) % state % xtime % scalar = timeStamp
block => block % next
end do
end subroutine timestep
- subroutine srk3(domain, dt, itimestep)
+ subroutine srk3(domain, dt, timeStamp)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Advance model state forward in time by the specified time step using
! time-split RK3 scheme
@@ -66,7 +66,7 @@
type (domain_type), intent(inout) :: domain
real (kind=RKIND), intent(in) :: dt
- integer, intent(in):: itimestep
+ character(len=*), intent(in):: timeStamp
integer :: iCell, k
type (block_type), pointer :: block
@@ -386,7 +386,7 @@
!call microphysics schemes:
if(config_microp_scheme .ne. 'off') &
call microphysics_driver ( block % state % time_levs(2) % state, block % diag, block % diag_physics, &
- block % tend, block % mesh, itimestep )
+ block % tend, block % mesh, timeStamp )
do iScalar = 1, block % state % time_levs(2) % state % num_scalars
scalar_min = 0.
Modified: branches/atmos_physics/src/core_init_nhyd_atmos/Makefile
===================================================================
--- branches/atmos_physics/src/core_init_nhyd_atmos/Makefile        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_init_nhyd_atmos/Makefile        2011-09-07 00:23:57 UTC (rev 979)
@@ -35,7 +35,7 @@
.F.o:
        $(RM) $@ $*.mod
        $(CPP) $(CPPFLAGS) $(CPPINCLUDES) $< > $*.f90
-        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators
+        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I../external/esmf_time_f90
.c.o:
        $(CC) $(CFLAGS) $(CPPFLAGS) $(CPPINCLUDES) -c $<
Modified: branches/atmos_physics/src/core_init_nhyd_atmos/Registry
===================================================================
--- branches/atmos_physics/src/core_init_nhyd_atmos/Registry        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_init_nhyd_atmos/Registry        2011-09-07 00:23:57 UTC (rev 979)
@@ -2,14 +2,17 @@
# namelist type namelist_record name default_value
#
namelist integer nhyd_model config_test_case 5
+namelist integer nhyd_model config_calendar_type MPAS_GREGORIAN
+namelist character nhyd_model config_start_time none
+namelist character nhyd_model config_stop_time none
namelist integer nhyd_model config_theta_adv_order 2
namelist real nhyd_model config_coef_3rd_order 1.0
namelist integer dimensions config_nvertlevels 26
namelist integer dimensions config_nfglevels 27
namelist integer dimensions config_nsoil_levels 4
namelist character data_sources config_geog_data_path /data3/mp/wrfhelp/WPS_GEOG/
-namelist character data_sources config_met_prefix GFS
-namelist character data_sources config_init_date 2010-05-26_12
+namelist character data_sources config_met_prefix FILE
+namelist integer data_sources config_fg_interval 21600
namelist real vertical_grid config_ztop 24000.0
namelist integer vertical_grid config_nsmterrain 2
namelist logical vertical_grid config_smooth_surfaces true
@@ -17,9 +20,11 @@
namelist logical preproc_stages config_vertical_grid true
namelist logical preproc_stages config_met_interp true
namelist character io config_input_name grid.nc
+namelist character io config_sfc_update_name sfc_update.nc
namelist character io config_output_name output.nc
namelist character io config_restart_name restart.nc
namelist character io config_decomp_file_prefix graph.info.part.
+namelist integer io config_frames_per_outfile 0
namelist integer restart config_restart_interval 0
namelist logical restart config_do_restart false
namelist real restart config_restart_time 172800.0
Modified: branches/atmos_physics/src/core_init_nhyd_atmos/module_mpas_core.F
===================================================================
--- branches/atmos_physics/src/core_init_nhyd_atmos/module_mpas_core.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_init_nhyd_atmos/module_mpas_core.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -4,7 +4,7 @@
contains
- subroutine mpas_core_init(domain)
+ subroutine mpas_core_init(domain, startTimeStamp)
use grid_types
use configure
@@ -13,6 +13,9 @@
implicit none
type (domain_type), intent(inout) :: domain
+ character(len=*), intent(out) :: startTimeStamp
+
+ startTimeStamp = config_start_time
end subroutine mpas_core_init
Modified: branches/atmos_physics/src/core_init_nhyd_atmos/module_test_cases.F
===================================================================
--- branches/atmos_physics/src/core_init_nhyd_atmos/module_test_cases.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_init_nhyd_atmos/module_test_cases.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -6,6 +6,7 @@
use dmpar
use advection
use sort
+ use mpas_timekeeping
contains
@@ -2728,7 +2729,7 @@
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#if 0
- call read_met_init(trim(config_met_prefix), .false., trim(config_init_date), istatus)
+ call read_met_init(trim(config_met_prefix), .false., config_start_time(1:13), istatus)
if (istatus /= 0) then
write(0,*) 'Error reading initial met data'
@@ -3096,7 +3097,7 @@
!
! First, try to locate the LANDSEA field for use as an interpolation mask
!
- call read_met_init(trim(config_met_prefix), .false., trim(config_init_date), istatus)
+ call read_met_init(trim(config_met_prefix), .false., config_start_time(1:13), istatus)
if (istatus /= 0) then
write(0,*) 'Error reading initial met data'
@@ -3135,7 +3136,7 @@
allocate(vert_level(config_nfglevels))
vert_level(:) = -1.0
- call read_met_init(trim(config_met_prefix), .false., trim(config_init_date), istatus)
+ call read_met_init(trim(config_met_prefix), .false., config_start_time(1:13), istatus)
if (istatus /= 0) then
write(0,*) 'Error reading initial met data'
@@ -3582,7 +3583,7 @@
!
! Get SEAICE from a separate file
!
- call read_met_init('SEAICE_FRACTIONAL', .true., trim(config_init_date), istatus)
+ call read_met_init('SEAICE_FRACTIONAL', .true., config_start_time(1:13), istatus)
if (istatus /= 0) then
write(0,*) 'Error reading SEAICE_FRACTIONAL data'
@@ -4009,21 +4010,119 @@
integer, intent(in) :: test_case
type (parallel_info), pointer :: parinfo
+ integer :: istatus
+ integer :: iCell, i, j
+ type (met_data) :: field
+ type (proj_info) :: proj
+ real (kind=RKIND) :: lat, lon, x, y
+ integer, dimension(5) :: interp_list
+ real (kind=RKIND), allocatable, dimension(:,:) :: slab_r8
type (io_output_object) :: sfc_update_obj
+ type (MPAS_Clock_type) :: fg_clock
+ type (MPAS_Time_type) :: start_time, stop_time, curr_time
+ type (MPAS_TimeInterval_type) :: fg_interval
+ character (len=32) :: timeString
+
+ ! Set interpolation sequence to be used for SST/SKINTEMP field
+ interp_list(1) = FOUR_POINT
+ interp_list(2) = SEARCH
+ interp_list(3) = 0
+
+
+ ! Set up clock to step through all intermediate file dates to be processed
+ call MPAS_setTime(start_time, dateTimeString=trim(config_start_time))
+ call MPAS_setTime(stop_time, dateTimeString=trim(config_stop_time))
+ call MPAS_setTimeInterval(fg_interval, S=config_fg_interval)
+
+ call MPAS_createClock(fg_clock, start_time, fg_interval, stopTime=stop_time)
+
+
+ ! Initialize the output file
sfc_update_obj % time = 1
- sfc_update_obj % filename = 'sfc_update.nc'
+ sfc_update_obj % filename = trim(config_sfc_update_name)
call output_state_init(sfc_update_obj, domain, "SFC")
- do while (sfc_update_obj % time <= 5)
- fg % sst % array(:) = real(sfc_update_obj % time * 100)
+ ! Loop over all times, interpolating the SKINTEMP field from each intermediate file
+ curr_time = MPAS_getClockTime(fg_clock, MPAS_NOW)
+ do while (curr_time <= stop_time)
+ call MPAS_getTime(curr_time, dateTimeString=timeString)
+ write(0,*) 'Processing ',trim(config_met_prefix)//':'//timeString(1:13)
+
+ ! Open intermediate file
+ call read_met_init(trim(config_met_prefix), .false., timeString(1:13), istatus)
+ if (istatus /= 0) then
+ write(0,*) 'Error reading ',trim(config_met_prefix)//':'//timeString(1:13)
+ exit
+ end if
+
+ ! Scan through all fields in the file, looking for the SKINTEMP field
+ call read_next_met_field(field, istatus)
+ do while (istatus == 0)
+
+ if (index(field % field, 'SKINTEMP') /= 0) then
+
+ ! Interpolation routines use real(kind=RKIND), so copy from default real array
+ allocate(slab_r8(field % nx, field % ny))
+ do j=1,field % ny
+ do i=1,field % nx
+ slab_r8(i,j) = field % slab(i,j)
+ end do
+ end do
+
+ !
+ ! Set up map projection
+ !
+ call map_init(proj)
+
+ if (field % iproj == PROJ_LATLON) then
+ call map_set(PROJ_LATLON, proj, &
+ latinc = real(field % deltalat), &
+ loninc = real(field % deltalon), &
+ knowni = 1.0, &
+ knownj = 1.0, &
+ lat1 = real(field % startlat), &
+ lon1 = real(field % startlon))
+ end if
+
+ ! Interpolate SKINTEMP field to each MPAS grid cell
+ do iCell=1,grid % nCells
+ lat = grid % latCell % array(iCell) * DEG_PER_RAD
+ lon = grid % lonCell % array(iCell) * DEG_PER_RAD
+ call latlon_to_ij(proj, lat, lon, x, y)
+ if (x < 0.5) then
+ lon = lon + 360.0
+ call latlon_to_ij(proj, lat, lon, x, y)
+ else if (x >= real(field%nx)+0.5) then
+ lon = lon - 360.0
+ call latlon_to_ij(proj, lat, lon, x, y)
+ end if
+ fg % sst % array(iCell) = interp_sequence(x, y, 1, slab_r8, 1, field % nx, 1, field % ny, 1, 1, -1.e30, interp_list, 1)
+ end do
+
+ deallocate(slab_r8)
+ deallocate(field % slab)
+ exit
+ end if
+
+ deallocate(field % slab)
+ call read_next_met_field(field, istatus)
+ end do
+
+ ! Close intermediate file
+ call read_met_close()
+
+ ! Write the interpolated SST/SKINTEMP field as a new time slice in the MPAS output file
call output_state_for_domain(sfc_update_obj, domain, sfc_update_obj % time)
sfc_update_obj % time = sfc_update_obj % time + 1
+
+ call MPAS_advanceClock(fg_clock)
+ curr_time = MPAS_getClockTime(fg_clock, MPAS_NOW)
end do
call output_state_finalize(sfc_update_obj, dminfo)
-
+
end subroutine nhyd_test_case_sst
#if 0
Modified: branches/atmos_physics/src/core_nhyd_atmos/Makefile
===================================================================
--- branches/atmos_physics/src/core_nhyd_atmos/Makefile        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_nhyd_atmos/Makefile        2011-09-07 00:23:57 UTC (rev 979)
@@ -37,4 +37,4 @@
.F.o:
        $(RM) $@ $*.mod
        $(CPP) $(CPPFLAGS) $(PHYSICS) $(CPPINCLUDES) $< > $*.f90
-        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I../core_physics -I../core_physics/physics_wrf
+        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I../core_physics -I../core_physics/physics_wrf -I../external/esmf_time_f90
Modified: branches/atmos_physics/src/core_nhyd_atmos/Registry
===================================================================
--- branches/atmos_physics/src/core_nhyd_atmos/Registry        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_nhyd_atmos/Registry        2011-09-07 00:23:57 UTC (rev 979)
@@ -4,9 +4,11 @@
namelist integer nhyd_model config_test_case 5
namelist character nhyd_model config_time_integration SRK3
namelist real nhyd_model config_dt 172.8
-namelist integer nhyd_model config_ntimesteps 7500
-namelist integer nhyd_model config_sfc_update_interval 0
-namelist integer nhyd_model config_output_interval 500
+namelist integer nhyd_model config_calendar_type MPAS_GREGORIAN
+namelist character nhyd_model config_start_time 0000-01-01_00:00:00
+namelist character nhyd_model config_stop_time none
+namelist character nhyd_model config_run_duration none
+namelist character nhyd_model config_sfc_update_interval none
namelist character nhyd_model config_horiz_mixing 2d_smagorinsky
namelist real nhyd_model config_h_mom_eddy_visc2 0.0
namelist real nhyd_model config_h_mom_eddy_visc4 0.0
@@ -36,15 +38,16 @@
namelist logical nhyd_model config_h_ScaleWithMesh false
namelist real damping config_zd 22000.0
namelist real damping config_xnutr 0.0
-namelist integer dimensions config_nvertlevels 26
-namelist character io config_input_name grid.nc
-namelist character io config_sfc_update_name sfc_update.nc
-namelist character io config_output_name output.nc
-namelist character io config_restart_name restart.nc
-namelist character io config_decomp_file_prefix graph.info.part.
-namelist integer restart config_restart_interval 0
-namelist logical restart config_do_restart false
-namelist real restart config_restart_time 172800.0
+namelist integer dimensions config_nvertlevels 26
+namelist character io config_input_name grid.nc
+namelist character io config_sfc_update_name sfc_update.nc
+namelist character io config_output_name output.nc
+namelist character io config_restart_name restart.nc
+namelist character io config_output_interval 06:00:00
+namelist integer io config_frames_per_outfile 0
+namelist character io config_decomp_file_prefix graph.info.part.
+namelist logical restart config_do_restart false
+namelist character restart config_restart_interval none
#
# dim type name_in_file name_in_code
@@ -66,7 +69,7 @@
#
# var type name_in_file ( dims ) iro- name_in_code super-array array_class
#
-var persistent real xtime ( Time ) 2 iro xtime state - -
+var persistent text xtime ( Time ) 2 iro xtime state - -
# horizontal grid structure
Modified: branches/atmos_physics/src/core_nhyd_atmos/module_mpas_core.F
===================================================================
--- branches/atmos_physics/src/core_nhyd_atmos/module_mpas_core.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_nhyd_atmos/module_mpas_core.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -5,12 +5,18 @@
type (io_output_object) :: restart_obj
type (io_input_object) :: sfc_update_obj
integer :: restart_frame
+ integer :: current_outfile_frames
+
+ type (MPAS_Clock_type) :: clock
+ integer, parameter :: outputAlarmID = 1
+ integer, parameter :: restartAlarmID = 2
+ integer, parameter :: sfcAlarmID = 3
contains
- subroutine mpas_core_init(domain)
+ subroutine mpas_core_init(domain, startTimeStamp)
use configure
use grid_types
@@ -19,6 +25,7 @@
implicit none
type (domain_type), intent(inout) :: domain
+ character(len=*), intent(out) :: startTimeStamp
real (kind=RKIND) :: dt
type (block_type), pointer :: block
@@ -30,24 +37,90 @@
! Initialize core
!
dt = config_dt
+
+ call simulation_clock_init(domain, dt, startTimeStamp)
+
block => domain % blocklist
do while (associated(block))
call mpas_init_block(domain % dminfo, block, block % mesh, dt)
+ block % state % time_levs(1) % state % xtime % scalar = startTimeStamp
block => block % next
end do
restart_frame = 1
+ current_outfile_frames = 0
!MGD TODO: this should pick up at the right frame when doing a restart
sfc_update_obj % time = 1
sfc_update_obj % filename = trim(config_sfc_update_name)
sfc_update_obj % stream = STREAM_SFC
- if (config_sfc_update_interval > 0) call io_input_init(sfc_update_obj, domain % dminfo)
+ if (config_sfc_update_interval /= "none") call io_input_init(sfc_update_obj, domain % dminfo)
end subroutine mpas_core_init
+ subroutine simulation_clock_init(domain, dt, startTimeStamp)
+
+ implicit none
+
+ type (domain_type), intent(inout) :: domain
+ real (kind=RKIND), intent(in) :: dt
+ character(len=*), intent(out) :: startTimeStamp
+
+ type (MPAS_Time_Type) :: startTime, stopTime, alarmStartTime
+ type (MPAS_TimeInterval_type) :: runDuration, timeStep, alarmTimeStep
+ integer :: ierr
+
+ call MPAS_setTime(curr_time=startTime, dateTimeString=config_start_time, ierr=ierr)
+ call MPAS_setTimeInterval(timeStep, dt=dt, ierr=ierr)
+
+ if (trim(config_run_duration) /= "none") then
+ call MPAS_setTimeInterval(runDuration, timeString=config_run_duration, ierr=ierr)
+ call MPAS_createClock(clock, startTime=startTime, timeStep=timeStep, runDuration=runDuration, ierr=ierr)
+
+ if (trim(config_stop_time) /= "none") then
+ call MPAS_setTime(curr_time=stopTime, dateTimeString=config_stop_time, ierr=ierr)
+ if(startTime + runduration /= stopTime) then
+ write(0,*) 'Warning: config_run_duration and config_stop_time are inconsitent: using config_run_duration.'
+ end if
+ end if
+ else if (trim(config_stop_time) /= "none") then
+ call MPAS_setTime(curr_time=stopTime, dateTimeString=config_stop_time, ierr=ierr)
+ call MPAS_createClock(clock, startTime=startTime, timeStep=timeStep, stopTime=stopTime, ierr=ierr)
+ else
+ write(0,*) 'Error: Neither config_run_duration nor config_stop_time were specified.'
+ call dmpar_abort(domain % dminfo)
+ end if
+
+ ! set output alarm
+ call MPAS_setTimeInterval(alarmTimeStep, timeString=config_output_interval, ierr=ierr)
+ alarmStartTime = startTime + alarmTimeStep
+ call MPAS_addClockAlarm(clock, outputAlarmID, alarmStartTime, alarmTimeStep, ierr=ierr)
+
+ ! set restart alarm, if necessary
+ if (trim(config_restart_interval) /= "none") then
+ call MPAS_setTimeInterval(alarmTimeStep, timeString=config_restart_interval, ierr=ierr)
+ alarmStartTime = startTime + alarmTimeStep
+ call MPAS_addClockAlarm(clock, restartAlarmID, alarmStartTime, alarmTimeStep, ierr=ierr)
+ end if
+
+ ! set sfc alarm, if necessary
+ if (trim(config_sfc_update_interval) /= "none") then
+ call MPAS_setTimeInterval(alarmTimeStep, timeString=config_sfc_update_interval, ierr=ierr)
+ alarmStartTime = startTime + alarmTimeStep
+ call MPAS_addClockAlarm(clock, sfcAlarmID, alarmStartTime, alarmTimeStep, ierr=ierr)
+ end if
+
+ !TODO: set phyics alarms here...
+ !....
+ !....
+
+ call MPAS_getTime(curr_time=startTime, dateTimeString=startTimeStamp, ierr=ierr)
+
+ end subroutine simulation_clock_init
+
+
subroutine mpas_init_block(dminfo, block, mesh, dt)
use grid_types
@@ -69,7 +142,7 @@
type (block_type), intent(inout) :: block
type (mesh_type), intent(inout) :: mesh
real (kind=RKIND), intent(in) :: dt
-
+
call dmpar_exch_halo_field2dReal(dminfo, block % state % time_levs(1) % state % u % array(:,:), &
block % mesh % nVertLevels, block % mesh % nEdges, &
block % parinfo % edgesToSend, block % parinfo % edgesToRecv)
@@ -109,8 +182,9 @@
if(moist_physics) then
!initialization of seom input variables in registry:
call physics_registry_init(config_do_restart, mesh, block % sfc_input)
- call physics_run_init(mesh)
+ call physics_run_init(mesh, clock)
+
!initialization of all physics:
call physics_init(dminfo, config_do_restart, mesh, block % state % time_levs(1) % state, &
block % diag_physics, block % sfc_input)
@@ -118,8 +192,6 @@
endif
#endif
- if (.not. config_do_restart) block % state % time_levs(1) % state % xtime % scalar = 0.0
-
call compute_mesh_scaling(mesh)
call compute_damping_coefs(mesh)
@@ -146,15 +218,22 @@
type (io_output_object), intent(inout) :: output_obj
integer, intent(inout) :: output_frame
- integer :: ntimesteps, itimestep
real (kind=RKIND) :: dt
type (block_type), pointer :: block_ptr
-
+
+ type (MPAS_Time_Type) :: currTime
+ character(len=32) :: timeStamp
+ integer :: itimestep
+ integer :: ierr
+
! Eventually, dt should be domain specific
dt = config_dt
- ntimesteps = config_ntimesteps
+
+ currTime = MPAS_getClockTime(clock, MPAS_NOW, ierr)
+ call MPAS_getTime(curr_time=currTime, dateTimeString=timeStamp, ierr=ierr)
+ write(0,*) 'Initial timestep ', timeStamp
- if (config_sfc_update_interval > 0) then
+ if (config_sfc_update_interval /= "none") then
call read_and_distribute_fields(domain % dminfo, sfc_update_obj, domain % blocklist, &
readCellStart, nReadCells, readEdgeStart, nReadEdges, readVertexStart, nReadVertices, &
readVertLevelStart, nReadVertLevels, &
@@ -166,33 +245,50 @@
! During integration, time level 1 stores the model state at the beginning of the
! time step, and time level 2 stores the state advanced dt in time by timestep(...)
- do itimestep = 1,ntimesteps
- write(0,*) 'Doing timestep ', itimestep
+ itimestep = 0
+ do while (.not. MPAS_isClockStopTime(clock))
+
+ itimestep = itimestep + 1
+ call MPAS_advanceClock(clock)
+
+ currTime = MPAS_getClockTime(clock, MPAS_NOW, ierr)
+ call MPAS_getTime(curr_time=currTime, dateTimeString=timeStamp, ierr=ierr)
+ write(0,*) 'Doing timestep ', timeStamp
+
call timer_start("time integration")
- call mpas_timestep(domain, itimestep, dt)
+ call mpas_timestep(domain, dt, itimestep)
call timer_stop("time integration")
! Move time level 2 fields back into time level 1 for next time step
call shift_time_levels_state(domain % blocklist % state)
- if (mod(itimestep, config_output_interval) == 0) then
+ !TODO: MPAS_getClockRingingAlarms is probably faster than multiple MPAS_isAlarmRinging...
+
+ if (MPAS_isAlarmRinging(clock, outputAlarmID, ierr=ierr)) then
+ call MPAS_resetClockAlarm(clock, outputAlarmID, ierr=ierr)
+ !output_frame will always be > 1 here unless it is reset after the output file is finalized
+ if(output_frame == 1) call output_state_init(output_obj, domain, "OUTPUT", trim(timeStamp))
call write_output_frame(output_obj, output_frame, domain)
end if
- if (mod(itimestep, config_restart_interval) == 0 .and. config_restart_interval > 0) then
+
+ if (MPAS_isAlarmRinging(clock, restartAlarmID, ierr=ierr)) then
+ call MPAS_resetClockAlarm(clock, restartAlarmID, ierr=ierr)
if (restart_frame == 1) call output_state_init(restart_obj, domain, "RESTART")
call output_state_for_domain(restart_obj, domain, restart_frame)
restart_frame = restart_frame + 1
end if
- if (config_sfc_update_interval > 0) then
- if (mod(itimestep, config_sfc_update_interval) == 0) then
- sfc_update_obj % time = sfc_update_obj % time + 1
- call read_and_distribute_fields(domain % dminfo, sfc_update_obj, domain % blocklist, &
+
+ if (MPAS_isAlarmRinging(clock, sfcAlarmID, ierr=ierr)) then
+ call MPAS_resetClockAlarm(clock, sfcAlarmID, ierr=ierr)
+
+ sfc_update_obj % time = sfc_update_obj % time + 1
+ call read_and_distribute_fields(domain % dminfo, sfc_update_obj, domain % blocklist, &
readCellStart, nReadCells, readEdgeStart, nReadEdges, readVertexStart, nReadVertices, &
readVertLevelStart, nReadVertLevels, &
sendCellList, recvCellList, sendEdgeList, recvEdgeList, sendVertexList, recvVertexList, &
sendVertLevelList, recvVertLevelList)
- end if
end if
+
end do
end subroutine mpas_core_run
@@ -228,6 +324,16 @@
call output_state_for_domain(output_obj, domain, output_frame)
output_frame = output_frame + 1
+ ! if the maximum number of frames per outfile has been reached, finalize outfile and reset frame
+ if (config_frames_per_outfile > 0) then
+ current_outfile_frames = current_outfile_frames + 1
+ if(current_outfile_frames >= config_frames_per_outfile) then
+ current_outfile_frames = 0
+ call output_state_finalize(output_obj, domain % dminfo)
+ output_frame = 1
+ end if
+ end if
+
end subroutine write_output_frame
@@ -262,7 +368,7 @@
end subroutine compute_output_diagnostics
- subroutine mpas_timestep(domain, itimestep, dt)
+ subroutine mpas_timestep(domain, dt, itimestep)
use grid_types
use time_integration
@@ -276,18 +382,35 @@
implicit none
type (domain_type), intent(inout) :: domain
+ real (kind=RKIND), intent(in) :: dt
integer, intent(in) :: itimestep
- real (kind=RKIND), intent(in) :: dt
-
+
+ type (MPAS_Time_Type) :: startTime, currTime
+ type (MPAS_TimeInterval_Type) :: xtimeTime
+ character(len=32) :: timeStamp
+ integer :: s, s_n, s_d
+ real (kind=RKIND) :: xtime_s
+ integer :: ierr
+
+ startTime = MPAS_getClockTime(clock, MPAS_START_TIME, ierr)
+ currTime = MPAS_getClockTime(clock, MPAS_NOW, ierr)
+
+ xtimeTime = currTime - startTime
+ call MPAS_getTimeInterval(interval=xtimeTime, S=s, S_n=s_n, S_d=s_d, ierr=ierr)
+ xtime_s = (s + s_n / s_d)
+
+ call MPAS_getTime(curr_time=currTime, dateTimeString=timeStamp, ierr=ierr)
+
+
#ifdef DO_PHYSICS
!proceed with physics if moist_physics is set to true:
if(moist_physics) then
call physics_timetracker(domain,dt,itimestep)
- if(l_physics) call physics_driver(domain,itimestep)
+ if(l_physics) call physics_driver(domain,itimestep,xtime_s)
endif
#endif
- call timestep(domain, dt, itimestep)
+ call timestep(domain, dt, timeStamp, itimestep)
#ifdef DO_PHYSICS
!update physics diagnostics at the end of dynamic time-step:
@@ -304,10 +427,13 @@
implicit none
type (domain_type), intent(inout) :: domain
+ integer :: ierr
if (restart_frame > 1) call output_state_finalize(restart_obj, domain % dminfo)
- if (config_sfc_update_interval > 0) call io_input_finalize(sfc_update_obj, domain % dminfo)
+ if (config_sfc_update_interval /= "none") call io_input_finalize(sfc_update_obj, domain % dminfo)
+
+ call MPAS_destroyClock(clock, ierr)
end subroutine mpas_core_finalize
Modified: branches/atmos_physics/src/core_nhyd_atmos/module_time_integration.F
===================================================================
--- branches/atmos_physics/src/core_nhyd_atmos/module_time_integration.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_nhyd_atmos/module_time_integration.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -15,7 +15,7 @@
contains
- subroutine timestep(domain, dt, itimestep)
+ subroutine timestep(domain, dt, timeStamp, itimestep)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Advance model state forward in time by the specified time step
!
@@ -28,8 +28,9 @@
implicit none
type (domain_type), intent(inout) :: domain
- integer, intent(in):: itimestep
real (kind=RKIND), intent(in) :: dt
+ character(len=*), intent(in) :: timeStamp
+ integer, intent(in) :: itimestep
type (block_type), pointer :: block
@@ -43,7 +44,7 @@
block => domain % blocklist
do while (associated(block))
- block % state % time_levs(2) % state % xtime % scalar = block % state % time_levs(1) % state % xtime % scalar + dt
+ block % state % time_levs(2) % state % xtime % scalar = timeStamp
block => block % next
end do
@@ -67,7 +68,7 @@
type (domain_type), intent(inout) :: domain
real (kind=RKIND), intent(in) :: dt
- integer, intent(in):: itimestep
+ integer, intent(in) :: itimestep
integer :: iCell, k, iEdge
type (block_type), pointer :: block
Modified: branches/atmos_physics/src/core_ocean/Makefile
===================================================================
--- branches/atmos_physics/src/core_ocean/Makefile        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_ocean/Makefile        2011-09-07 00:23:57 UTC (rev 979)
@@ -27,4 +27,4 @@
.F.o:
        $(RM) $@ $*.mod
        $(CPP) $(CPPFLAGS) $(CPPINCLUDES) $< > $*.f90
-        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators
+        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I../external/esmf_time_f90
Modified: branches/atmos_physics/src/core_ocean/Registry
===================================================================
--- branches/atmos_physics/src/core_ocean/Registry        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_ocean/Registry        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,43 +1,46 @@
#
# namelist type namelist_record name default_value
#
-namelist integer sw_model config_test_case 5
-namelist character sw_model config_time_integration RK4
-namelist real sw_model config_dt 172.8
-namelist integer sw_model config_ntimesteps 7500
-namelist integer sw_model config_output_interval 500
-namelist integer sw_model config_stats_interval 100
+namelist integer sw_model config_test_case 5
+namelist character sw_model config_time_integration RK4
+namelist real sw_model config_dt 172.8
+namelist integer sw_model config_calendar_type MPAS_360DAY
+namelist character sw_model config_start_time 0000-01-01_00:00:00
+namelist character sw_model config_stop_time none
+namelist character sw_model config_run_duration none
+namelist integer sw_model config_stats_interval 100
namelist character io config_input_name grid.nc
namelist character io config_output_name output.nc
namelist character io config_restart_name restart.nc
+namelist character io config_output_interval 24:00:00
+namelist integer io config_frames_per_outfile 0
namelist character io config_decomp_file_prefix graph.info.part.
-namelist integer restart config_restart_interval 0
-namelist logical restart config_do_restart false
-namelist real restart config_restart_time 172800.0
-namelist character grid config_vert_grid_type isopycnal
-namelist real grid config_rho0 1028
+namelist logical restart config_do_restart false
+namelist character restart config_restart_interval none
+namelist character grid config_vert_grid_type isopycnal
+namelist real grid config_rho0 1028
namelist real hmix config_h_mom_eddy_visc2 0.0
namelist real hmix config_h_mom_eddy_visc4 0.0
namelist real hmix config_h_tracer_eddy_diff2 0.0
namelist real hmix config_h_tracer_eddy_diff4 0.0
namelist real hmix config_apvm_upwinding 0.5
-namelist character vmix config_vert_visc_type const
-namelist character vmix config_vert_diff_type const
-namelist real vmix config_vert_viscosity 2.5e-4
-namelist real vmix config_vert_diffusion 2.5e-5
-namelist real vmix config_vmixTanhViscMax 2.5e-1
-namelist real vmix config_vmixTanhViscMin 1.0e-4
-namelist real vmix config_vmixTanhDiffMax 2.5e-2
-namelist real vmix config_vmixTanhDiffMin 1.0e-5
-namelist real vmix config_vmixTanhZMid -100
-namelist real vmix config_vmixTanhZWidth 100
-namelist character eos config_eos_type linear
-namelist character advection config_vert_tracer_adv stencil
+namelist character vmix config_vert_visc_type const
+namelist character vmix config_vert_diff_type const
+namelist real vmix config_vert_viscosity 2.5e-4
+namelist real vmix config_vert_diffusion 2.5e-5
+namelist real vmix config_vmixTanhViscMax 2.5e-1
+namelist real vmix config_vmixTanhViscMin 1.0e-4
+namelist real vmix config_vmixTanhDiffMax 2.5e-2
+namelist real vmix config_vmixTanhDiffMin 1.0e-5
+namelist real vmix config_vmixTanhZMid -100
+namelist real vmix config_vmixTanhZWidth 100
+namelist character eos config_eos_type linear
+namelist character advection config_vert_tracer_adv stencil
namelist integer advection config_vert_tracer_adv_order 4
-namelist integer advection config_tracer_adv_order 2
-namelist integer advection config_thickness_adv_order 2
-namelist logical advection config_positive_definite false
-namelist logical advection config_monotonic false
+namelist integer advection config_tracer_adv_order 2
+namelist integer advection config_thickness_adv_order 2
+namelist logical advection config_positive_definite false
+namelist logical advection config_monotonic false
#
# dim type name_in_file name_in_code
@@ -58,7 +61,7 @@
#
# var persistence type name_in_file ( dims ) time_levs iro- name_in_code struct super-array array_class
#
-var persistent real xtime ( Time ) 2 ro xtime state - -
+var persistent text xtime ( Time ) 2 ro xtime state - -
var persistent real latCell ( nCells ) 0 iro latCell mesh - -
var persistent real lonCell ( nCells ) 0 iro lonCell mesh - -
Modified: branches/atmos_physics/src/core_ocean/module_global_diagnostics.F
===================================================================
--- branches/atmos_physics/src/core_ocean/module_global_diagnostics.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_ocean/module_global_diagnostics.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -322,7 +322,7 @@
write (fileID,'(100es24.16)') averages(1:nVariables)
close (fileID)
open(fileID,file='stats_time.txt',ACCESS='append')
- write (fileID,'(i5,100es24.16)') timeIndex, &
+ write (fileID,'(i5,10x,a,100es24.16)') timeIndex, &
state % xtime % scalar, dt, &
CFLNumberGlobal
close (fileID)
Modified: branches/atmos_physics/src/core_ocean/module_mpas_core.F
===================================================================
--- branches/atmos_physics/src/core_ocean/module_mpas_core.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_ocean/module_mpas_core.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,24 +1,32 @@
module mpas_core
use mpas_framework
+ use mpas_timekeeping
use dmpar
- use test_cases
+ use test_cases
type (io_output_object) :: restart_obj
integer :: restart_frame
+ integer :: current_outfile_frames
+ type (MPAS_Clock_type) :: clock
+
+ integer, parameter :: outputAlarmID = 1
+ integer, parameter :: restartAlarmID = 2
+ integer, parameter :: statsAlarmID = 3
+
contains
+ subroutine mpas_core_init(domain, startTimeStamp)
- subroutine mpas_core_init(domain)
-
use configure
use grid_types
implicit none
type (domain_type), intent(inout) :: domain
+ character(len=*), intent(out) :: startTimeStamp
real (kind=RKIND) :: dt
type (block_type), pointer :: block
@@ -43,9 +51,13 @@
! Initialize core
!
dt = config_dt
+
+ call simulation_clock_init(domain, dt, startTimeStamp)
+
block => domain % blocklist
do while (associated(block))
call mpas_init_block(block, block % mesh, dt)
+ block % state % time_levs(1) % state % xtime % scalar = startTimeStamp
block => block % next
end do
@@ -60,10 +72,70 @@
! call write_output_frame(output_obj, domain)
restart_frame = 1
+ current_outfile_frames = 0
end subroutine mpas_core_init
+ subroutine simulation_clock_init(domain, dt, startTimeStamp)
+
+ implicit none
+
+ type (domain_type), intent(inout) :: domain
+ real (kind=RKIND), intent(in) :: dt
+ character(len=*), intent(out) :: startTimeStamp
+
+ type (MPAS_Time_Type) :: startTime, stopTime, alarmStartTime
+ type (MPAS_TimeInterval_type) :: runDuration, timeStep, alarmTimeStep
+ integer :: ierr
+
+ call MPAS_setTime(curr_time=startTime, dateTimeString=config_start_time, ierr=ierr)
+ call MPAS_setTimeInterval(timeStep, dt=dt, ierr=ierr)
+
+ if (trim(config_run_duration) /= "none") then
+ call MPAS_setTimeInterval(runDuration, timeString=config_run_duration, ierr=ierr)
+ call MPAS_createClock(clock, startTime=startTime, timeStep=timeStep, runDuration=runDuration, ierr=ierr)
+
+ if (trim(config_stop_time) /= "none") then
+ call MPAS_setTime(curr_time=stopTime, dateTimeString=config_stop_time, ierr=ierr)
+ if(startTime + runduration /= stopTime) then
+ write(0,*) 'Warning: config_run_duration and config_stop_time are inconsitent: using config_run_duration.'
+ end if
+ end if
+ else if (trim(config_stop_time) /= "none") then
+ call MPAS_setTime(curr_time=stopTime, dateTimeString=config_stop_time, ierr=ierr)
+ call MPAS_createClock(clock, startTime=startTime, timeStep=timeStep, stopTime=stopTime, ierr=ierr)
+ else
+ write(0,*) 'Error: Neither config_run_duration nor config_stop_time were specified.'
+ call dmpar_finalize(domain % dminfo)
+ end if
+
+ ! set output alarm
+ call MPAS_setTimeInterval(alarmTimeStep, timeString=config_output_interval, ierr=ierr)
+ alarmStartTime = startTime + alarmTimeStep
+ call MPAS_addClockAlarm(clock, outputAlarmID, alarmStartTime, alarmTimeStep, ierr=ierr)
+
+ ! set restart alarm, if necessary
+ if (trim(config_restart_interval) /= "none") then
+ call MPAS_setTimeInterval(alarmTimeStep, timeString=config_restart_interval, ierr=ierr)
+ alarmStartTime = startTime + alarmTimeStep
+ call MPAS_addClockAlarm(clock, restartAlarmID, alarmStartTime, alarmTimeStep, ierr=ierr)
+ end if
+
+ !TODO: use this code if we desire to convert config_stats_interval to alarms
+ !(must also change config_stats_interval type to character)
+ ! set stats alarm, if necessary
+ !if (trim(config_stats_interval) /= "none") then
+ ! call MPAS_setTimeInterval(alarmTimeStep, timeString=config_stats_interval, ierr=ierr)
+ ! alarmStartTime = startTime + alarmTimeStep
+ ! call MPAS_addClockAlarm(clock, statsAlarmID, alarmStartTime, alarmTimeStep, ierr=ierr)
+ !end if
+
+ call MPAS_getTime(curr_time=startTime, dateTimeString=startTimeStamp, ierr=ierr)
+
+ end subroutine simulation_clock_init
+
+
subroutine mpas_init_block(block, mesh, dt)
use grid_types
@@ -107,9 +179,7 @@
:block % mesh % nVertLevels,iCell) = -1e34
end do
- if (.not. config_do_restart) then
- block % state % time_levs(1) % state % xtime % scalar = 0.0
- else
+ if (config_do_restart) then
do i=2,nTimeLevs
call copy_state(block % state % time_levs(i) % state, &
block % state % time_levs(1) % state)
@@ -131,39 +201,55 @@
type (io_output_object), intent(inout) :: output_obj
integer, intent(inout) :: output_frame
- integer :: ntimesteps, itimestep
+ integer :: itimestep
real (kind=RKIND) :: dt
type (block_type), pointer :: block_ptr
+
+ type (MPAS_Time_Type) :: currTime
+ character(len=32) :: timeStamp
+ integer :: ierr
! Eventually, dt should be domain specific
dt = config_dt
- ntimesteps = config_ntimesteps
-
+
+ currTime = MPAS_getClockTime(clock, MPAS_NOW, ierr)
+ call MPAS_getTime(curr_time=currTime, dateTimeString=timeStamp, ierr=ierr)
+ write(0,*) 'Initial time ', timeStamp
+
call write_output_frame(output_obj, output_frame, domain)
! During integration, time level 1 stores the model state at the beginning of the
! time step, and time level 2 stores the state advanced dt in time by timestep(...)
- do itimestep = 1,ntimesteps
- write(0,*) 'Doing timestep ', itimestep
+ itimestep = 0
+ do while (.not. MPAS_isClockStopTime(clock))
+
+ itimestep = itimestep + 1
+ call MPAS_advanceClock(clock)
+
+ currTime = MPAS_getClockTime(clock, MPAS_NOW, ierr)
+ call MPAS_getTime(curr_time=currTime, dateTimeString=timeStamp, ierr=ierr)
+ write(0,*) 'Doing timestep ', timeStamp
+
call timer_start("time integration")
- call mpas_timestep(domain, itimestep, dt)
+ call mpas_timestep(domain, itimestep, dt, timeStamp)
call timer_stop("time integration")
! Move time level 2 fields back into time level 1 for next time step
call shift_time_levels_state(domain % blocklist % state)
-
- if (config_output_interval > 0) then
- if (mod(itimestep, config_output_interval) == 0) then
- call write_output_frame(output_obj, output_frame, domain)
- end if
- endif
- if (config_restart_interval > 0) then
- if (mod(itimestep, config_restart_interval) == 0) then
- if (restart_frame == 1) call output_state_init(restart_obj, domain, "RESTART")
- call output_state_for_domain(restart_obj, domain, restart_frame)
- restart_frame = restart_frame + 1
- end if
- endif
+
+ if (MPAS_isAlarmRinging(clock, outputAlarmID, ierr=ierr)) then
+ call MPAS_resetClockAlarm(clock, outputAlarmID, ierr=ierr)
+ if(output_frame == 1) call output_state_init(output_obj, domain, "OUTPUT", trim(timeStamp)) ! output_frame will always be > 1 here unless it is reset after the output file is finalized
+ call write_output_frame(output_obj, output_frame, domain)
+ end if
+
+ if (MPAS_isAlarmRinging(clock, restartAlarmID, ierr=ierr)) then
+ call MPAS_resetClockAlarm(clock, restartAlarmID, ierr=ierr)
+ if (restart_frame == 1) call output_state_init(restart_obj, domain, "RESTART")
+ call output_state_for_domain(restart_obj, domain, restart_frame)
+ restart_frame = restart_frame + 1
+ end if
+
end do
end subroutine mpas_core_run
@@ -198,6 +284,16 @@
call output_state_for_domain(output_obj, domain, output_frame)
output_frame = output_frame + 1
+
+ ! if the maximum number of frames per outfile has been reached, finalize outfile and reset frame
+ if (config_frames_per_outfile > 0) then
+ current_outfile_frames = current_outfile_frames + 1
+ if(current_outfile_frames >= config_frames_per_outfile) then
+ current_outfile_frames = 0
+ call output_state_finalize(output_obj, domain % dminfo)
+ output_frame = 1
+ end if
+ end if
end subroutine write_output_frame
@@ -225,7 +321,7 @@
end subroutine compute_output_diagnostics
- subroutine mpas_timestep(domain, itimestep, dt)
+ subroutine mpas_timestep(domain, itimestep, dt, timeStamp)
use grid_types
use time_integration
@@ -237,10 +333,13 @@
type (domain_type), intent(inout) :: domain
integer, intent(in) :: itimestep
real (kind=RKIND), intent(in) :: dt
+ character(len=*), intent(in) :: timeStamp
+
type (block_type), pointer :: block_ptr
+ integer :: ierr
- call timestep(domain, dt)
-
+ call timestep(domain, dt, timeStamp)
+
if (config_stats_interval > 0) then
if (mod(itimestep, config_stats_interval) == 0) then
block_ptr => domain % blocklist
@@ -248,7 +347,7 @@
write(0,*) 'Error: computeGlobalDiagnostics assumes ',&
'that there is only one block per processor.'
end if
-
+
call timer_start("global diagnostics")
call computeGlobalDiagnostics(domain % dminfo, &
block_ptr % state % time_levs(2) % state, block_ptr % mesh, &
@@ -256,7 +355,24 @@
call timer_stop("global diagnostics")
end if
end if
+
+ !TODO: replace the above code block with this if we desire to convert config_stats_interval to use alarms
+ !if (MPAS_isAlarmRinging(clock, statsAlarmID, ierr=ierr)) then
+ ! call MPAS_resetClockAlarm(clock, statsAlarmID, ierr=ierr)
+
+ ! block_ptr => domain % blocklist
+ ! if (associated(block_ptr % next)) then
+ ! write(0,*) 'Error: computeGlobalDiagnostics assumes ',&
+ ! 'that there is only one block per processor.'
+ ! end if
+ ! call timer_start("global diagnostics")
+ ! call computeGlobalDiagnostics(domain % dminfo, &
+ ! block_ptr % state % time_levs(2) % state, block_ptr % mesh, &
+ ! timeStamp, dt)
+ ! call timer_stop("global diagnostics")
+ !end if
+
end subroutine mpas_timestep
@@ -452,11 +568,15 @@
use grid_types
implicit none
-
+
+ integer :: ierr
+
type (domain_type), intent(inout) :: domain
if (restart_frame > 1) call output_state_finalize(restart_obj, domain % dminfo)
-
+
+ call MPAS_destroyClock(clock, ierr)
+
end subroutine mpas_core_finalize
end module mpas_core
Modified: branches/atmos_physics/src/core_ocean/module_time_integration.F
===================================================================
--- branches/atmos_physics/src/core_ocean/module_time_integration.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_ocean/module_time_integration.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -9,7 +9,7 @@
contains
- subroutine timestep(domain, dt)
+ subroutine timestep(domain, dt, timeStamp)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Advance model state forward in time by the specified time step
!
@@ -23,6 +23,7 @@
type (domain_type), intent(inout) :: domain
real (kind=RKIND), intent(in) :: dt
+ character(len=*), intent(in) :: timeStamp
type (dm_info) :: dminfo
type (block_type), pointer :: block
@@ -38,8 +39,7 @@
block => domain % blocklist
do while (associated(block))
- block % state % time_levs(2) % state % xtime % scalar &
- = block % state % time_levs(1) % state % xtime % scalar + dt
+ block % state % time_levs(2) % state % xtime % scalar = timeStamp
if (isNaN(sum(block % state % time_levs(2) % state % u % array))) then
write(0,*) 'Abort: NaN detected'
Modified: branches/atmos_physics/src/core_physics/Makefile
===================================================================
--- branches/atmos_physics/src/core_physics/Makefile        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_physics/Makefile        2011-09-07 00:23:57 UTC (rev 979)
@@ -87,7 +87,7 @@
        ./physics_wrf/module_ra_rrtmg_lw.o
module_driver_radiation_sw.o: \
-        module_physics_aquaplanet.o \
+        module_physics_manager.o \
        module_physics_constants.o \
        module_physics_rrtmg_swinit.o \
        module_physics_vars.o \
@@ -115,7 +115,7 @@
        module_physics_landuse.o
module_physics_landuse.o: \
-        module_physics_aquaplanet.o \
+        module_physics_manager.o \
        module_physics_utilities.o
module_physics_lsm_noahinit.o: \
@@ -200,4 +200,4 @@
.F.o:
        $(RM) $@ $*.mod
        $(CPP) $(CPPFLAGS) $(COREDEF) $(CPPINCLUDES) -DIWORDSIZE=4 -DRWORDSIZE=8 $< > $*.f90
-        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I./physics_wrf -I./physics_eaung
+        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I./physics_wrf -I./physics_eaung -I../external/esmf_time_f90
Modified: branches/atmos_physics/src/core_physics/module_driver_microphysics.F
===================================================================
--- branches/atmos_physics/src/core_physics/module_driver_microphysics.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_physics/module_driver_microphysics.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -296,7 +296,7 @@
! dynamics grid:
#ifdef non_hydrostatic_core
- call microphysics_to_MPAS(mesh,state,diag,tend,itimestep)
+ call microphysics_to_MPAS(mesh,state,diag,tend)
#elif hydrostatic_core
call microphysics_to_MPAS(state,tend)
#endif
Modified: branches/atmos_physics/src/core_physics/module_driver_radiation_sw.F
===================================================================
--- branches/atmos_physics/src/core_physics/module_driver_radiation_sw.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_physics/module_driver_radiation_sw.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -2,7 +2,8 @@
module module_driver_radiation_sw
use grid_types
- use module_physics_aquaplanet !temporary until we have a time manager and sfc conditions.
+ !use module_physics_aquaplanet !temporary until we have a time manager and sfc conditions.
+ use module_physics_manager
use module_physics_constants
use module_physics_rrtmg_swinit
use module_physics_vars
@@ -231,23 +232,25 @@
!=============================================================================================
subroutine driver_radiation_sw(itimestep,mesh,state,diag_physics,sfc_input, &
- tend_physics)
+ tend_physics, xtime_s)
!=============================================================================================
!input arguments:
integer,intent(in):: itimestep
type(mesh_type),intent(in) :: mesh
type(state_type),intent(in):: state
+ real(kind=RKIND),intent(in):: xtime_s
!inout arguments:
type(diag_physics_type),intent(inout):: diag_physics
type(sfc_input_type) ,intent(inout):: sfc_input
type(tend_physics_type),intent(inout):: tend_physics
+
!local variables:
real(kind=RKIND):: radt,xtime_m
- real(kind=RKIND),pointer:: xtime
+ !real(kind=RKIND),pointer:: xtime
!---------------------------------------------------------------------------------------------
write(0,100) itimestep
@@ -257,14 +260,14 @@
101 format(2i6,8(1x,e15.8))
102 format(3i6,8(1x,e15.8))
- xtime => state % xtime % scalar
- xtime_m = xtime/60.
+ !xtime => state % xtime % scalar
+ xtime_m = xtime_s/60.
!copy all MPAS arrays to rectangular grid:
call radiation_sw_from_MPAS(mesh,diag_physics,sfc_input)
!... calculates solar declination:
- call radconst(xtime,declin,solcon,julday,degrad,dpd)
+ call radconst(declin,solcon,julday,degrad,dpd)
!... convert the radiation time_step to minutes:
radt = dt_radtsw/60.
@@ -341,12 +344,12 @@
end subroutine driver_radiation_sw
!=============================================================================================
- subroutine radconst(xtime,declin,solcon,julian,degrad,dpd)
+ subroutine radconst(declin,solcon,julian,degrad,dpd)
!=============================================================================================
!input arguments:
integer,intent(in):: julian
- real(kind=RKIND),intent(in):: degrad,dpd,xtime
+ real(kind=RKIND),intent(in):: degrad,dpd
!output arguments:
real(kind=RKIND),intent(out):: declin,solcon
Modified: branches/atmos_physics/src/core_physics/module_physics_driver.F
===================================================================
--- branches/atmos_physics/src/core_physics/module_physics_driver.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_physics/module_physics_driver.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -25,13 +25,15 @@
contains
!=============================================================================================
- subroutine physics_driver(domain,itimestep)
+ subroutine physics_driver(domain,itimestep, xtime_s)
!=============================================================================================
!input arguments:
!----------------
integer,intent(in):: itimestep
+ real (kind=RKIND), intent(in) :: xtime_s
+
!inout arguments:
!----------------
type(domain_type),intent(inout):: domain
@@ -75,7 +77,8 @@
if(l_radtsw) then
call allocate_radiation_sw
call driver_radiation_sw(itimestep,block%mesh,block%state%time_levs(1)%state, &
- block%diag_physics,block%sfc_input,block%tend_physics)
+ block%diag_physics,block%sfc_input,block%tend_physics, &
+ xtime_s)
endif
!call to long wave radiation scheme:
Modified: branches/atmos_physics/src/core_physics/module_physics_interface_nhyd.F
===================================================================
--- branches/atmos_physics/src/core_physics/module_physics_interface_nhyd.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_physics/module_physics_interface_nhyd.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -456,11 +456,10 @@
end subroutine microphysics_from_MPAS
!=============================================================================================
- subroutine microphysics_to_MPAS(mesh,state,diag,tend,itimestep)
+ subroutine microphysics_to_MPAS(mesh,state,diag,tend)
!=============================================================================================
!input variables:
- integer,intent(in):: itimestep
type(mesh_type),intent(in):: mesh
!output variables:
Modified: branches/atmos_physics/src/core_physics/module_physics_landuse.F
===================================================================
--- branches/atmos_physics/src/core_physics/module_physics_landuse.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_physics/module_physics_landuse.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -8,7 +8,8 @@
use dmpar
use grid_types
- use module_physics_aquaplanet !for now,we set the julian day to March 21.
+ !use module_physics_aquaplanet !for now,we set the julian day to March 21.
+ use module_physics_manager
use module_physics_utilities
use module_physics_vars
Modified: branches/atmos_physics/src/core_physics/module_physics_manager.F
===================================================================
--- branches/atmos_physics/src/core_physics/module_physics_manager.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_physics/module_physics_manager.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -2,16 +2,22 @@
module module_physics_manager
use configure
use grid_types
-
+ use mpas_timekeeping
+
use module_physics_vars
implicit none
private
public:: physics_timetracker,physics_run_init
+ integer, public :: julday !Julian day
+ real(kind=RKIND), public :: gmt !Greenwich mean time hour of model start (hr)
+
+
logical, public:: l_physics
integer, private:: i,k,j,n
+
contains
!=============================================================================================
@@ -49,16 +55,30 @@
end subroutine physics_timetracker
!=============================================================================================
- subroutine physics_run_init(mesh)
+ subroutine physics_run_init(mesh, clock)
!=============================================================================================
!input arguments:
type(mesh_type),intent(in):: mesh
+ type (MPAS_Clock_type) :: clock
+ type (MPAS_Time_Type) :: startTime
+ integer :: h, m, s, s_n, s_d, DoY
+ real(kind=RKIND) :: utc_h
+ integer :: ierr
+
!=============================================================================================
write(0,*)
write(0,*) '--- enter subroutine physics_wrf_interface:'
+!initialization of gmt, julian day, and alarms:
+
+ startTime = MPAS_getClockTime(clock, MPAS_START_TIME, ierr)
+ call MPAS_getTime(curr_time=startTime, H=h, M=m, S=s, S_n=s_n, S_d=s_d, DoY=DoY, ierr=ierr)
+ utc_h = real(h) + real(m) / 60.0 + real(s + s_n / s_d) / 3600.0
+ gmt = utc_h
+ julday = DoY
+
!initialization of wrf dimensions:
!ldf (10-10-201): changed initialization
Modified: branches/atmos_physics/src/core_sw/Makefile
===================================================================
--- branches/atmos_physics/src/core_sw/Makefile        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_sw/Makefile        2011-09-07 00:23:57 UTC (rev 979)
@@ -27,4 +27,4 @@
.F.o:
        $(RM) $@ $*.mod
        $(CPP) $(CPPFLAGS) $(CPPINCLUDES) $< > $*.f90
-        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators
+        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../operators -I../external/esmf_time_f90
Modified: branches/atmos_physics/src/core_sw/Registry
===================================================================
--- branches/atmos_physics/src/core_sw/Registry        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_sw/Registry        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,31 +1,34 @@
#
# namelist type namelist_record name default_value
#
-namelist integer sw_model config_test_case 5
-namelist character sw_model config_time_integration RK4
-namelist real sw_model config_dt 172.8
-namelist integer sw_model config_ntimesteps 7500
-namelist integer sw_model config_output_interval 500
-namelist integer sw_model config_stats_interval 100
-namelist logical sw_model config_h_ScaleWithMesh false
-namelist real sw_model config_h_mom_eddy_visc2 0.0
-namelist real sw_model config_h_mom_eddy_visc4 0.0
-namelist real sw_model config_h_tracer_eddy_diff2 0.0
-namelist real sw_model config_h_tracer_eddy_diff4 0.0
-namelist integer sw_model config_thickness_adv_order 2
-namelist integer sw_model config_tracer_adv_order 2
-namelist logical sw_model config_positive_definite false
-namelist logical sw_model config_monotonic false
-namelist logical sw_model config_wind_stress                        false
-namelist logical sw_model config_bottom_drag                        false
-namelist real sw_model config_apvm_upwinding 0.5
-namelist character io config_input_name grid.nc
-namelist character io config_output_name output.nc
-namelist character io config_restart_name restart.nc
-namelist character io config_decomp_file_prefix graph.info.part.
-namelist integer restart config_restart_interval 0
-namelist logical restart config_do_restart false
-namelist real restart config_restart_time 172800.0
+namelist integer sw_model config_test_case 5
+namelist character sw_model config_time_integration RK4
+namelist real sw_model config_dt 172.8
+namelist integer sw_model config_calendar_type MPAS_360DAY
+namelist character sw_model config_start_time 0000-01-01_00:00:00
+namelist character sw_model config_stop_time none
+namelist character sw_model config_run_duration none
+namelist integer sw_model config_stats_interval 100
+namelist logical sw_model config_h_ScaleWithMesh false
+namelist real sw_model config_h_mom_eddy_visc2 0.0
+namelist real sw_model config_h_mom_eddy_visc4 0.0
+namelist real sw_model config_h_tracer_eddy_diff2 0.0
+namelist real sw_model config_h_tracer_eddy_diff4 0.0
+namelist integer sw_model config_thickness_adv_order 2
+namelist integer sw_model config_tracer_adv_order 2
+namelist logical sw_model config_positive_definite false
+namelist logical sw_model config_monotonic false
+namelist logical sw_model config_wind_stress false
+namelist logical sw_model config_bottom_drag false
+namelist real sw_model config_apvm_upwinding 0.5
+namelist character io config_input_name grid.nc
+namelist character io config_output_name output.nc
+namelist character io config_restart_name restart.nc
+namelist character io config_output_interval 06:00:00
+namelist integer io config_frames_per_outfile 0
+namelist character io config_decomp_file_prefix graph.info.part.
+namelist logical restart config_do_restart false
+namelist character restart config_restart_interval none
#
# dim type name_in_file name_in_code
@@ -46,7 +49,7 @@
#
# var persistence type name_in_file ( dims ) time_levs iro- name_in_code struct super-array array_class
#
-var persistent real xtime ( Time ) 2 ro xtime state - -
+var persistent text xtime ( Time ) 2 ro xtime state - -
var persistent real latCell ( nCells ) 0 iro latCell mesh - -
var persistent real lonCell ( nCells ) 0 iro lonCell mesh - -
@@ -152,5 +155,5 @@
var persistent real circulation ( nVertLevels nVertices Time ) 2 - circulation state - -
var persistent real gradPVt ( nVertLevels nEdges Time ) 2 - gradPVt state - -
var persistent real gradPVn ( nVertLevels nEdges Time ) 2 - gradPVn state - -
-var persistent real        h_vertex ( nVertLevels nVertices Time ) 2 - h_vertex state - -
+var persistent real h_vertex ( nVertLevels nVertices Time ) 2 - h_vertex state - -
Modified: branches/atmos_physics/src/core_sw/module_mpas_core.F
===================================================================
--- branches/atmos_physics/src/core_sw/module_mpas_core.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_sw/module_mpas_core.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,15 +1,21 @@
module mpas_core
use mpas_framework
+ use mpas_timekeeping
type (io_output_object) :: restart_obj
integer :: restart_frame
+ integer :: current_outfile_frames
+ type (MPAS_Clock_type) :: clock
+ integer, parameter :: outputAlarmID = 1
+ integer, parameter :: restartAlarmID = 2
+ !integer, parameter :: statsAlarmID = 3
+
contains
-
- subroutine mpas_core_init(domain)
+ subroutine mpas_core_init(domain, startTimeStamp)
use configure
use grid_types
@@ -18,6 +24,7 @@
implicit none
type (domain_type), intent(inout) :: domain
+ character(len=*), intent(out) :: startTimeStamp
real (kind=RKIND) :: dt
type (block_type), pointer :: block
@@ -29,17 +36,81 @@
! Initialize core
!
dt = config_dt
+
+ call simulation_clock_init(domain, dt, startTimeStamp)
+
block => domain % blocklist
do while (associated(block))
call mpas_init_block(block, block % mesh, dt)
+ block % state % time_levs(1) % state % xtime % scalar = startTimeStamp
block => block % next
end do
restart_frame = 1
-
+ current_outfile_frames = 0
+
end subroutine mpas_core_init
-
-
+
+
+ subroutine simulation_clock_init(domain, dt, startTimeStamp)
+
+ implicit none
+
+ type (domain_type), intent(inout) :: domain
+ real (kind=RKIND), intent(in) :: dt
+ character(len=*), intent(out) :: startTimeStamp
+
+ type (MPAS_Time_Type) :: startTime, stopTime, alarmStartTime
+ type (MPAS_TimeInterval_type) :: runDuration, timeStep, alarmTimeStep
+ integer :: ierr
+
+ call MPAS_setTime(curr_time=startTime, dateTimeString=config_start_time, ierr=ierr)
+ call MPAS_setTimeInterval(timeStep, dt=dt, ierr=ierr)
+
+ if (trim(config_run_duration) /= "none") then
+ call MPAS_setTimeInterval(runDuration, timeString=config_run_duration, ierr=ierr)
+ call MPAS_createClock(clock, startTime=startTime, timeStep=timeStep, runDuration=runDuration, ierr=ierr)
+
+ if (trim(config_stop_time) /= "none") then
+ call MPAS_setTime(curr_time=stopTime, dateTimeString=config_stop_time, ierr=ierr)
+ if(startTime + runduration /= stopTime) then
+ write(0,*) 'Warning: config_run_duration and config_stop_time are inconsitent: using config_run_duration.'
+ end if
+ end if
+ else if (trim(config_stop_time) /= "none") then
+ call MPAS_setTime(curr_time=stopTime, dateTimeString=config_stop_time, ierr=ierr)
+ call MPAS_createClock(clock, startTime=startTime, timeStep=timeStep, stopTime=stopTime, ierr=ierr)
+ else
+ write(0,*) 'Error: Neither config_run_duration nor config_stop_time were specified.'
+ call dmpar_abort(domain % dminfo)
+ end if
+
+ ! set output alarm
+ call MPAS_setTimeInterval(alarmTimeStep, timeString=config_output_interval, ierr=ierr)
+ alarmStartTime = startTime + alarmTimeStep
+ call MPAS_addClockAlarm(clock, outputAlarmID, alarmStartTime, alarmTimeStep, ierr=ierr)
+
+ ! set restart alarm, if necessary
+ if (trim(config_restart_interval) /= "none") then
+ call MPAS_setTimeInterval(alarmTimeStep, timeString=config_restart_interval, ierr=ierr)
+ alarmStartTime = startTime + alarmTimeStep
+ call MPAS_addClockAlarm(clock, restartAlarmID, alarmStartTime, alarmTimeStep, ierr=ierr)
+ end if
+
+ !TODO: use this code if we desire to convert config_stats_interval to alarms
+ !(must also change config_stats_interval type to character)
+ ! set stats alarm, if necessary
+ !if (trim(config_stats_interval) /= "none") then
+ ! call MPAS_setTimeInterval(alarmTimeStep, timeString=config_stats_interval, ierr=ierr)
+ ! alarmStartTime = startTime + alarmTimeStep
+ ! call MPAS_addClockAlarm(clock, statsAlarmID, alarmStartTime, alarmTimeStep, ierr=ierr)
+ !end if
+
+ call MPAS_getTime(curr_time=startTime, dateTimeString=startTimeStamp, ierr=ierr)
+
+ end subroutine simulation_clock_init
+
+
subroutine mpas_init_block(block, mesh, dt)
use grid_types
@@ -53,7 +124,7 @@
type (mesh_type), intent(inout) :: mesh
real (kind=RKIND), intent(in) :: dt
-
+
call compute_solve_diagnostics(dt, block % state % time_levs(1) % state, mesh)
call compute_mesh_scaling(mesh)
@@ -61,8 +132,6 @@
call init_reconstruct(mesh)
call reconstruct(block % state % time_levs(1) % state, block % diag, mesh)
- if (.not. config_do_restart) block % state % time_levs(1) % state % xtime % scalar = 0.0
-
end subroutine mpas_init_block
@@ -77,36 +146,58 @@
type (domain_type), intent(inout) :: domain
type (io_output_object), intent(inout) :: output_obj
integer, intent(inout) :: output_frame
-
- integer :: ntimesteps, itimestep
+
+ integer :: itimestep
real (kind=RKIND) :: dt
type (block_type), pointer :: block_ptr
+
+ type (MPAS_Time_Type) :: currTime
+ character(len=32) :: timeStamp
+ integer :: ierr
! Eventually, dt should be domain specific
dt = config_dt
- ntimesteps = config_ntimesteps
-
+
+ currTime = MPAS_getClockTime(clock, MPAS_NOW, ierr)
+ call MPAS_getTime(curr_time=currTime, dateTimeString=timeStamp, ierr=ierr)
+ write(0,*) 'Initial timestep ', timeStamp
+
call write_output_frame(output_obj, output_frame, domain)
-
+
! During integration, time level 1 stores the model state at the beginning of the
! time step, and time level 2 stores the state advanced dt in time by timestep(...)
- do itimestep = 1,ntimesteps
- write(0,*) 'Doing timestep ', itimestep
+ itimestep = 0
+ do while (.not. MPAS_isClockStopTime(clock))
+
+ itimestep = itimestep + 1
+ call MPAS_advanceClock(clock)
+
+ currTime = MPAS_getClockTime(clock, MPAS_NOW, ierr)
+ call MPAS_getTime(curr_time=currTime, dateTimeString=timeStamp, ierr=ierr)
+ write(0,*) 'Doing timestep ', timeStamp
+
call timer_start("time integration")
- call mpas_timestep(domain, itimestep, dt)
+ call mpas_timestep(domain, itimestep, dt, timeStamp)
call timer_stop("time integration")
-
+
! Move time level 2 fields back into time level 1 for next time step
call shift_time_levels_state(domain % blocklist % state)
-
- if (mod(itimestep, config_output_interval) == 0) then
+
+ !TODO: MPAS_getClockRingingAlarms is probably faster than multiple MPAS_isAlarmRinging...
+
+ if (MPAS_isAlarmRinging(clock, outputAlarmID, ierr=ierr)) then
+ call MPAS_resetClockAlarm(clock, outputAlarmID, ierr=ierr)
+ if(output_frame == 1) call output_state_init(output_obj, domain, "OUTPUT", trim(timeStamp)) ! output_frame will always be > 1 here unless it is reset after the output file is finalized
call write_output_frame(output_obj, output_frame, domain)
end if
- if (mod(itimestep, config_restart_interval) == 0 .and. config_restart_interval > 0) then
+
+ if (MPAS_isAlarmRinging(clock, restartAlarmID, ierr=ierr)) then
+ call MPAS_resetClockAlarm(clock, restartAlarmID, ierr=ierr)
if (restart_frame == 1) call output_state_init(restart_obj, domain, "RESTART")
call output_state_for_domain(restart_obj, domain, restart_frame)
restart_frame = restart_frame + 1
end if
+
end do
end subroutine mpas_core_run
@@ -124,10 +215,10 @@
use io_output
implicit none
-
+
+ type (io_output_object), intent(inout) :: output_obj
integer, intent(inout) :: output_frame
type (domain_type), intent(inout) :: domain
- type (io_output_object), intent(inout) :: output_obj
integer :: i, j, k
integer :: eoe
@@ -141,7 +232,17 @@
call output_state_for_domain(output_obj, domain, output_frame)
output_frame = output_frame + 1
-
+
+ ! if the maximum number of frames per outfile has been reached, finalize outfile and reset frame
+ if (config_frames_per_outfile > 0) then
+ current_outfile_frames = current_outfile_frames + 1
+ if(current_outfile_frames >= config_frames_per_outfile) then
+ current_outfile_frames = 0
+ call output_state_finalize(output_obj, domain % dminfo)
+ output_frame = 1
+ end if
+ end if
+
end subroutine write_output_frame
@@ -168,7 +269,7 @@
end subroutine compute_output_diagnostics
- subroutine mpas_timestep(domain, itimestep, dt)
+ subroutine mpas_timestep(domain, itimestep, dt, timeStamp)
use grid_types
use time_integration
@@ -180,9 +281,12 @@
type (domain_type), intent(inout) :: domain
integer, intent(in) :: itimestep
real (kind=RKIND), intent(in) :: dt
+ character(len=*), intent(in) :: timeStamp
+
type (block_type), pointer :: block_ptr
+ integer :: ierr
- call timestep(domain, dt)
+ call timestep(domain, dt, timeStamp)
if(config_stats_interval .gt. 0) then
if(mod(itimestep, config_stats_interval) == 0) then
@@ -199,6 +303,23 @@
call timer_stop("global_diagnostics")
end if
end if
+
+ !TODO: replace the above code block with this if we desire to convert config_stats_interval to use alarms
+ !if (MPAS_isAlarmRinging(clock, statsAlarmID, ierr=ierr)) then
+ ! call MPAS_resetClockAlarm(clock, statsAlarmID, ierr=ierr)
+
+ ! block_ptr => domain % blocklist
+ ! if(associated(block_ptr % next)) then
+ ! write(0,*) 'Error: computeGlobalDiagnostics assumes ',&
+ ! 'that there is only one block per processor.'
+ ! end if
+
+ ! call timer_start("global_diagnostics")
+ ! call computeGlobalDiagnostics(domain % dminfo, &
+ ! block_ptr % state % time_levs(2) % state, block_ptr % mesh, &
+ ! timeStamp, dt)
+ ! call timer_stop("global_diagnostics")
+ !end if
end subroutine mpas_timestep
@@ -208,11 +329,14 @@
use grid_types
implicit none
-
+
type (domain_type), intent(inout) :: domain
+ integer :: ierr
if (restart_frame > 1) call output_state_finalize(restart_obj, domain % dminfo)
-
+
+ call MPAS_destroyClock(clock, ierr)
+
end subroutine mpas_core_finalize
Modified: branches/atmos_physics/src/core_sw/module_time_integration.F
===================================================================
--- branches/atmos_physics/src/core_sw/module_time_integration.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/core_sw/module_time_integration.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -10,7 +10,7 @@
contains
- subroutine timestep(domain, dt)
+ subroutine timestep(domain, dt, timeStamp)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Advance model state forward in time by the specified time step
!
@@ -24,6 +24,7 @@
type (domain_type), intent(inout) :: domain
real (kind=RKIND), intent(in) :: dt
+ character(len=*), intent(in) :: timeStamp
type (block_type), pointer :: block
@@ -37,7 +38,7 @@
block => domain % blocklist
do while (associated(block))
- block % state % time_levs(2) % state % xtime % scalar = block % state % time_levs(1) % state % xtime % scalar + dt
+ block % state % time_levs(2) % state % xtime % scalar = timeStamp
block => block % next
end do
Modified: branches/atmos_physics/src/driver/Makefile
===================================================================
--- branches/atmos_physics/src/driver/Makefile        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/driver/Makefile        2011-09-07 00:23:57 UTC (rev 979)
@@ -15,4 +15,4 @@
.F.o:
        $(RM) $@ $*.mod
        $(CPP) $(CPPFLAGS) $(CPPINCLUDES) $< > $*.f90
-        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../core_$(CORE)
+        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../framework -I../core_$(CORE) -I../external/esmf_time_f90
Modified: branches/atmos_physics/src/driver/module_mpas_subdriver.F
===================================================================
--- branches/atmos_physics/src/driver/module_mpas_subdriver.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/driver/module_mpas_subdriver.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -17,6 +17,7 @@
implicit none
real (kind=RKIND) :: dt
+ character(len=32) :: timeStamp
call timer_start("total time")
call timer_start("initialize")
@@ -34,7 +35,7 @@
!
! Initialize core
!
- call mpas_core_init(domain)
+ call mpas_core_init(domain, timeStamp)
call timer_stop("initialize")
@@ -43,8 +44,13 @@
! Set up output streams to be written to by the MPAS core
!
output_frame = 1
- call output_state_init(output_obj, domain, "OUTPUT")
+ if(config_frames_per_outfile > 0) then
+ call output_state_init(output_obj, domain, "OUTPUT", trim(timeStamp))
+ else
+ call output_state_init(output_obj, domain, "OUTPUT")
+ end if
+
end subroutine mpas_init
Modified: branches/atmos_physics/src/external/Makefile
===================================================================
--- branches/atmos_physics/src/external/Makefile        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/external/Makefile        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,9 +1,9 @@
.SUFFIXES: .F .c .o
-all: dummy
+all: esmf_time
-dummy:
-        echo "*** Compiling external packages ***"
+esmf_time:
+        ( cd esmf_time_f90; make FC="$(FC) $(FFLAGS)" CPP="$(CPP)" )
clean:
-        echo "*** Cleaning external packages ***"
+        ( cd esmf_time_f90; make clean )
Deleted: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Alarm.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/ESMF_Alarm.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Alarm.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,953 +0,0 @@
-!
-! Earth System Modeling Framework
-! Copyright 2002-2003, University Corporation for Atmospheric Research,
-! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
-! Laboratory, University of Michigan, National Centers for Environmental
-! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
-! NASA Goddard Space Flight Center.
-! Licensed under the University of Illinois-NCSA license.
-!
-!==============================================================================
-!
-! ESMF Alarm Module
- module ESMF_AlarmMod
-!
-!==============================================================================
-!
-! This file contains the Alarm class definition and all Alarm class
-! methods.
-!
-!------------------------------------------------------------------------------
-! INCLUDES
-#include <ESMF_TimeMgr.inc>
-
-!===============================================================================
-!BOPI
-!
-! !MODULE: ESMF_AlarmMod
-!
-! !DESCRIPTION:
-! Part of Time Manager F90 API wrapper of C++ implemenation
-!
-! Defines F90 wrapper entry points for corresponding
-! C++ class {\tt ESMC\_Alarm}
-!
-! See {\tt ../include/ESMC\_Alarm.h} for complete description
-!
-!------------------------------------------------------------------------------
-! !USES:
- ! inherit from ESMF base class
- use ESMF_BaseMod
-
- ! associated derived types
- use ESMF_TimeIntervalMod, only : ESMF_TimeInterval, &
- ESMF_TimeIntervalAbsValue
- use ESMF_TimeMod, only : ESMF_Time
-
- implicit none
-
-!------------------------------------------------------------------------------
-! !PRIVATE TYPES:
- private
-!------------------------------------------------------------------------------
-! ! ESMF_Alarm
-!
-! ! F90 class type to match C++ Alarm class in size only;
-! ! all dereferencing within class is performed by C++ implementation
-
-! internals for ESMF_Alarm
- type ESMF_AlarmInt
- type(ESMF_TimeInterval) :: RingInterval
- type(ESMF_Time) :: RingTime
- type(ESMF_Time) :: PrevRingTime
- type(ESMF_Time) :: StopTime
- integer :: ID
- integer :: AlarmMutex
- logical :: Ringing
- logical :: Enabled
- logical :: RingTimeSet
- logical :: RingIntervalSet
- logical :: StopTimeSet
- end type
-
-! Actual public type: this bit allows easy mimic of "deep" ESMF_AlarmCreate
-! in ESMF 2.1.0+. Note that ESMF_AlarmCreate is in a separate module to avoid
-! cyclic dependence.
-! NOTE: DO NOT ADD NON-POINTER STATE TO THIS DATA TYPE. It emulates ESMF
-! shallow-copy-masquerading-as-reference-copy insanity.
- type ESMF_Alarm
- type(ESMF_AlarmInt), pointer :: alarmint
- end type
-
-!------------------------------------------------------------------------------
-! !PUBLIC TYPES:
- public ESMF_Alarm
- public ESMF_AlarmInt ! needed on AIX but not PGI
-!------------------------------------------------------------------------------
-
-! !PUBLIC MEMBER FUNCTIONS:
- public ESMF_AlarmDestroy
- public ESMF_AlarmSet
- public ESMF_AlarmGet
-! public ESMF_AlarmGetRingInterval
-! public ESMF_AlarmSetRingInterval
-! public ESMF_AlarmGetRingTime
-! public ESMF_AlarmSetRingTime
- public ESMF_AlarmGetPrevRingTime
- public ESMF_AlarmSetPrevRingTime
-! public ESMF_AlarmGetStopTime
-! public ESMF_AlarmSetStopTime
- public ESMF_AlarmEnable
- public ESMF_AlarmDisable
- public ESMF_AlarmRingerOn
- public ESMF_AlarmRingerOff
- public ESMF_AlarmIsRinging
-! public ESMF_AlarmCheckRingTime
- public operator(==)
-
-! Required inherited and overridden ESMF_Base class methods
-
-! public ESMF_AlarmRead
-! public ESMF_AlarmWrite
- public ESMF_AlarmValidate
- public ESMF_AlarmPrint
-
-! !PRIVATE MEMBER FUNCTIONS:
- private ESMF_AlarmEQ
-!EOPI
-
-!==============================================================================
-!
-! INTERFACE BLOCKS
-!
-!==============================================================================
-!BOP
-! !INTERFACE:
- interface operator(==)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_AlarmEQ
-
-! !DESCRIPTION:
-! This interface overloads the == operator for the {\tt ESMF\_Alarm} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-
-!==============================================================================
-
- contains
-
-!==============================================================================
-
-!------------------------------------------------------------------------------
-!
-! This section includes the Set methods.
-!
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmSet - Initializes an alarm
-
-! !INTERFACE:
- subroutine ESMF_AlarmSet(alarm, RingTime, RingInterval, PrevRingTime, &
- StopTime, Enabled, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(inout) :: alarm ! really INTENT(OUT)
- type(ESMF_Time), intent(in), optional :: RingTime, PrevRingTime
- type(ESMF_TimeInterval), intent(in), optional :: RingInterval
- type(ESMF_Time), intent(in), optional :: StopTime
- logical, intent(in), optional :: Enabled
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Initializes an {\tt ESMF\_Alarm}
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to initialize
-! \item[{[RingTime]}]
-! Optional ring time for one-shot or first repeating alarm
-! \item[{[RingInterval]}]
-! Optional ring interval for repeating alarms
-! \item[{[StopTime]}]
-! Optional stop time for repeating alarms
-! \item[Enabled]
-! Alarm enabled/disabled
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG4.1, TMG4.7
-!EOP
- IF ( ASSOCIATED( alarm%alarmint ) ) THEN
- alarm%alarmint%RingTimeSet = .FALSE.
- alarm%alarmint%RingIntervalSet = .FALSE.
- alarm%alarmint%StopTimeSet = .FALSE.
- IF ( PRESENT( RingInterval ) ) THEN
- ! force RingInterval to be positive
- alarm%alarmint%RingInterval = &
- ESMF_TimeIntervalAbsValue( RingInterval )
- alarm%alarmint%RingIntervalSet = .TRUE.
- ENDIF
- IF ( PRESENT( PrevRingTime ) ) THEN
- alarm%alarmint%PrevRingTime = PrevRingTime
- ENDIF
- IF ( PRESENT( RingTime ) ) THEN
- alarm%alarmint%RingTime = RingTime
- alarm%alarmint%RingTimeSet = .TRUE.
- ENDIF
- IF ( PRESENT( StopTime ) ) THEN
- alarm%alarmint%StopTime = StopTime
- alarm%alarmint%StopTimeSet = .TRUE.
- ENDIF
- alarm%alarmint%Enabled = .TRUE.
- IF ( PRESENT( Enabled ) ) THEN
- alarm%alarmint%Enabled = Enabled
- ENDIF
- IF ( PRESENT( rc ) ) THEN
- rc = ESMF_SUCCESS
- ENDIF
- alarm%alarmint%Ringing = .FALSE.
- alarm%alarmint%Enabled = .TRUE.
- ELSE
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- ENDIF
-
- end subroutine ESMF_AlarmSet
-
-
-
-! Deallocate memory for ESMF_Alarm
- SUBROUTINE ESMF_AlarmDestroy( alarm, rc )
- TYPE(ESMF_Alarm), INTENT(INOUT) :: alarm
- INTEGER, INTENT( OUT), OPTIONAL :: rc
- IF ( ASSOCIATED( alarm%alarmint ) ) THEN
- DEALLOCATE( alarm%alarmint )
- ENDIF
- ! TBH: ignore deallocate errors, for now
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
- END SUBROUTINE ESMF_AlarmDestroy
-
-
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmGetRingInterval - Get an alarm's ring interval
-!
-! !INTERFACE:
- subroutine ESMF_AlarmGetRingInterval(alarm, RingInterval, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(in) :: alarm
- type(ESMF_TimeInterval), intent(out) :: RingInterval
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Get an {\tt ESMF\_Alarm}'s ring interval
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to get the ring interval
-! \item[RingInterval]
-! The {\tt Alarm}'s ring interval
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-
-! !REQUIREMENTS:
-! TMG4.7
-!EOP
- RingInterval = alarm%alarmint%RingInterval
-
- end subroutine ESMF_AlarmGetRingInterval
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmSetRingInterval - Set an alarm's ring interval
-!
-! !INTERFACE:
- subroutine ESMF_AlarmSetRingInterval(alarm, RingInterval, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(out) :: alarm
- type(ESMF_TimeInterval), intent(in) :: RingInterval
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Set an {\tt ESMF\_Alarm}'s ring interval
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to set the ring interval
-! \item[RingInterval]
-! The {\tt Alarm}'s ring interval
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG4.5.2, TMG4.7
-!EOP
- CALL wrf_error_fatal( 'ESMF_AlarmSetRingInterval not supported' )
- end subroutine ESMF_AlarmSetRingInterval
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmGetRingTime - Get an alarm's time to ring
-!
-! !INTERFACE:
- subroutine ESMF_AlarmGetRingTime(alarm, RingTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(in) :: alarm
- type(ESMF_Time), intent(out) :: RingTime
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Get an {\tt ESMF\_Alarm}'s time to ring
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to get the ring time
-! \item[RingTime]
-! The {\tt ESMF\_Alarm}'s ring time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG4.7, TMG4.8
-!EOP
- CALL wrf_error_fatal( 'ESMF_AlarmGetRingTime not supported' )
- end subroutine ESMF_AlarmGetRingTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmSetRingTime - Set an alarm's time to ring
-!
-! !INTERFACE:
- subroutine ESMF_AlarmSetRingTime(alarm, RingTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(out) :: alarm
- type(ESMF_Time), intent(in) :: RingTime
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Set an {\tt ESMF\_Alarm}'s time to ring
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to set the ring time
-! \item[RingTime]
-! The {\tt ESMF\_Alarm}'s ring time to set
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG4.5.1, TMG4.7, TMG4.8
-!EOP
- CALL wrf_error_fatal( 'ESMF_AlarmSetRingTime not supported' )
- end subroutine ESMF_AlarmSetRingTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmGet - Get an alarm's parameters -- compatibility with ESMF 2.0.1
-!
-! !INTERFACE:
- subroutine ESMF_AlarmGet(alarm, PrevRingTime, RingInterval, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(in) :: alarm
- type(ESMF_Time), intent(out), optional :: PrevRingTime
- type(ESMF_TimeInterval), intent(out), optional :: RingInterval
- integer, intent(out), optional :: rc
- integer :: ierr
-
-! !DESCRIPTION:
-! Get an {\tt ESMF\_Alarm}'s previous ring time
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to get the previous ring time
-! \item[PrevRingTime]
-! The {\tt ESMF\_Alarm}'s previous ring time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG4.7, TMG4.8
-!EOP
-
- ierr = ESMF_SUCCESS
-
- IF ( PRESENT(PrevRingTime) ) THEN
- CALL ESMF_AlarmGetPrevRingTime(alarm, PrevRingTime, rc=ierr)
- ENDIF
- IF ( PRESENT(RingInterval) ) THEN
- CALL ESMF_AlarmGetRingInterval(alarm, RingInterval, rc=ierr)
- ENDIF
-
- IF ( PRESENT(rc) ) THEN
- rc = ierr
- ENDIF
-
- end subroutine ESMF_AlarmGet
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmGetPrevRingTime - Get an alarm's previous ring time
-!
-! !INTERFACE:
- subroutine ESMF_AlarmGetPrevRingTime(alarm, PrevRingTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(in) :: alarm
- type(ESMF_Time), intent(out) :: PrevRingTime
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Get an {\tt ESMF\_Alarm}'s previous ring time
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to get the previous ring time
-! \item[PrevRingTime]
-! The {\tt ESMF\_Alarm}'s previous ring time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG4.7, TMG4.8
-!EOP
- IF ( ASSOCIATED( alarm%alarmint ) ) THEN
- PrevRingTime = alarm%alarmint%PrevRingTime
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
- ELSE
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- ENDIF
- end subroutine ESMF_AlarmGetPrevRingTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmSetPrevRingTime - Set an alarm's previous ring time
-!
-! !INTERFACE:
- subroutine ESMF_AlarmSetPrevRingTime(alarm, PrevRingTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(out) :: alarm
- type(ESMF_Time), intent(in) :: PrevRingTime
- integer, intent(out), optional :: rc
-
- IF ( ASSOCIATED( alarm%alarmint ) ) THEN
- alarm%alarmint%PrevRingTime = PrevRingTime
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
- ELSE
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- ENDIF
-
- end subroutine ESMF_AlarmSetPrevRingTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmGetStopTime - Get an alarm's stop time
-!
-! !INTERFACE:
- subroutine ESMF_AlarmGetStopTime(alarm, StopTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(in) :: alarm
- type(ESMF_Time), intent(out) :: StopTime
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Get an {\tt ESMF\_Alarm}'s stop time
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to get the stop time
-! \item[StopTime]
-! The {\tt ESMF\_Alarm}'s stop time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG4.5.2, TMG4.7
-!EOP
- CALL wrf_error_fatal( 'ESMF_AlarmGetStopTime not supported' )
- end subroutine ESMF_AlarmGetStopTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmSetStopTime - Set an alarm's stop time
-!
-! !INTERFACE:
- subroutine ESMF_AlarmSetStopTime(alarm, StopTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(out) :: alarm
- type(ESMF_Time), intent(in) :: StopTime
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Set an {\tt ESMF\_Alarm}'s stop time
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to set the stop time
-! \item[StopTime]
-! The {\tt ESMF\_Alarm}'s stop time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG4.5.2, TMG4.7
-!EOP
- CALL wrf_error_fatal( 'ESMF_AlarmSetStopTime not supported' )
- end subroutine ESMF_AlarmSetStopTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmEnable - Enables an alarm
-
-! !INTERFACE:
- subroutine ESMF_AlarmEnable(alarm, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(inout) :: alarm ! really INTENT(OUT)
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Enables an {\tt ESMF\_Alarm} to function
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to enable
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-
-! !REQUIREMENTS:
-! TMG4.5.3
-!EOP
- IF ( ASSOCIATED( alarm%alarmint ) ) THEN
- alarm%alarmint%Enabled = .TRUE.
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
- ELSE
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- ENDIF
- end subroutine ESMF_AlarmEnable
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmDisable - Disables an alarm
-
-! !INTERFACE:
- subroutine ESMF_AlarmDisable(alarm, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(inout) :: alarm ! really INTENT(OUT)
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Disables an {\tt ESMF\_Alarm}
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to disable
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-
-! !REQUIREMENTS:
-! TMG4.5.3
-!EOP
- IF ( ASSOCIATED( alarm%alarmint ) ) THEN
- alarm%alarmint%Enabled = .FALSE.
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
- ELSE
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- ENDIF
- end subroutine ESMF_AlarmDisable
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmRingerOn - Turn on an alarm
-
-
-! !INTERFACE:
- subroutine ESMF_AlarmRingerOn(alarm, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(inout) :: alarm ! really INTENT(OUT)
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Turn on an {\tt ESMF\_Alarm}; sets ringing state
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to turn on
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG4.6
-!EOP
- IF ( ASSOCIATED( alarm%alarmint ) ) THEN
- IF ( alarm%alarmint%Enabled ) THEN
- alarm%alarmint%Ringing = .TRUE.
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
- ELSE
- alarm%alarmint%Ringing = .FALSE.
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- ENDIF
- ELSE
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- ENDIF
-
- end subroutine ESMF_AlarmRingerOn
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmRingerOff - Turn off an alarm
-
-! !INTERFACE:
- subroutine ESMF_AlarmRingerOff(alarm, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(inout) :: alarm ! really INTENT(OUT)
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Turn off an {\tt ESMF\_Alarm}; unsets ringing state
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to turn off
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-
-! !REQUIREMENTS:
-! TMG4.6
-!EOP
- IF ( ASSOCIATED( alarm%alarmint ) ) THEN
- alarm%alarmint%Ringing = .FALSE.
- IF ( alarm%alarmint%Enabled ) THEN
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
- ELSE
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- ENDIF
- ELSE
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- ENDIF
- end subroutine ESMF_AlarmRingerOff
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmIsRinging - Check if alarm is ringing
-
-! !INTERFACE:
- function ESMF_AlarmIsRinging(alarm, rc)
-!
-! !RETURN VALUE:
- logical :: ESMF_AlarmIsRinging
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(in) :: alarm
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Check if {\tt ESMF\_Alarm} is ringing.
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to check for ringing state
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-
-! !REQUIREMENTS:
-! TMG4.4
-!EOP
- IF ( ASSOCIATED( alarm%alarmint ) ) THEN
- IF ( alarm%alarmint%Enabled ) THEN
- ESMF_AlarmIsRinging = alarm%alarmint%Ringing
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
- ELSE
- ESMF_AlarmIsRinging = .FALSE.
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- ENDIF
- ELSE
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- ENDIF
- end function ESMF_AlarmIsRinging
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmCheckRingTime - Method used by a clock to check whether to trigger an alarm
-!
-! !INTERFACE:
- function ESMF_AlarmCheckRingTime(alarm, ClockCurrTime, positive, rc)
-!
-! !RETURN VALUE:
- logical :: ESMF_AlarmCheckRingTime
-!
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(inout) :: alarm
- type(ESMF_Time), intent(in) :: ClockCurrTime
- integer, intent(in) :: positive
- integer, intent(out), optional :: rc
-!
-! !DESCRIPTION:
-! Main method used by a {\tt ESMF\_Clock} to check whether to trigger
-! the {\tt ESMF\_Alarm}
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to check if time to ring
-! \item[ClockCurrTime]
-! The {\tt ESMF\_Clock}'s current time
-! \item[positive]
-! Whether to check ring time in the positive or negative direction
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-
-! !REQUIREMENTS:
-! TMG4.4, TMG4.6
-!EOP
- CALL wrf_error_fatal( 'ESMF_AlarmCheckRingTime not supported' )
- ESMF_AlarmCheckRingTime = .FALSE. ! keep compilers happy
- end function ESMF_AlarmCheckRingTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmEQ - Compare two alarms for equality
-!
-! !INTERFACE:
- function ESMF_AlarmEQ(alarm1, alarm2)
-!
-! !RETURN VALUE:
- logical :: ESMF_AlarmEQ
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(in) :: alarm1
- type(ESMF_Alarm), intent(in) :: alarm2
-
-! !DESCRIPTION:
-! Compare two alarms for equality; return true if equal, false otherwise
-! Maps to overloaded (==) operator interface function
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm1]
-! The first {\tt ESMF\_Alarm} to compare
-! \item[alarm2]
-! The second {\tt ESMF\_Alarm} to compare
-! \end{description}
-!
-! !REQUIREMENTS:
-!EOP
- CALL wrf_error_fatal( 'ESMF_AlarmEQ not supported ' )
- ESMF_AlarmEQ = .FALSE. ! keep compilers happy
- end function ESMF_AlarmEQ
-
-!------------------------------------------------------------------------------
-!
-! This section defines the overridden Read, Write, Validate and Print methods
-! from the ESMF_Base class
-!
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmRead - restores an alarm
-
-! !INTERFACE:
- subroutine ESMF_AlarmRead(alarm, RingInterval, RingTime, &
- PrevRingTime, StopTime, Ringing, &
- Enabled, ID, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(out) :: alarm
- type(ESMF_TimeInterval), intent(in) :: RingInterval
- type(ESMF_Time), intent(in) :: RingTime
- type(ESMF_Time), intent(in) :: PrevRingTime
- type(ESMF_Time), intent(in) :: StopTime
- logical, intent(in) :: Ringing
- logical, intent(in) :: Enabled
- integer, intent(in) :: ID
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Restores an {\tt ESMF\_Alarm}
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to restore
-! \item[RingInterval]
-! The ring interval for repeating alarms
-! \item[RingTime]
-! Ring time for one-shot or first repeating alarm
-! \item[PrevRingTime]
-! The {\tt ESMF\_Alarm}'s previous ring time
-! \item[StopTime]
-! Stop time for repeating alarms
-! \item[Ringing]
-! The {\tt ESMF\_Alarm}'s ringing state
-! \item[Enabled]
-! {\tt ESMF\_Alarm} enabled/disabled
-! \item[ID]
-! The {\tt ESMF\_Alarm}'s ID
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-!EOP
- CALL wrf_error_fatal( 'ESMF_AlarmRead not supported' )
- end subroutine ESMF_AlarmRead
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmWrite - saves an alarm
-
-! !INTERFACE:
- subroutine ESMF_AlarmWrite(alarm, RingInterval, RingTime, &
- PrevRingTime, StopTime, Ringing, &
- Enabled, ID, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(in) :: alarm
- type(ESMF_TimeInterval), intent(out) :: RingInterval
- type(ESMF_Time), intent(out) :: RingTime
- type(ESMF_Time), intent(out) :: PrevRingTime
- type(ESMF_Time), intent(out) :: StopTime
- logical, intent(out) :: Ringing
- logical, intent(out) :: Enabled
- integer, intent(out) :: ID
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Saves an {\tt ESMF\_Alarm}
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! The object instance to save
-! \item[RingInterval]
-! Ring interval for repeating alarms
-! \item[RingTime]
-! Ring time for one-shot or first repeating alarm
-! \item[PrevRingTime]
-! The {\tt ESMF\_Alarm}'s previous ring time
-! \item[StopTime]
-! Stop time for repeating alarms
-! \item[Ringing]
-! The {\tt ESMF\_Alarm}'s ringing state
-! \item[Enabled]
-! {\tt ESMF\_Alarm} enabled/disabled
-! \item[ID]
-! The {\tt ESMF\_Alarm}'s ID
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-!EOP
- CALL wrf_error_fatal( 'ESMF_AlarmWrite not supported' )
- end subroutine ESMF_AlarmWrite
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmValidate - Validate an Alarm's properties
-
-! !INTERFACE:
- subroutine ESMF_AlarmValidate(alarm, opts, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(in) :: alarm
- character (len=*), intent(in), optional :: opts
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Perform a validation check on a {\tt ESMF\_Alarm}'s properties
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! {\tt ESMF\_Alarm} to validate
-! \item[{[opts]}]
-! Validate options
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMGn.n.n
-!EOP
- CALL wrf_error_fatal( 'ESMF_AlarmValidate not supported' )
- end subroutine ESMF_AlarmValidate
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AlarmPrint - Print out an Alarm's properties
-
-! !INTERFACE:
- subroutine ESMF_AlarmPrint(alarm, opts, rc)
-
-! !ARGUMENTS:
- type(ESMF_Alarm), intent(in) :: alarm
- character (len=*), intent(in), optional :: opts
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! To support testing/debugging, print out a {\tt ESMF\_Alarm}'s
-! properties.
-!
-! The arguments are:
-! \begin{description}
-! \item[alarm]
-! {\tt ESMF\_Alarm} to print out
-! \item[{[opts]}]
-! Print options
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMGn.n.n
-!EOP
- CALL wrf_error_fatal( 'ESMF_AlarmPrint not supported' )
- end subroutine ESMF_AlarmPrint
-
-!------------------------------------------------------------------------------
-
- end module ESMF_AlarmMod
Copied: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Alarm.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/ESMF_Alarm.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/ESMF_Alarm.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Alarm.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,953 @@
+!
+! Earth System Modeling Framework
+! Copyright 2002-2003, University Corporation for Atmospheric Research,
+! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
+! Laboratory, University of Michigan, National Centers for Environmental
+! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
+! NASA Goddard Space Flight Center.
+! Licensed under the University of Illinois-NCSA license.
+!
+!==============================================================================
+!
+! ESMF Alarm Module
+ module ESMF_AlarmMod
+!
+!==============================================================================
+!
+! This file contains the Alarm class definition and all Alarm class
+! methods.
+!
+!------------------------------------------------------------------------------
+! INCLUDES
+#include <ESMF_TimeMgr.inc>
+
+!===============================================================================
+!BOPI
+!
+! !MODULE: ESMF_AlarmMod
+!
+! !DESCRIPTION:
+! Part of Time Manager F90 API wrapper of C++ implemenation
+!
+! Defines F90 wrapper entry points for corresponding
+! C++ class {\tt ESMC\_Alarm}
+!
+! See {\tt ../include/ESMC\_Alarm.h} for complete description
+!
+!------------------------------------------------------------------------------
+! !USES:
+ ! inherit from ESMF base class
+ use ESMF_BaseMod
+
+ ! associated derived types
+ use ESMF_TimeIntervalMod, only : ESMF_TimeInterval, &
+ ESMF_TimeIntervalAbsValue
+ use ESMF_TimeMod, only : ESMF_Time
+
+ implicit none
+
+!------------------------------------------------------------------------------
+! !PRIVATE TYPES:
+ private
+!------------------------------------------------------------------------------
+! ! ESMF_Alarm
+!
+! ! F90 class type to match C++ Alarm class in size only;
+! ! all dereferencing within class is performed by C++ implementation
+
+! internals for ESMF_Alarm
+ type ESMF_AlarmInt
+ type(ESMF_TimeInterval) :: RingInterval
+ type(ESMF_Time) :: RingTime
+ type(ESMF_Time) :: PrevRingTime
+ type(ESMF_Time) :: StopTime
+ integer :: ID
+ integer :: AlarmMutex
+ logical :: Ringing
+ logical :: Enabled
+ logical :: RingTimeSet
+ logical :: RingIntervalSet
+ logical :: StopTimeSet
+ end type
+
+! Actual public type: this bit allows easy mimic of "deep" ESMF_AlarmCreate
+! in ESMF 2.1.0+. Note that ESMF_AlarmCreate is in a separate module to avoid
+! cyclic dependence.
+! NOTE: DO NOT ADD NON-POINTER STATE TO THIS DATA TYPE. It emulates ESMF
+! shallow-copy-masquerading-as-reference-copy insanity.
+ type ESMF_Alarm
+ type(ESMF_AlarmInt), pointer :: alarmint
+ end type
+
+!------------------------------------------------------------------------------
+! !PUBLIC TYPES:
+ public ESMF_Alarm
+ public ESMF_AlarmInt ! needed on AIX but not PGI
+!------------------------------------------------------------------------------
+
+! !PUBLIC MEMBER FUNCTIONS:
+ public ESMF_AlarmDestroy
+ public ESMF_AlarmSet
+ public ESMF_AlarmGet
+! public ESMF_AlarmGetRingInterval
+! public ESMF_AlarmSetRingInterval
+! public ESMF_AlarmGetRingTime
+! public ESMF_AlarmSetRingTime
+ public ESMF_AlarmGetPrevRingTime
+ public ESMF_AlarmSetPrevRingTime
+! public ESMF_AlarmGetStopTime
+! public ESMF_AlarmSetStopTime
+ public ESMF_AlarmEnable
+ public ESMF_AlarmDisable
+ public ESMF_AlarmRingerOn
+ public ESMF_AlarmRingerOff
+ public ESMF_AlarmIsRinging
+! public ESMF_AlarmCheckRingTime
+ public operator(==)
+
+! Required inherited and overridden ESMF_Base class methods
+
+! public ESMF_AlarmRead
+! public ESMF_AlarmWrite
+ public ESMF_AlarmValidate
+ public ESMF_AlarmPrint
+
+! !PRIVATE MEMBER FUNCTIONS:
+ private ESMF_AlarmEQ
+!EOPI
+
+!==============================================================================
+!
+! INTERFACE BLOCKS
+!
+!==============================================================================
+!BOP
+! !INTERFACE:
+ interface operator(==)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_AlarmEQ
+
+! !DESCRIPTION:
+! This interface overloads the == operator for the {\tt ESMF\_Alarm} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+
+!==============================================================================
+
+ contains
+
+!==============================================================================
+
+!------------------------------------------------------------------------------
+!
+! This section includes the Set methods.
+!
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmSet - Initializes an alarm
+
+! !INTERFACE:
+ subroutine ESMF_AlarmSet(alarm, RingTime, RingInterval, PrevRingTime, &
+ StopTime, Enabled, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(inout) :: alarm ! really INTENT(OUT)
+ type(ESMF_Time), intent(in), optional :: RingTime, PrevRingTime
+ type(ESMF_TimeInterval), intent(in), optional :: RingInterval
+ type(ESMF_Time), intent(in), optional :: StopTime
+ logical, intent(in), optional :: Enabled
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Initializes an {\tt ESMF\_Alarm}
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to initialize
+! \item[{[RingTime]}]
+! Optional ring time for one-shot or first repeating alarm
+! \item[{[RingInterval]}]
+! Optional ring interval for repeating alarms
+! \item[{[StopTime]}]
+! Optional stop time for repeating alarms
+! \item[Enabled]
+! Alarm enabled/disabled
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG4.1, TMG4.7
+!EOP
+ IF ( ASSOCIATED( alarm%alarmint ) ) THEN
+ alarm%alarmint%RingTimeSet = .FALSE.
+ alarm%alarmint%RingIntervalSet = .FALSE.
+ alarm%alarmint%StopTimeSet = .FALSE.
+ IF ( PRESENT( RingInterval ) ) THEN
+ ! force RingInterval to be positive
+ alarm%alarmint%RingInterval = &
+ ESMF_TimeIntervalAbsValue( RingInterval )
+ alarm%alarmint%RingIntervalSet = .TRUE.
+ ENDIF
+ IF ( PRESENT( PrevRingTime ) ) THEN
+ alarm%alarmint%PrevRingTime = PrevRingTime
+ ENDIF
+ IF ( PRESENT( RingTime ) ) THEN
+ alarm%alarmint%RingTime = RingTime
+ alarm%alarmint%RingTimeSet = .TRUE.
+ ENDIF
+ IF ( PRESENT( StopTime ) ) THEN
+ alarm%alarmint%StopTime = StopTime
+ alarm%alarmint%StopTimeSet = .TRUE.
+ ENDIF
+ alarm%alarmint%Enabled = .TRUE.
+ IF ( PRESENT( Enabled ) ) THEN
+ alarm%alarmint%Enabled = Enabled
+ ENDIF
+ IF ( PRESENT( rc ) ) THEN
+ rc = ESMF_SUCCESS
+ ENDIF
+ alarm%alarmint%Ringing = .FALSE.
+ alarm%alarmint%Enabled = .TRUE.
+ ELSE
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ ENDIF
+
+ end subroutine ESMF_AlarmSet
+
+
+
+! Deallocate memory for ESMF_Alarm
+ SUBROUTINE ESMF_AlarmDestroy( alarm, rc )
+ TYPE(ESMF_Alarm), INTENT(INOUT) :: alarm
+ INTEGER, INTENT( OUT), OPTIONAL :: rc
+ IF ( ASSOCIATED( alarm%alarmint ) ) THEN
+ DEALLOCATE( alarm%alarmint )
+ ENDIF
+ ! TBH: ignore deallocate errors, for now
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+ END SUBROUTINE ESMF_AlarmDestroy
+
+
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmGetRingInterval - Get an alarm's ring interval
+!
+! !INTERFACE:
+ subroutine ESMF_AlarmGetRingInterval(alarm, RingInterval, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(in) :: alarm
+ type(ESMF_TimeInterval), intent(out) :: RingInterval
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Get an {\tt ESMF\_Alarm}'s ring interval
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to get the ring interval
+! \item[RingInterval]
+! The {\tt Alarm}'s ring interval
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+
+! !REQUIREMENTS:
+! TMG4.7
+!EOP
+ RingInterval = alarm%alarmint%RingInterval
+
+ end subroutine ESMF_AlarmGetRingInterval
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmSetRingInterval - Set an alarm's ring interval
+!
+! !INTERFACE:
+ subroutine ESMF_AlarmSetRingInterval(alarm, RingInterval, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(out) :: alarm
+ type(ESMF_TimeInterval), intent(in) :: RingInterval
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Set an {\tt ESMF\_Alarm}'s ring interval
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to set the ring interval
+! \item[RingInterval]
+! The {\tt Alarm}'s ring interval
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG4.5.2, TMG4.7
+!EOP
+ CALL wrf_error_fatal( 'ESMF_AlarmSetRingInterval not supported' )
+ end subroutine ESMF_AlarmSetRingInterval
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmGetRingTime - Get an alarm's time to ring
+!
+! !INTERFACE:
+ subroutine ESMF_AlarmGetRingTime(alarm, RingTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(in) :: alarm
+ type(ESMF_Time), intent(out) :: RingTime
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Get an {\tt ESMF\_Alarm}'s time to ring
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to get the ring time
+! \item[RingTime]
+! The {\tt ESMF\_Alarm}'s ring time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG4.7, TMG4.8
+!EOP
+ CALL wrf_error_fatal( 'ESMF_AlarmGetRingTime not supported' )
+ end subroutine ESMF_AlarmGetRingTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmSetRingTime - Set an alarm's time to ring
+!
+! !INTERFACE:
+ subroutine ESMF_AlarmSetRingTime(alarm, RingTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(out) :: alarm
+ type(ESMF_Time), intent(in) :: RingTime
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Set an {\tt ESMF\_Alarm}'s time to ring
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to set the ring time
+! \item[RingTime]
+! The {\tt ESMF\_Alarm}'s ring time to set
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG4.5.1, TMG4.7, TMG4.8
+!EOP
+ CALL wrf_error_fatal( 'ESMF_AlarmSetRingTime not supported' )
+ end subroutine ESMF_AlarmSetRingTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmGet - Get an alarm's parameters -- compatibility with ESMF 2.0.1
+!
+! !INTERFACE:
+ subroutine ESMF_AlarmGet(alarm, PrevRingTime, RingInterval, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(in) :: alarm
+ type(ESMF_Time), intent(out), optional :: PrevRingTime
+ type(ESMF_TimeInterval), intent(out), optional :: RingInterval
+ integer, intent(out), optional :: rc
+ integer :: ierr
+
+! !DESCRIPTION:
+! Get an {\tt ESMF\_Alarm}'s previous ring time
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to get the previous ring time
+! \item[PrevRingTime]
+! The {\tt ESMF\_Alarm}'s previous ring time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG4.7, TMG4.8
+!EOP
+
+ ierr = ESMF_SUCCESS
+
+ IF ( PRESENT(PrevRingTime) ) THEN
+ CALL ESMF_AlarmGetPrevRingTime(alarm, PrevRingTime, rc=ierr)
+ ENDIF
+ IF ( PRESENT(RingInterval) ) THEN
+ CALL ESMF_AlarmGetRingInterval(alarm, RingInterval, rc=ierr)
+ ENDIF
+
+ IF ( PRESENT(rc) ) THEN
+ rc = ierr
+ ENDIF
+
+ end subroutine ESMF_AlarmGet
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmGetPrevRingTime - Get an alarm's previous ring time
+!
+! !INTERFACE:
+ subroutine ESMF_AlarmGetPrevRingTime(alarm, PrevRingTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(in) :: alarm
+ type(ESMF_Time), intent(out) :: PrevRingTime
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Get an {\tt ESMF\_Alarm}'s previous ring time
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to get the previous ring time
+! \item[PrevRingTime]
+! The {\tt ESMF\_Alarm}'s previous ring time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG4.7, TMG4.8
+!EOP
+ IF ( ASSOCIATED( alarm%alarmint ) ) THEN
+ PrevRingTime = alarm%alarmint%PrevRingTime
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+ ELSE
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ ENDIF
+ end subroutine ESMF_AlarmGetPrevRingTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmSetPrevRingTime - Set an alarm's previous ring time
+!
+! !INTERFACE:
+ subroutine ESMF_AlarmSetPrevRingTime(alarm, PrevRingTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(out) :: alarm
+ type(ESMF_Time), intent(in) :: PrevRingTime
+ integer, intent(out), optional :: rc
+
+ IF ( ASSOCIATED( alarm%alarmint ) ) THEN
+ alarm%alarmint%PrevRingTime = PrevRingTime
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+ ELSE
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ ENDIF
+
+ end subroutine ESMF_AlarmSetPrevRingTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmGetStopTime - Get an alarm's stop time
+!
+! !INTERFACE:
+ subroutine ESMF_AlarmGetStopTime(alarm, StopTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(in) :: alarm
+ type(ESMF_Time), intent(out) :: StopTime
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Get an {\tt ESMF\_Alarm}'s stop time
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to get the stop time
+! \item[StopTime]
+! The {\tt ESMF\_Alarm}'s stop time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG4.5.2, TMG4.7
+!EOP
+ CALL wrf_error_fatal( 'ESMF_AlarmGetStopTime not supported' )
+ end subroutine ESMF_AlarmGetStopTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmSetStopTime - Set an alarm's stop time
+!
+! !INTERFACE:
+ subroutine ESMF_AlarmSetStopTime(alarm, StopTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(out) :: alarm
+ type(ESMF_Time), intent(in) :: StopTime
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Set an {\tt ESMF\_Alarm}'s stop time
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to set the stop time
+! \item[StopTime]
+! The {\tt ESMF\_Alarm}'s stop time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG4.5.2, TMG4.7
+!EOP
+ CALL wrf_error_fatal( 'ESMF_AlarmSetStopTime not supported' )
+ end subroutine ESMF_AlarmSetStopTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmEnable - Enables an alarm
+
+! !INTERFACE:
+ subroutine ESMF_AlarmEnable(alarm, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(inout) :: alarm ! really INTENT(OUT)
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Enables an {\tt ESMF\_Alarm} to function
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to enable
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+
+! !REQUIREMENTS:
+! TMG4.5.3
+!EOP
+ IF ( ASSOCIATED( alarm%alarmint ) ) THEN
+ alarm%alarmint%Enabled = .TRUE.
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+ ELSE
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ ENDIF
+ end subroutine ESMF_AlarmEnable
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmDisable - Disables an alarm
+
+! !INTERFACE:
+ subroutine ESMF_AlarmDisable(alarm, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(inout) :: alarm ! really INTENT(OUT)
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Disables an {\tt ESMF\_Alarm}
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to disable
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+
+! !REQUIREMENTS:
+! TMG4.5.3
+!EOP
+ IF ( ASSOCIATED( alarm%alarmint ) ) THEN
+ alarm%alarmint%Enabled = .FALSE.
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+ ELSE
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ ENDIF
+ end subroutine ESMF_AlarmDisable
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmRingerOn - Turn on an alarm
+
+
+! !INTERFACE:
+ subroutine ESMF_AlarmRingerOn(alarm, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(inout) :: alarm ! really INTENT(OUT)
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Turn on an {\tt ESMF\_Alarm}; sets ringing state
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to turn on
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG4.6
+!EOP
+ IF ( ASSOCIATED( alarm%alarmint ) ) THEN
+ IF ( alarm%alarmint%Enabled ) THEN
+ alarm%alarmint%Ringing = .TRUE.
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+ ELSE
+ alarm%alarmint%Ringing = .FALSE.
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ ENDIF
+ ELSE
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ ENDIF
+
+ end subroutine ESMF_AlarmRingerOn
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmRingerOff - Turn off an alarm
+
+! !INTERFACE:
+ subroutine ESMF_AlarmRingerOff(alarm, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(inout) :: alarm ! really INTENT(OUT)
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Turn off an {\tt ESMF\_Alarm}; unsets ringing state
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to turn off
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+
+! !REQUIREMENTS:
+! TMG4.6
+!EOP
+ IF ( ASSOCIATED( alarm%alarmint ) ) THEN
+ alarm%alarmint%Ringing = .FALSE.
+ IF ( alarm%alarmint%Enabled ) THEN
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+ ELSE
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ ENDIF
+ ELSE
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ ENDIF
+ end subroutine ESMF_AlarmRingerOff
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmIsRinging - Check if alarm is ringing
+
+! !INTERFACE:
+ function ESMF_AlarmIsRinging(alarm, rc)
+!
+! !RETURN VALUE:
+ logical :: ESMF_AlarmIsRinging
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(in) :: alarm
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Check if {\tt ESMF\_Alarm} is ringing.
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to check for ringing state
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+
+! !REQUIREMENTS:
+! TMG4.4
+!EOP
+ IF ( ASSOCIATED( alarm%alarmint ) ) THEN
+ IF ( alarm%alarmint%Enabled ) THEN
+ ESMF_AlarmIsRinging = alarm%alarmint%Ringing
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+ ELSE
+ ESMF_AlarmIsRinging = .FALSE.
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ ENDIF
+ ELSE
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ ENDIF
+ end function ESMF_AlarmIsRinging
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmCheckRingTime - Method used by a clock to check whether to trigger an alarm
+!
+! !INTERFACE:
+ function ESMF_AlarmCheckRingTime(alarm, ClockCurrTime, positive, rc)
+!
+! !RETURN VALUE:
+ logical :: ESMF_AlarmCheckRingTime
+!
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(inout) :: alarm
+ type(ESMF_Time), intent(in) :: ClockCurrTime
+ integer, intent(in) :: positive
+ integer, intent(out), optional :: rc
+!
+! !DESCRIPTION:
+! Main method used by a {\tt ESMF\_Clock} to check whether to trigger
+! the {\tt ESMF\_Alarm}
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to check if time to ring
+! \item[ClockCurrTime]
+! The {\tt ESMF\_Clock}'s current time
+! \item[positive]
+! Whether to check ring time in the positive or negative direction
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+
+! !REQUIREMENTS:
+! TMG4.4, TMG4.6
+!EOP
+ CALL wrf_error_fatal( 'ESMF_AlarmCheckRingTime not supported' )
+ ESMF_AlarmCheckRingTime = .FALSE. ! keep compilers happy
+ end function ESMF_AlarmCheckRingTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmEQ - Compare two alarms for equality
+!
+! !INTERFACE:
+ function ESMF_AlarmEQ(alarm1, alarm2)
+!
+! !RETURN VALUE:
+ logical :: ESMF_AlarmEQ
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(in) :: alarm1
+ type(ESMF_Alarm), intent(in) :: alarm2
+
+! !DESCRIPTION:
+! Compare two alarms for equality; return true if equal, false otherwise
+! Maps to overloaded (==) operator interface function
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm1]
+! The first {\tt ESMF\_Alarm} to compare
+! \item[alarm2]
+! The second {\tt ESMF\_Alarm} to compare
+! \end{description}
+!
+! !REQUIREMENTS:
+!EOP
+ CALL wrf_error_fatal( 'ESMF_AlarmEQ not supported ' )
+ ESMF_AlarmEQ = .FALSE. ! keep compilers happy
+ end function ESMF_AlarmEQ
+
+!------------------------------------------------------------------------------
+!
+! This section defines the overridden Read, Write, Validate and Print methods
+! from the ESMF_Base class
+!
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmRead - restores an alarm
+
+! !INTERFACE:
+ subroutine ESMF_AlarmRead(alarm, RingInterval, RingTime, &
+ PrevRingTime, StopTime, Ringing, &
+ Enabled, ID, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(out) :: alarm
+ type(ESMF_TimeInterval), intent(in) :: RingInterval
+ type(ESMF_Time), intent(in) :: RingTime
+ type(ESMF_Time), intent(in) :: PrevRingTime
+ type(ESMF_Time), intent(in) :: StopTime
+ logical, intent(in) :: Ringing
+ logical, intent(in) :: Enabled
+ integer, intent(in) :: ID
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Restores an {\tt ESMF\_Alarm}
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to restore
+! \item[RingInterval]
+! The ring interval for repeating alarms
+! \item[RingTime]
+! Ring time for one-shot or first repeating alarm
+! \item[PrevRingTime]
+! The {\tt ESMF\_Alarm}'s previous ring time
+! \item[StopTime]
+! Stop time for repeating alarms
+! \item[Ringing]
+! The {\tt ESMF\_Alarm}'s ringing state
+! \item[Enabled]
+! {\tt ESMF\_Alarm} enabled/disabled
+! \item[ID]
+! The {\tt ESMF\_Alarm}'s ID
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+!EOP
+ CALL wrf_error_fatal( 'ESMF_AlarmRead not supported' )
+ end subroutine ESMF_AlarmRead
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmWrite - saves an alarm
+
+! !INTERFACE:
+ subroutine ESMF_AlarmWrite(alarm, RingInterval, RingTime, &
+ PrevRingTime, StopTime, Ringing, &
+ Enabled, ID, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(in) :: alarm
+ type(ESMF_TimeInterval), intent(out) :: RingInterval
+ type(ESMF_Time), intent(out) :: RingTime
+ type(ESMF_Time), intent(out) :: PrevRingTime
+ type(ESMF_Time), intent(out) :: StopTime
+ logical, intent(out) :: Ringing
+ logical, intent(out) :: Enabled
+ integer, intent(out) :: ID
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Saves an {\tt ESMF\_Alarm}
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! The object instance to save
+! \item[RingInterval]
+! Ring interval for repeating alarms
+! \item[RingTime]
+! Ring time for one-shot or first repeating alarm
+! \item[PrevRingTime]
+! The {\tt ESMF\_Alarm}'s previous ring time
+! \item[StopTime]
+! Stop time for repeating alarms
+! \item[Ringing]
+! The {\tt ESMF\_Alarm}'s ringing state
+! \item[Enabled]
+! {\tt ESMF\_Alarm} enabled/disabled
+! \item[ID]
+! The {\tt ESMF\_Alarm}'s ID
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+!EOP
+ CALL wrf_error_fatal( 'ESMF_AlarmWrite not supported' )
+ end subroutine ESMF_AlarmWrite
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmValidate - Validate an Alarm's properties
+
+! !INTERFACE:
+ subroutine ESMF_AlarmValidate(alarm, opts, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(in) :: alarm
+ character (len=*), intent(in), optional :: opts
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Perform a validation check on a {\tt ESMF\_Alarm}'s properties
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! {\tt ESMF\_Alarm} to validate
+! \item[{[opts]}]
+! Validate options
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMGn.n.n
+!EOP
+ CALL wrf_error_fatal( 'ESMF_AlarmValidate not supported' )
+ end subroutine ESMF_AlarmValidate
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AlarmPrint - Print out an Alarm's properties
+
+! !INTERFACE:
+ subroutine ESMF_AlarmPrint(alarm, opts, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Alarm), intent(in) :: alarm
+ character (len=*), intent(in), optional :: opts
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! To support testing/debugging, print out a {\tt ESMF\_Alarm}'s
+! properties.
+!
+! The arguments are:
+! \begin{description}
+! \item[alarm]
+! {\tt ESMF\_Alarm} to print out
+! \item[{[opts]}]
+! Print options
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMGn.n.n
+!EOP
+ CALL wrf_error_fatal( 'ESMF_AlarmPrint not supported' )
+ end subroutine ESMF_AlarmPrint
+
+!------------------------------------------------------------------------------
+
+ end module ESMF_AlarmMod
Deleted: branches/atmos_physics/src/external/esmf_time_f90/ESMF_AlarmClock.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/ESMF_AlarmClock.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_AlarmClock.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,96 +0,0 @@
-!
-! Earth System Modeling Framework
-! Copyright 2002-2003, University Corporation for Atmospheric Research,
-! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
-! Laboratory, University of Michigan, National Centers for Environmental
-! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
-! NASA Goddard Space Flight Center.
-! Licensed under the University of Illinois-NCSA license.
-!
-!==============================================================================
-!
-! ESMF Alarm-Clock Module
- module ESMF_AlarmClockMod
-!
-!==============================================================================
-!
-! This file contains the AlarmCreate method.
-!
-!------------------------------------------------------------------------------
-! INCLUDES
-#include <ESMF_TimeMgr.inc>
-
-!===============================================================================
-!BOPI
-!
-! !MODULE: ESMF_AlarmClockMod
-!
-! !DESCRIPTION:
-! Separate module that uses both ESMF_AlarmMod and ESMF_ClockMod.
-! Separation is needed to avoid cyclic dependence.
-!
-! Defines F90 wrapper entry points for corresponding
-! C++ class {\tt ESMC\_Alarm}
-!
-! See {\tt ../include/ESMC\_Alarm.h} for complete description
-!
-!------------------------------------------------------------------------------
-! !USES:
- ! inherit ESMF_Alarm and ESMF_Clock
- use ESMF_AlarmMod, only : ESMF_Alarm, ESMF_AlarmSet
- use ESMF_ClockMod, only : ESMF_Clock, ESMF_ClockAddAlarm
-
- ! associated derived types
- use ESMF_TimeIntervalMod, only : ESMF_TimeInterval
- use ESMF_TimeMod, only : ESMF_Time
-
- implicit none
-
-!------------------------------------------------------------------------------
-! !PRIVATE TYPES:
- private
-!------------------------------------------------------------------------------
-
-! !PUBLIC MEMBER FUNCTIONS:
- public ESMF_AlarmCreate
-
-!==============================================================================
-
- contains
-
-!==============================================================================
-
-
-! Create ESMF_Alarm using ESMF 2.1.0+ semantics
- FUNCTION ESMF_AlarmCreate( clock, RingTime, RingInterval, &
- StopTime, Enabled, rc )
-
- ! return value
- type(ESMF_Alarm) :: ESMF_AlarmCreate
- ! !ARGUMENTS:
- type(ESMF_Clock), intent(inout), optional :: clock
- type(ESMF_Time), intent(in), optional :: RingTime
- type(ESMF_TimeInterval), intent(in), optional :: RingInterval
- type(ESMF_Time), intent(in), optional :: StopTime
- logical, intent(in), optional :: Enabled
- integer, intent(out), optional :: rc
- ! locals
- type(ESMF_Alarm) :: alarmtmp
- ! TBH: ignore allocate errors, for now
- ALLOCATE( alarmtmp%alarmint )
- CALL ESMF_AlarmSet( alarmtmp, &
- RingTime=RingTime, &
- RingInterval=RingInterval, &
- StopTime=StopTime, &
- Enabled=Enabled, &
- rc=rc )
- IF ( PRESENT ( clock ) ) THEN
- CALL ESMF_ClockAddAlarm( clock, alarmtmp, rc )
- ENDIF
- ESMF_AlarmCreate = alarmtmp
- END FUNCTION ESMF_AlarmCreate
-
-
-!------------------------------------------------------------------------------
-
- end module ESMF_AlarmClockMod
Copied: branches/atmos_physics/src/external/esmf_time_f90/ESMF_AlarmClock.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/ESMF_AlarmClock.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/ESMF_AlarmClock.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_AlarmClock.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,96 @@
+!
+! Earth System Modeling Framework
+! Copyright 2002-2003, University Corporation for Atmospheric Research,
+! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
+! Laboratory, University of Michigan, National Centers for Environmental
+! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
+! NASA Goddard Space Flight Center.
+! Licensed under the University of Illinois-NCSA license.
+!
+!==============================================================================
+!
+! ESMF Alarm-Clock Module
+ module ESMF_AlarmClockMod
+!
+!==============================================================================
+!
+! This file contains the AlarmCreate method.
+!
+!------------------------------------------------------------------------------
+! INCLUDES
+#include <ESMF_TimeMgr.inc>
+
+!===============================================================================
+!BOPI
+!
+! !MODULE: ESMF_AlarmClockMod
+!
+! !DESCRIPTION:
+! Separate module that uses both ESMF_AlarmMod and ESMF_ClockMod.
+! Separation is needed to avoid cyclic dependence.
+!
+! Defines F90 wrapper entry points for corresponding
+! C++ class {\tt ESMC\_Alarm}
+!
+! See {\tt ../include/ESMC\_Alarm.h} for complete description
+!
+!------------------------------------------------------------------------------
+! !USES:
+ ! inherit ESMF_Alarm and ESMF_Clock
+ use ESMF_AlarmMod, only : ESMF_Alarm, ESMF_AlarmSet
+ use ESMF_ClockMod, only : ESMF_Clock, ESMF_ClockAddAlarm
+
+ ! associated derived types
+ use ESMF_TimeIntervalMod, only : ESMF_TimeInterval
+ use ESMF_TimeMod, only : ESMF_Time
+
+ implicit none
+
+!------------------------------------------------------------------------------
+! !PRIVATE TYPES:
+ private
+!------------------------------------------------------------------------------
+
+! !PUBLIC MEMBER FUNCTIONS:
+ public ESMF_AlarmCreate
+
+!==============================================================================
+
+ contains
+
+!==============================================================================
+
+
+! Create ESMF_Alarm using ESMF 2.1.0+ semantics
+ FUNCTION ESMF_AlarmCreate( clock, RingTime, RingInterval, &
+ StopTime, Enabled, rc )
+
+ ! return value
+ type(ESMF_Alarm) :: ESMF_AlarmCreate
+ ! !ARGUMENTS:
+ type(ESMF_Clock), intent(inout), optional :: clock
+ type(ESMF_Time), intent(in), optional :: RingTime
+ type(ESMF_TimeInterval), intent(in), optional :: RingInterval
+ type(ESMF_Time), intent(in), optional :: StopTime
+ logical, intent(in), optional :: Enabled
+ integer, intent(out), optional :: rc
+ ! locals
+ type(ESMF_Alarm) :: alarmtmp
+ ! TBH: ignore allocate errors, for now
+ ALLOCATE( alarmtmp%alarmint )
+ CALL ESMF_AlarmSet( alarmtmp, &
+ RingTime=RingTime, &
+ RingInterval=RingInterval, &
+ StopTime=StopTime, &
+ Enabled=Enabled, &
+ rc=rc )
+ IF ( PRESENT ( clock ) ) THEN
+ CALL ESMF_ClockAddAlarm( clock, alarmtmp, rc )
+ ENDIF
+ ESMF_AlarmCreate = alarmtmp
+ END FUNCTION ESMF_AlarmCreate
+
+
+!------------------------------------------------------------------------------
+
+ end module ESMF_AlarmClockMod
Deleted: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Base.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/ESMF_Base.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Base.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,1082 +0,0 @@
-!
-! Earth System Modeling Framework
-! Copyright 2002-2003, University Corporation for Atmospheric Research,
-! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
-! Laboratory, University of Michigan, National Centers for Environmental
-! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
-! NASA Goddard Space Flight Center.
-! Licensed under the University of Illinois-NCSA license.
-!
-! ESMF Base Module
-!
-! (all lines between the !BOP and !EOP markers will be included in the
-! automated document processing.)
-!------------------------------------------------------------------------------
-
-!------------------------------------------------------------------------------
-! module definition
-
- module ESMF_BaseMod
-
-!BOP
-! !MODULE: ESMF_BaseMod - Base class for all ESMF classes
-!
-! !DESCRIPTION:
-!
-! The code in this file implements the Base defined type
-! and functions which operate on all types. This is an
-! interface to the actual C++ base class implementation in the ../src dir.
-!
-! See the ESMF Developers Guide document for more details.
-!
-!------------------------------------------------------------------------------
-
-! !USES:
- implicit none
-!
-! !PRIVATE TYPES:
- private
-
-!------------------------------------------------------------------------------
-!
-! Global integer parameters, used frequently
-
- integer, parameter :: ESMF_SUCCESS = 0, ESMF_FAILURE = -1
- integer, parameter :: ESMF_MAXSTR = 128
- integer, parameter :: ESMF_MAXDIM = 7, &
- ESMF_MAXDECOMPDIM=3, &
- ESMF_MAXGRIDDIM=2
-
- integer, parameter :: ESMF_MAJOR_VERSION = 2
- integer, parameter :: ESMF_MINOR_VERSION = 1
- integer, parameter :: ESMF_REVISION = 1
- integer, parameter :: ESMF_PATCHLEVEL = 0
- character(32), parameter :: ESMF_VERSION_STRING = "2.1.1"
-
-!------------------------------------------------------------------------------
-!
- type ESMF_Status
- private
- integer :: status
- end type
-
- type(ESMF_Status), parameter :: ESMF_STATE_UNINIT = ESMF_Status(1), &
- ESMF_STATE_READY = ESMF_Status(2), &
- ESMF_STATE_UNALLOCATED = ESMF_Status(3), &
- ESMF_STATE_ALLOCATED = ESMF_Status(4), &
- ESMF_STATE_BUSY = ESMF_Status(5), &
- ESMF_STATE_INVALID = ESMF_Status(6)
-
-!------------------------------------------------------------------------------
-!
- type ESMF_Pointer
- private
- integer*8 :: ptr
- end type
-
- type(ESMF_Pointer), parameter :: ESMF_NULL_POINTER = ESMF_Pointer(0), &
- ESMF_BAD_POINTER = ESMF_Pointer(-1)
-
-
-!------------------------------------------------------------------------------
-!
- !! TODO: I believe if we define an assignment(=) operator to convert
- !! a datatype into integer, then we could use the type and kind as
- !! targets in a select case() statement and make the contents private.
- !! (see pg 248 of the "big book")
- type ESMF_DataType
- !!private
- integer :: dtype
- end type
-
- type(ESMF_DataType), parameter :: ESMF_DATA_INTEGER = ESMF_DataType(1), &
- ESMF_DATA_REAL = ESMF_DataType(2), &
- ESMF_DATA_LOGICAL = ESMF_DataType(3), &
- ESMF_DATA_CHARACTER = ESMF_DataType(4)
-
-!------------------------------------------------------------------------------
-
- integer, parameter :: &
- ESMF_KIND_I1 = selected_int_kind(2), &
- ESMF_KIND_I2 = selected_int_kind(4), &
- ESMF_KIND_I4 = selected_int_kind(9), &
- ESMF_KIND_I8 = selected_int_kind(18), &
- ESMF_KIND_R4 = selected_real_kind(3,25), &
- ESMF_KIND_R8 = selected_real_kind(6,45), &
- ESMF_KIND_C8 = selected_real_kind(3,25), &
- ESMF_KIND_C16 = selected_real_kind(6,45)
-
-!------------------------------------------------------------------------------
-
- type ESMF_DataValue
- private
- type(ESMF_DataType) :: dt
- integer :: rank
- ! how do you do values of all types here ? TODO
- ! in C++ i'd do a union w/ overloaded access funcs
- integer :: vi
- !integer, dimension (:), pointer :: vip
- !real :: vr
- !real, dimension (:), pointer :: vrp
- !logical :: vl
- !logical, pointer :: vlp
- !character (len=ESMF_MAXSTR) :: vc
- !character, pointer :: vcp
- end type
-
-!------------------------------------------------------------------------------
-!
- type ESMF_Attribute
- private
- character (len=ESMF_MAXSTR) :: attr_name
- type (ESMF_DataType) :: attr_type
- type (ESMF_DataValue) :: attr_value
- end type
-
-!------------------------------------------------------------------------------
-!
- !! TODO: this should be a shallow object, with a simple init() and
- !! get() function, and the contents should go back to being private.
- type ESMF_AxisIndex
-! !!private
- integer :: l
- integer :: r
- integer :: max
- integer :: decomp
- integer :: gstart
- end type
-
- !! TODO: same comment as above.
- type ESMF_MemIndex
-! !!private
- integer :: l
- integer :: r
- integer :: str
- integer :: num
- end type
-
-!------------------------------------------------------------------------------
-!
- type ESMF_BasePointer
- private
- integer*8 :: base_ptr
- end type
-
- integer :: global_count = 0
-
-!------------------------------------------------------------------------------
-!
-! ! WARNING: must match corresponding values in ../include/ESMC_Base.h
- type ESMF_Logical
- private
- integer :: value
- end type
-
- type(ESMF_Logical), parameter :: ESMF_TF_UNKNOWN = ESMF_Logical(1), &
- ESMF_TF_TRUE = ESMF_Logical(2), &
- ESMF_TF_FALSE = ESMF_Logical(3)
-
-!------------------------------------------------------------------------------
-!
- type ESMF_Base
- private
- integer :: ID
- integer :: ref_count
- type (ESMF_Status) :: base_status
- character (len=ESMF_MAXSTR) :: name
- end type
-
-! !PUBLIC TYPES:
-
- public ESMF_STATE_INVALID
-! public ESMF_STATE_UNINIT, ESMF_STATE_READY, &
-! ESMF_STATE_UNALLOCATED, ESMF_STATE_ALLOCATED, &
-! ESMF_STATE_BUSY
-
- public ESMF_DATA_INTEGER, ESMF_DATA_REAL, &
- ESMF_DATA_LOGICAL, ESMF_DATA_CHARACTER
-
- public ESMF_KIND_I1, ESMF_KIND_I2, ESMF_KIND_I4, ESMF_KIND_I8, &
- ESMF_KIND_R4, ESMF_KIND_R8, ESMF_KIND_C8, ESMF_KIND_C16
-
- public ESMF_NULL_POINTER, ESMF_BAD_POINTER
-
-
- public ESMF_FAILURE, ESMF_SUCCESS
- public ESMF_MAXSTR
- public ESMF_MAXDIM, ESMF_MAXDECOMPDIM, ESMF_MAXGRIDDIM
-
- public ESMF_MAJOR_VERSION, ESMF_MINOR_VERSION, ESMF_REVISION
- public ESMF_VERSION_STRING
-
- public ESMF_Status, ESMF_Pointer, ESMF_DataType
- public ESMF_DataValue, ESMF_Attribute
-! public ESMF_MemIndex
-! public ESMF_BasePointer
- public ESMF_Base
-
- public ESMF_AxisIndex, ESMF_AxisIndexGet
-! public ESMF_AxisIndexInit
- public ESMF_Logical
-! public ESMF_TF_TRUE, ESMF_TF_FALSE
-
-! !PUBLIC MEMBER FUNCTIONS:
-!
-! !DESCRIPTION:
-! The following routines apply to any type in the system.
-! The attribute routines can be inherited as-is. The other
-! routines need to be specialized by the higher level objects.
-!
-! Base class methods
-! public ESMF_BaseInit
-
-! public ESMF_BaseGetConfig
-! public ESMF_BaseSetConfig
-
-! public ESMF_BaseGetInstCount
-
-! public ESMF_BaseSetID
-! public ESMF_BaseGetID
-
-! public ESMF_BaseSetRefCount
-! public ESMF_BaseGetRefCount
-
-! public ESMF_BaseSetStatus
-! public ESMF_BaseGetStatus
-
-! Virtual methods to be defined by derived classes
-! public ESMF_Read
-! public ESMF_Write
-! public ESMF_Validate
-! public ESMF_Print
-
-! Attribute methods
- public ESMF_AttributeSet
- public ESMF_AttributeGet
- public ESMF_AttributeGetCount
- public ESMF_AttributeGetbyNumber
- public ESMF_AttributeGetNameList
- public ESMF_AttributeSetList
- public ESMF_AttributeGetList
- public ESMF_AttributeSetObjectList
- public ESMF_AttributeGetObjectList
- public ESMF_AttributeCopy
- public ESMF_AttributeCopyAll
-
-! Misc methods
- public ESMF_SetName
- public ESMF_GetName
- public ESMF_SetPointer
- public ESMF_SetNullPointer
- public ESMF_GetPointer
-
-! Print methods for calling by higher level print functions
-! (they have little formatting other than the actual values)
- public ESMF_StatusString, ESMF_DataTypeString
-
-! Overloaded = operator functions
- public operator(.eq.), operator(.ne.), assignment(=)
-!
-!
-!EOP
-
-!------------------------------------------------------------------------------
-
-! overload .eq. & .ne. with additional derived types so you can compare
-! them as if they were simple integers.
-
-
-interface operator (.eq.)
- module procedure ESMF_sfeq
- module procedure ESMF_dteq
- module procedure ESMF_pteq
- module procedure ESMF_tfeq
- module procedure ESMF_aieq
-end interface
-
-interface operator (.ne.)
- module procedure ESMF_sfne
- module procedure ESMF_dtne
- module procedure ESMF_ptne
- module procedure ESMF_tfne
- module procedure ESMF_aine
-end interface
-
-interface assignment (=)
- module procedure ESMF_dtas
- module procedure ESMF_ptas
-end interface
-
-!------------------------------------------------------------------------------
-
- contains
-
-!------------------------------------------------------------------------------
-! function to compare two ESMF_Status flags to see if they're the same or not
-
-function ESMF_sfeq(sf1, sf2)
- logical ESMF_sfeq
- type(ESMF_Status), intent(in) :: sf1, sf2
-
- ESMF_sfeq = (sf1%status .eq. sf2%status)
-end function
-
-function ESMF_sfne(sf1, sf2)
- logical ESMF_sfne
- type(ESMF_Status), intent(in) :: sf1, sf2
-
- ESMF_sfne = (sf1%status .ne. sf2%status)
-end function
-
-!------------------------------------------------------------------------------
-! function to compare two ESMF_DataTypes to see if they're the same or not
-
-function ESMF_dteq(dt1, dt2)
- logical ESMF_dteq
- type(ESMF_DataType), intent(in) :: dt1, dt2
-
- ESMF_dteq = (dt1%dtype .eq. dt2%dtype)
-end function
-
-function ESMF_dtne(dt1, dt2)
- logical ESMF_dtne
- type(ESMF_DataType), intent(in) :: dt1, dt2
-
- ESMF_dtne = (dt1%dtype .ne. dt2%dtype)
-end function
-
-subroutine ESMF_dtas(intval, dtval)
- integer, intent(out) :: intval
- type(ESMF_DataType), intent(in) :: dtval
-
- intval = dtval%dtype
-end subroutine
-
-
-!------------------------------------------------------------------------------
-! function to compare two ESMF_Pointers to see if they're the same or not
-
-function ESMF_pteq(pt1, pt2)
- logical ESMF_pteq
- type(ESMF_Pointer), intent(in) :: pt1, pt2
-
- ESMF_pteq = (pt1%ptr .eq. pt2%ptr)
-end function
-
-function ESMF_ptne(pt1, pt2)
- logical ESMF_ptne
- type(ESMF_Pointer), intent(in) :: pt1, pt2
-
- ESMF_ptne = (pt1%ptr .ne. pt2%ptr)
-end function
-
-subroutine ESMF_ptas(ptval, intval)
- type(ESMF_Pointer), intent(out) :: ptval
- integer, intent(in) :: intval
-
- ptval%ptr = intval
-end subroutine
-
-!------------------------------------------------------------------------------
-! function to compare two ESMF_Logicals to see if they're the same or not
-! also need assignment to real f90 logical?
-
-function ESMF_tfeq(tf1, tf2)
- logical ESMF_tfeq
- type(ESMF_Logical), intent(in) :: tf1, tf2
-
- ESMF_tfeq = (tf1%value .eq. tf2%value)
-end function
-
-function ESMF_tfne(tf1, tf2)
- logical ESMF_tfne
- type(ESMF_Logical), intent(in) :: tf1, tf2
-
- ESMF_tfne = (tf1%value .ne. tf2%value)
-end function
-
-!------------------------------------------------------------------------------
-! function to compare two ESMF_AxisIndex to see if they're the same or not
-
-function ESMF_aieq(ai1, ai2)
- logical ESMF_aieq
- type(ESMF_AxisIndex), intent(in) :: ai1, ai2
-
- ESMF_aieq = ((ai1%l .eq. ai2%l) .and. &
- (ai1%r .eq. ai2%r) .and. &
- (ai1%max .eq. ai2%max) .and. &
- (ai1%decomp .eq. ai2%decomp) .and. &
- (ai1%gstart .eq. ai2%gstart))
-
-end function
-
-function ESMF_aine(ai1, ai2)
- logical ESMF_aine
- type(ESMF_AxisIndex), intent(in) :: ai1, ai2
-
- ESMF_aine = ((ai1%l .ne. ai2%l) .or. &
- (ai1%r .ne. ai2%r) .or. &
- (ai1%max .ne. ai2%max) .or. &
- (ai1%decomp .ne. ai2%decomp) .or. &
- (ai1%gstart .ne. ai2%gstart))
-
-end function
-
-!------------------------------------------------------------------------------
-!------------------------------------------------------------------------------
-!
-! Base methods
-!
-!------------------------------------------------------------------------------
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_BaseInit - initialize a Base object
-!
-! !INTERFACE:
- subroutine ESMF_BaseInit(base, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Base) :: base
- integer, intent(out), optional :: rc
-
-!
-! !DESCRIPTION:
-! Set initial state on a Base object.
-!
-! \begin{description}
-! \item [base]
-! In the Fortran interface, this must in fact be a {\tt Base}
-! derived type object. It is expected that all specialized
-! derived types will include a {\tt Base} object as the first
-! entry.
-! \item [{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-!
-! \end{description}
-!
-!EOP
-
- logical :: rcpresent ! Return code present
-
-! !Initialize return code
- rcpresent = .FALSE.
- if(present(rc)) then
- rcpresent = .TRUE.
- rc = ESMF_FAILURE
- endif
-
- global_count = global_count + 1
- base%ID = global_count
- base%ref_count = 1
- base%base_status = ESMF_STATE_READY
- base%name = "undefined"
-
- if (rcpresent) rc = ESMF_SUCCESS
-
- end subroutine ESMF_BaseInit
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_SetName - set the name of this object
-!
-! !INTERFACE:
- subroutine ESMF_SetName(anytype, name, namespace, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Base) :: anytype
- character (len = *), intent(in), optional :: name
- character (len = *), intent(in), optional :: namespace
- integer, intent(out), optional :: rc
-
-!
-! !DESCRIPTION:
-! Associate a name with any object in the system.
-!
-! \begin{description}
-! \item [anytype]
-! In the Fortran interface, this must in fact be a {\tt Base}
-! derived type object. It is expected that all specialized
-! derived types will include a {\tt Base} object as the first
-! entry.
-! \item [[name]]
-! Object name. An error will be returned if a duplicate name
-! is specified. If a name is not given a unique name will be
-! generated and can be queried by the {\tt ESMF_GetName} routine.
-! \item [[namespace]]
-! Object namespace (e.g. "Application", "Component", "Grid", etc).
-! If given, the name will be checked that it is unique within
-! this namespace. If not given, the generated name will be
-! unique within this namespace. If namespace is not specified,
-! a default "global" namespace will be assumed and the same rules
-! for names will be followed.
-! \item [[rc]]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-!
-! \end{description}
-!
-!
-
-!
-!EOP
-! !REQUIREMENTS: FLD1.5, FLD1.5.3
- logical :: rcpresent ! Return code present
- character (len = ESMF_MAXSTR) :: ournamespace ! Namespace if not given
- character (len = ESMF_MAXSTR) :: defaultname ! Name if not given
- integer, save :: seqnum = 0 ! HACK - generate uniq names
- ! but not coordinated across procs
-
-! !Initialize return code
- rcpresent = .FALSE.
- if(present(rc)) then
- rcpresent = .TRUE.
- rc = ESMF_FAILURE
- endif
-
-! ! TODO: this code should generate a unique name if a name
-! ! is not given. If a namespace is given, the name has to
-! ! be unique within that namespace. Example namespaces could
-! ! be: Applications, Components, Fields/Bundles, Grids.
-!
-! ! Construct a default namespace if one is not given
- if((.not. present(namespace)) .or. (namespace .eq. "")) then
- ournamespace = "global"
- else
- ournamespace = namespace
- endif
-! ! Construct a default name if one is not given
- if((.not. present(name)) .or. (name .eq. "")) then
-
- write(defaultname, 20) trim(ournamespace), seqnum
-20 format(A,I3.3)
- seqnum = seqnum + 1
- anytype%name = defaultname
- else
- anytype%name = name
- endif
-
- if (rcpresent) rc = ESMF_SUCCESS
-
- end subroutine ESMF_SetName
-
-!-------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_GetName - get the name of this object
-!
-! !INTERFACE:
- subroutine ESMF_GetName(anytype, name, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Base), intent(in) :: anytype ! any ESMF object/type
- character (len = *), intent(out) :: name ! object/type name
- integer, intent(out), optional :: rc ! return code
-
-!
-! !DESCRIPTION:
-! Return the name of any type in the system.
-
-!
-!EOP
-! !REQUIREMENTS: FLD1.5, FLD1.5.3
-
- name = anytype%name
- if (present(rc)) rc = ESMF_SUCCESS
-
- end subroutine ESMF_GetName
-
-
-!-------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AttributeSet - set attribute on an ESMF type
-!
-! !INTERFACE:
- subroutine ESMF_AttributeSet(anytype, name, value, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Base), intent(in) :: anytype ! any ESMF type
- character (len = *), intent(in) :: name ! attribute name
- type(ESMF_DataValue), intent(in) :: value ! attribute value
- integer, intent(out), optional :: rc ! return code
-
-!
-! !DESCRIPTION:
-! Associate a (name,value) pair with any type in the system.
-
-!
-!EOP
-! !REQUIREMENTS: FLD1.5, FLD1.5.3
-
- end subroutine ESMF_AttributeSet
-
-
-!-------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_AttributeGet - get attribute from an ESMF type
-!
-! !INTERFACE:
- subroutine ESMF_AttributeGet(anytype, name, type, value, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Base), intent(in) :: anytype ! any ESMF type
- character (len = *), intent(in) :: name ! attribute name
- type(ESMF_DataType), intent(out) :: type ! all possible data types
- type(ESMF_DataValue), intent(out) :: value ! attribute value
- integer, intent(out), optional :: rc ! return code
-
-!
-! !DESCRIPTION:
-
-!
-!EOP
-! !REQUIREMENTS: FLD1.5.1, FLD1.5.3
-
- end subroutine ESMF_AttributeGet
-
-
-!-------------------------------------------------------------------------
-!BOP
-!
-! !IROUTINE: ESMF_AttributeGetCount - get an ESMF object's number of attributes
-!
-! !INTERFACE:
- subroutine ESMF_AttributeGetCount(anytype, count, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Base), intent(in) :: anytype ! any ESMF type
- integer, intent(out) :: count ! attribute count
- integer, intent(out), optional :: rc ! return code
-
-!
-! !DESCRIPTION:
-! Returns number of attributes present.
-
-!
-!EOP
-! !REQUIREMENTS: FLD1.7.5
-
- end subroutine ESMF_AttributeGetCount
-
-
-!-------------------------------------------------------------------------
-!BOP
-!
-! !IROUTINE: ESMF_AttributeGetbyNumber - get an ESMF object's attribute by num ber
-!
-! !INTERFACE:
- subroutine ESMF_AttributeGetbyNumber(anytype, number, name, type, value, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Base), intent(in) :: anytype ! any ESMF type
- integer, intent(in) :: number ! attribute number
- character (len = *), intent(in) :: name ! attribute name
- type(ESMF_DataType), intent(out) :: type ! all possible data types
- type(ESMF_DataValue), intent(out) :: value ! attribute value
- integer, intent(out), optional :: rc ! return code
-
-!
-! !DESCRIPTION:
-! Allows the caller to get attributes by number instead of by name.
-! This can be useful in iterating through all attributes in a loop.
-!
-!EOP
-! !REQUIREMENTS:
-
- end subroutine ESMF_AttributeGetbyNumber
-
-
-!-------------------------------------------------------------------------
-!BOP
-!
-!IROUTINE: ESMF_AttributeGetNameList - get an ESMF object's attribute name list
-!
-! !INTERFACE:
- subroutine ESMF_AttributeGetNameList(anytype, count, namelist, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Base), intent(in) :: anytype ! any ESMF type
- integer, intent(out) :: count ! attribute count
- character (len = *), dimension (:), intent(out) :: namelist ! attribute names
- integer, intent(out), optional :: rc ! return code
-
-!
-! !DESCRIPTION:
-! Return a list of all attribute names without returning the values.
-
-!
-!EOP
-! !REQUIREMENTS: FLD1.7.3
-
- end subroutine ESMF_AttributeGetNameList
-
-
-!-------------------------------------------------------------------------
-!BOP
-!
-! !IROUTINE: ESMF_AttributeSetList - set an ESMF object's attributes
-!
-! !INTERFACE:
- subroutine ESMF_AttributeSetList(anytype, namelist, valuelist, rc)
-
-!
-! !ARGUMENTS:
- type(ESMF_Base), intent(in) :: anytype ! any ESMF type
- character (len = *), dimension (:), intent(in) :: namelist ! attribute names
- type(ESMF_DataValue), dimension (:), intent(in) :: valuelist ! attribute values
- integer, intent(out), optional :: rc ! return code
-
-!
-! !DESCRIPTION:
-! Set multiple attributes on an object in one call. Depending on what is
-! allowed by the interface, all attributes may have to have the same type.
-!
-!EOP
-! !REQUIREMENTS: (none. added for completeness)
-
- end subroutine ESMF_AttributeSetList
-
-
-!-------------------------------------------------------------------------
-!BOP
-!
-! !IROUTINE: ESMF_AttributeGetList - get an ESMF object's attributes
-!
-! !INTERFACE:
- subroutine ESMF_AttributeGetList(anytype, namelist, typelist, valuelist, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Base), intent(in) :: anytype ! any ESMF type
- character (len = *), dimension (:), intent(in) :: namelist ! attribute names
- type(ESMF_DataType), dimension (:), intent(out) :: typelist ! all possible data types
- type(ESMF_DataValue), dimension (:), intent(out) :: valuelist ! attribute values
- integer, intent(out), optional :: rc ! return code
-
-!
-! !DESCRIPTION:
-! Get multiple attributes from an object in a single call.
-
-!
-!EOP
-! !REQUIREMENTS: FLD1.7.4
-
- end subroutine ESMF_AttributeGetList
-
-
-!-------------------------------------------------------------------------
-!BOP
-!
-! !IROUTINE: ESMF_AttributeSetObjectList - set an attribute on multiple ESMF objects
-!
-! !INTERFACE:
- subroutine ESMF_AttributeSetObjectList(anytypelist, name, value, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Base), dimension (:), intent(in) :: anytypelist ! list of any ESMF types
- character (len = *), intent(in) :: name ! attribute name
- type(ESMF_DataValue), dimension (:), intent(in) :: value ! attribute value
- integer, intent(out), optional :: rc ! return code
-
-!
-! !DESCRIPTION:
-! Set the same attribute on multiple objects in one call.
-
-!
-!EOP
-! !REQUIREMENTS: FLD1.5.5 (pri 2)
-
- end subroutine ESMF_AttributeSetObjectList
-
-
-!-------------------------------------------------------------------------
-!BOP
-!
-!
-! !IROUTINE: ESMF_AttributeGetObjectList - get an attribute from multiple ESMF objects
-!
-! !INTERFACE:
- subroutine ESMF_AttributeGetObjectList(anytypelist, name, typelist, valuelist, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Base), dimension (:), intent(in) :: anytypelist ! list of any ESMF types
- character (len = *), intent(in) :: name ! attribute name
- type(ESMF_DataType), dimension (:), intent(out) :: typelist ! all possible data types
- type(ESMF_DataValue), dimension (:), intent(out) :: valuelist ! attribute values
- integer, intent(out), optional :: rc ! return code
-
-!
-! !DESCRIPTION:
-! Get the same attribute name from multiple objects in one call.
-
-!
-!EOP
-! !REQUIREMENTS: FLD1.5.5 (pri 2)
-
- end subroutine ESMF_AttributeGetObjectList
-
-
-!-------------------------------------------------------------------------
-!BOP
-!
-! !IROUTINE: ESMF_AttributeCopy - copy an attribute between two objects
-!
-! !INTERFACE:
- subroutine ESMF_AttributeCopy(name, source, destination, rc)
-!
-! !ARGUMENTS:
- character (len = *), intent(in) :: name ! attribute name
- type(ESMF_Base), intent(in) :: source ! any ESMF type
- type(ESMF_Base), intent(in) :: destination ! any ESMF type
- integer, intent(out), optional :: rc ! return code
-
-!
-! !DESCRIPTION:
-! The specified attribute associated with the source object is
-! copied to the destination object. << does this assume overwriting the
-! attribute if it already exists in the output or does this require yet
-! another arg to say what to do with collisions? >>
-
-
-!
-!EOP
-! !REQUIREMENTS: FLD1.5.4
-
- end subroutine ESMF_AttributeCopy
-
-
-!-------------------------------------------------------------------------
-!BOP
-!
-!IROUTINE: ESMC_AttributeCopyAll - copy attributes between two objects
-
-!
-! !INTERFACE:
- subroutine ESMF_AttributeCopyAll(source, destination, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Base), intent(in) :: source ! any ESMF type
- type(ESMF_Base), intent(in) :: destination ! any ESMF type
- integer, intent(out), optional :: rc ! return code
-
-!
-! !DESCRIPTION:
-! All attributes associated with the source object are copied to the
-! destination object. Some attributes will have to be considered
-! {\tt read only} and won't be updated by this call. (e.g. an attribute
-! like {\tt name} must be unique and therefore can't be duplicated.)
-
-!
-!EOP
-! !REQUIREMENTS: FLD1.5.4
-
- end subroutine ESMF_AttributeCopyAll
-
-!=========================================================================
-! Misc utility routines, perhaps belongs in a utility file?
-!-------------------------------------------------------------------------
-!BOP
-!
-!IROUTINE: ESMC_AxisIndexInit - initialize an AxisIndex object
-
-!
-! !INTERFACE:
- subroutine ESMF_AxisIndexInit(ai, l, r, max, decomp, gstart, rc)
-!
-! !ARGUMENTS:
- type(ESMF_AxisIndex), intent(inout) :: ai
- integer, intent(in) :: l, r, max, decomp, gstart
- integer, intent(out), optional :: rc
-!
-! !DESCRIPTION:
-! Set the contents of an AxisIndex type.
-
-!
-!EOP
-! !REQUIREMENTS:
-
- ai%l = l
- ai%r = r
- ai%max = max
- ai%decomp = decomp
- ai%gstart = gstart
-
- if (present(rc)) rc = ESMF_SUCCESS
-
- end subroutine ESMF_AxisIndexInit
-
-!BOP
-!
-!IROUTINE: ESMC_AxisIndexInit - initialize an AxisIndex object
-
-!
-! !INTERFACE:
- subroutine ESMF_AxisIndexGet(ai, l, r, max, decomp, gstart, rc)
-!
-! !ARGUMENTS:
- type(ESMF_AxisIndex), intent(inout) :: ai
- integer, intent(out), optional :: l, r, max, decomp, gstart
- integer, intent(out), optional :: rc
-!
-! !DESCRIPTION:
-! Get the contents of an AxisIndex type.
-
-!
-!EOP
-! !REQUIREMENTS:
-
- if (present(l)) l = ai%l
- if (present(r)) r = ai%r
- if (present(max)) max = ai%max
- if (present(decomp)) decomp = ai%decomp
- if (present(gstart)) gstart = ai%gstart
-
- if (present(rc)) rc = ESMF_SUCCESS
-
- end subroutine ESMF_AxisIndexGet
-
-!-------------------------------------------------------------------------
-!-------------------------------------------------------------------------
-!BOP
-!
-!IROUTINE: ESMF_SetPointer - set an opaque value
-
-!
-! !INTERFACE:
- subroutine ESMF_SetPointer(ptype, contents, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Pointer) :: ptype
- integer*8, intent(in) :: contents
- integer, intent(out), optional :: rc
-
-!
-! !DESCRIPTION:
-! Set the contents of an opaque pointer type.
-
-!
-!EOP
-! !REQUIREMENTS:
- ptype%ptr = contents
- if (present(rc)) rc = ESMF_SUCCESS
-
- end subroutine ESMF_SetPointer
-
-!-------------------------------------------------------------------------
-!BOP
-!
-!IROUTINE: ESMF_SetNullPointer - set an opaque value
-
-!
-! !INTERFACE:
- subroutine ESMF_SetNullPointer(ptype, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Pointer) :: ptype
- integer, intent(out), optional :: rc
-
-!
-! !DESCRIPTION:
-! Set the contents of an opaque pointer type.
-
-!
-!EOP
-! !REQUIREMENTS:
- integer*8, parameter :: nullp = 0
-
- ptype%ptr = nullp
- if (present(rc)) rc = ESMF_SUCCESS
-
- end subroutine ESMF_SetNullPointer
-!-------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_GetPointer - get an opaque value
-!
-! !INTERFACE:
- function ESMF_GetPointer(ptype, rc)
-!
-! !RETURN VALUE:
- integer*8 :: ESMF_GetPointer
-
-! !ARGUMENTS:
- type(ESMF_Pointer), intent(in) :: ptype
- integer, intent(out), optional :: rc
-
-!
-! !DESCRIPTION:
-! Get the contents of an opaque pointer type.
-
-!
-!EOP
-! !REQUIREMENTS:
- ESMF_GetPointer = ptype%ptr
- if (present(rc)) rc = ESMF_SUCCESS
-
- end function ESMF_GetPointer
-
-!-------------------------------------------------------------------------
-! misc print routines
-!-------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_StatusString - Return status as a string
-!
-! !INTERFACE:
- subroutine ESMF_StatusString(status, string, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Status), intent(in) :: status
- character(len=*), intent(out) :: string
- integer, intent(out), optional :: rc
-
-!
-! !DESCRIPTION:
-! Return a status variable as a string.
-
-!
-!EOP
-! !REQUIREMENTS:
-
- if (status .eq. ESMF_STATE_UNINIT) string = "Uninitialized"
- if (status .eq. ESMF_STATE_READY) string = "Ready"
- if (status .eq. ESMF_STATE_UNALLOCATED) string = "Unallocated"
- if (status .eq. ESMF_STATE_ALLOCATED) string = "Allocated"
- if (status .eq. ESMF_STATE_BUSY) string = "Busy"
- if (status .eq. ESMF_STATE_INVALID) string = "Invalid"
-
- if (present(rc)) rc = ESMF_SUCCESS
-
- end subroutine ESMF_StatusString
-
-!-------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_DataTypeString - Return DataType as a string
-!
-! !INTERFACE:
- subroutine ESMF_DataTypeString(datatype, string, rc)
-!
-! !ARGUMENTS:
- type(ESMF_DataType), intent(in) :: datatype
- character(len=*), intent(out) :: string
- integer, intent(out), optional :: rc
-
-!
-! !DESCRIPTION:
-! Return a datatype variable as a string.
-
-!
-!EOP
-! !REQUIREMENTS:
-
- if (datatype .eq. ESMF_DATA_INTEGER) string = "Integer"
- if (datatype .eq. ESMF_DATA_REAL) string = "Real"
- if (datatype .eq. ESMF_DATA_LOGICAL) string = "Logical"
- if (datatype .eq. ESMF_DATA_CHARACTER) string = "Character"
-
- if (present(rc)) rc = ESMF_SUCCESS
-
- end subroutine ESMF_DataTypeString
-
-!-------------------------------------------------------------------------
-!
-!-------------------------------------------------------------------------
-! put Print and Validate skeletons here - but they should be
-! overridden by higher level more specialized functions.
-!-------------------------------------------------------------------------
-
- end module ESMF_BaseMod
Copied: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Base.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/ESMF_Base.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/ESMF_Base.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Base.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,1082 @@
+!
+! Earth System Modeling Framework
+! Copyright 2002-2003, University Corporation for Atmospheric Research,
+! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
+! Laboratory, University of Michigan, National Centers for Environmental
+! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
+! NASA Goddard Space Flight Center.
+! Licensed under the University of Illinois-NCSA license.
+!
+! ESMF Base Module
+!
+! (all lines between the !BOP and !EOP markers will be included in the
+! automated document processing.)
+!------------------------------------------------------------------------------
+
+!------------------------------------------------------------------------------
+! module definition
+
+ module ESMF_BaseMod
+
+!BOP
+! !MODULE: ESMF_BaseMod - Base class for all ESMF classes
+!
+! !DESCRIPTION:
+!
+! The code in this file implements the Base defined type
+! and functions which operate on all types. This is an
+! interface to the actual C++ base class implementation in the ../src dir.
+!
+! See the ESMF Developers Guide document for more details.
+!
+!------------------------------------------------------------------------------
+
+! !USES:
+ implicit none
+!
+! !PRIVATE TYPES:
+ private
+
+!------------------------------------------------------------------------------
+!
+! Global integer parameters, used frequently
+
+ integer, parameter :: ESMF_SUCCESS = 0, ESMF_FAILURE = -1
+ integer, parameter :: ESMF_MAXSTR = 128
+ integer, parameter :: ESMF_MAXDIM = 7, &
+ ESMF_MAXDECOMPDIM=3, &
+ ESMF_MAXGRIDDIM=2
+
+ integer, parameter :: ESMF_MAJOR_VERSION = 2
+ integer, parameter :: ESMF_MINOR_VERSION = 1
+ integer, parameter :: ESMF_REVISION = 1
+ integer, parameter :: ESMF_PATCHLEVEL = 0
+ character(32), parameter :: ESMF_VERSION_STRING = "2.1.1"
+
+!------------------------------------------------------------------------------
+!
+ type ESMF_Status
+ private
+ integer :: status
+ end type
+
+ type(ESMF_Status), parameter :: ESMF_STATE_UNINIT = ESMF_Status(1), &
+ ESMF_STATE_READY = ESMF_Status(2), &
+ ESMF_STATE_UNALLOCATED = ESMF_Status(3), &
+ ESMF_STATE_ALLOCATED = ESMF_Status(4), &
+ ESMF_STATE_BUSY = ESMF_Status(5), &
+ ESMF_STATE_INVALID = ESMF_Status(6)
+
+!------------------------------------------------------------------------------
+!
+ type ESMF_Pointer
+ private
+ integer*8 :: ptr
+ end type
+
+ type(ESMF_Pointer), parameter :: ESMF_NULL_POINTER = ESMF_Pointer(0), &
+ ESMF_BAD_POINTER = ESMF_Pointer(-1)
+
+
+!------------------------------------------------------------------------------
+!
+ !! TODO: I believe if we define an assignment(=) operator to convert
+ !! a datatype into integer, then we could use the type and kind as
+ !! targets in a select case() statement and make the contents private.
+ !! (see pg 248 of the "big book")
+ type ESMF_DataType
+ !!private
+ integer :: dtype
+ end type
+
+ type(ESMF_DataType), parameter :: ESMF_DATA_INTEGER = ESMF_DataType(1), &
+ ESMF_DATA_REAL = ESMF_DataType(2), &
+ ESMF_DATA_LOGICAL = ESMF_DataType(3), &
+ ESMF_DATA_CHARACTER = ESMF_DataType(4)
+
+!------------------------------------------------------------------------------
+
+ integer, parameter :: &
+ ESMF_KIND_I1 = selected_int_kind(2), &
+ ESMF_KIND_I2 = selected_int_kind(4), &
+ ESMF_KIND_I4 = selected_int_kind(9), &
+ ESMF_KIND_I8 = selected_int_kind(18), &
+ ESMF_KIND_R4 = selected_real_kind(3,25), &
+ ESMF_KIND_R8 = selected_real_kind(6,45), &
+ ESMF_KIND_C8 = selected_real_kind(3,25), &
+ ESMF_KIND_C16 = selected_real_kind(6,45)
+
+!------------------------------------------------------------------------------
+
+ type ESMF_DataValue
+ private
+ type(ESMF_DataType) :: dt
+ integer :: rank
+ ! how do you do values of all types here ? TODO
+ ! in C++ i'd do a union w/ overloaded access funcs
+ integer :: vi
+ !integer, dimension (:), pointer :: vip
+ !real :: vr
+ !real, dimension (:), pointer :: vrp
+ !logical :: vl
+ !logical, pointer :: vlp
+ !character (len=ESMF_MAXSTR) :: vc
+ !character, pointer :: vcp
+ end type
+
+!------------------------------------------------------------------------------
+!
+ type ESMF_Attribute
+ private
+ character (len=ESMF_MAXSTR) :: attr_name
+ type (ESMF_DataType) :: attr_type
+ type (ESMF_DataValue) :: attr_value
+ end type
+
+!------------------------------------------------------------------------------
+!
+ !! TODO: this should be a shallow object, with a simple init() and
+ !! get() function, and the contents should go back to being private.
+ type ESMF_AxisIndex
+! !!private
+ integer :: l
+ integer :: r
+ integer :: max
+ integer :: decomp
+ integer :: gstart
+ end type
+
+ !! TODO: same comment as above.
+ type ESMF_MemIndex
+! !!private
+ integer :: l
+ integer :: r
+ integer :: str
+ integer :: num
+ end type
+
+!------------------------------------------------------------------------------
+!
+ type ESMF_BasePointer
+ private
+ integer*8 :: base_ptr
+ end type
+
+ integer :: global_count = 0
+
+!------------------------------------------------------------------------------
+!
+! ! WARNING: must match corresponding values in ../include/ESMC_Base.h
+ type ESMF_Logical
+ private
+ integer :: value
+ end type
+
+ type(ESMF_Logical), parameter :: ESMF_TF_UNKNOWN = ESMF_Logical(1), &
+ ESMF_TF_TRUE = ESMF_Logical(2), &
+ ESMF_TF_FALSE = ESMF_Logical(3)
+
+!------------------------------------------------------------------------------
+!
+ type ESMF_Base
+ private
+ integer :: ID
+ integer :: ref_count
+ type (ESMF_Status) :: base_status
+ character (len=ESMF_MAXSTR) :: name
+ end type
+
+! !PUBLIC TYPES:
+
+ public ESMF_STATE_INVALID
+! public ESMF_STATE_UNINIT, ESMF_STATE_READY, &
+! ESMF_STATE_UNALLOCATED, ESMF_STATE_ALLOCATED, &
+! ESMF_STATE_BUSY
+
+ public ESMF_DATA_INTEGER, ESMF_DATA_REAL, &
+ ESMF_DATA_LOGICAL, ESMF_DATA_CHARACTER
+
+ public ESMF_KIND_I1, ESMF_KIND_I2, ESMF_KIND_I4, ESMF_KIND_I8, &
+ ESMF_KIND_R4, ESMF_KIND_R8, ESMF_KIND_C8, ESMF_KIND_C16
+
+ public ESMF_NULL_POINTER, ESMF_BAD_POINTER
+
+
+ public ESMF_FAILURE, ESMF_SUCCESS
+ public ESMF_MAXSTR
+ public ESMF_MAXDIM, ESMF_MAXDECOMPDIM, ESMF_MAXGRIDDIM
+
+ public ESMF_MAJOR_VERSION, ESMF_MINOR_VERSION, ESMF_REVISION
+ public ESMF_VERSION_STRING
+
+ public ESMF_Status, ESMF_Pointer, ESMF_DataType
+ public ESMF_DataValue, ESMF_Attribute
+! public ESMF_MemIndex
+! public ESMF_BasePointer
+ public ESMF_Base
+
+ public ESMF_AxisIndex, ESMF_AxisIndexGet
+! public ESMF_AxisIndexInit
+ public ESMF_Logical
+! public ESMF_TF_TRUE, ESMF_TF_FALSE
+
+! !PUBLIC MEMBER FUNCTIONS:
+!
+! !DESCRIPTION:
+! The following routines apply to any type in the system.
+! The attribute routines can be inherited as-is. The other
+! routines need to be specialized by the higher level objects.
+!
+! Base class methods
+! public ESMF_BaseInit
+
+! public ESMF_BaseGetConfig
+! public ESMF_BaseSetConfig
+
+! public ESMF_BaseGetInstCount
+
+! public ESMF_BaseSetID
+! public ESMF_BaseGetID
+
+! public ESMF_BaseSetRefCount
+! public ESMF_BaseGetRefCount
+
+! public ESMF_BaseSetStatus
+! public ESMF_BaseGetStatus
+
+! Virtual methods to be defined by derived classes
+! public ESMF_Read
+! public ESMF_Write
+! public ESMF_Validate
+! public ESMF_Print
+
+! Attribute methods
+ public ESMF_AttributeSet
+ public ESMF_AttributeGet
+ public ESMF_AttributeGetCount
+ public ESMF_AttributeGetbyNumber
+ public ESMF_AttributeGetNameList
+ public ESMF_AttributeSetList
+ public ESMF_AttributeGetList
+ public ESMF_AttributeSetObjectList
+ public ESMF_AttributeGetObjectList
+ public ESMF_AttributeCopy
+ public ESMF_AttributeCopyAll
+
+! Misc methods
+ public ESMF_SetName
+ public ESMF_GetName
+ public ESMF_SetPointer
+ public ESMF_SetNullPointer
+ public ESMF_GetPointer
+
+! Print methods for calling by higher level print functions
+! (they have little formatting other than the actual values)
+ public ESMF_StatusString, ESMF_DataTypeString
+
+! Overloaded = operator functions
+ public operator(.eq.), operator(.ne.), assignment(=)
+!
+!
+!EOP
+
+!------------------------------------------------------------------------------
+
+! overload .eq. & .ne. with additional derived types so you can compare
+! them as if they were simple integers.
+
+
+interface operator (.eq.)
+ module procedure ESMF_sfeq
+ module procedure ESMF_dteq
+ module procedure ESMF_pteq
+ module procedure ESMF_tfeq
+ module procedure ESMF_aieq
+end interface
+
+interface operator (.ne.)
+ module procedure ESMF_sfne
+ module procedure ESMF_dtne
+ module procedure ESMF_ptne
+ module procedure ESMF_tfne
+ module procedure ESMF_aine
+end interface
+
+interface assignment (=)
+ module procedure ESMF_dtas
+ module procedure ESMF_ptas
+end interface
+
+!------------------------------------------------------------------------------
+
+ contains
+
+!------------------------------------------------------------------------------
+! function to compare two ESMF_Status flags to see if they're the same or not
+
+function ESMF_sfeq(sf1, sf2)
+ logical ESMF_sfeq
+ type(ESMF_Status), intent(in) :: sf1, sf2
+
+ ESMF_sfeq = (sf1%status .eq. sf2%status)
+end function
+
+function ESMF_sfne(sf1, sf2)
+ logical ESMF_sfne
+ type(ESMF_Status), intent(in) :: sf1, sf2
+
+ ESMF_sfne = (sf1%status .ne. sf2%status)
+end function
+
+!------------------------------------------------------------------------------
+! function to compare two ESMF_DataTypes to see if they're the same or not
+
+function ESMF_dteq(dt1, dt2)
+ logical ESMF_dteq
+ type(ESMF_DataType), intent(in) :: dt1, dt2
+
+ ESMF_dteq = (dt1%dtype .eq. dt2%dtype)
+end function
+
+function ESMF_dtne(dt1, dt2)
+ logical ESMF_dtne
+ type(ESMF_DataType), intent(in) :: dt1, dt2
+
+ ESMF_dtne = (dt1%dtype .ne. dt2%dtype)
+end function
+
+subroutine ESMF_dtas(intval, dtval)
+ integer, intent(out) :: intval
+ type(ESMF_DataType), intent(in) :: dtval
+
+ intval = dtval%dtype
+end subroutine
+
+
+!------------------------------------------------------------------------------
+! function to compare two ESMF_Pointers to see if they're the same or not
+
+function ESMF_pteq(pt1, pt2)
+ logical ESMF_pteq
+ type(ESMF_Pointer), intent(in) :: pt1, pt2
+
+ ESMF_pteq = (pt1%ptr .eq. pt2%ptr)
+end function
+
+function ESMF_ptne(pt1, pt2)
+ logical ESMF_ptne
+ type(ESMF_Pointer), intent(in) :: pt1, pt2
+
+ ESMF_ptne = (pt1%ptr .ne. pt2%ptr)
+end function
+
+subroutine ESMF_ptas(ptval, intval)
+ type(ESMF_Pointer), intent(out) :: ptval
+ integer, intent(in) :: intval
+
+ ptval%ptr = intval
+end subroutine
+
+!------------------------------------------------------------------------------
+! function to compare two ESMF_Logicals to see if they're the same or not
+! also need assignment to real f90 logical?
+
+function ESMF_tfeq(tf1, tf2)
+ logical ESMF_tfeq
+ type(ESMF_Logical), intent(in) :: tf1, tf2
+
+ ESMF_tfeq = (tf1%value .eq. tf2%value)
+end function
+
+function ESMF_tfne(tf1, tf2)
+ logical ESMF_tfne
+ type(ESMF_Logical), intent(in) :: tf1, tf2
+
+ ESMF_tfne = (tf1%value .ne. tf2%value)
+end function
+
+!------------------------------------------------------------------------------
+! function to compare two ESMF_AxisIndex to see if they're the same or not
+
+function ESMF_aieq(ai1, ai2)
+ logical ESMF_aieq
+ type(ESMF_AxisIndex), intent(in) :: ai1, ai2
+
+ ESMF_aieq = ((ai1%l .eq. ai2%l) .and. &
+ (ai1%r .eq. ai2%r) .and. &
+ (ai1%max .eq. ai2%max) .and. &
+ (ai1%decomp .eq. ai2%decomp) .and. &
+ (ai1%gstart .eq. ai2%gstart))
+
+end function
+
+function ESMF_aine(ai1, ai2)
+ logical ESMF_aine
+ type(ESMF_AxisIndex), intent(in) :: ai1, ai2
+
+ ESMF_aine = ((ai1%l .ne. ai2%l) .or. &
+ (ai1%r .ne. ai2%r) .or. &
+ (ai1%max .ne. ai2%max) .or. &
+ (ai1%decomp .ne. ai2%decomp) .or. &
+ (ai1%gstart .ne. ai2%gstart))
+
+end function
+
+!------------------------------------------------------------------------------
+!------------------------------------------------------------------------------
+!
+! Base methods
+!
+!------------------------------------------------------------------------------
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_BaseInit - initialize a Base object
+!
+! !INTERFACE:
+ subroutine ESMF_BaseInit(base, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Base) :: base
+ integer, intent(out), optional :: rc
+
+!
+! !DESCRIPTION:
+! Set initial state on a Base object.
+!
+! \begin{description}
+! \item [base]
+! In the Fortran interface, this must in fact be a {\tt Base}
+! derived type object. It is expected that all specialized
+! derived types will include a {\tt Base} object as the first
+! entry.
+! \item [{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+!
+! \end{description}
+!
+!EOP
+
+ logical :: rcpresent ! Return code present
+
+! !Initialize return code
+ rcpresent = .FALSE.
+ if(present(rc)) then
+ rcpresent = .TRUE.
+ rc = ESMF_FAILURE
+ endif
+
+ global_count = global_count + 1
+ base%ID = global_count
+ base%ref_count = 1
+ base%base_status = ESMF_STATE_READY
+ base%name = "undefined"
+
+ if (rcpresent) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_BaseInit
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_SetName - set the name of this object
+!
+! !INTERFACE:
+ subroutine ESMF_SetName(anytype, name, namespace, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Base) :: anytype
+ character (len = *), intent(in), optional :: name
+ character (len = *), intent(in), optional :: namespace
+ integer, intent(out), optional :: rc
+
+!
+! !DESCRIPTION:
+! Associate a name with any object in the system.
+!
+! \begin{description}
+! \item [anytype]
+! In the Fortran interface, this must in fact be a {\tt Base}
+! derived type object. It is expected that all specialized
+! derived types will include a {\tt Base} object as the first
+! entry.
+! \item [[name]]
+! Object name. An error will be returned if a duplicate name
+! is specified. If a name is not given a unique name will be
+! generated and can be queried by the {\tt ESMF_GetName} routine.
+! \item [[namespace]]
+! Object namespace (e.g. "Application", "Component", "Grid", etc).
+! If given, the name will be checked that it is unique within
+! this namespace. If not given, the generated name will be
+! unique within this namespace. If namespace is not specified,
+! a default "global" namespace will be assumed and the same rules
+! for names will be followed.
+! \item [[rc]]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+!
+! \end{description}
+!
+!
+
+!
+!EOP
+! !REQUIREMENTS: FLD1.5, FLD1.5.3
+ logical :: rcpresent ! Return code present
+ character (len = ESMF_MAXSTR) :: ournamespace ! Namespace if not given
+ character (len = ESMF_MAXSTR) :: defaultname ! Name if not given
+ integer, save :: seqnum = 0 ! HACK - generate uniq names
+ ! but not coordinated across procs
+
+! !Initialize return code
+ rcpresent = .FALSE.
+ if(present(rc)) then
+ rcpresent = .TRUE.
+ rc = ESMF_FAILURE
+ endif
+
+! ! TODO: this code should generate a unique name if a name
+! ! is not given. If a namespace is given, the name has to
+! ! be unique within that namespace. Example namespaces could
+! ! be: Applications, Components, Fields/Bundles, Grids.
+!
+! ! Construct a default namespace if one is not given
+ if((.not. present(namespace)) .or. (namespace .eq. "")) then
+ ournamespace = "global"
+ else
+ ournamespace = namespace
+ endif
+! ! Construct a default name if one is not given
+ if((.not. present(name)) .or. (name .eq. "")) then
+
+ write(defaultname, 20) trim(ournamespace), seqnum
+20 format(A,I3.3)
+ seqnum = seqnum + 1
+ anytype%name = defaultname
+ else
+ anytype%name = name
+ endif
+
+ if (rcpresent) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_SetName
+
+!-------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_GetName - get the name of this object
+!
+! !INTERFACE:
+ subroutine ESMF_GetName(anytype, name, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Base), intent(in) :: anytype ! any ESMF object/type
+ character (len = *), intent(out) :: name ! object/type name
+ integer, intent(out), optional :: rc ! return code
+
+!
+! !DESCRIPTION:
+! Return the name of any type in the system.
+
+!
+!EOP
+! !REQUIREMENTS: FLD1.5, FLD1.5.3
+
+ name = anytype%name
+ if (present(rc)) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_GetName
+
+
+!-------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AttributeSet - set attribute on an ESMF type
+!
+! !INTERFACE:
+ subroutine ESMF_AttributeSet(anytype, name, value, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Base), intent(in) :: anytype ! any ESMF type
+ character (len = *), intent(in) :: name ! attribute name
+ type(ESMF_DataValue), intent(in) :: value ! attribute value
+ integer, intent(out), optional :: rc ! return code
+
+!
+! !DESCRIPTION:
+! Associate a (name,value) pair with any type in the system.
+
+!
+!EOP
+! !REQUIREMENTS: FLD1.5, FLD1.5.3
+
+ end subroutine ESMF_AttributeSet
+
+
+!-------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_AttributeGet - get attribute from an ESMF type
+!
+! !INTERFACE:
+ subroutine ESMF_AttributeGet(anytype, name, type, value, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Base), intent(in) :: anytype ! any ESMF type
+ character (len = *), intent(in) :: name ! attribute name
+ type(ESMF_DataType), intent(out) :: type ! all possible data types
+ type(ESMF_DataValue), intent(out) :: value ! attribute value
+ integer, intent(out), optional :: rc ! return code
+
+!
+! !DESCRIPTION:
+
+!
+!EOP
+! !REQUIREMENTS: FLD1.5.1, FLD1.5.3
+
+ end subroutine ESMF_AttributeGet
+
+
+!-------------------------------------------------------------------------
+!BOP
+!
+! !IROUTINE: ESMF_AttributeGetCount - get an ESMF object's number of attributes
+!
+! !INTERFACE:
+ subroutine ESMF_AttributeGetCount(anytype, count, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Base), intent(in) :: anytype ! any ESMF type
+ integer, intent(out) :: count ! attribute count
+ integer, intent(out), optional :: rc ! return code
+
+!
+! !DESCRIPTION:
+! Returns number of attributes present.
+
+!
+!EOP
+! !REQUIREMENTS: FLD1.7.5
+
+ end subroutine ESMF_AttributeGetCount
+
+
+!-------------------------------------------------------------------------
+!BOP
+!
+! !IROUTINE: ESMF_AttributeGetbyNumber - get an ESMF object's attribute by num ber
+!
+! !INTERFACE:
+ subroutine ESMF_AttributeGetbyNumber(anytype, number, name, type, value, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Base), intent(in) :: anytype ! any ESMF type
+ integer, intent(in) :: number ! attribute number
+ character (len = *), intent(in) :: name ! attribute name
+ type(ESMF_DataType), intent(out) :: type ! all possible data types
+ type(ESMF_DataValue), intent(out) :: value ! attribute value
+ integer, intent(out), optional :: rc ! return code
+
+!
+! !DESCRIPTION:
+! Allows the caller to get attributes by number instead of by name.
+! This can be useful in iterating through all attributes in a loop.
+!
+!EOP
+! !REQUIREMENTS:
+
+ end subroutine ESMF_AttributeGetbyNumber
+
+
+!-------------------------------------------------------------------------
+!BOP
+!
+!IROUTINE: ESMF_AttributeGetNameList - get an ESMF object's attribute name list
+!
+! !INTERFACE:
+ subroutine ESMF_AttributeGetNameList(anytype, count, namelist, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Base), intent(in) :: anytype ! any ESMF type
+ integer, intent(out) :: count ! attribute count
+ character (len = *), dimension (:), intent(out) :: namelist ! attribute names
+ integer, intent(out), optional :: rc ! return code
+
+!
+! !DESCRIPTION:
+! Return a list of all attribute names without returning the values.
+
+!
+!EOP
+! !REQUIREMENTS: FLD1.7.3
+
+ end subroutine ESMF_AttributeGetNameList
+
+
+!-------------------------------------------------------------------------
+!BOP
+!
+! !IROUTINE: ESMF_AttributeSetList - set an ESMF object's attributes
+!
+! !INTERFACE:
+ subroutine ESMF_AttributeSetList(anytype, namelist, valuelist, rc)
+
+!
+! !ARGUMENTS:
+ type(ESMF_Base), intent(in) :: anytype ! any ESMF type
+ character (len = *), dimension (:), intent(in) :: namelist ! attribute names
+ type(ESMF_DataValue), dimension (:), intent(in) :: valuelist ! attribute values
+ integer, intent(out), optional :: rc ! return code
+
+!
+! !DESCRIPTION:
+! Set multiple attributes on an object in one call. Depending on what is
+! allowed by the interface, all attributes may have to have the same type.
+!
+!EOP
+! !REQUIREMENTS: (none. added for completeness)
+
+ end subroutine ESMF_AttributeSetList
+
+
+!-------------------------------------------------------------------------
+!BOP
+!
+! !IROUTINE: ESMF_AttributeGetList - get an ESMF object's attributes
+!
+! !INTERFACE:
+ subroutine ESMF_AttributeGetList(anytype, namelist, typelist, valuelist, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Base), intent(in) :: anytype ! any ESMF type
+ character (len = *), dimension (:), intent(in) :: namelist ! attribute names
+ type(ESMF_DataType), dimension (:), intent(out) :: typelist ! all possible data types
+ type(ESMF_DataValue), dimension (:), intent(out) :: valuelist ! attribute values
+ integer, intent(out), optional :: rc ! return code
+
+!
+! !DESCRIPTION:
+! Get multiple attributes from an object in a single call.
+
+!
+!EOP
+! !REQUIREMENTS: FLD1.7.4
+
+ end subroutine ESMF_AttributeGetList
+
+
+!-------------------------------------------------------------------------
+!BOP
+!
+! !IROUTINE: ESMF_AttributeSetObjectList - set an attribute on multiple ESMF objects
+!
+! !INTERFACE:
+ subroutine ESMF_AttributeSetObjectList(anytypelist, name, value, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Base), dimension (:), intent(in) :: anytypelist ! list of any ESMF types
+ character (len = *), intent(in) :: name ! attribute name
+ type(ESMF_DataValue), dimension (:), intent(in) :: value ! attribute value
+ integer, intent(out), optional :: rc ! return code
+
+!
+! !DESCRIPTION:
+! Set the same attribute on multiple objects in one call.
+
+!
+!EOP
+! !REQUIREMENTS: FLD1.5.5 (pri 2)
+
+ end subroutine ESMF_AttributeSetObjectList
+
+
+!-------------------------------------------------------------------------
+!BOP
+!
+!
+! !IROUTINE: ESMF_AttributeGetObjectList - get an attribute from multiple ESMF objects
+!
+! !INTERFACE:
+ subroutine ESMF_AttributeGetObjectList(anytypelist, name, typelist, valuelist, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Base), dimension (:), intent(in) :: anytypelist ! list of any ESMF types
+ character (len = *), intent(in) :: name ! attribute name
+ type(ESMF_DataType), dimension (:), intent(out) :: typelist ! all possible data types
+ type(ESMF_DataValue), dimension (:), intent(out) :: valuelist ! attribute values
+ integer, intent(out), optional :: rc ! return code
+
+!
+! !DESCRIPTION:
+! Get the same attribute name from multiple objects in one call.
+
+!
+!EOP
+! !REQUIREMENTS: FLD1.5.5 (pri 2)
+
+ end subroutine ESMF_AttributeGetObjectList
+
+
+!-------------------------------------------------------------------------
+!BOP
+!
+! !IROUTINE: ESMF_AttributeCopy - copy an attribute between two objects
+!
+! !INTERFACE:
+ subroutine ESMF_AttributeCopy(name, source, destination, rc)
+!
+! !ARGUMENTS:
+ character (len = *), intent(in) :: name ! attribute name
+ type(ESMF_Base), intent(in) :: source ! any ESMF type
+ type(ESMF_Base), intent(in) :: destination ! any ESMF type
+ integer, intent(out), optional :: rc ! return code
+
+!
+! !DESCRIPTION:
+! The specified attribute associated with the source object is
+! copied to the destination object. << does this assume overwriting the
+! attribute if it already exists in the output or does this require yet
+! another arg to say what to do with collisions? >>
+
+
+!
+!EOP
+! !REQUIREMENTS: FLD1.5.4
+
+ end subroutine ESMF_AttributeCopy
+
+
+!-------------------------------------------------------------------------
+!BOP
+!
+!IROUTINE: ESMC_AttributeCopyAll - copy attributes between two objects
+
+!
+! !INTERFACE:
+ subroutine ESMF_AttributeCopyAll(source, destination, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Base), intent(in) :: source ! any ESMF type
+ type(ESMF_Base), intent(in) :: destination ! any ESMF type
+ integer, intent(out), optional :: rc ! return code
+
+!
+! !DESCRIPTION:
+! All attributes associated with the source object are copied to the
+! destination object. Some attributes will have to be considered
+! {\tt read only} and won't be updated by this call. (e.g. an attribute
+! like {\tt name} must be unique and therefore can't be duplicated.)
+
+!
+!EOP
+! !REQUIREMENTS: FLD1.5.4
+
+ end subroutine ESMF_AttributeCopyAll
+
+!=========================================================================
+! Misc utility routines, perhaps belongs in a utility file?
+!-------------------------------------------------------------------------
+!BOP
+!
+!IROUTINE: ESMC_AxisIndexInit - initialize an AxisIndex object
+
+!
+! !INTERFACE:
+ subroutine ESMF_AxisIndexInit(ai, l, r, max, decomp, gstart, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_AxisIndex), intent(inout) :: ai
+ integer, intent(in) :: l, r, max, decomp, gstart
+ integer, intent(out), optional :: rc
+!
+! !DESCRIPTION:
+! Set the contents of an AxisIndex type.
+
+!
+!EOP
+! !REQUIREMENTS:
+
+ ai%l = l
+ ai%r = r
+ ai%max = max
+ ai%decomp = decomp
+ ai%gstart = gstart
+
+ if (present(rc)) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_AxisIndexInit
+
+!BOP
+!
+!IROUTINE: ESMC_AxisIndexInit - initialize an AxisIndex object
+
+!
+! !INTERFACE:
+ subroutine ESMF_AxisIndexGet(ai, l, r, max, decomp, gstart, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_AxisIndex), intent(inout) :: ai
+ integer, intent(out), optional :: l, r, max, decomp, gstart
+ integer, intent(out), optional :: rc
+!
+! !DESCRIPTION:
+! Get the contents of an AxisIndex type.
+
+!
+!EOP
+! !REQUIREMENTS:
+
+ if (present(l)) l = ai%l
+ if (present(r)) r = ai%r
+ if (present(max)) max = ai%max
+ if (present(decomp)) decomp = ai%decomp
+ if (present(gstart)) gstart = ai%gstart
+
+ if (present(rc)) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_AxisIndexGet
+
+!-------------------------------------------------------------------------
+!-------------------------------------------------------------------------
+!BOP
+!
+!IROUTINE: ESMF_SetPointer - set an opaque value
+
+!
+! !INTERFACE:
+ subroutine ESMF_SetPointer(ptype, contents, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Pointer) :: ptype
+ integer*8, intent(in) :: contents
+ integer, intent(out), optional :: rc
+
+!
+! !DESCRIPTION:
+! Set the contents of an opaque pointer type.
+
+!
+!EOP
+! !REQUIREMENTS:
+ ptype%ptr = contents
+ if (present(rc)) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_SetPointer
+
+!-------------------------------------------------------------------------
+!BOP
+!
+!IROUTINE: ESMF_SetNullPointer - set an opaque value
+
+!
+! !INTERFACE:
+ subroutine ESMF_SetNullPointer(ptype, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Pointer) :: ptype
+ integer, intent(out), optional :: rc
+
+!
+! !DESCRIPTION:
+! Set the contents of an opaque pointer type.
+
+!
+!EOP
+! !REQUIREMENTS:
+ integer*8, parameter :: nullp = 0
+
+ ptype%ptr = nullp
+ if (present(rc)) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_SetNullPointer
+!-------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_GetPointer - get an opaque value
+!
+! !INTERFACE:
+ function ESMF_GetPointer(ptype, rc)
+!
+! !RETURN VALUE:
+ integer*8 :: ESMF_GetPointer
+
+! !ARGUMENTS:
+ type(ESMF_Pointer), intent(in) :: ptype
+ integer, intent(out), optional :: rc
+
+!
+! !DESCRIPTION:
+! Get the contents of an opaque pointer type.
+
+!
+!EOP
+! !REQUIREMENTS:
+ ESMF_GetPointer = ptype%ptr
+ if (present(rc)) rc = ESMF_SUCCESS
+
+ end function ESMF_GetPointer
+
+!-------------------------------------------------------------------------
+! misc print routines
+!-------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_StatusString - Return status as a string
+!
+! !INTERFACE:
+ subroutine ESMF_StatusString(status, string, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Status), intent(in) :: status
+ character(len=*), intent(out) :: string
+ integer, intent(out), optional :: rc
+
+!
+! !DESCRIPTION:
+! Return a status variable as a string.
+
+!
+!EOP
+! !REQUIREMENTS:
+
+ if (status .eq. ESMF_STATE_UNINIT) string = "Uninitialized"
+ if (status .eq. ESMF_STATE_READY) string = "Ready"
+ if (status .eq. ESMF_STATE_UNALLOCATED) string = "Unallocated"
+ if (status .eq. ESMF_STATE_ALLOCATED) string = "Allocated"
+ if (status .eq. ESMF_STATE_BUSY) string = "Busy"
+ if (status .eq. ESMF_STATE_INVALID) string = "Invalid"
+
+ if (present(rc)) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_StatusString
+
+!-------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_DataTypeString - Return DataType as a string
+!
+! !INTERFACE:
+ subroutine ESMF_DataTypeString(datatype, string, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_DataType), intent(in) :: datatype
+ character(len=*), intent(out) :: string
+ integer, intent(out), optional :: rc
+
+!
+! !DESCRIPTION:
+! Return a datatype variable as a string.
+
+!
+!EOP
+! !REQUIREMENTS:
+
+ if (datatype .eq. ESMF_DATA_INTEGER) string = "Integer"
+ if (datatype .eq. ESMF_DATA_REAL) string = "Real"
+ if (datatype .eq. ESMF_DATA_LOGICAL) string = "Logical"
+ if (datatype .eq. ESMF_DATA_CHARACTER) string = "Character"
+
+ if (present(rc)) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_DataTypeString
+
+!-------------------------------------------------------------------------
+!
+!-------------------------------------------------------------------------
+! put Print and Validate skeletons here - but they should be
+! overridden by higher level more specialized functions.
+!-------------------------------------------------------------------------
+
+ end module ESMF_BaseMod
Deleted: branches/atmos_physics/src/external/esmf_time_f90/ESMF_BaseTime.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/ESMF_BaseTime.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_BaseTime.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,318 +0,0 @@
-!
-! Earth System Modeling Framework
-! Copyright 2002-2003, University Corporation for Atmospheric Research,
-! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
-! Laboratory, University of Michigan, National Centers for Environmental
-! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
-! NASA Goddard Space Flight Center.
-! Licensed under the University of Illinois-NCSA license.
-!
-!==============================================================================
-!
-! ESMF BaseTime Module
- module ESMF_BaseTimeMod
-!
-!==============================================================================
-!
-! This file contains the BaseTime class definition and all BaseTime class
-! methods.
-!
-!------------------------------------------------------------------------------
-! INCLUDES
-
-#include <ESMF_TimeMgr.inc>
-!
-!===============================================================================
-!BOPI
-! !MODULE: ESMF_BaseTimeMod - Base ESMF time definition
-!
-! !DESCRIPTION:
-! Part of Time Manager F90 API wrapper of C++ implemenation
-!
-! This module serves only as the common Time definition inherited
-! by {\tt ESMF\_TimeInterval} and {\tt ESMF\_Time}
-!
-! See {\tt ../include/ESMC\_BaseTime.h} for complete description
-!
-!------------------------------------------------------------------------------
-! !USES:
- use ESMF_BaseMod ! ESMF Base class
- implicit none
-!
-!------------------------------------------------------------------------------
-! !PRIVATE TYPES:
- private
-!------------------------------------------------------------------------------
-! ! ESMF_BaseTime
-!
-! ! Base class type to match C++ BaseTime class in size only;
-! ! all dereferencing within class is performed by C++ implementation
-
- type ESMF_BaseTime
- integer(ESMF_KIND_I8) :: S ! whole seconds
- integer(ESMF_KIND_I8) :: Sn ! fractional seconds, numerator
- integer(ESMF_KIND_I8) :: Sd ! fractional seconds, denominator
- end type
-
-!------------------------------------------------------------------------------
-! !PUBLIC TYPES:
- public ESMF_BaseTime
-!------------------------------------------------------------------------------
-!
-! !PUBLIC MEMBER FUNCTIONS:
-!
-! overloaded operators
- public operator(+)
- private ESMF_BaseTimeSum
- public operator(-)
- private ESMF_BaseTimeDifference
- public operator(/)
- private ESMF_BaseTimeQuotI
- private ESMF_BaseTimeQuotI8
- public operator(.EQ.)
- private ESMF_BaseTimeEQ
- public operator(.NE.)
- private ESMF_BaseTimeNE
- public operator(.LT.)
- private ESMF_BaseTimeLT
- public operator(.GT.)
- private ESMF_BaseTimeGT
- public operator(.LE.)
- private ESMF_BaseTimeLE
- public operator(.GE.)
- private ESMF_BaseTimeGE
-
-!==============================================================================
-!
-! INTERFACE BLOCKS
-!
-!==============================================================================
- interface operator(+)
- module procedure ESMF_BaseTimeSum
- end interface
- interface operator(-)
- module procedure ESMF_BaseTimeDifference
- end interface
- interface operator(/)
- module procedure ESMF_BaseTimeQuotI,ESMF_BaseTimeQuotI8
- end interface
- interface operator(.EQ.)
- module procedure ESMF_BaseTimeEQ
- end interface
- interface operator(.NE.)
- module procedure ESMF_BaseTimeNE
- end interface
- interface operator(.LT.)
- module procedure ESMF_BaseTimeLT
- end interface
- interface operator(.GT.)
- module procedure ESMF_BaseTimeGT
- end interface
- interface operator(.LE.)
- module procedure ESMF_BaseTimeLE
- end interface
- interface operator(.GE.)
- module procedure ESMF_BaseTimeGE
- end interface
-
-
-!==============================================================================
-
- contains
-
-!==============================================================================
-
-
-! Add two basetimes
- FUNCTION ESMF_BaseTimeSum( basetime1, basetime2 )
- TYPE(ESMF_BaseTime) :: ESMF_BaseTimeSum
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
- ! locals
- INTEGER (ESMF_KIND_I8) :: Sn1, Sd1, Sn2, Sd2, lcd
-! PRINT *,'DEBUG: BEGIN ESMF_BaseTimeSum()'
-! PRINT *,'DEBUG: ESMF_BaseTimeSum(): basetime1%S = ',basetime1%S
-! PRINT *,'DEBUG: ESMF_BaseTimeSum(): basetime1%Sn = ',basetime1%Sn
-! PRINT *,'DEBUG: ESMF_BaseTimeSum(): basetime1%Sd = ',basetime1%Sd
-! PRINT *,'DEBUG: ESMF_BaseTimeSum(): basetime2%S = ',basetime2%S
-! PRINT *,'DEBUG: ESMF_BaseTimeSum(): basetime2%Sn = ',basetime2%Sn
-! PRINT *,'DEBUG: ESMF_BaseTimeSum(): basetime2%Sd = ',basetime2%Sd
- ESMF_BaseTimeSum = basetime1
- ESMF_BaseTimeSum%S = ESMF_BaseTimeSum%S + basetime2%S
- Sn1 = basetime1%Sn
- Sd1 = basetime1%Sd
- Sn2 = basetime2%Sn
- Sd2 = basetime2%Sd
-! PRINT *,'DEBUG: ESMF_BaseTimeSum(): Sn1 = ',Sn1
-! PRINT *,'DEBUG: ESMF_BaseTimeSum(): Sd1 = ',Sd1
-! PRINT *,'DEBUG: ESMF_BaseTimeSum(): Sn2 = ',Sn2
-! PRINT *,'DEBUG: ESMF_BaseTimeSum(): Sd2 = ',Sd2
- IF ( ( Sd1 .EQ. 0 ) .AND. ( Sd2 .EQ. 0 ) ) THEN
-! PRINT *,'DEBUG: ESMF_BaseTimeSum(): no fractions'
- ESMF_BaseTimeSum%Sn = 0
- ESMF_BaseTimeSum%Sd = 0
- ELSE IF ( ( Sd1 .NE. 0 ) .AND. ( Sd2 .EQ. 0 ) ) THEN
- ESMF_BaseTimeSum%Sn = Sn1
- ESMF_BaseTimeSum%Sd = Sd1
- ELSE IF ( ( Sd1 .EQ. 0 ) .AND. ( Sd2 .NE. 0 ) ) THEN
- ESMF_BaseTimeSum%Sn = Sn2
- ESMF_BaseTimeSum%Sd = Sd2
- ELSE IF ( ( Sd1 .NE. 0 ) .AND. ( Sd2 .NE. 0 ) ) THEN
- CALL compute_lcd( Sd1 , Sd2 , lcd )
- ESMF_BaseTimeSum%Sd = lcd
- ESMF_BaseTimeSum%Sn = (Sn1 * lcd / Sd1) + (Sn2 * lcd / Sd2)
- ENDIF
-! PRINT *,'DEBUG: ESMF_BaseTimeSum(): ESMF_BaseTimeSum%S = ',ESMF_BaseTimeSum%S
-! PRINT *,'DEBUG: ESMF_BaseTimeSum(): ESMF_BaseTimeSum%Sn = ',ESMF_BaseTimeSum%Sn
-! PRINT *,'DEBUG: ESMF_BaseTimeSum(): ESMF_BaseTimeSum%Sd = ',ESMF_BaseTimeSum%Sd
- CALL normalize_basetime( ESMF_BaseTimeSum )
-! PRINT *,'DEBUG: END ESMF_BaseTimeSum()'
- END FUNCTION ESMF_BaseTimeSum
-
-
-! Subtract two basetimes
- FUNCTION ESMF_BaseTimeDifference( basetime1, basetime2 )
- TYPE(ESMF_BaseTime) :: ESMF_BaseTimeDifference
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
- ! locals
- TYPE(ESMF_BaseTime) :: neg2
-
- neg2%S = -basetime2%S
- neg2%Sn = -basetime2%Sn
- neg2%Sd = basetime2%Sd
-
- ESMF_BaseTimeDifference = basetime1 + neg2
-
- END FUNCTION ESMF_BaseTimeDifference
-
-
-! Divide basetime by 8-byte integer
- FUNCTION ESMF_BaseTimeQuotI8( basetime, divisor )
- TYPE(ESMF_BaseTime) :: ESMF_BaseTimeQuotI8
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime
- INTEGER(ESMF_KIND_I8), INTENT(IN) :: divisor
- ! locals
- INTEGER(ESMF_KIND_I8) :: d, n, dinit
-
-!PRINT *,'DEBUG ESMF_BaseTimeQuotI8() A: S,Sn,Sd = ', &
-! basetime%S,basetime%Sn,basetime%Sd
-!PRINT *,'DEBUG ESMF_BaseTimeQuotI8() A: divisor = ', divisor
- IF ( divisor == 0_ESMF_KIND_I8 ) THEN
- CALL wrf_error_fatal( 'ESMF_BaseTimeQuotI8: divide by zero' )
- ENDIF
-
-!$$$ move to default constructor
- ESMF_BaseTimeQuotI8%S = 0
- ESMF_BaseTimeQuotI8%Sn = 0
- ESMF_BaseTimeQuotI8%Sd = 0
-
- ! convert to a fraction and divide by multipling the denonminator by
- ! the divisor
- IF ( basetime%Sd == 0 ) THEN
- dinit = 1_ESMF_KIND_I8
- ELSE
- dinit = basetime%Sd
- ENDIF
- n = basetime%S * dinit + basetime%Sn
- d = dinit * divisor
-!PRINT *,'DEBUG ESMF_BaseTimeQuotI8() B: n,d = ',n,d
- CALL simplify( n, d, ESMF_BaseTimeQuotI8%Sn, ESMF_BaseTimeQuotI8%Sd )
-!PRINT *,'DEBUG ESMF_BaseTimeQuotI8() C: S,Sn,Sd = ', &
-! ESMF_BaseTimeQuotI8%S,ESMF_BaseTimeQuotI8%Sn,ESMF_BaseTimeQuotI8%Sd
- CALL normalize_basetime( ESMF_BaseTimeQuotI8 )
-!PRINT *,'DEBUG ESMF_BaseTimeQuotI8() D: S,Sn,Sd = ', &
-! ESMF_BaseTimeQuotI8%S,ESMF_BaseTimeQuotI8%Sn,ESMF_BaseTimeQuotI8%Sd
- END FUNCTION ESMF_BaseTimeQuotI8
-
-! Divide basetime by integer
- FUNCTION ESMF_BaseTimeQuotI( basetime, divisor )
- TYPE(ESMF_BaseTime) :: ESMF_BaseTimeQuotI
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime
- INTEGER, INTENT(IN) :: divisor
- IF ( divisor == 0 ) THEN
- CALL wrf_error_fatal( 'ESMF_BaseTimeQuotI: divide by zero' )
- ENDIF
- ESMF_BaseTimeQuotI = basetime / INT( divisor, ESMF_KIND_I8 )
- END FUNCTION ESMF_BaseTimeQuotI
-
-
-! .EQ. for two basetimes
- FUNCTION ESMF_BaseTimeEQ( basetime1, basetime2 )
- LOGICAL :: ESMF_BaseTimeEQ
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
- INTEGER :: retval
- CALL seccmp( basetime1%S, basetime1%Sn, basetime1%Sd, &
- basetime2%S, basetime2%Sn, basetime2%Sd, &
- retval )
- ESMF_BaseTimeEQ = ( retval .EQ. 0 )
- END FUNCTION ESMF_BaseTimeEQ
-
-
-! .NE. for two basetimes
- FUNCTION ESMF_BaseTimeNE( basetime1, basetime2 )
- LOGICAL :: ESMF_BaseTimeNE
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
- INTEGER :: retval
- CALL seccmp( basetime1%S, basetime1%Sn, basetime1%Sd, &
- basetime2%S, basetime2%Sn, basetime2%Sd, &
- retval )
- ESMF_BaseTimeNE = ( retval .NE. 0 )
- END FUNCTION ESMF_BaseTimeNE
-
-
-! .LT. for two basetimes
- FUNCTION ESMF_BaseTimeLT( basetime1, basetime2 )
- LOGICAL :: ESMF_BaseTimeLT
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
- INTEGER :: retval
- CALL seccmp( basetime1%S, basetime1%Sn, basetime1%Sd, &
- basetime2%S, basetime2%Sn, basetime2%Sd, &
- retval )
- ESMF_BaseTimeLT = ( retval .LT. 0 )
- END FUNCTION ESMF_BaseTimeLT
-
-
-! .GT. for two basetimes
- FUNCTION ESMF_BaseTimeGT( basetime1, basetime2 )
- LOGICAL :: ESMF_BaseTimeGT
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
- INTEGER :: retval
- CALL seccmp( basetime1%S, basetime1%Sn, basetime1%Sd, &
- basetime2%S, basetime2%Sn, basetime2%Sd, &
- retval )
- ESMF_BaseTimeGT = ( retval .GT. 0 )
- END FUNCTION ESMF_BaseTimeGT
-
-
-! .LE. for two basetimes
- FUNCTION ESMF_BaseTimeLE( basetime1, basetime2 )
- LOGICAL :: ESMF_BaseTimeLE
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
- INTEGER :: retval
- CALL seccmp( basetime1%S, basetime1%Sn, basetime1%Sd, &
- basetime2%S, basetime2%Sn, basetime2%Sd, &
- retval )
- ESMF_BaseTimeLE = ( retval .LE. 0 )
- END FUNCTION ESMF_BaseTimeLE
-
-
-! .GE. for two basetimes
- FUNCTION ESMF_BaseTimeGE( basetime1, basetime2 )
- LOGICAL :: ESMF_BaseTimeGE
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
- TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
- INTEGER :: retval
- CALL seccmp( basetime1%S, basetime1%Sn, basetime1%Sd, &
- basetime2%S, basetime2%Sn, basetime2%Sd, &
- retval )
- ESMF_BaseTimeGE = ( retval .GE. 0 )
- END FUNCTION ESMF_BaseTimeGE
-
-
- end module ESMF_BaseTimeMod
Copied: branches/atmos_physics/src/external/esmf_time_f90/ESMF_BaseTime.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/ESMF_BaseTime.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/ESMF_BaseTime.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_BaseTime.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,318 @@
+!
+! Earth System Modeling Framework
+! Copyright 2002-2003, University Corporation for Atmospheric Research,
+! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
+! Laboratory, University of Michigan, National Centers for Environmental
+! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
+! NASA Goddard Space Flight Center.
+! Licensed under the University of Illinois-NCSA license.
+!
+!==============================================================================
+!
+! ESMF BaseTime Module
+ module ESMF_BaseTimeMod
+!
+!==============================================================================
+!
+! This file contains the BaseTime class definition and all BaseTime class
+! methods.
+!
+!------------------------------------------------------------------------------
+! INCLUDES
+
+#include <ESMF_TimeMgr.inc>
+!
+!===============================================================================
+!BOPI
+! !MODULE: ESMF_BaseTimeMod - Base ESMF time definition
+!
+! !DESCRIPTION:
+! Part of Time Manager F90 API wrapper of C++ implemenation
+!
+! This module serves only as the common Time definition inherited
+! by {\tt ESMF\_TimeInterval} and {\tt ESMF\_Time}
+!
+! See {\tt ../include/ESMC\_BaseTime.h} for complete description
+!
+!------------------------------------------------------------------------------
+! !USES:
+ use ESMF_BaseMod ! ESMF Base class
+ implicit none
+!
+!------------------------------------------------------------------------------
+! !PRIVATE TYPES:
+ private
+!------------------------------------------------------------------------------
+! ! ESMF_BaseTime
+!
+! ! Base class type to match C++ BaseTime class in size only;
+! ! all dereferencing within class is performed by C++ implementation
+
+ type ESMF_BaseTime
+ integer(ESMF_KIND_I8) :: S ! whole seconds
+ integer(ESMF_KIND_I8) :: Sn ! fractional seconds, numerator
+ integer(ESMF_KIND_I8) :: Sd ! fractional seconds, denominator
+ end type
+
+!------------------------------------------------------------------------------
+! !PUBLIC TYPES:
+ public ESMF_BaseTime
+!------------------------------------------------------------------------------
+!
+! !PUBLIC MEMBER FUNCTIONS:
+!
+! overloaded operators
+ public operator(+)
+ private ESMF_BaseTimeSum
+ public operator(-)
+ private ESMF_BaseTimeDifference
+ public operator(/)
+ private ESMF_BaseTimeQuotI
+ private ESMF_BaseTimeQuotI8
+ public operator(.EQ.)
+ private ESMF_BaseTimeEQ
+ public operator(.NE.)
+ private ESMF_BaseTimeNE
+ public operator(.LT.)
+ private ESMF_BaseTimeLT
+ public operator(.GT.)
+ private ESMF_BaseTimeGT
+ public operator(.LE.)
+ private ESMF_BaseTimeLE
+ public operator(.GE.)
+ private ESMF_BaseTimeGE
+
+!==============================================================================
+!
+! INTERFACE BLOCKS
+!
+!==============================================================================
+ interface operator(+)
+ module procedure ESMF_BaseTimeSum
+ end interface
+ interface operator(-)
+ module procedure ESMF_BaseTimeDifference
+ end interface
+ interface operator(/)
+ module procedure ESMF_BaseTimeQuotI,ESMF_BaseTimeQuotI8
+ end interface
+ interface operator(.EQ.)
+ module procedure ESMF_BaseTimeEQ
+ end interface
+ interface operator(.NE.)
+ module procedure ESMF_BaseTimeNE
+ end interface
+ interface operator(.LT.)
+ module procedure ESMF_BaseTimeLT
+ end interface
+ interface operator(.GT.)
+ module procedure ESMF_BaseTimeGT
+ end interface
+ interface operator(.LE.)
+ module procedure ESMF_BaseTimeLE
+ end interface
+ interface operator(.GE.)
+ module procedure ESMF_BaseTimeGE
+ end interface
+
+
+!==============================================================================
+
+ contains
+
+!==============================================================================
+
+
+! Add two basetimes
+ FUNCTION ESMF_BaseTimeSum( basetime1, basetime2 )
+ TYPE(ESMF_BaseTime) :: ESMF_BaseTimeSum
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
+ ! locals
+ INTEGER (ESMF_KIND_I8) :: Sn1, Sd1, Sn2, Sd2, lcd
+! PRINT *,'DEBUG: BEGIN ESMF_BaseTimeSum()'
+! PRINT *,'DEBUG: ESMF_BaseTimeSum(): basetime1%S = ',basetime1%S
+! PRINT *,'DEBUG: ESMF_BaseTimeSum(): basetime1%Sn = ',basetime1%Sn
+! PRINT *,'DEBUG: ESMF_BaseTimeSum(): basetime1%Sd = ',basetime1%Sd
+! PRINT *,'DEBUG: ESMF_BaseTimeSum(): basetime2%S = ',basetime2%S
+! PRINT *,'DEBUG: ESMF_BaseTimeSum(): basetime2%Sn = ',basetime2%Sn
+! PRINT *,'DEBUG: ESMF_BaseTimeSum(): basetime2%Sd = ',basetime2%Sd
+ ESMF_BaseTimeSum = basetime1
+ ESMF_BaseTimeSum%S = ESMF_BaseTimeSum%S + basetime2%S
+ Sn1 = basetime1%Sn
+ Sd1 = basetime1%Sd
+ Sn2 = basetime2%Sn
+ Sd2 = basetime2%Sd
+! PRINT *,'DEBUG: ESMF_BaseTimeSum(): Sn1 = ',Sn1
+! PRINT *,'DEBUG: ESMF_BaseTimeSum(): Sd1 = ',Sd1
+! PRINT *,'DEBUG: ESMF_BaseTimeSum(): Sn2 = ',Sn2
+! PRINT *,'DEBUG: ESMF_BaseTimeSum(): Sd2 = ',Sd2
+ IF ( ( Sd1 .EQ. 0 ) .AND. ( Sd2 .EQ. 0 ) ) THEN
+! PRINT *,'DEBUG: ESMF_BaseTimeSum(): no fractions'
+ ESMF_BaseTimeSum%Sn = 0
+ ESMF_BaseTimeSum%Sd = 0
+ ELSE IF ( ( Sd1 .NE. 0 ) .AND. ( Sd2 .EQ. 0 ) ) THEN
+ ESMF_BaseTimeSum%Sn = Sn1
+ ESMF_BaseTimeSum%Sd = Sd1
+ ELSE IF ( ( Sd1 .EQ. 0 ) .AND. ( Sd2 .NE. 0 ) ) THEN
+ ESMF_BaseTimeSum%Sn = Sn2
+ ESMF_BaseTimeSum%Sd = Sd2
+ ELSE IF ( ( Sd1 .NE. 0 ) .AND. ( Sd2 .NE. 0 ) ) THEN
+ CALL compute_lcd( Sd1 , Sd2 , lcd )
+ ESMF_BaseTimeSum%Sd = lcd
+ ESMF_BaseTimeSum%Sn = (Sn1 * lcd / Sd1) + (Sn2 * lcd / Sd2)
+ ENDIF
+! PRINT *,'DEBUG: ESMF_BaseTimeSum(): ESMF_BaseTimeSum%S = ',ESMF_BaseTimeSum%S
+! PRINT *,'DEBUG: ESMF_BaseTimeSum(): ESMF_BaseTimeSum%Sn = ',ESMF_BaseTimeSum%Sn
+! PRINT *,'DEBUG: ESMF_BaseTimeSum(): ESMF_BaseTimeSum%Sd = ',ESMF_BaseTimeSum%Sd
+ CALL normalize_basetime( ESMF_BaseTimeSum )
+! PRINT *,'DEBUG: END ESMF_BaseTimeSum()'
+ END FUNCTION ESMF_BaseTimeSum
+
+
+! Subtract two basetimes
+ FUNCTION ESMF_BaseTimeDifference( basetime1, basetime2 )
+ TYPE(ESMF_BaseTime) :: ESMF_BaseTimeDifference
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
+ ! locals
+ TYPE(ESMF_BaseTime) :: neg2
+
+ neg2%S = -basetime2%S
+ neg2%Sn = -basetime2%Sn
+ neg2%Sd = basetime2%Sd
+
+ ESMF_BaseTimeDifference = basetime1 + neg2
+
+ END FUNCTION ESMF_BaseTimeDifference
+
+
+! Divide basetime by 8-byte integer
+ FUNCTION ESMF_BaseTimeQuotI8( basetime, divisor )
+ TYPE(ESMF_BaseTime) :: ESMF_BaseTimeQuotI8
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime
+ INTEGER(ESMF_KIND_I8), INTENT(IN) :: divisor
+ ! locals
+ INTEGER(ESMF_KIND_I8) :: d, n, dinit
+
+!PRINT *,'DEBUG ESMF_BaseTimeQuotI8() A: S,Sn,Sd = ', &
+! basetime%S,basetime%Sn,basetime%Sd
+!PRINT *,'DEBUG ESMF_BaseTimeQuotI8() A: divisor = ', divisor
+ IF ( divisor == 0_ESMF_KIND_I8 ) THEN
+ CALL wrf_error_fatal( 'ESMF_BaseTimeQuotI8: divide by zero' )
+ ENDIF
+
+!$$$ move to default constructor
+ ESMF_BaseTimeQuotI8%S = 0
+ ESMF_BaseTimeQuotI8%Sn = 0
+ ESMF_BaseTimeQuotI8%Sd = 0
+
+ ! convert to a fraction and divide by multipling the denonminator by
+ ! the divisor
+ IF ( basetime%Sd == 0 ) THEN
+ dinit = 1_ESMF_KIND_I8
+ ELSE
+ dinit = basetime%Sd
+ ENDIF
+ n = basetime%S * dinit + basetime%Sn
+ d = dinit * divisor
+!PRINT *,'DEBUG ESMF_BaseTimeQuotI8() B: n,d = ',n,d
+ CALL simplify( n, d, ESMF_BaseTimeQuotI8%Sn, ESMF_BaseTimeQuotI8%Sd )
+!PRINT *,'DEBUG ESMF_BaseTimeQuotI8() C: S,Sn,Sd = ', &
+! ESMF_BaseTimeQuotI8%S,ESMF_BaseTimeQuotI8%Sn,ESMF_BaseTimeQuotI8%Sd
+ CALL normalize_basetime( ESMF_BaseTimeQuotI8 )
+!PRINT *,'DEBUG ESMF_BaseTimeQuotI8() D: S,Sn,Sd = ', &
+! ESMF_BaseTimeQuotI8%S,ESMF_BaseTimeQuotI8%Sn,ESMF_BaseTimeQuotI8%Sd
+ END FUNCTION ESMF_BaseTimeQuotI8
+
+! Divide basetime by integer
+ FUNCTION ESMF_BaseTimeQuotI( basetime, divisor )
+ TYPE(ESMF_BaseTime) :: ESMF_BaseTimeQuotI
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime
+ INTEGER, INTENT(IN) :: divisor
+ IF ( divisor == 0 ) THEN
+ CALL wrf_error_fatal( 'ESMF_BaseTimeQuotI: divide by zero' )
+ ENDIF
+ ESMF_BaseTimeQuotI = basetime / INT( divisor, ESMF_KIND_I8 )
+ END FUNCTION ESMF_BaseTimeQuotI
+
+
+! .EQ. for two basetimes
+ FUNCTION ESMF_BaseTimeEQ( basetime1, basetime2 )
+ LOGICAL :: ESMF_BaseTimeEQ
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
+ INTEGER :: retval
+ CALL seccmp( basetime1%S, basetime1%Sn, basetime1%Sd, &
+ basetime2%S, basetime2%Sn, basetime2%Sd, &
+ retval )
+ ESMF_BaseTimeEQ = ( retval .EQ. 0 )
+ END FUNCTION ESMF_BaseTimeEQ
+
+
+! .NE. for two basetimes
+ FUNCTION ESMF_BaseTimeNE( basetime1, basetime2 )
+ LOGICAL :: ESMF_BaseTimeNE
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
+ INTEGER :: retval
+ CALL seccmp( basetime1%S, basetime1%Sn, basetime1%Sd, &
+ basetime2%S, basetime2%Sn, basetime2%Sd, &
+ retval )
+ ESMF_BaseTimeNE = ( retval .NE. 0 )
+ END FUNCTION ESMF_BaseTimeNE
+
+
+! .LT. for two basetimes
+ FUNCTION ESMF_BaseTimeLT( basetime1, basetime2 )
+ LOGICAL :: ESMF_BaseTimeLT
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
+ INTEGER :: retval
+ CALL seccmp( basetime1%S, basetime1%Sn, basetime1%Sd, &
+ basetime2%S, basetime2%Sn, basetime2%Sd, &
+ retval )
+ ESMF_BaseTimeLT = ( retval .LT. 0 )
+ END FUNCTION ESMF_BaseTimeLT
+
+
+! .GT. for two basetimes
+ FUNCTION ESMF_BaseTimeGT( basetime1, basetime2 )
+ LOGICAL :: ESMF_BaseTimeGT
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
+ INTEGER :: retval
+ CALL seccmp( basetime1%S, basetime1%Sn, basetime1%Sd, &
+ basetime2%S, basetime2%Sn, basetime2%Sd, &
+ retval )
+ ESMF_BaseTimeGT = ( retval .GT. 0 )
+ END FUNCTION ESMF_BaseTimeGT
+
+
+! .LE. for two basetimes
+ FUNCTION ESMF_BaseTimeLE( basetime1, basetime2 )
+ LOGICAL :: ESMF_BaseTimeLE
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
+ INTEGER :: retval
+ CALL seccmp( basetime1%S, basetime1%Sn, basetime1%Sd, &
+ basetime2%S, basetime2%Sn, basetime2%Sd, &
+ retval )
+ ESMF_BaseTimeLE = ( retval .LE. 0 )
+ END FUNCTION ESMF_BaseTimeLE
+
+
+! .GE. for two basetimes
+ FUNCTION ESMF_BaseTimeGE( basetime1, basetime2 )
+ LOGICAL :: ESMF_BaseTimeGE
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime1
+ TYPE(ESMF_BaseTime), INTENT(IN) :: basetime2
+ INTEGER :: retval
+ CALL seccmp( basetime1%S, basetime1%Sn, basetime1%Sd, &
+ basetime2%S, basetime2%Sn, basetime2%Sd, &
+ retval )
+ ESMF_BaseTimeGE = ( retval .GE. 0 )
+ END FUNCTION ESMF_BaseTimeGE
+
+
+ end module ESMF_BaseTimeMod
Deleted: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Calendar.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/ESMF_Calendar.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Calendar.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,284 +0,0 @@
-!
-! Earth System Modeling Framework
-! Copyright 2002-2003, University Corporation for Atmospheric Research,
-! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
-! Laboratory, University of Michigan, National Centers for Environmental
-! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
-! NASA Goddard Space Flight Center.
-! Licensed under the University of Illinois-NCSA license.
-!
-!==============================================================================
-!
-! ESMF Calendar Module
- module ESMF_CalendarMod
-!
-!==============================================================================
-!
-! This file contains the Calendar class definition and all Calendar class
-! methods.
-!
-!------------------------------------------------------------------------------
-! INCLUDES
-#include <ESMF_TimeMgr.inc>
-
-!==============================================================================
-!BOPI
-! !MODULE: ESMF_CalendarMod
-!
-! !DESCRIPTION:
-! Part of Time Manager F90 API wrapper of C++ implemenation
-!
-! Defines F90 wrapper entry points for corresponding
-! C++ class { \tt ESMC\_Calendar} implementation
-!
-! See {\tt ../include/ESMC\_Calendar.h} for complete description
-!
-!------------------------------------------------------------------------------
-! !USES:
- ! inherit from ESMF base class
- use ESMF_BaseMod
-
- ! inherit from base time class
- use ESMF_BaseTimeMod
-
- implicit none
-!
-!------------------------------------------------------------------------------
-! !PRIVATE TYPES:
- private
-!------------------------------------------------------------------------------
-
-
-
- INTEGER, PARAMETER :: MONTHS_PER_YEAR = 12
- INTEGER, PARAMETER :: mday(MONTHS_PER_YEAR) &
- = (/31,28,31,30,31,30,31,31,30,31,30,31/)
- INTEGER, PARAMETER :: mdayleap(MONTHS_PER_YEAR) &
- = (/31,29,31,30,31,30,31,31,30,31,30,31/)
- INTEGER, DIMENSION(365) :: daym
- INTEGER, DIMENSION(366) :: daymleap
- INTEGER :: mdaycum(0:MONTHS_PER_YEAR)
- INTEGER :: mdayleapcum(0:MONTHS_PER_YEAR)
- TYPE(ESMF_BaseTime), TARGET :: monthbdys(0:MONTHS_PER_YEAR)
- TYPE(ESMF_BaseTime), TARGET :: monthbdysleap(0:MONTHS_PER_YEAR)
-
-
-!------------------------------------------------------------------------------
-! ! ESMF_CalendarType
-!
-! ! F90 "enum" type to match C++ ESMC_CalendarType enum
-
- type ESMF_CalendarType
- private
- integer :: caltype
- end type
-
- type(ESMF_CalendarType), parameter :: &
- ESMF_CAL_GREGORIAN = ESMF_CalendarType(1), &
- ESMF_CAL_JULIAN = ESMF_CalendarType(2), &
- ! like Gregorian, except Feb always has 28 days
- ESMF_CAL_NOLEAP = ESMF_CalendarType(3), &
- ! 12 months, 30 days each
- ESMF_CAL_360DAY = ESMF_CalendarType(4), &
- ! user defined
- ESMF_CAL_GENERIC = ESMF_CalendarType(5), &
- ! track base time seconds only
- ESMF_CAL_NOCALENDAR = ESMF_CalendarType(6)
-
-!------------------------------------------------------------------------------
-! ! ESMF_Calendar
-!
-! ! F90 class type to match C++ Calendar class in size only;
-! ! all dereferencing within class is performed by C++ implementation
-!
-!------------------------------------------------------------------------------
-!
-! ! ESMF_DaysPerYear
-!
- type ESMF_DaysPerYear
- private
- integer :: D ! whole days per year
-! Fractional days-per-year are not yet used in this implementation.
-! integer :: Dn ! fractional days per year numerator
-! integer :: Dd ! fractional days per year denominator
- end type ! e.g. for Venus, D=0, Dn=926, Dd=1000
-!
-!------------------------------------------------------------------------------
-! ! ESMF_Calendar
-!
-!
- type ESMF_Calendar
- private
- type(ESMF_CalendarType) :: Type
-! TBH: When NO_DT_COMPONENT_INIT is set, code that uses F95 compile-time
-! TBH: initialization of components of derived types is not included.
-! TBH: Some older compilers, like PGI 5.x do not support this F95 feature.
-#ifdef NO_DT_COMPONENT_INIT
- logical :: Set
-#else
- logical :: Set = .false.
-#endif
- integer, dimension(MONTHS_PER_YEAR) :: DaysPerMonth
- integer :: SecondsPerDay
- integer :: SecondsPerYear
- type(ESMF_DaysPerYear) :: DaysPerYear
- end type
-
-!------------------------------------------------------------------------------
-! !PUBLIC DATA:
- TYPE(ESMF_Calendar), public, save, pointer :: defaultCal ! Default Calendar
-
-
-!
-!------------------------------------------------------------------------------
-! !PUBLIC TYPES:
- public MONTHS_PER_YEAR
- public mday
- public mdayleap
- public monthbdys
- public monthbdysleap
- public daym
- public daymleap
- public mdaycum
- public mdayleapcum
- public ESMF_CalendarType
- public ESMF_CAL_GREGORIAN, ESMF_CAL_NOLEAP, &
- ESMF_CAL_360DAY, ESMF_CAL_NOCALENDAR
-! public ESMF_CAL_JULIAN
-! public ESMF_CAL_GENERIC
- public ESMF_Calendar
-
-!------------------------------------------------------------------------------
-!
-! !PUBLIC MEMBER FUNCTIONS:
- public ESMF_CalendarCreate
-
-! Required inherited and overridden ESMF_Base class methods
-
- public ESMF_CalendarInitialized ! Only in this implementation, intended
- ! to be private within ESMF methods
-!EOPI
-
-!==============================================================================
-
- contains
-
-
-!==============================================================================
-!BOP
-! !IROUTINE: ESMF_CalendarCreate - Create a new ESMF Calendar of built-in type
-
-! !INTERFACE:
- ! Private name; call using ESMF_CalendarCreate()
- function ESMF_CalendarCreate(name, calendartype, rc)
-
-! !RETURN VALUE:
- type(ESMF_Calendar) :: ESMF_CalendarCreate
-
-! !ARGUMENTS:
- character (len=*), intent(in), optional :: name
- type(ESMF_CalendarType), intent(in) :: calendartype
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Creates and sets a {\tt calendar} to the given built-in
-! {\tt ESMF\_CalendarType}.
-!
-! This is a private method; invoke via the public overloaded entry point
-! {\tt ESMF\_CalendarCreate()}.
-!
-! The arguments are:
-! \begin{description}
-! \item[{[name]}]
-! The name for the newly created calendar. If not specified, a
-! default unique name will be generated: "CalendarNNN" where NNN
-! is a unique sequence number from 001 to 999.
-! \item[calendartype]
-! The built-in {\tt ESMF\_CalendarType}. Valid values are:
-! {\tt ESMF\_CAL\_360DAY}, {\tt ESMF\_CAL\_GREGORIAN},
-! {\tt ESMF\_CAL\_JULIANDAY}, {\tt ESMF\_CAL\_NOCALENDAR}, and
-! {\tt ESMF\_CAL\_NOLEAP}.
-! See the "Time Manager Reference" document for a description of
-! each calendar type.
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-!EOP
-! !REQUIREMENTS:
-! TMGn.n.n
- type(ESMF_DaysPerYear) :: dayspy
-
- if ( present(rc) ) rc = ESMF_FAILURE
-! Calendar type is hard-coded. Use ESMF library if more flexibility is
-! needed.
-#ifdef NO_LEAP_CALENDAR
- if ( calendartype%caltype /= ESMF_CAL_NOLEAP%caltype ) then
- write(6,*) 'Not a valid calendar type for this implementation'
- write(6,*) 'This implementation only allows ESMF_CAL_NOLEAP'
- write(6,*) 'calender type set to = ', calendartype%caltype
- write(6,*) 'NO_LEAP calendar type is = ', ESMF_CAL_NOLEAP%caltype
- return
- end if
- ESMF_CalendarCreate%Type = ESMF_CAL_NOLEAP
-#else
- if ( calendartype%caltype /= ESMF_CAL_GREGORIAN%caltype ) then
- write(6,*) 'Not a valid calendar type for this implementation'
- write(6,*) 'This implementation only allows ESMF_CAL_GREGORIAN'
- write(6,*) 'calender type set to = ', calendartype%caltype
- write(6,*) 'GREGORIAN calendar type is = ', ESMF_CAL_GREGORIAN%caltype
- return
- end if
- ESMF_CalendarCreate%Type = ESMF_CAL_GREGORIAN
-#endif
-! This is a bug on some systems -- need initial value set by compiler at
-! startup.
-! However, note that some older compilers do not support compile-time
-! initialization of data members of Fortran derived data types. For example,
-! PGI 5.x compilers do not support this F95 feature. See
-! NO_DT_COMPONENT_INIT.
- ESMF_CalendarCreate%Set = .true.
- ESMF_CalendarCreate%SecondsPerDay = SECONDS_PER_DAY
-! DaysPerYear and SecondsPerYear are incorrect for Gregorian calendars...
- dayspy%D = size(daym)
-!TBH: TODO: Replace DaysPerYear and SecondsPerYear with methods
-!TBH: TODO: since they only make sense for the NO_LEAP calendar!
- ESMF_CalendarCreate%DaysPerYear = dayspy
- ESMF_CalendarCreate%SecondsPerYear = ESMF_CalendarCreate%SecondsPerDay &
- * dayspy%D
-!TBH: TODO: use mdayleap for leap-year calendar
- ESMF_CalendarCreate%DaysPerMonth(:) = mday(:)
-
- if ( present(rc) ) rc = ESMF_SUCCESS
-
- end function ESMF_CalendarCreate
-
-
-!==============================================================================
-!BOP
-! !IROUTINE: ESMF_CalendarInitialized - check if calendar was created
-
-! !INTERFACE:
- function ESMF_CalendarInitialized(calendar)
-
-! !RETURN VALUE:
- logical ESMF_CalendarInitialized
-
-! !ARGUMENTS:
- type(ESMF_Calendar), intent(in) :: calendar
-
-! !DESCRIPTION:
-!EOP
-! !REQUIREMENTS:
-! TMGn.n.n
-! Note that return value from this function will be bogus for older compilers
-! that do not support compile-time initialization of data members of Fortran
-! derived data types. For example, PGI 5.x compilers do not support this F95
-! feature. At the moment, the call to this fuction is #ifdefd out when the
-! leap-year calendar is used so this is not an issue for WRF (see
-! NO_DT_COMPONENT_INIT).
- ESMF_CalendarInitialized = calendar%set
-
- end function ESMF_CalendarInitialized
-
- end module ESMF_CalendarMod
Copied: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Calendar.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/ESMF_Calendar.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/ESMF_Calendar.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Calendar.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,284 @@
+!
+! Earth System Modeling Framework
+! Copyright 2002-2003, University Corporation for Atmospheric Research,
+! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
+! Laboratory, University of Michigan, National Centers for Environmental
+! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
+! NASA Goddard Space Flight Center.
+! Licensed under the University of Illinois-NCSA license.
+!
+!==============================================================================
+!
+! ESMF Calendar Module
+ module ESMF_CalendarMod
+!
+!==============================================================================
+!
+! This file contains the Calendar class definition and all Calendar class
+! methods.
+!
+!------------------------------------------------------------------------------
+! INCLUDES
+#include <ESMF_TimeMgr.inc>
+
+!==============================================================================
+!BOPI
+! !MODULE: ESMF_CalendarMod
+!
+! !DESCRIPTION:
+! Part of Time Manager F90 API wrapper of C++ implemenation
+!
+! Defines F90 wrapper entry points for corresponding
+! C++ class { \tt ESMC\_Calendar} implementation
+!
+! See {\tt ../include/ESMC\_Calendar.h} for complete description
+!
+!------------------------------------------------------------------------------
+! !USES:
+ ! inherit from ESMF base class
+ use ESMF_BaseMod
+
+ ! inherit from base time class
+ use ESMF_BaseTimeMod
+
+ implicit none
+!
+!------------------------------------------------------------------------------
+! !PRIVATE TYPES:
+ private
+!------------------------------------------------------------------------------
+
+
+
+ INTEGER, PARAMETER :: MONTHS_PER_YEAR = 12
+ INTEGER, PARAMETER :: mday(MONTHS_PER_YEAR) &
+ = (/31,28,31,30,31,30,31,31,30,31,30,31/)
+ INTEGER, PARAMETER :: mdayleap(MONTHS_PER_YEAR) &
+ = (/31,29,31,30,31,30,31,31,30,31,30,31/)
+ INTEGER, DIMENSION(365) :: daym
+ INTEGER, DIMENSION(366) :: daymleap
+ INTEGER :: mdaycum(0:MONTHS_PER_YEAR)
+ INTEGER :: mdayleapcum(0:MONTHS_PER_YEAR)
+ TYPE(ESMF_BaseTime), TARGET :: monthbdys(0:MONTHS_PER_YEAR)
+ TYPE(ESMF_BaseTime), TARGET :: monthbdysleap(0:MONTHS_PER_YEAR)
+
+
+!------------------------------------------------------------------------------
+! ! ESMF_CalendarType
+!
+! ! F90 "enum" type to match C++ ESMC_CalendarType enum
+
+ type ESMF_CalendarType
+ private
+ integer :: caltype
+ end type
+
+ type(ESMF_CalendarType), parameter :: &
+ ESMF_CAL_GREGORIAN = ESMF_CalendarType(1), &
+ ESMF_CAL_JULIAN = ESMF_CalendarType(2), &
+ ! like Gregorian, except Feb always has 28 days
+ ESMF_CAL_NOLEAP = ESMF_CalendarType(3), &
+ ! 12 months, 30 days each
+ ESMF_CAL_360DAY = ESMF_CalendarType(4), &
+ ! user defined
+ ESMF_CAL_GENERIC = ESMF_CalendarType(5), &
+ ! track base time seconds only
+ ESMF_CAL_NOCALENDAR = ESMF_CalendarType(6)
+
+!------------------------------------------------------------------------------
+! ! ESMF_Calendar
+!
+! ! F90 class type to match C++ Calendar class in size only;
+! ! all dereferencing within class is performed by C++ implementation
+!
+!------------------------------------------------------------------------------
+!
+! ! ESMF_DaysPerYear
+!
+ type ESMF_DaysPerYear
+ private
+ integer :: D ! whole days per year
+! Fractional days-per-year are not yet used in this implementation.
+! integer :: Dn ! fractional days per year numerator
+! integer :: Dd ! fractional days per year denominator
+ end type ! e.g. for Venus, D=0, Dn=926, Dd=1000
+!
+!------------------------------------------------------------------------------
+! ! ESMF_Calendar
+!
+!
+ type ESMF_Calendar
+ private
+ type(ESMF_CalendarType) :: Type
+! TBH: When NO_DT_COMPONENT_INIT is set, code that uses F95 compile-time
+! TBH: initialization of components of derived types is not included.
+! TBH: Some older compilers, like PGI 5.x do not support this F95 feature.
+#ifdef NO_DT_COMPONENT_INIT
+ logical :: Set
+#else
+ logical :: Set = .false.
+#endif
+ integer, dimension(MONTHS_PER_YEAR) :: DaysPerMonth
+ integer :: SecondsPerDay
+ integer :: SecondsPerYear
+ type(ESMF_DaysPerYear) :: DaysPerYear
+ end type
+
+!------------------------------------------------------------------------------
+! !PUBLIC DATA:
+ TYPE(ESMF_Calendar), public, save, pointer :: defaultCal ! Default Calendar
+
+
+!
+!------------------------------------------------------------------------------
+! !PUBLIC TYPES:
+ public MONTHS_PER_YEAR
+ public mday
+ public mdayleap
+ public monthbdys
+ public monthbdysleap
+ public daym
+ public daymleap
+ public mdaycum
+ public mdayleapcum
+ public ESMF_CalendarType
+ public ESMF_CAL_GREGORIAN, ESMF_CAL_NOLEAP, &
+ ESMF_CAL_360DAY, ESMF_CAL_NOCALENDAR
+! public ESMF_CAL_JULIAN
+! public ESMF_CAL_GENERIC
+ public ESMF_Calendar
+
+!------------------------------------------------------------------------------
+!
+! !PUBLIC MEMBER FUNCTIONS:
+ public ESMF_CalendarCreate
+
+! Required inherited and overridden ESMF_Base class methods
+
+ public ESMF_CalendarInitialized ! Only in this implementation, intended
+ ! to be private within ESMF methods
+!EOPI
+
+!==============================================================================
+
+ contains
+
+
+!==============================================================================
+!BOP
+! !IROUTINE: ESMF_CalendarCreate - Create a new ESMF Calendar of built-in type
+
+! !INTERFACE:
+ ! Private name; call using ESMF_CalendarCreate()
+ function ESMF_CalendarCreate(name, calendartype, rc)
+
+! !RETURN VALUE:
+ type(ESMF_Calendar) :: ESMF_CalendarCreate
+
+! !ARGUMENTS:
+ character (len=*), intent(in), optional :: name
+ type(ESMF_CalendarType), intent(in) :: calendartype
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Creates and sets a {\tt calendar} to the given built-in
+! {\tt ESMF\_CalendarType}.
+!
+! This is a private method; invoke via the public overloaded entry point
+! {\tt ESMF\_CalendarCreate()}.
+!
+! The arguments are:
+! \begin{description}
+! \item[{[name]}]
+! The name for the newly created calendar. If not specified, a
+! default unique name will be generated: "CalendarNNN" where NNN
+! is a unique sequence number from 001 to 999.
+! \item[calendartype]
+! The built-in {\tt ESMF\_CalendarType}. Valid values are:
+! {\tt ESMF\_CAL\_360DAY}, {\tt ESMF\_CAL\_GREGORIAN},
+! {\tt ESMF\_CAL\_JULIANDAY}, {\tt ESMF\_CAL\_NOCALENDAR}, and
+! {\tt ESMF\_CAL\_NOLEAP}.
+! See the "Time Manager Reference" document for a description of
+! each calendar type.
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+!EOP
+! !REQUIREMENTS:
+! TMGn.n.n
+ type(ESMF_DaysPerYear) :: dayspy
+
+ if ( present(rc) ) rc = ESMF_FAILURE
+! Calendar type is hard-coded. Use ESMF library if more flexibility is
+! needed.
+#ifdef NO_LEAP_CALENDAR
+ if ( calendartype%caltype /= ESMF_CAL_NOLEAP%caltype ) then
+ write(6,*) 'Not a valid calendar type for this implementation'
+ write(6,*) 'This implementation only allows ESMF_CAL_NOLEAP'
+ write(6,*) 'calender type set to = ', calendartype%caltype
+ write(6,*) 'NO_LEAP calendar type is = ', ESMF_CAL_NOLEAP%caltype
+ return
+ end if
+ ESMF_CalendarCreate%Type = ESMF_CAL_NOLEAP
+#else
+ if ( calendartype%caltype /= ESMF_CAL_GREGORIAN%caltype ) then
+ write(6,*) 'Not a valid calendar type for this implementation'
+ write(6,*) 'This implementation only allows ESMF_CAL_GREGORIAN'
+ write(6,*) 'calender type set to = ', calendartype%caltype
+ write(6,*) 'GREGORIAN calendar type is = ', ESMF_CAL_GREGORIAN%caltype
+ return
+ end if
+ ESMF_CalendarCreate%Type = ESMF_CAL_GREGORIAN
+#endif
+! This is a bug on some systems -- need initial value set by compiler at
+! startup.
+! However, note that some older compilers do not support compile-time
+! initialization of data members of Fortran derived data types. For example,
+! PGI 5.x compilers do not support this F95 feature. See
+! NO_DT_COMPONENT_INIT.
+ ESMF_CalendarCreate%Set = .true.
+ ESMF_CalendarCreate%SecondsPerDay = SECONDS_PER_DAY
+! DaysPerYear and SecondsPerYear are incorrect for Gregorian calendars...
+ dayspy%D = size(daym)
+!TBH: TODO: Replace DaysPerYear and SecondsPerYear with methods
+!TBH: TODO: since they only make sense for the NO_LEAP calendar!
+ ESMF_CalendarCreate%DaysPerYear = dayspy
+ ESMF_CalendarCreate%SecondsPerYear = ESMF_CalendarCreate%SecondsPerDay &
+ * dayspy%D
+!TBH: TODO: use mdayleap for leap-year calendar
+ ESMF_CalendarCreate%DaysPerMonth(:) = mday(:)
+
+ if ( present(rc) ) rc = ESMF_SUCCESS
+
+ end function ESMF_CalendarCreate
+
+
+!==============================================================================
+!BOP
+! !IROUTINE: ESMF_CalendarInitialized - check if calendar was created
+
+! !INTERFACE:
+ function ESMF_CalendarInitialized(calendar)
+
+! !RETURN VALUE:
+ logical ESMF_CalendarInitialized
+
+! !ARGUMENTS:
+ type(ESMF_Calendar), intent(in) :: calendar
+
+! !DESCRIPTION:
+!EOP
+! !REQUIREMENTS:
+! TMGn.n.n
+! Note that return value from this function will be bogus for older compilers
+! that do not support compile-time initialization of data members of Fortran
+! derived data types. For example, PGI 5.x compilers do not support this F95
+! feature. At the moment, the call to this fuction is #ifdefd out when the
+! leap-year calendar is used so this is not an issue for WRF (see
+! NO_DT_COMPONENT_INIT).
+ ESMF_CalendarInitialized = calendar%set
+
+ end function ESMF_CalendarInitialized
+
+ end module ESMF_CalendarMod
Deleted: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Clock.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/ESMF_Clock.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Clock.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,1366 +0,0 @@
-!
-! Earth System Modeling Framework
-! Copyright 2002-2003, University Corporation for Atmospheric Research,
-! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
-! Laboratory, University of Michigan, National Centers for Environmental
-! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
-! NASA Goddard Space Flight Center.
-! Licensed under the University of Illinois-NCSA license.
-!
-!==============================================================================
-!
-! ESMF Clock Module
- module ESMF_ClockMod
-!
-!==============================================================================
-!
-! This file contains the Clock class definition and all Clock class methods.
-!
-!------------------------------------------------------------------------------
-! INCLUDES
-#include <ESMF_TimeMgr.inc>
-
-!==============================================================================
-!BOPI
-! !MODULE: ESMF_ClockMod
-!
-! !DESCRIPTION:
-! Part of Time Manager F90 API wrapper of C++ implemenation
-!
-! Defines F90 wrapper entry points for corresponding
-! C++ class {\tt ESMC\_Time} implementation
-!
-! See {\tt ../include/ESMC\_Clock.h} for complete description
-!
-!------------------------------------------------------------------------------
-! !USES:
- ! inherit from ESMF base class
- use ESMF_BaseMod
-
- ! associated derived types
- use ESMF_TimeIntervalMod ! , only : ESMF_TimeInterval, &
- ! ESMF_TimeIntervalIsPositive
- use ESMF_TimeMod ! , only : ESMF_Time
- use ESMF_AlarmMod, only : ESMF_Alarm
-
- implicit none
-!
-!------------------------------------------------------------------------------
-! !PRIVATE TYPES:
- private
-!------------------------------------------------------------------------------
-! ! ESMF_Clock
-!
-! ! F90 class type to match C++ Clock class in size only;
-! ! all dereferencing within class is performed by C++ implementation
-
-! internals for ESMF_Clock
- type ESMF_ClockInt
- type(ESMF_TimeInterval) :: TimeStep
- type(ESMF_Time) :: StartTime
- type(ESMF_Time) :: StopTime
- type(ESMF_Time) :: RefTime
- type(ESMF_Time) :: CurrTime
- type(ESMF_Time) :: PrevTime
- integer(ESMF_KIND_I8) :: AdvanceCount
- integer :: ClockMutex
- integer :: NumAlarms
- ! Note: to mimic ESMF 2.1.0+, AlarmList is maintained
- ! within ESMF_Clock even though copies of each alarm are
- ! returned from ESMF_AlarmCreate() at the same time they
- ! are copied into the AlarmList! This duplication is not
- ! as hideous as it might be because the ESMF_Alarm type
- ! has data members that are all POINTERs (thus the horrible
- ! shallow-copy-masquerading-as-reference-copy hack works).
- type(ESMF_Alarm), pointer, dimension(:) :: AlarmList
- end type
-
-! Actual public type: this bit allows easy mimic of "deep" ESMF_ClockCreate
-! in ESMF 2.1.0+
-! NOTE: DO NOT ADD NON-POINTER STATE TO THIS DATA TYPE. It emulates ESMF
-! shallow-copy-masquerading-as-reference-copy.
- type ESMF_Clock
- type(ESMF_ClockInt), pointer :: clockint
- end type
-
-!------------------------------------------------------------------------------
-! !PUBLIC TYPES:
- public ESMF_Clock
- public ESMF_ClockInt ! needed on AIX but not PGI
-!------------------------------------------------------------------------------
-!
-! !PUBLIC MEMBER FUNCTIONS:
- public ESMF_ClockCreate
- public ESMF_ClockDestroy
- public ESMF_ClockSet
-! public ESMF_ClockSetOLD
- public ESMF_ClockGet
-! public ESMF_ClockGetAdvanceCount
-! public ESMF_ClockGetTimeStep
-! public ESMF_ClockSetTimeStep
-! public ESMF_ClockGetCurrTime
-! public ESMF_ClockSetCurrTime
-! public ESMF_ClockGetStartTime
-! public ESMF_ClockGetStopTime
-! public ESMF_ClockGetRefTime
-! public ESMF_ClockGetPrevTime
-! public ESMF_ClockGetCurrSimTime
-! public ESMF_ClockGetPrevSimTime
-! This must be public for ESMF_AlarmClockMod...
- public ESMF_ClockAddAlarm
- public ESMF_ClockGetAlarmList
-! public ESMF_ClockGetNumAlarms
-! public ESMF_ClockSyncToWallClock
- public ESMF_ClockAdvance
- public ESMF_ClockIsStopTime
- public ESMF_ClockStopTimeDisable
-
-! Required inherited and overridden ESMF_Base class methods
-
-! public ESMF_ClockRead
-! public ESMF_ClockWrite
- public ESMF_ClockValidate
- public ESMF_ClockPrint
-!EOPI
-
-!==============================================================================
-
- contains
-
-!==============================================================================
-!
-! This section includes the Set methods.
-!
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockSetOLD - Initialize a clockint
-
-! !INTERFACE:
- subroutine ESMF_ClockSetOLD(clockint, TimeStep, StartTime, &
- StopTime, RefTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_ClockInt), intent(out) :: clockint
- type(ESMF_TimeInterval), intent(in), optional :: TimeStep
- type(ESMF_Time), intent(in) :: StartTime
- type(ESMF_Time), intent(in) :: StopTime
- type(ESMF_Time), intent(in), optional :: RefTime
- integer, intent(out), optional :: rc
-! Local
- integer i
-
-! !DESCRIPTION:
-! Initialize an {\tt ESMF\_Clock}
-!
-! The arguments are:
-! \begin{description}
-! \item[clockint]
-! The object instance to initialize
-! \item[{[TimeStep]}]
-! The {\tt ESMF\_Clock}'s time step interval
-! \item[StartTime]
-! The {\tt ESMF\_Clock}'s starting time
-! \item[StopTime]
-! The {\tt ESMF\_Clock}'s stopping time
-! \item[{[RefTime]}]
-! The {\tt ESMF\_Clock}'s reference time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG3.1, TMG3.4.4
-!EOP
- IF ( PRESENT(TimeStep) ) clockint%TimeStep = TimeStep
- IF ( PRESENT(RefTime) )THEN
- clockint%RefTime = RefTime
- ELSE
- clockint%RefTime = StartTime
- END IF
- clockint%CurrTime = StartTime
- clockint%StartTime = StartTime
- clockint%StopTime = StopTime
- clockint%NumAlarms = 0
- clockint%AdvanceCount = 0
- ALLOCATE(clockint%AlarmList(MAX_ALARMS))
- ! TBH: This incredible hack can be removed once ESMF_*Validate()
- ! TBH: can tell if a deep ESMF_* was created or not.
- DO i = 1, MAX_ALARMS
- NULLIFY( clockint%AlarmList( i )%alarmint )
- ENDDO
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
-
- end subroutine ESMF_ClockSetOLD
-
-
-! !IROUTINE: ESMF_ClockSet - Set clock properties -- for compatibility with ESMF 2.0.1
-
-! !INTERFACE:
- subroutine ESMF_ClockSet(clock, TimeStep, StartTime, StopTime, &
- RefTime, CurrTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(inout) :: clock
- type(ESMF_TimeInterval), intent(in), optional :: TimeStep
- type(ESMF_Time), intent(in), optional :: StartTime
- type(ESMF_Time), intent(in), optional :: StopTime
- type(ESMF_Time), intent(in), optional :: RefTime
- type(ESMF_Time), intent(in), optional :: CurrTime
- integer, intent(out), optional :: rc
-! Local
- integer ierr
-
-! !DESCRIPTION:
-! Initialize an {\tt ESMF\_Clock}
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to initialize
-! \item[{[TimeStep]}]
-! The {\tt ESMF\_Clock}'s time step interval
-! \item[StartTime]
-! The {\tt ESMF\_Clock}'s starting time
-! \item[StopTime]
-! The {\tt ESMF\_Clock}'s stopping time
-! \item[{[RefTime]}]
-! The {\tt ESMF\_Clock}'s reference time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG3.1, TMG3.4.4
-!EOP
- ierr = ESMF_SUCCESS
- IF ( PRESENT(TimeStep) ) THEN
- CALL ESMF_ClockSetTimeStep ( clock, TimeStep, rc=ierr )
- ENDIF
- IF ( PRESENT(RefTime) ) clock%clockint%RefTime = RefTime
- IF ( PRESENT(StartTime) ) clock%clockint%StartTime = StartTime
- IF ( PRESENT(StopTime) ) clock%clockint%StopTime = StopTime
- IF ( PRESENT(CurrTime) ) THEN
- CALL ESMF_ClockSetCurrTime(clock, CurrTime, rc=ierr)
- ENDIF
- IF ( PRESENT(rc) ) rc = ierr
-
- end subroutine ESMF_ClockSet
-
-
-! Create ESMF_Clock using ESMF 2.1.0+ semantics
- FUNCTION ESMF_ClockCreate( name, TimeStep, StartTime, StopTime, &
- RefTime, rc )
- ! return value
- type(ESMF_Clock) :: ESMF_ClockCreate
- ! !ARGUMENTS:
- character (len=*), intent(in), optional :: name
- type(ESMF_TimeInterval), intent(in), optional :: TimeStep
- type(ESMF_Time), intent(in) :: StartTime
- type(ESMF_Time), intent(in) :: StopTime
- type(ESMF_Time), intent(in), optional :: RefTime
- integer, intent(out), optional :: rc
- ! locals
- type(ESMF_Clock) :: clocktmp
- ! TBH: ignore allocate errors, for now
- ALLOCATE( clocktmp%clockint )
- CALL ESMF_ClockSetOLD( clocktmp%clockint, &
- TimeStep= TimeStep, &
- StartTime=StartTime, &
- StopTime= StopTime, &
- RefTime=RefTime, rc=rc )
- ESMF_ClockCreate = clocktmp
- END FUNCTION ESMF_ClockCreate
-
-
-! Deallocate memory for ESMF_Clock
- SUBROUTINE ESMF_ClockDestroy( clock, rc )
- TYPE(ESMF_Clock), INTENT(INOUT) :: clock
- INTEGER, INTENT( OUT), OPTIONAL :: rc
- ! TBH: ignore deallocate errors, for now
- DEALLOCATE( clock%clockint%AlarmList )
- DEALLOCATE( clock%clockint )
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
- END SUBROUTINE ESMF_ClockDestroy
-
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockGet - Get clock properties -- for compatibility with ESMF 2.0.1
-
-! !INTERFACE:
- subroutine ESMF_ClockGet(clock, StartTime, CurrTime, &
- AdvanceCount, StopTime, TimeStep, &
- PrevTime, RefTime, &
- rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- type(ESMF_Time), intent(out), optional :: StartTime
- type(ESMF_Time), intent(out), optional :: CurrTime
- type(ESMF_Time), intent(out), optional :: StopTime
- type(ESMF_Time), intent(out), optional :: PrevTime
- type(ESMF_Time), intent(out), optional :: RefTime
- integer(ESMF_KIND_I8), intent(out), optional :: AdvanceCount
- type(ESMF_TimeInterval), intent(out), optional :: TimeStep
- integer, intent(out), optional :: rc
- integer :: ierr
-
-! !DESCRIPTION:
-! Returns the number of times the {\tt ESMF\_Clock} has been advanced
-! (time stepped)
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to get the advance count from
-! \item[StartTime]
-! The start time
-! \item[CurrTime]
-! The current time
-! \item[AdvanceCount]
-! The number of times the {\tt ESMF\_Clock} has been advanced
-! \item[StopTime]
-! The {\tt ESMF\_Clock}'s stopping time
-! \item[{[TimeStep]}]
-! The {\tt ESMF\_Clock}'s time step interval
-! \item[{[PrevTime]}]
-! The {\tt ESMF\_Clock}'s previous current time
-! \item[{[PrevTime]}]
-! The {\tt ESMF\_Clock}'s reference time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-
-! !REQUIREMENTS:
-! TMG3.5.1
-!EOP
- ierr = ESMF_SUCCESS
-
- IF ( PRESENT (StartTime) ) THEN
- CALL ESMF_ClockGetStartTime( clock, StartTime=StartTime, rc=ierr )
- ENDIF
- IF ( PRESENT (CurrTime) ) THEN
- CALL ESMF_ClockGetCurrTime( clock , CurrTime, ierr )
- ENDIF
- IF ( PRESENT (StopTime) ) THEN
- CALL ESMF_ClockGetStopTime( clock , StopTime, ierr )
- ENDIF
- IF ( PRESENT (AdvanceCount) ) THEN
- CALL ESMF_ClockGetAdvanceCount(clock, AdvanceCount, ierr)
- ENDIF
- IF ( PRESENT (TimeStep) ) THEN
- CALL ESMF_ClockGetTimeStep(clock, TimeStep, ierr)
- ENDIF
- IF ( PRESENT (PrevTime) ) THEN
- CALL ESMF_ClockGetPrevTime(clock, PrevTime, ierr)
- ENDIF
- IF ( PRESENT (RefTime) ) THEN
- CALL ESMF_ClockGetRefTime(clock, RefTime, ierr)
- ENDIF
-
- IF ( PRESENT (rc) ) THEN
- rc = ierr
- ENDIF
-
- end subroutine ESMF_ClockGet
-
-
-! !IROUTINE: ESMF_ClockGetAdvanceCount - Get the clock's advance count
-
-! !INTERFACE:
- subroutine ESMF_ClockGetAdvanceCount(clock, AdvanceCount, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- integer(ESMF_KIND_I8), intent(out) :: AdvanceCount
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Returns the number of times the {\tt ESMF\_Clock} has been advanced
-! (time stepped)
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to get the advance count from
-! \item[AdvanceCount]
-! The number of times the {\tt ESMF\_Clock} has been advanced
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-
-! !REQUIREMENTS:
-! TMG3.5.1
-!EOP
-
- AdvanceCount = clock%clockint%AdvanceCount
-
- IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
-
- end subroutine ESMF_ClockGetAdvanceCount
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockGetTimeStep - Get a clock's timestep interval
-
-! !INTERFACE:
- subroutine ESMF_ClockGetTimeStep(clock, TimeStep, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- type(ESMF_TimeInterval), intent(out) :: TimeStep
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Get an {\tt ESMF\_Clock}'s timestep interval
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to get the time step from
-! \item[TimeStep]
-! The time step
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG3.5.2
-!EOP
-
- TimeStep = clock%clockint%TimeStep
- IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
-
- end subroutine ESMF_ClockGetTimeStep
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockSetTimeStep - Set a clock's timestep interval
-
-! !INTERFACE:
- subroutine ESMF_ClockSetTimeStep(clock, TimeStep, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(inout) :: clock ! really INTENT(OUT)
- type(ESMF_TimeInterval), intent(in) :: TimeStep
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Set an {\tt ESMF\_Clock}'s timestep interval
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to set the time step
-! \item[TimeStep]
-! The time step
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG3.4.2
-!EOP
-
- clock%clockint%TimeStep = TimeStep
- IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
-
- end subroutine ESMF_ClockSetTimeStep
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockGetCurrTime - Get a clock's current time
-
-! !INTERFACE:
- subroutine ESMF_ClockGetCurrTime(clock, CurrTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- type(ESMF_Time), intent(out) :: CurrTime
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Get an {\tt ESMF\_Clock}'s current time
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to get the current time from
-! \item[CurrTime]
-! The current time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG3.5.4
-!EOP
-
- CurrTime = clock%clockint%CurrTime
- IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
- end subroutine ESMF_ClockGetCurrTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockSetCurrTime - Set a clock's current time
-
-! !INTERFACE:
- subroutine ESMF_ClockSetCurrTime(clock, CurrTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(inout) :: clock ! really INTENT(OUT)
- type(ESMF_Time), intent(in) :: CurrTime
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Set an {\tt ESMF\_Clock}'s current time
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to set the current time from
-! \item[CurrTime]
-! The current time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG3.4.3
-!EOP
-
- clock%clockint%CurrTime = CurrTime
- IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
-
- end subroutine ESMF_ClockSetCurrTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockGetStartTime - Get a clock's start time
-
-! !INTERFACE:
- subroutine ESMF_ClockGetStartTime(clock, StartTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- type(ESMF_Time), intent(out) :: StartTime
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Get an {\tt ESMF\_Clock}'s start time
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to get the start time from
-! \item[StartTime]
-! The start time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG3.5.3
-!EOP
-
- StartTime = clock%clockint%StartTime
- IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
-
- end subroutine ESMF_ClockGetStartTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockGetStopTime - Get a clock's stop time
-
-! !INTERFACE:
- subroutine ESMF_ClockGetStopTime(clock, StopTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- type(ESMF_Time), intent(out) :: StopTime
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Get an {\tt ESMF\_Clock}'s stop time
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to get the stop time from
-! \item[StopTime]
-! The stop time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG3.5.3
-!EOP
-
- StopTime = clock%clockint%StopTime
- IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
-
- end subroutine ESMF_ClockGetStopTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockGetRefTime - Get a clock's reference time
-
-! !INTERFACE:
- subroutine ESMF_ClockGetRefTime(clock, RefTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- type(ESMF_Time), intent(out) :: RefTime
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Get an {\tt ESMF\_Clock}'s reference time
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to get the reference time from
-! \item[RefTime]
-! The reference time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG3.5.3
-!EOP
- refTime = clock%clockint%RefTime
- IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
- end subroutine ESMF_ClockGetRefTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockGetPrevTime - Get a clock's previous current time
-
-! !INTERFACE:
- subroutine ESMF_ClockGetPrevTime(clock, PrevTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- type(ESMF_Time), intent(out) :: PrevTime
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Get an {\tt ESMF\_Clock}'s previous current time
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to get the previous current time from
-! \item[PrevTime]
-! The previous current time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG3.5.4
-!EOP
-
-! hack for bug in PGI 5.1-x
-! prevTime = Clock%clockint%CurrTime - Clock%clockint%TimeStep
- prevTime = ESMF_TimeDec( Clock%clockint%CurrTime, &
- Clock%clockint%TimeStep )
-
- IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
- end subroutine ESMF_ClockGetPrevTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockGetCurrSimTime - Get a clock's current simulation time
-
-! !INTERFACE:
- subroutine ESMF_ClockGetCurrSimTime(clock, CurrSimTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- type(ESMF_TimeInterval), intent(out) :: CurrSimTime
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Get an {\tt ESMF\_Clock}'s current simulation time
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to get the current simulation time from
-! \item[CurrSimTime]
-! The current simulation time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG3.5.5
-!EOP
- CALL wrf_error_fatal( 'ESMF_ClockGetCurrSimTime not supported' )
- end subroutine ESMF_ClockGetCurrSimTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockGetPrevSimTime - Get a clock's previous simulation time
-
-! !INTERFACE:
- subroutine ESMF_ClockGetPrevSimTime(clock, PrevSimTime, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- type(ESMF_TimeInterval), intent(out) :: PrevSimTime
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Get an {\tt ESMF\_Clock}'s previous simulation time
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to get the previous simulation time from
-! \item[PrevSimTime]
-! The previous simulation time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG3.5.5
-!EOP
- CALL wrf_error_fatal( 'ESMF_ClockGetPrevSimTime not supported' )
- end subroutine ESMF_ClockGetPrevSimTime
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockAddAlarm - Add an alarm to a clock's alarm list
-
-! !INTERFACE:
- subroutine ESMF_ClockAddAlarm(clock, Alarm, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(inout) :: clock
- type(ESMF_Alarm), intent(inout) :: Alarm
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Add an {\tt ESMF\_Alarm} to an {\tt ESMF\_Clock}'s {\tt ESMF\_Alarm} list
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to add an {\tt ESMF\_Alarm} to
-! \item[Alarm]
-! The {\tt ESMF\_Alarm} to add to the {\tt ESMF\_Clock}'s
-! {\tt ESMF\_Alarm} list
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG4.1, TMG4.2
-!EOP
-
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
- clock%clockint%NumAlarms = clock%clockint%NumAlarms + 1
- IF ( clock%clockint%NumAlarms > SIZE (clock%clockint%AlarmList) ) THEN
- CALL wrf_error_fatal ( 'ESMF_ClockAddAlarm: too many alarms' )
- ELSE IF ( .NOT. ASSOCIATED( Alarm%alarmint ) ) THEN
- CALL wrf_error_fatal ( &
- 'ESMF_ClockAddAlarm: alarm not created' )
- ELSE
- IF ( Alarm%alarmint%RingTimeSet ) THEN
- Alarm%alarmint%PrevRingTime = Alarm%alarmint%RingTime
-!MGD: If the ring time is equal to the current time, the alarm should be ringing
- IF (Alarm%alarmint%PrevRingTime == clock%clockint%CurrTime) THEN
- Alarm%alarmint%Ringing = .TRUE.
- ELSE
- Alarm%alarmint%Ringing = .FALSE.
- ENDIF
- ELSE
-!TBH: This has the nasty side-effect of forcing us to explicitly turn on
-!TBH: alarms that are created with RingInterval only, if we want them to start
-!TBH: ringing right away. And this is done (see
-!TBH: COMPUTE_VORTEX_CENTER_ALARM). Straighten this out...
- Alarm%alarmint%PrevRingTime = clock%clockint%CurrTime
- Alarm%alarmint%Ringing = .FALSE.
- ENDIF
-
- ! finally, load the alarm into the list
-! write(0,*)'ESMF_ClockAddAlarm ',clock%clockint%NumAlarms
- clock%clockint%AlarmList(clock%clockint%NumAlarms) = Alarm
- ENDIF
-
- end subroutine ESMF_ClockAddAlarm
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockGetAlarmList - Get a clock's alarm list
-
-! !INTERFACE:
- subroutine ESMF_ClockGetAlarmList(clock, AlarmList, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- type(ESMF_Alarm), pointer :: AlarmList(:)
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Get an {\tt ESMF\_Clock}'s {\tt ESMF\_Alarm} list
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to get the {\tt ESMF\_Alarm} list from
-! \item[AlarmList]
-! The {\tt ESMF\_Clock}'s {\tt ESMF\_Alarm} list
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG4.3
-!EOP
-
- AlarmList => clock%clockint%AlarmList
- IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
-
- end subroutine ESMF_ClockGetAlarmList
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockGetNumAlarms - Get the number of alarms in a clock's alarm list
-
-! !INTERFACE:
- subroutine ESMF_ClockGetNumAlarms(clock, NumAlarms, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- integer, intent(out) :: NumAlarms
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Get the number of {\tt ESMF\_Alarm}s in an {\tt ESMF\_Clock}'s
-! {\tt ESMF\_Alarm} list
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to get the number of {\tt ESMF\_Alarm}s from
-! \item[NumAlarms]
-! The number of {\tt ESMF\_Alarm}s in the {\tt ESMF\_Clock}'s
-! {\tt ESMF\_Alarm} list
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG4.3
-!EOP
-
- NumAlarms = clock%clockint%NumAlarms
- IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
-
- end subroutine ESMF_ClockGetNumAlarms
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockSyncToWallClock - Set clock's current time to wall clock time
-
-! !INTERFACE:
- subroutine ESMF_ClockSyncToWallClock(clock, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(inout) :: clock
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Set an {\tt ESMF\_Clock}'s current time to wall clock time
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to synchronize to wall clock time
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG3.4.5
-!EOP
- CALL wrf_error_fatal( 'ESMF_ClockSyncToWallClock not supported' )
- end subroutine ESMF_ClockSyncToWallClock
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockAdvance - Advance a clock's current time by one time step
-
-! !INTERFACE:
- subroutine ESMF_ClockAdvance(clock, RingingAlarmList, &
- NumRingingAlarms, rc)
-
-use esmf_timemod
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(inout) :: clock
- type(ESMF_Alarm), dimension(MAX_ALARMS), intent(out), optional :: &
- RingingAlarmList
- integer, intent(out), optional :: NumRingingAlarms
- integer, intent(out), optional :: rc
-! Local
- logical pred1, pred2, pred3
- integer i, n
- type(ESMF_Alarm) :: alarm
- logical :: positive_timestep
-!
-! !DESCRIPTION:
-! Advance an {\tt ESMF\_Clock}'s current time by one time step
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to advance
-! \item[{[RingingAlarmList]}]
-! Return a list of any ringing alarms after the time step
-! \item[{[NumRingingAlarms]}]
-! The number of ringing alarms returned
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG3.4.1
-!EOP
-! hack for bug in PGI 5.1-x
-! clock%clockint%CurrTime = clock%clockint%CurrTime + &
-! clock%clockint%TimeStep
- clock%clockint%CurrTime = ESMF_TimeInc( clock%clockint%CurrTime, &
- clock%clockint%TimeStep )
- positive_timestep = ESMF_TimeIntervalIsPositive( clock%clockint%TimeStep )
-
- IF ( Present(NumRingingAlarms) ) NumRingingAlarms = 0
- clock%clockint%AdvanceCount = clock%clockint%AdvanceCount + 1
- DO i = 1, MAX_ALARMS
- alarm = clock%clockint%AlarmList(i)
- ! TBH: This is really dangerous. We need to be able to NULLIFY
- ! TBH: alarmint at compile-time (F95 synax) to make this safe.
-!$$$TBH: see if F95 compile-time pointer-nullification is supported by all
-!$$$TBH: compilers we support
- IF ( ASSOCIATED( alarm%alarmint ) ) THEN
- IF ( alarm%alarmint%Enabled ) THEN
- IF ( alarm%alarmint%RingIntervalSet ) THEN
- pred1 = .FALSE. ; pred2 = .FALSE. ; pred3 = .FALSE.
- ! alarm cannot ring if clock has passed the alarms stop time
- IF ( alarm%alarmint%StopTimeSet ) THEN
-!MGD we probably want the same logic for before RingTime
-!MGD IF ( positive_timestep ) THEN
-! hack for bug in PGI 5.1-x
-! PRED1 = clock%clockint%CurrTime > alarm%alarmint%StopTime
- PRED1 = ESMF_TimeGT( clock%clockint%CurrTime, &
- alarm%alarmint%StopTime )
-!MGD ELSE
-!MGD ! in this case time step is negative and stop time is
-!MGD ! less than start time
-!MGD! PRED1 = clock%clockint%CurrTime < alarm%alarmint%StopTime
-!MGD PRED1 = ESMF_TimeLT( clock%clockint%CurrTime, &
-!MGD alarm%alarmint%StopTime )
-!MGD ENDIF
- ELSE IF ( alarm%alarmint%RingTimeSet .AND. .NOT. PRED1) THEN
-!MGD IF ( positive_timestep ) THEN
-!MGD PRED1 = ESMF_TimeGT( clock%clockint%CurrTime, &
-!MGD alarm%alarmint%RingTime )
-!MGD ELSE
- PRED1 = ESMF_TimeLT( clock%clockint%CurrTime, &
- alarm%alarmint%RingTime )
-!MGD ENDIF
- ENDIF
- ! one-shot alarm: check for ring time
-! TBH: Need to remove duplicated code. Need to enforce only one of
-! TBH: alarm%alarmint%RingTimeSet or alarm%alarmint%RingIntervalSet ever
-! TBH: being .TRUE. and simplify the logic. Also, the simpler
-! TBH: implementation in the duplicated code below should be sufficient.
- IF ( alarm%alarmint%RingTimeSet ) THEN
- IF ( positive_timestep ) THEN
-! hack for bug in PGI 5.1-x
-! PRED2 = ( alarm%alarmint%RingTime <= clock%clockint%CurrTime &
-! .AND. clock%clockint%CurrTime < alarm%alarmint%RingTime + &
-! clock%clockint%TimeStep )
- PRED2 = ( ESMF_TimeLE( alarm%alarmint%RingTime, &
- clock%clockint%CurrTime ) &
- .AND. ESMF_TimeLT( clock%clockint%CurrTime, &
- ESMF_TimeInc( alarm%alarmint%RingTime, &
- clock%clockint%TimeStep ) ) )
- ELSE
- ! in this case time step is negative and stop time is
- ! less than start time
-! hack for bug in PGI 5.1-x
-! PRED2 = ( alarm%alarmint%RingTime >= clock%clockint%CurrTime &
-! .AND. clock%clockint%CurrTime > alarm%alarmint%RingTime + &
-! clock%clockint%TimeStep )
- PRED2 = ( ESMF_TimeGE( alarm%alarmint%RingTime, &
- clock%clockint%CurrTime ) &
- .AND. ESMF_TimeGT( clock%clockint%CurrTime, &
- ESMF_TimeInc( alarm%alarmint%RingTime, &
- clock%clockint%TimeStep ) ) )
- ENDIF
- ENDIF
- ! repeating alarm: check for ring interval
- IF ( alarm%alarmint%RingIntervalSet ) THEN
- IF ( positive_timestep ) THEN
-! hack for bug in PGI 5.1-x
-! PRED3 = ( alarm%alarmint%PrevRingTime + alarm%alarmint%RingInterval <= &
-! clock%clockint%CurrTime )
-
- PRED3 = ( ESMF_TimeLE( ESMF_TimeInc( &
- alarm%alarmint%PrevRingTime, &
- alarm%alarmint%RingInterval ), &
- clock%clockint%CurrTime ) )
- ELSE
- ! in this case time step is negative and stop time is
- ! less than start time
- ! ring interval must always be positive
-! hack for bug in PGI 5.1-x
-! PRED3 = ( alarm%alarmint%PrevRingTime - alarm%alarmint%RingInterval >= &
-! clock%clockint%CurrTime )
-
- PRED3 = ( ESMF_TimeGE( ESMF_TimeDec( &
- alarm%alarmint%PrevRingTime, &
- alarm%alarmint%RingInterval ), &
- clock%clockint%CurrTime ) )
- ENDIF
- ENDIF
- IF ( (.NOT. pred1) .AND. pred2 ) THEN
- alarm%alarmint%Ringing = .TRUE.
- alarm%alarmint%PrevRingTime = clock%clockint%CurrTime
-! MGD do we really want the line below?
-! alarm%alarmint%RingTimeSet = .FALSE. !it is a one time alarm, it rang, now let it resort to interval
- IF ( PRESENT( RingingAlarmList ) .AND. &
- PRESENT ( NumRingingAlarms ) ) THEN
- NumRingingAlarms = NumRingingAlarms + 1
- RingingAlarmList( NumRingingAlarms ) = alarm
- ENDIF
- ELSE IF ( (.NOT. pred1) .AND. pred3 ) THEN
- alarm%alarmint%Ringing = .TRUE.
- IF ( positive_timestep ) THEN
-! hack for bug in PGI 5.1-x
-! IF ( PRED3) alarm%alarmint%PrevRingTime = alarm%alarmint%PrevRingTime + &
-! alarm%alarmint%RingInterval
- IF ( PRED3 ) &
- alarm%alarmint%PrevRingTime = &
- ESMF_TimeInc( alarm%alarmint%PrevRingTime, &
- alarm%alarmint%RingInterval )
- ELSE
- ! in this case time step is negative and stop time is
- ! less than start time
- ! ring interval must always be positive
-! hack for bug in PGI 5.1-x
-! IF ( PRED3) alarm%alarmint%PrevRingTime = alarm%alarmint%PrevRingTime - &
-! alarm%alarmint%RingInterval
- IF ( PRED3 ) &
- alarm%alarmint%PrevRingTime = &
- ESMF_TimeDec( alarm%alarmint%PrevRingTime, &
- alarm%alarmint%RingInterval )
- ENDIF
- IF ( PRESENT( RingingAlarmList ) .AND. &
- PRESENT ( NumRingingAlarms ) ) THEN
- NumRingingAlarms = NumRingingAlarms + 1
- RingingAlarmList( NumRingingAlarms ) = alarm
- ENDIF
- ENDIF
- ELSE IF ( alarm%alarmint%RingTimeSet ) THEN
-! TBH: Need to remove duplicated code. Need to enforce only one of
-! TBH: alarm%alarmint%RingTimeSet or alarm%alarmint%RingIntervalSet ever
-! TBH: being .TRUE. and simplify the logic. Also, the simpler
-! TBH: implementation in here should be sufficient.
- IF ( positive_timestep ) THEN
-! hack for bug in PGI 5.1-x
-! IF ( alarm%alarmint%RingTime <= clock%clockint%CurrTime ) THEN
- IF ( ESMF_TimeLE( alarm%alarmint%RingTime, &
- clock%clockint%CurrTime ) ) THEN
- alarm%alarmint%RingTimeSet = .FALSE. !it is a one time alarm, it rang, now let it resort to interval
- alarm%alarmint%Ringing = .TRUE.
- alarm%alarmint%PrevRingTime = clock%clockint%CurrTime
- IF ( PRESENT( RingingAlarmList ) .AND. &
- PRESENT ( NumRingingAlarms ) ) THEN
- NumRingingAlarms = NumRingingAlarms + 1
- RingingAlarmList( NumRingingAlarms ) = alarm
- ENDIF
- ENDIF
- ELSE
- ! in this case time step is negative and stop time is
- ! less than start time
-! hack for bug in PGI 5.1-x
-! IF ( alarm%alarmint%RingTime >= clock%clockint%CurrTime ) THEN
- IF ( ESMF_TimeGE( alarm%alarmint%RingTime, &
- clock%clockint%CurrTime ) ) THEN
- alarm%alarmint%RingTimeSet = .FALSE. !it is a one time alarm, it rang, now let it resort to interval
- alarm%alarmint%Ringing = .TRUE.
- alarm%alarmint%PrevRingTime = clock%clockint%CurrTime
- IF ( PRESENT( RingingAlarmList ) .AND. &
- PRESENT ( NumRingingAlarms ) ) THEN
- NumRingingAlarms = NumRingingAlarms + 1
- RingingAlarmList( NumRingingAlarms ) = alarm
- ENDIF
- ENDIF
- ENDIF
- ENDIF
- IF ( alarm%alarmint%StopTimeSet ) THEN
-! TBH: what is this for???
- ENDIF
- ENDIF
- ENDIF
- clock%clockint%AlarmList(i) = alarm
- ENDDO
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
-
- end subroutine ESMF_ClockAdvance
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockStopTimeDisable - NOOP for compatibility with ESMF 2.1.0+
-
-! !INTERFACE:
- subroutine ESMF_ClockStopTimeDisable(clock, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- integer, intent(out), optional :: rc
-
- rc = ESMF_SUCCESS
-
- end subroutine ESMF_ClockStopTimeDisable
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockIsStopTime - Has the clock reached its stop time ?
-
-! !INTERFACE:
- function ESMF_ClockIsStopTime(clock, rc)
-!
-! !RETURN VALUE:
- logical :: ESMF_ClockIsStopTime
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- integer, intent(out), optional :: rc
- logical :: positive_timestep
-
-! !DESCRIPTION:
-! Return true if {\tt ESMF\_Clock} has reached its stop time, false
-! otherwise
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to check
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-
-! !REQUIREMENTS:
-! TMG3.5.6
-!EOP
-
- positive_timestep = ESMF_TimeIntervalIsPositive( clock%clockint%TimeStep )
- IF ( positive_timestep ) THEN
-! hack for bug in PGI 5.1-x
-! if ( clock%clockint%CurrTime .GE. clock%clockint%StopTime ) THEN
- if ( ESMF_TimeGE( clock%clockint%CurrTime, &
- clock%clockint%StopTime ) ) THEN
- ESMF_ClockIsStopTime = .TRUE.
- else
- ESMF_ClockIsStopTime = .FALSE.
- endif
- ELSE
-! hack for bug in PGI 5.1-x
-! if ( clock%clockint%CurrTime .LE. clock%clockint%StopTime ) THEN
- if ( ESMF_TimeLE( clock%clockint%CurrTime, &
- clock%clockint%StopTime ) ) THEN
- ESMF_ClockIsStopTime = .TRUE.
- else
- ESMF_ClockIsStopTime = .FALSE.
- endif
- ENDIF
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
-
- end function ESMF_ClockIsStopTime
-
-!------------------------------------------------------------------------------
-!
-! This section defines the overridden Read, Write, Validate and Print methods
-! from the ESMF_Base class
-!
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockRead - Restores a clock
-
-! !INTERFACE:
- subroutine ESMF_ClockRead(clock, TimeStep, StartTime, StopTime, &
- RefTime, CurrTime, PrevTime, AdvanceCount, &
- AlarmList, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(out) :: clock
- type(ESMF_TimeInterval), intent(in) :: TimeStep
- type(ESMF_Time), intent(in) :: StartTime
- type(ESMF_Time), intent(in) :: StopTime
- type(ESMF_Time), intent(in) :: RefTime
- type(ESMF_Time), intent(in) :: CurrTime
- type(ESMF_Time), intent(in) :: PrevTime
- integer(ESMF_KIND_I8), intent(in) :: AdvanceCount
- type(ESMF_Alarm), dimension(MAX_ALARMS), intent(in) :: AlarmList
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Restore an {\tt ESMF\_Clock}
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to restore
-! \item[TimeStep]
-! The {\tt ESMF\_Clock}'s time step interval
-! \item[StartTime]
-! The {\tt ESMF\_Clock}'s starting time
-! \item[StopTime]
-! The {\tt ESMF\_Clock}'s stopping time
-! \item[RefTime]
-! The {\tt ESMF\_Clock}'s reference time
-! \item[CurrTime]
-! The {\tt ESMF\_Clock}'s current time
-! \item[PrevTime]
-! The {\tt ESMF\_Clock}'s previous time
-! \item[AdvanceCount]
-! The number of times the {\tt ESMF\_Clock} has been advanced
-! \item[AlarmList]
-! The {\tt ESMF\_Clock}'s {\tt ESMF\_Alarm} list
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-!EOP
- CALL wrf_error_fatal( 'ESMF_ClockRead not supported' )
- end subroutine ESMF_ClockRead
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockWrite - Saves a clock
-
-! !INTERFACE:
- subroutine ESMF_ClockWrite(clock, TimeStep, StartTime, StopTime, &
- RefTime, CurrTime, PrevTime, AdvanceCount, &
- AlarmList, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- type(ESMF_TimeInterval), intent(out) :: TimeStep
- type(ESMF_Time), intent(out) :: StartTime
- type(ESMF_Time), intent(out) :: StopTime
- type(ESMF_Time), intent(out) :: RefTime
- type(ESMF_Time), intent(out) :: CurrTime
- type(ESMF_Time), intent(out) :: PrevTime
- integer(ESMF_KIND_I8), intent(out) :: AdvanceCount
- type(ESMF_Alarm), dimension(MAX_ALARMS), intent(out) :: AlarmList
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Save an {\tt ESMF\_Clock}
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! The object instance to save
-! \item[TimeStep]
-! The {\tt ESMF\_Clock}'s time step interval
-! \item[StartTime]
-! The {\tt ESMF\_Clock}'s starting time
-! \item[StopTime]
-! The {\tt ESMF\_Clock}'s stopping time
-! \item[RefTime]
-! The {\tt ESMF\_Clock}'s reference time
-! \item[CurrTime]
-! The {\tt ESMF\_Clock}'s current time
-! \item[PrevTime]
-! The {\tt ESMF\_Clock}'s previous time
-! \item[AdvanceCount]
-! The number of times the {\tt ESMF\_Clock} has been advanced
-! \item[AlarmList]
-! The {\tt ESMF\_Clock}'s {\tt ESMF\_Alarm} list
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-!EOP
- CALL wrf_error_fatal( 'ESMF_ClockWrite not supported' )
- end subroutine ESMF_ClockWrite
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockValidate - Validate a Clock's properties
-
-! !INTERFACE:
- subroutine ESMF_ClockValidate(clock, opts, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- character (len=*), intent(in), optional :: opts
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! Perform a validation check on an {\tt ESMF\_Clock}'s properties
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! {\tt ESMF\_Clock} to validate
-! \item[{[opts]}]
-! Validate options
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMGn.n.n
-!EOP
- CALL wrf_error_fatal( 'ESMF_ClockValidate not supported' )
- end subroutine ESMF_ClockValidate
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_ClockPrint - Print out a Clock's properties
-
-! !INTERFACE:
- subroutine ESMF_ClockPrint(clock, opts, rc)
-
-! !ARGUMENTS:
- type(ESMF_Clock), intent(in) :: clock
- character (len=*), intent(in), optional :: opts
- integer, intent(out), optional :: rc
-
-! !DESCRIPTION:
-! To support testing/debugging, print out an {\tt ESMF\_Clock}'s
-! properties.
-!
-! The arguments are:
-! \begin{description}
-! \item[clock]
-! {\tt ESMF\_Clock} to print out
-! \item[{[opts]}]
-! Print options
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMGn.n.n
-!EOP
- CALL wrf_error_fatal( 'ESMF_ClockPrint not supported' )
- end subroutine ESMF_ClockPrint
-
-!------------------------------------------------------------------------------
-
- end module ESMF_ClockMod
Copied: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Clock.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/ESMF_Clock.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/ESMF_Clock.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Clock.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,1366 @@
+!
+! Earth System Modeling Framework
+! Copyright 2002-2003, University Corporation for Atmospheric Research,
+! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
+! Laboratory, University of Michigan, National Centers for Environmental
+! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
+! NASA Goddard Space Flight Center.
+! Licensed under the University of Illinois-NCSA license.
+!
+!==============================================================================
+!
+! ESMF Clock Module
+ module ESMF_ClockMod
+!
+!==============================================================================
+!
+! This file contains the Clock class definition and all Clock class methods.
+!
+!------------------------------------------------------------------------------
+! INCLUDES
+#include <ESMF_TimeMgr.inc>
+
+!==============================================================================
+!BOPI
+! !MODULE: ESMF_ClockMod
+!
+! !DESCRIPTION:
+! Part of Time Manager F90 API wrapper of C++ implemenation
+!
+! Defines F90 wrapper entry points for corresponding
+! C++ class {\tt ESMC\_Time} implementation
+!
+! See {\tt ../include/ESMC\_Clock.h} for complete description
+!
+!------------------------------------------------------------------------------
+! !USES:
+ ! inherit from ESMF base class
+ use ESMF_BaseMod
+
+ ! associated derived types
+ use ESMF_TimeIntervalMod ! , only : ESMF_TimeInterval, &
+ ! ESMF_TimeIntervalIsPositive
+ use ESMF_TimeMod ! , only : ESMF_Time
+ use ESMF_AlarmMod, only : ESMF_Alarm
+
+ implicit none
+!
+!------------------------------------------------------------------------------
+! !PRIVATE TYPES:
+ private
+!------------------------------------------------------------------------------
+! ! ESMF_Clock
+!
+! ! F90 class type to match C++ Clock class in size only;
+! ! all dereferencing within class is performed by C++ implementation
+
+! internals for ESMF_Clock
+ type ESMF_ClockInt
+ type(ESMF_TimeInterval) :: TimeStep
+ type(ESMF_Time) :: StartTime
+ type(ESMF_Time) :: StopTime
+ type(ESMF_Time) :: RefTime
+ type(ESMF_Time) :: CurrTime
+ type(ESMF_Time) :: PrevTime
+ integer(ESMF_KIND_I8) :: AdvanceCount
+ integer :: ClockMutex
+ integer :: NumAlarms
+ ! Note: to mimic ESMF 2.1.0+, AlarmList is maintained
+ ! within ESMF_Clock even though copies of each alarm are
+ ! returned from ESMF_AlarmCreate() at the same time they
+ ! are copied into the AlarmList! This duplication is not
+ ! as hideous as it might be because the ESMF_Alarm type
+ ! has data members that are all POINTERs (thus the horrible
+ ! shallow-copy-masquerading-as-reference-copy hack works).
+ type(ESMF_Alarm), pointer, dimension(:) :: AlarmList
+ end type
+
+! Actual public type: this bit allows easy mimic of "deep" ESMF_ClockCreate
+! in ESMF 2.1.0+
+! NOTE: DO NOT ADD NON-POINTER STATE TO THIS DATA TYPE. It emulates ESMF
+! shallow-copy-masquerading-as-reference-copy.
+ type ESMF_Clock
+ type(ESMF_ClockInt), pointer :: clockint
+ end type
+
+!------------------------------------------------------------------------------
+! !PUBLIC TYPES:
+ public ESMF_Clock
+ public ESMF_ClockInt ! needed on AIX but not PGI
+!------------------------------------------------------------------------------
+!
+! !PUBLIC MEMBER FUNCTIONS:
+ public ESMF_ClockCreate
+ public ESMF_ClockDestroy
+ public ESMF_ClockSet
+! public ESMF_ClockSetOLD
+ public ESMF_ClockGet
+! public ESMF_ClockGetAdvanceCount
+! public ESMF_ClockGetTimeStep
+! public ESMF_ClockSetTimeStep
+! public ESMF_ClockGetCurrTime
+! public ESMF_ClockSetCurrTime
+! public ESMF_ClockGetStartTime
+! public ESMF_ClockGetStopTime
+! public ESMF_ClockGetRefTime
+! public ESMF_ClockGetPrevTime
+! public ESMF_ClockGetCurrSimTime
+! public ESMF_ClockGetPrevSimTime
+! This must be public for ESMF_AlarmClockMod...
+ public ESMF_ClockAddAlarm
+ public ESMF_ClockGetAlarmList
+! public ESMF_ClockGetNumAlarms
+! public ESMF_ClockSyncToWallClock
+ public ESMF_ClockAdvance
+ public ESMF_ClockIsStopTime
+ public ESMF_ClockStopTimeDisable
+
+! Required inherited and overridden ESMF_Base class methods
+
+! public ESMF_ClockRead
+! public ESMF_ClockWrite
+ public ESMF_ClockValidate
+ public ESMF_ClockPrint
+!EOPI
+
+!==============================================================================
+
+ contains
+
+!==============================================================================
+!
+! This section includes the Set methods.
+!
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockSetOLD - Initialize a clockint
+
+! !INTERFACE:
+ subroutine ESMF_ClockSetOLD(clockint, TimeStep, StartTime, &
+ StopTime, RefTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_ClockInt), intent(out) :: clockint
+ type(ESMF_TimeInterval), intent(in), optional :: TimeStep
+ type(ESMF_Time), intent(in) :: StartTime
+ type(ESMF_Time), intent(in) :: StopTime
+ type(ESMF_Time), intent(in), optional :: RefTime
+ integer, intent(out), optional :: rc
+! Local
+ integer i
+
+! !DESCRIPTION:
+! Initialize an {\tt ESMF\_Clock}
+!
+! The arguments are:
+! \begin{description}
+! \item[clockint]
+! The object instance to initialize
+! \item[{[TimeStep]}]
+! The {\tt ESMF\_Clock}'s time step interval
+! \item[StartTime]
+! The {\tt ESMF\_Clock}'s starting time
+! \item[StopTime]
+! The {\tt ESMF\_Clock}'s stopping time
+! \item[{[RefTime]}]
+! The {\tt ESMF\_Clock}'s reference time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG3.1, TMG3.4.4
+!EOP
+ IF ( PRESENT(TimeStep) ) clockint%TimeStep = TimeStep
+ IF ( PRESENT(RefTime) )THEN
+ clockint%RefTime = RefTime
+ ELSE
+ clockint%RefTime = StartTime
+ END IF
+ clockint%CurrTime = StartTime
+ clockint%StartTime = StartTime
+ clockint%StopTime = StopTime
+ clockint%NumAlarms = 0
+ clockint%AdvanceCount = 0
+ ALLOCATE(clockint%AlarmList(MAX_ALARMS))
+ ! TBH: This incredible hack can be removed once ESMF_*Validate()
+ ! TBH: can tell if a deep ESMF_* was created or not.
+ DO i = 1, MAX_ALARMS
+ NULLIFY( clockint%AlarmList( i )%alarmint )
+ ENDDO
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_ClockSetOLD
+
+
+! !IROUTINE: ESMF_ClockSet - Set clock properties -- for compatibility with ESMF 2.0.1
+
+! !INTERFACE:
+ subroutine ESMF_ClockSet(clock, TimeStep, StartTime, StopTime, &
+ RefTime, CurrTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(inout) :: clock
+ type(ESMF_TimeInterval), intent(in), optional :: TimeStep
+ type(ESMF_Time), intent(in), optional :: StartTime
+ type(ESMF_Time), intent(in), optional :: StopTime
+ type(ESMF_Time), intent(in), optional :: RefTime
+ type(ESMF_Time), intent(in), optional :: CurrTime
+ integer, intent(out), optional :: rc
+! Local
+ integer ierr
+
+! !DESCRIPTION:
+! Initialize an {\tt ESMF\_Clock}
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to initialize
+! \item[{[TimeStep]}]
+! The {\tt ESMF\_Clock}'s time step interval
+! \item[StartTime]
+! The {\tt ESMF\_Clock}'s starting time
+! \item[StopTime]
+! The {\tt ESMF\_Clock}'s stopping time
+! \item[{[RefTime]}]
+! The {\tt ESMF\_Clock}'s reference time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG3.1, TMG3.4.4
+!EOP
+ ierr = ESMF_SUCCESS
+ IF ( PRESENT(TimeStep) ) THEN
+ CALL ESMF_ClockSetTimeStep ( clock, TimeStep, rc=ierr )
+ ENDIF
+ IF ( PRESENT(RefTime) ) clock%clockint%RefTime = RefTime
+ IF ( PRESENT(StartTime) ) clock%clockint%StartTime = StartTime
+ IF ( PRESENT(StopTime) ) clock%clockint%StopTime = StopTime
+ IF ( PRESENT(CurrTime) ) THEN
+ CALL ESMF_ClockSetCurrTime(clock, CurrTime, rc=ierr)
+ ENDIF
+ IF ( PRESENT(rc) ) rc = ierr
+
+ end subroutine ESMF_ClockSet
+
+
+! Create ESMF_Clock using ESMF 2.1.0+ semantics
+ FUNCTION ESMF_ClockCreate( name, TimeStep, StartTime, StopTime, &
+ RefTime, rc )
+ ! return value
+ type(ESMF_Clock) :: ESMF_ClockCreate
+ ! !ARGUMENTS:
+ character (len=*), intent(in), optional :: name
+ type(ESMF_TimeInterval), intent(in), optional :: TimeStep
+ type(ESMF_Time), intent(in) :: StartTime
+ type(ESMF_Time), intent(in) :: StopTime
+ type(ESMF_Time), intent(in), optional :: RefTime
+ integer, intent(out), optional :: rc
+ ! locals
+ type(ESMF_Clock) :: clocktmp
+ ! TBH: ignore allocate errors, for now
+ ALLOCATE( clocktmp%clockint )
+ CALL ESMF_ClockSetOLD( clocktmp%clockint, &
+ TimeStep= TimeStep, &
+ StartTime=StartTime, &
+ StopTime= StopTime, &
+ RefTime=RefTime, rc=rc )
+ ESMF_ClockCreate = clocktmp
+ END FUNCTION ESMF_ClockCreate
+
+
+! Deallocate memory for ESMF_Clock
+ SUBROUTINE ESMF_ClockDestroy( clock, rc )
+ TYPE(ESMF_Clock), INTENT(INOUT) :: clock
+ INTEGER, INTENT( OUT), OPTIONAL :: rc
+ ! TBH: ignore deallocate errors, for now
+ DEALLOCATE( clock%clockint%AlarmList )
+ DEALLOCATE( clock%clockint )
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+ END SUBROUTINE ESMF_ClockDestroy
+
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockGet - Get clock properties -- for compatibility with ESMF 2.0.1
+
+! !INTERFACE:
+ subroutine ESMF_ClockGet(clock, StartTime, CurrTime, &
+ AdvanceCount, StopTime, TimeStep, &
+ PrevTime, RefTime, &
+ rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ type(ESMF_Time), intent(out), optional :: StartTime
+ type(ESMF_Time), intent(out), optional :: CurrTime
+ type(ESMF_Time), intent(out), optional :: StopTime
+ type(ESMF_Time), intent(out), optional :: PrevTime
+ type(ESMF_Time), intent(out), optional :: RefTime
+ integer(ESMF_KIND_I8), intent(out), optional :: AdvanceCount
+ type(ESMF_TimeInterval), intent(out), optional :: TimeStep
+ integer, intent(out), optional :: rc
+ integer :: ierr
+
+! !DESCRIPTION:
+! Returns the number of times the {\tt ESMF\_Clock} has been advanced
+! (time stepped)
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to get the advance count from
+! \item[StartTime]
+! The start time
+! \item[CurrTime]
+! The current time
+! \item[AdvanceCount]
+! The number of times the {\tt ESMF\_Clock} has been advanced
+! \item[StopTime]
+! The {\tt ESMF\_Clock}'s stopping time
+! \item[{[TimeStep]}]
+! The {\tt ESMF\_Clock}'s time step interval
+! \item[{[PrevTime]}]
+! The {\tt ESMF\_Clock}'s previous current time
+! \item[{[PrevTime]}]
+! The {\tt ESMF\_Clock}'s reference time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+
+! !REQUIREMENTS:
+! TMG3.5.1
+!EOP
+ ierr = ESMF_SUCCESS
+
+ IF ( PRESENT (StartTime) ) THEN
+ CALL ESMF_ClockGetStartTime( clock, StartTime=StartTime, rc=ierr )
+ ENDIF
+ IF ( PRESENT (CurrTime) ) THEN
+ CALL ESMF_ClockGetCurrTime( clock , CurrTime, ierr )
+ ENDIF
+ IF ( PRESENT (StopTime) ) THEN
+ CALL ESMF_ClockGetStopTime( clock , StopTime, ierr )
+ ENDIF
+ IF ( PRESENT (AdvanceCount) ) THEN
+ CALL ESMF_ClockGetAdvanceCount(clock, AdvanceCount, ierr)
+ ENDIF
+ IF ( PRESENT (TimeStep) ) THEN
+ CALL ESMF_ClockGetTimeStep(clock, TimeStep, ierr)
+ ENDIF
+ IF ( PRESENT (PrevTime) ) THEN
+ CALL ESMF_ClockGetPrevTime(clock, PrevTime, ierr)
+ ENDIF
+ IF ( PRESENT (RefTime) ) THEN
+ CALL ESMF_ClockGetRefTime(clock, RefTime, ierr)
+ ENDIF
+
+ IF ( PRESENT (rc) ) THEN
+ rc = ierr
+ ENDIF
+
+ end subroutine ESMF_ClockGet
+
+
+! !IROUTINE: ESMF_ClockGetAdvanceCount - Get the clock's advance count
+
+! !INTERFACE:
+ subroutine ESMF_ClockGetAdvanceCount(clock, AdvanceCount, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ integer(ESMF_KIND_I8), intent(out) :: AdvanceCount
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Returns the number of times the {\tt ESMF\_Clock} has been advanced
+! (time stepped)
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to get the advance count from
+! \item[AdvanceCount]
+! The number of times the {\tt ESMF\_Clock} has been advanced
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+
+! !REQUIREMENTS:
+! TMG3.5.1
+!EOP
+
+ AdvanceCount = clock%clockint%AdvanceCount
+
+ IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_ClockGetAdvanceCount
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockGetTimeStep - Get a clock's timestep interval
+
+! !INTERFACE:
+ subroutine ESMF_ClockGetTimeStep(clock, TimeStep, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ type(ESMF_TimeInterval), intent(out) :: TimeStep
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Get an {\tt ESMF\_Clock}'s timestep interval
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to get the time step from
+! \item[TimeStep]
+! The time step
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG3.5.2
+!EOP
+
+ TimeStep = clock%clockint%TimeStep
+ IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_ClockGetTimeStep
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockSetTimeStep - Set a clock's timestep interval
+
+! !INTERFACE:
+ subroutine ESMF_ClockSetTimeStep(clock, TimeStep, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(inout) :: clock ! really INTENT(OUT)
+ type(ESMF_TimeInterval), intent(in) :: TimeStep
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Set an {\tt ESMF\_Clock}'s timestep interval
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to set the time step
+! \item[TimeStep]
+! The time step
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG3.4.2
+!EOP
+
+ clock%clockint%TimeStep = TimeStep
+ IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_ClockSetTimeStep
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockGetCurrTime - Get a clock's current time
+
+! !INTERFACE:
+ subroutine ESMF_ClockGetCurrTime(clock, CurrTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ type(ESMF_Time), intent(out) :: CurrTime
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Get an {\tt ESMF\_Clock}'s current time
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to get the current time from
+! \item[CurrTime]
+! The current time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG3.5.4
+!EOP
+
+ CurrTime = clock%clockint%CurrTime
+ IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
+ end subroutine ESMF_ClockGetCurrTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockSetCurrTime - Set a clock's current time
+
+! !INTERFACE:
+ subroutine ESMF_ClockSetCurrTime(clock, CurrTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(inout) :: clock ! really INTENT(OUT)
+ type(ESMF_Time), intent(in) :: CurrTime
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Set an {\tt ESMF\_Clock}'s current time
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to set the current time from
+! \item[CurrTime]
+! The current time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG3.4.3
+!EOP
+
+ clock%clockint%CurrTime = CurrTime
+ IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_ClockSetCurrTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockGetStartTime - Get a clock's start time
+
+! !INTERFACE:
+ subroutine ESMF_ClockGetStartTime(clock, StartTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ type(ESMF_Time), intent(out) :: StartTime
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Get an {\tt ESMF\_Clock}'s start time
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to get the start time from
+! \item[StartTime]
+! The start time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG3.5.3
+!EOP
+
+ StartTime = clock%clockint%StartTime
+ IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_ClockGetStartTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockGetStopTime - Get a clock's stop time
+
+! !INTERFACE:
+ subroutine ESMF_ClockGetStopTime(clock, StopTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ type(ESMF_Time), intent(out) :: StopTime
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Get an {\tt ESMF\_Clock}'s stop time
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to get the stop time from
+! \item[StopTime]
+! The stop time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG3.5.3
+!EOP
+
+ StopTime = clock%clockint%StopTime
+ IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_ClockGetStopTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockGetRefTime - Get a clock's reference time
+
+! !INTERFACE:
+ subroutine ESMF_ClockGetRefTime(clock, RefTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ type(ESMF_Time), intent(out) :: RefTime
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Get an {\tt ESMF\_Clock}'s reference time
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to get the reference time from
+! \item[RefTime]
+! The reference time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG3.5.3
+!EOP
+ refTime = clock%clockint%RefTime
+ IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
+ end subroutine ESMF_ClockGetRefTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockGetPrevTime - Get a clock's previous current time
+
+! !INTERFACE:
+ subroutine ESMF_ClockGetPrevTime(clock, PrevTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ type(ESMF_Time), intent(out) :: PrevTime
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Get an {\tt ESMF\_Clock}'s previous current time
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to get the previous current time from
+! \item[PrevTime]
+! The previous current time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG3.5.4
+!EOP
+
+! hack for bug in PGI 5.1-x
+! prevTime = Clock%clockint%CurrTime - Clock%clockint%TimeStep
+ prevTime = ESMF_TimeDec( Clock%clockint%CurrTime, &
+ Clock%clockint%TimeStep )
+
+ IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
+ end subroutine ESMF_ClockGetPrevTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockGetCurrSimTime - Get a clock's current simulation time
+
+! !INTERFACE:
+ subroutine ESMF_ClockGetCurrSimTime(clock, CurrSimTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ type(ESMF_TimeInterval), intent(out) :: CurrSimTime
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Get an {\tt ESMF\_Clock}'s current simulation time
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to get the current simulation time from
+! \item[CurrSimTime]
+! The current simulation time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG3.5.5
+!EOP
+ CALL wrf_error_fatal( 'ESMF_ClockGetCurrSimTime not supported' )
+ end subroutine ESMF_ClockGetCurrSimTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockGetPrevSimTime - Get a clock's previous simulation time
+
+! !INTERFACE:
+ subroutine ESMF_ClockGetPrevSimTime(clock, PrevSimTime, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ type(ESMF_TimeInterval), intent(out) :: PrevSimTime
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Get an {\tt ESMF\_Clock}'s previous simulation time
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to get the previous simulation time from
+! \item[PrevSimTime]
+! The previous simulation time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG3.5.5
+!EOP
+ CALL wrf_error_fatal( 'ESMF_ClockGetPrevSimTime not supported' )
+ end subroutine ESMF_ClockGetPrevSimTime
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockAddAlarm - Add an alarm to a clock's alarm list
+
+! !INTERFACE:
+ subroutine ESMF_ClockAddAlarm(clock, Alarm, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(inout) :: clock
+ type(ESMF_Alarm), intent(inout) :: Alarm
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Add an {\tt ESMF\_Alarm} to an {\tt ESMF\_Clock}'s {\tt ESMF\_Alarm} list
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to add an {\tt ESMF\_Alarm} to
+! \item[Alarm]
+! The {\tt ESMF\_Alarm} to add to the {\tt ESMF\_Clock}'s
+! {\tt ESMF\_Alarm} list
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG4.1, TMG4.2
+!EOP
+
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+ clock%clockint%NumAlarms = clock%clockint%NumAlarms + 1
+ IF ( clock%clockint%NumAlarms > SIZE (clock%clockint%AlarmList) ) THEN
+ CALL wrf_error_fatal ( 'ESMF_ClockAddAlarm: too many alarms' )
+ ELSE IF ( .NOT. ASSOCIATED( Alarm%alarmint ) ) THEN
+ CALL wrf_error_fatal ( &
+ 'ESMF_ClockAddAlarm: alarm not created' )
+ ELSE
+ IF ( Alarm%alarmint%RingTimeSet ) THEN
+ Alarm%alarmint%PrevRingTime = Alarm%alarmint%RingTime
+!MGD: If the ring time is equal to the current time, the alarm should be ringing
+ IF (Alarm%alarmint%PrevRingTime == clock%clockint%CurrTime) THEN
+ Alarm%alarmint%Ringing = .TRUE.
+ ELSE
+ Alarm%alarmint%Ringing = .FALSE.
+ ENDIF
+ ELSE
+!TBH: This has the nasty side-effect of forcing us to explicitly turn on
+!TBH: alarms that are created with RingInterval only, if we want them to start
+!TBH: ringing right away. And this is done (see
+!TBH: COMPUTE_VORTEX_CENTER_ALARM). Straighten this out...
+ Alarm%alarmint%PrevRingTime = clock%clockint%CurrTime
+ Alarm%alarmint%Ringing = .FALSE.
+ ENDIF
+
+ ! finally, load the alarm into the list
+! write(0,*)'ESMF_ClockAddAlarm ',clock%clockint%NumAlarms
+ clock%clockint%AlarmList(clock%clockint%NumAlarms) = Alarm
+ ENDIF
+
+ end subroutine ESMF_ClockAddAlarm
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockGetAlarmList - Get a clock's alarm list
+
+! !INTERFACE:
+ subroutine ESMF_ClockGetAlarmList(clock, AlarmList, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ type(ESMF_Alarm), pointer :: AlarmList(:)
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Get an {\tt ESMF\_Clock}'s {\tt ESMF\_Alarm} list
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to get the {\tt ESMF\_Alarm} list from
+! \item[AlarmList]
+! The {\tt ESMF\_Clock}'s {\tt ESMF\_Alarm} list
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG4.3
+!EOP
+
+ AlarmList => clock%clockint%AlarmList
+ IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_ClockGetAlarmList
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockGetNumAlarms - Get the number of alarms in a clock's alarm list
+
+! !INTERFACE:
+ subroutine ESMF_ClockGetNumAlarms(clock, NumAlarms, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ integer, intent(out) :: NumAlarms
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Get the number of {\tt ESMF\_Alarm}s in an {\tt ESMF\_Clock}'s
+! {\tt ESMF\_Alarm} list
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to get the number of {\tt ESMF\_Alarm}s from
+! \item[NumAlarms]
+! The number of {\tt ESMF\_Alarm}s in the {\tt ESMF\_Clock}'s
+! {\tt ESMF\_Alarm} list
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG4.3
+!EOP
+
+ NumAlarms = clock%clockint%NumAlarms
+ IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_ClockGetNumAlarms
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockSyncToWallClock - Set clock's current time to wall clock time
+
+! !INTERFACE:
+ subroutine ESMF_ClockSyncToWallClock(clock, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(inout) :: clock
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Set an {\tt ESMF\_Clock}'s current time to wall clock time
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to synchronize to wall clock time
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG3.4.5
+!EOP
+ CALL wrf_error_fatal( 'ESMF_ClockSyncToWallClock not supported' )
+ end subroutine ESMF_ClockSyncToWallClock
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockAdvance - Advance a clock's current time by one time step
+
+! !INTERFACE:
+ subroutine ESMF_ClockAdvance(clock, RingingAlarmList, &
+ NumRingingAlarms, rc)
+
+use esmf_timemod
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(inout) :: clock
+ type(ESMF_Alarm), dimension(MAX_ALARMS), intent(out), optional :: &
+ RingingAlarmList
+ integer, intent(out), optional :: NumRingingAlarms
+ integer, intent(out), optional :: rc
+! Local
+ logical pred1, pred2, pred3
+ integer i, n
+ type(ESMF_Alarm) :: alarm
+ logical :: positive_timestep
+!
+! !DESCRIPTION:
+! Advance an {\tt ESMF\_Clock}'s current time by one time step
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to advance
+! \item[{[RingingAlarmList]}]
+! Return a list of any ringing alarms after the time step
+! \item[{[NumRingingAlarms]}]
+! The number of ringing alarms returned
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG3.4.1
+!EOP
+! hack for bug in PGI 5.1-x
+! clock%clockint%CurrTime = clock%clockint%CurrTime + &
+! clock%clockint%TimeStep
+ clock%clockint%CurrTime = ESMF_TimeInc( clock%clockint%CurrTime, &
+ clock%clockint%TimeStep )
+ positive_timestep = ESMF_TimeIntervalIsPositive( clock%clockint%TimeStep )
+
+ IF ( Present(NumRingingAlarms) ) NumRingingAlarms = 0
+ clock%clockint%AdvanceCount = clock%clockint%AdvanceCount + 1
+ DO i = 1, MAX_ALARMS
+ alarm = clock%clockint%AlarmList(i)
+ ! TBH: This is really dangerous. We need to be able to NULLIFY
+ ! TBH: alarmint at compile-time (F95 synax) to make this safe.
+!$$$TBH: see if F95 compile-time pointer-nullification is supported by all
+!$$$TBH: compilers we support
+ IF ( ASSOCIATED( alarm%alarmint ) ) THEN
+ IF ( alarm%alarmint%Enabled ) THEN
+ IF ( alarm%alarmint%RingIntervalSet ) THEN
+ pred1 = .FALSE. ; pred2 = .FALSE. ; pred3 = .FALSE.
+ ! alarm cannot ring if clock has passed the alarms stop time
+ IF ( alarm%alarmint%StopTimeSet ) THEN
+!MGD we probably want the same logic for before RingTime
+!MGD IF ( positive_timestep ) THEN
+! hack for bug in PGI 5.1-x
+! PRED1 = clock%clockint%CurrTime > alarm%alarmint%StopTime
+ PRED1 = ESMF_TimeGT( clock%clockint%CurrTime, &
+ alarm%alarmint%StopTime )
+!MGD ELSE
+!MGD ! in this case time step is negative and stop time is
+!MGD ! less than start time
+!MGD! PRED1 = clock%clockint%CurrTime < alarm%alarmint%StopTime
+!MGD PRED1 = ESMF_TimeLT( clock%clockint%CurrTime, &
+!MGD alarm%alarmint%StopTime )
+!MGD ENDIF
+ ELSE IF ( alarm%alarmint%RingTimeSet .AND. .NOT. PRED1) THEN
+!MGD IF ( positive_timestep ) THEN
+!MGD PRED1 = ESMF_TimeGT( clock%clockint%CurrTime, &
+!MGD alarm%alarmint%RingTime )
+!MGD ELSE
+ PRED1 = ESMF_TimeLT( clock%clockint%CurrTime, &
+ alarm%alarmint%RingTime )
+!MGD ENDIF
+ ENDIF
+ ! one-shot alarm: check for ring time
+! TBH: Need to remove duplicated code. Need to enforce only one of
+! TBH: alarm%alarmint%RingTimeSet or alarm%alarmint%RingIntervalSet ever
+! TBH: being .TRUE. and simplify the logic. Also, the simpler
+! TBH: implementation in the duplicated code below should be sufficient.
+ IF ( alarm%alarmint%RingTimeSet ) THEN
+ IF ( positive_timestep ) THEN
+! hack for bug in PGI 5.1-x
+! PRED2 = ( alarm%alarmint%RingTime <= clock%clockint%CurrTime &
+! .AND. clock%clockint%CurrTime < alarm%alarmint%RingTime + &
+! clock%clockint%TimeStep )
+ PRED2 = ( ESMF_TimeLE( alarm%alarmint%RingTime, &
+ clock%clockint%CurrTime ) &
+ .AND. ESMF_TimeLT( clock%clockint%CurrTime, &
+ ESMF_TimeInc( alarm%alarmint%RingTime, &
+ clock%clockint%TimeStep ) ) )
+ ELSE
+ ! in this case time step is negative and stop time is
+ ! less than start time
+! hack for bug in PGI 5.1-x
+! PRED2 = ( alarm%alarmint%RingTime >= clock%clockint%CurrTime &
+! .AND. clock%clockint%CurrTime > alarm%alarmint%RingTime + &
+! clock%clockint%TimeStep )
+ PRED2 = ( ESMF_TimeGE( alarm%alarmint%RingTime, &
+ clock%clockint%CurrTime ) &
+ .AND. ESMF_TimeGT( clock%clockint%CurrTime, &
+ ESMF_TimeInc( alarm%alarmint%RingTime, &
+ clock%clockint%TimeStep ) ) )
+ ENDIF
+ ENDIF
+ ! repeating alarm: check for ring interval
+ IF ( alarm%alarmint%RingIntervalSet ) THEN
+ IF ( positive_timestep ) THEN
+! hack for bug in PGI 5.1-x
+! PRED3 = ( alarm%alarmint%PrevRingTime + alarm%alarmint%RingInterval <= &
+! clock%clockint%CurrTime )
+
+ PRED3 = ( ESMF_TimeLE( ESMF_TimeInc( &
+ alarm%alarmint%PrevRingTime, &
+ alarm%alarmint%RingInterval ), &
+ clock%clockint%CurrTime ) )
+ ELSE
+ ! in this case time step is negative and stop time is
+ ! less than start time
+ ! ring interval must always be positive
+! hack for bug in PGI 5.1-x
+! PRED3 = ( alarm%alarmint%PrevRingTime - alarm%alarmint%RingInterval >= &
+! clock%clockint%CurrTime )
+
+ PRED3 = ( ESMF_TimeGE( ESMF_TimeDec( &
+ alarm%alarmint%PrevRingTime, &
+ alarm%alarmint%RingInterval ), &
+ clock%clockint%CurrTime ) )
+ ENDIF
+ ENDIF
+ IF ( (.NOT. pred1) .AND. pred2 ) THEN
+ alarm%alarmint%Ringing = .TRUE.
+ alarm%alarmint%PrevRingTime = clock%clockint%CurrTime
+! MGD do we really want the line below?
+! alarm%alarmint%RingTimeSet = .FALSE. !it is a one time alarm, it rang, now let it resort to interval
+ IF ( PRESENT( RingingAlarmList ) .AND. &
+ PRESENT ( NumRingingAlarms ) ) THEN
+ NumRingingAlarms = NumRingingAlarms + 1
+ RingingAlarmList( NumRingingAlarms ) = alarm
+ ENDIF
+ ELSE IF ( (.NOT. pred1) .AND. pred3 ) THEN
+ alarm%alarmint%Ringing = .TRUE.
+ IF ( positive_timestep ) THEN
+! hack for bug in PGI 5.1-x
+! IF ( PRED3) alarm%alarmint%PrevRingTime = alarm%alarmint%PrevRingTime + &
+! alarm%alarmint%RingInterval
+ IF ( PRED3 ) &
+ alarm%alarmint%PrevRingTime = &
+ ESMF_TimeInc( alarm%alarmint%PrevRingTime, &
+ alarm%alarmint%RingInterval )
+ ELSE
+ ! in this case time step is negative and stop time is
+ ! less than start time
+ ! ring interval must always be positive
+! hack for bug in PGI 5.1-x
+! IF ( PRED3) alarm%alarmint%PrevRingTime = alarm%alarmint%PrevRingTime - &
+! alarm%alarmint%RingInterval
+ IF ( PRED3 ) &
+ alarm%alarmint%PrevRingTime = &
+ ESMF_TimeDec( alarm%alarmint%PrevRingTime, &
+ alarm%alarmint%RingInterval )
+ ENDIF
+ IF ( PRESENT( RingingAlarmList ) .AND. &
+ PRESENT ( NumRingingAlarms ) ) THEN
+ NumRingingAlarms = NumRingingAlarms + 1
+ RingingAlarmList( NumRingingAlarms ) = alarm
+ ENDIF
+ ENDIF
+ ELSE IF ( alarm%alarmint%RingTimeSet ) THEN
+! TBH: Need to remove duplicated code. Need to enforce only one of
+! TBH: alarm%alarmint%RingTimeSet or alarm%alarmint%RingIntervalSet ever
+! TBH: being .TRUE. and simplify the logic. Also, the simpler
+! TBH: implementation in here should be sufficient.
+ IF ( positive_timestep ) THEN
+! hack for bug in PGI 5.1-x
+! IF ( alarm%alarmint%RingTime <= clock%clockint%CurrTime ) THEN
+ IF ( ESMF_TimeLE( alarm%alarmint%RingTime, &
+ clock%clockint%CurrTime ) ) THEN
+ alarm%alarmint%RingTimeSet = .FALSE. !it is a one time alarm, it rang, now let it resort to interval
+ alarm%alarmint%Ringing = .TRUE.
+ alarm%alarmint%PrevRingTime = clock%clockint%CurrTime
+ IF ( PRESENT( RingingAlarmList ) .AND. &
+ PRESENT ( NumRingingAlarms ) ) THEN
+ NumRingingAlarms = NumRingingAlarms + 1
+ RingingAlarmList( NumRingingAlarms ) = alarm
+ ENDIF
+ ENDIF
+ ELSE
+ ! in this case time step is negative and stop time is
+ ! less than start time
+! hack for bug in PGI 5.1-x
+! IF ( alarm%alarmint%RingTime >= clock%clockint%CurrTime ) THEN
+ IF ( ESMF_TimeGE( alarm%alarmint%RingTime, &
+ clock%clockint%CurrTime ) ) THEN
+ alarm%alarmint%RingTimeSet = .FALSE. !it is a one time alarm, it rang, now let it resort to interval
+ alarm%alarmint%Ringing = .TRUE.
+ alarm%alarmint%PrevRingTime = clock%clockint%CurrTime
+ IF ( PRESENT( RingingAlarmList ) .AND. &
+ PRESENT ( NumRingingAlarms ) ) THEN
+ NumRingingAlarms = NumRingingAlarms + 1
+ RingingAlarmList( NumRingingAlarms ) = alarm
+ ENDIF
+ ENDIF
+ ENDIF
+ ENDIF
+ IF ( alarm%alarmint%StopTimeSet ) THEN
+! TBH: what is this for???
+ ENDIF
+ ENDIF
+ ENDIF
+ clock%clockint%AlarmList(i) = alarm
+ ENDDO
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_ClockAdvance
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockStopTimeDisable - NOOP for compatibility with ESMF 2.1.0+
+
+! !INTERFACE:
+ subroutine ESMF_ClockStopTimeDisable(clock, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ integer, intent(out), optional :: rc
+
+ rc = ESMF_SUCCESS
+
+ end subroutine ESMF_ClockStopTimeDisable
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockIsStopTime - Has the clock reached its stop time ?
+
+! !INTERFACE:
+ function ESMF_ClockIsStopTime(clock, rc)
+!
+! !RETURN VALUE:
+ logical :: ESMF_ClockIsStopTime
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ integer, intent(out), optional :: rc
+ logical :: positive_timestep
+
+! !DESCRIPTION:
+! Return true if {\tt ESMF\_Clock} has reached its stop time, false
+! otherwise
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to check
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+
+! !REQUIREMENTS:
+! TMG3.5.6
+!EOP
+
+ positive_timestep = ESMF_TimeIntervalIsPositive( clock%clockint%TimeStep )
+ IF ( positive_timestep ) THEN
+! hack for bug in PGI 5.1-x
+! if ( clock%clockint%CurrTime .GE. clock%clockint%StopTime ) THEN
+ if ( ESMF_TimeGE( clock%clockint%CurrTime, &
+ clock%clockint%StopTime ) ) THEN
+ ESMF_ClockIsStopTime = .TRUE.
+ else
+ ESMF_ClockIsStopTime = .FALSE.
+ endif
+ ELSE
+! hack for bug in PGI 5.1-x
+! if ( clock%clockint%CurrTime .LE. clock%clockint%StopTime ) THEN
+ if ( ESMF_TimeLE( clock%clockint%CurrTime, &
+ clock%clockint%StopTime ) ) THEN
+ ESMF_ClockIsStopTime = .TRUE.
+ else
+ ESMF_ClockIsStopTime = .FALSE.
+ endif
+ ENDIF
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+
+ end function ESMF_ClockIsStopTime
+
+!------------------------------------------------------------------------------
+!
+! This section defines the overridden Read, Write, Validate and Print methods
+! from the ESMF_Base class
+!
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockRead - Restores a clock
+
+! !INTERFACE:
+ subroutine ESMF_ClockRead(clock, TimeStep, StartTime, StopTime, &
+ RefTime, CurrTime, PrevTime, AdvanceCount, &
+ AlarmList, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(out) :: clock
+ type(ESMF_TimeInterval), intent(in) :: TimeStep
+ type(ESMF_Time), intent(in) :: StartTime
+ type(ESMF_Time), intent(in) :: StopTime
+ type(ESMF_Time), intent(in) :: RefTime
+ type(ESMF_Time), intent(in) :: CurrTime
+ type(ESMF_Time), intent(in) :: PrevTime
+ integer(ESMF_KIND_I8), intent(in) :: AdvanceCount
+ type(ESMF_Alarm), dimension(MAX_ALARMS), intent(in) :: AlarmList
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Restore an {\tt ESMF\_Clock}
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to restore
+! \item[TimeStep]
+! The {\tt ESMF\_Clock}'s time step interval
+! \item[StartTime]
+! The {\tt ESMF\_Clock}'s starting time
+! \item[StopTime]
+! The {\tt ESMF\_Clock}'s stopping time
+! \item[RefTime]
+! The {\tt ESMF\_Clock}'s reference time
+! \item[CurrTime]
+! The {\tt ESMF\_Clock}'s current time
+! \item[PrevTime]
+! The {\tt ESMF\_Clock}'s previous time
+! \item[AdvanceCount]
+! The number of times the {\tt ESMF\_Clock} has been advanced
+! \item[AlarmList]
+! The {\tt ESMF\_Clock}'s {\tt ESMF\_Alarm} list
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+!EOP
+ CALL wrf_error_fatal( 'ESMF_ClockRead not supported' )
+ end subroutine ESMF_ClockRead
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockWrite - Saves a clock
+
+! !INTERFACE:
+ subroutine ESMF_ClockWrite(clock, TimeStep, StartTime, StopTime, &
+ RefTime, CurrTime, PrevTime, AdvanceCount, &
+ AlarmList, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ type(ESMF_TimeInterval), intent(out) :: TimeStep
+ type(ESMF_Time), intent(out) :: StartTime
+ type(ESMF_Time), intent(out) :: StopTime
+ type(ESMF_Time), intent(out) :: RefTime
+ type(ESMF_Time), intent(out) :: CurrTime
+ type(ESMF_Time), intent(out) :: PrevTime
+ integer(ESMF_KIND_I8), intent(out) :: AdvanceCount
+ type(ESMF_Alarm), dimension(MAX_ALARMS), intent(out) :: AlarmList
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Save an {\tt ESMF\_Clock}
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! The object instance to save
+! \item[TimeStep]
+! The {\tt ESMF\_Clock}'s time step interval
+! \item[StartTime]
+! The {\tt ESMF\_Clock}'s starting time
+! \item[StopTime]
+! The {\tt ESMF\_Clock}'s stopping time
+! \item[RefTime]
+! The {\tt ESMF\_Clock}'s reference time
+! \item[CurrTime]
+! The {\tt ESMF\_Clock}'s current time
+! \item[PrevTime]
+! The {\tt ESMF\_Clock}'s previous time
+! \item[AdvanceCount]
+! The number of times the {\tt ESMF\_Clock} has been advanced
+! \item[AlarmList]
+! The {\tt ESMF\_Clock}'s {\tt ESMF\_Alarm} list
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+!EOP
+ CALL wrf_error_fatal( 'ESMF_ClockWrite not supported' )
+ end subroutine ESMF_ClockWrite
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockValidate - Validate a Clock's properties
+
+! !INTERFACE:
+ subroutine ESMF_ClockValidate(clock, opts, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ character (len=*), intent(in), optional :: opts
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! Perform a validation check on an {\tt ESMF\_Clock}'s properties
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! {\tt ESMF\_Clock} to validate
+! \item[{[opts]}]
+! Validate options
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMGn.n.n
+!EOP
+ CALL wrf_error_fatal( 'ESMF_ClockValidate not supported' )
+ end subroutine ESMF_ClockValidate
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_ClockPrint - Print out a Clock's properties
+
+! !INTERFACE:
+ subroutine ESMF_ClockPrint(clock, opts, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Clock), intent(in) :: clock
+ character (len=*), intent(in), optional :: opts
+ integer, intent(out), optional :: rc
+
+! !DESCRIPTION:
+! To support testing/debugging, print out an {\tt ESMF\_Clock}'s
+! properties.
+!
+! The arguments are:
+! \begin{description}
+! \item[clock]
+! {\tt ESMF\_Clock} to print out
+! \item[{[opts]}]
+! Print options
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMGn.n.n
+!EOP
+ CALL wrf_error_fatal( 'ESMF_ClockPrint not supported' )
+ end subroutine ESMF_ClockPrint
+
+!------------------------------------------------------------------------------
+
+ end module ESMF_ClockMod
Deleted: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Fraction.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/ESMF_Fraction.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Fraction.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,79 +0,0 @@
-!
-! Earth System Modeling Framework
-! Copyright 2002-2003, University Corporation for Atmospheric Research,
-! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
-! Laboratory, University of Michigan, National Centers for Environmental
-! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
-! NASA Goddard Space Flight Center.
-! Licensed under the University of Illinois-NCSA license.
-!
-! ESMF Fraction Module
-!
-!==============================================================================
-!
-! ESMF Fraction Module
- module ESMF_FractionMod
-!
-!==============================================================================
-!
-! This file contains the Fraction class definition and all Fraction
-! class methods.
-!
-!------------------------------------------------------------------------------
-! INCLUDES
-!
-!===============================================================================
-!BOPI
-!
-! !MODULE: ESMF_FractionMod
-!
-! !DESCRIPTION:
-! Part of ESMF F90 API wrapper of C++ implemenation
-!
-! Defines F90 wrapper entry points for corresponding
-! C++ implementaion of class {\tt ESMC\_Fraction}
-!
-! See {\tt ../include/ESMC\_Fraction.h} for complete description
-!
-!------------------------------------------------------------------------------
-! !USES:
-
- implicit none
-!
-!------------------------------------------------------------------------------
-! !PRIVATE TYPES:
- private
-!------------------------------------------------------------------------------
-! ! ESMF_Fraction
-!
- type ESMF_Fraction
- private
- integer :: n ! Integer fraction (exact) n/d; numerator
- integer :: d ! Integer fraction (exact) n/d; denominator
- end type
-!
-!------------------------------------------------------------------------------
-! !PUBLIC TYPES:
- public ESMF_Fraction
-!------------------------------------------------------------------------------
-!
-! !PUBLIC MEMBER FUNCTIONS:
-
-! !PRIVATE MEMBER FUNCTIONS:
-
-!EOPI
-
-!==============================================================================
-
-! contains
-
-!==============================================================================
-!
-! Wrappers to C++ fraction routines
-!
-!------------------------------------------------------------------------------
-!
-
-!------------------------------------------------------------------------------
-
- end module ESMF_FractionMod
Copied: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Fraction.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/ESMF_Fraction.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/ESMF_Fraction.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Fraction.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,79 @@
+!
+! Earth System Modeling Framework
+! Copyright 2002-2003, University Corporation for Atmospheric Research,
+! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
+! Laboratory, University of Michigan, National Centers for Environmental
+! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
+! NASA Goddard Space Flight Center.
+! Licensed under the University of Illinois-NCSA license.
+!
+! ESMF Fraction Module
+!
+!==============================================================================
+!
+! ESMF Fraction Module
+ module ESMF_FractionMod
+!
+!==============================================================================
+!
+! This file contains the Fraction class definition and all Fraction
+! class methods.
+!
+!------------------------------------------------------------------------------
+! INCLUDES
+!
+!===============================================================================
+!BOPI
+!
+! !MODULE: ESMF_FractionMod
+!
+! !DESCRIPTION:
+! Part of ESMF F90 API wrapper of C++ implemenation
+!
+! Defines F90 wrapper entry points for corresponding
+! C++ implementaion of class {\tt ESMC\_Fraction}
+!
+! See {\tt ../include/ESMC\_Fraction.h} for complete description
+!
+!------------------------------------------------------------------------------
+! !USES:
+
+ implicit none
+!
+!------------------------------------------------------------------------------
+! !PRIVATE TYPES:
+ private
+!------------------------------------------------------------------------------
+! ! ESMF_Fraction
+!
+ type ESMF_Fraction
+ private
+ integer :: n ! Integer fraction (exact) n/d; numerator
+ integer :: d ! Integer fraction (exact) n/d; denominator
+ end type
+!
+!------------------------------------------------------------------------------
+! !PUBLIC TYPES:
+ public ESMF_Fraction
+!------------------------------------------------------------------------------
+!
+! !PUBLIC MEMBER FUNCTIONS:
+
+! !PRIVATE MEMBER FUNCTIONS:
+
+!EOPI
+
+!==============================================================================
+
+! contains
+
+!==============================================================================
+!
+! Wrappers to C++ fraction routines
+!
+!------------------------------------------------------------------------------
+!
+
+!------------------------------------------------------------------------------
+
+ end module ESMF_FractionMod
Deleted: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Macros.inc
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/ESMF_Macros.inc        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Macros.inc        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,35 +0,0 @@
-#if 0
-
-Earth System Modeling Framework
-Copyright 2002-2003, University Corporation for Atmospheric Research,
-Massachusetts Institute of Technology, Geophysical Fluid Dynamics
-Laboratory, University of Michigan, National Centers for Environmental
-Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
-NASA Goddard Space Flight Center.
-Licensed under the University of Illinois-NCSA license.
-
-Do not have C++ or F90 style comments in here because this file is processed
-by both C++ and F90 compilers.
-
-These lines prevent this file from being read more than once if it
-ends up being included multiple times.
-#endif
-
-#ifndef ESMF_MACROS_INC
-#define ESMF_MACROS_INC
-
-#if 0
-
-former file contents moved to ESMF_BaseMod
-so user code can be compiled without requiring
-the preprocessor.
-
-#endif
-
-#if 0
-i left the following macro here in case it is needed for our internal use.
-#endif
-
-#define ESMF_SRCLINE __FILE__, __LINE__
-
-#endif
Copied: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Macros.inc (from rev 968, trunk/mpas/src/external/esmf_time_f90/ESMF_Macros.inc)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/ESMF_Macros.inc         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Macros.inc        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,35 @@
+#if 0
+
+Earth System Modeling Framework
+Copyright 2002-2003, University Corporation for Atmospheric Research,
+Massachusetts Institute of Technology, Geophysical Fluid Dynamics
+Laboratory, University of Michigan, National Centers for Environmental
+Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
+NASA Goddard Space Flight Center.
+Licensed under the University of Illinois-NCSA license.
+
+Do not have C++ or F90 style comments in here because this file is processed
+by both C++ and F90 compilers.
+
+These lines prevent this file from being read more than once if it
+ends up being included multiple times.
+#endif
+
+#ifndef ESMF_MACROS_INC
+#define ESMF_MACROS_INC
+
+#if 0
+
+former file contents moved to ESMF_BaseMod
+so user code can be compiled without requiring
+the preprocessor.
+
+#endif
+
+#if 0
+i left the following macro here in case it is needed for our internal use.
+#endif
+
+#define ESMF_SRCLINE __FILE__, __LINE__
+
+#endif
Deleted: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Mod.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/ESMF_Mod.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Mod.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,17 +0,0 @@
-! TBH: This version is for use with the ESMF library embedded in the WRF
-! TBH: distribution.
-MODULE ESMF_Mod
- USE esmf_alarmmod
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_calendarmod
- USE esmf_clockmod
- USE esmf_fractionmod
- USE esmf_timeintervalmod
- USE esmf_timemod
- USE esmf_alarmclockmod
- USE esmf_stubs ! add new dummy interfaces and typedefs here as needed
-#include <ESMF_TimeMgr.inc>
- INTEGER, PARAMETER :: ESMF_MAX_ALARMS=MAX_ALARMS
-!
-END MODULE ESMF_Mod
Copied: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Mod.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/ESMF_Mod.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/ESMF_Mod.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Mod.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,17 @@
+! TBH: This version is for use with the ESMF library embedded in the WRF
+! TBH: distribution.
+MODULE ESMF_Mod
+ USE esmf_alarmmod
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_calendarmod
+ USE esmf_clockmod
+ USE esmf_fractionmod
+ USE esmf_timeintervalmod
+ USE esmf_timemod
+ USE esmf_alarmclockmod
+ USE esmf_stubs ! add new dummy interfaces and typedefs here as needed
+#include <ESMF_TimeMgr.inc>
+ INTEGER, PARAMETER :: ESMF_MAX_ALARMS=MAX_ALARMS
+!
+END MODULE ESMF_Mod
Deleted: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Stubs.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/ESMF_Stubs.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Stubs.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,132 +0,0 @@
-! Various dummy type definitions and routines for the sole purpose of
-! mimicking newer ESMF interface features without necessarily implementing
-! them.
-
-MODULE ESMF_Stubs
-
- IMPLICIT NONE
-
- PRIVATE
-
-! Bogus typedefs
- TYPE ESMF_Grid
- INTEGER :: dummy
- END TYPE
-
- TYPE ESMF_GridComp
- INTEGER :: dummy
- END TYPE
-
- TYPE ESMF_State
- INTEGER :: dummy
- END TYPE
-
- TYPE ESMF_VM
- INTEGER :: dummy
- END TYPE
-
- TYPE ESMF_MsgType
- INTEGER :: mtype
- END TYPE
- TYPE(ESMF_MsgType), PARAMETER :: &
- ESMF_LOG_INFO = ESMF_MsgType(1), &
- ESMF_LOG_WARNING = ESMF_MsgType(2), &
- ESMF_LOG_ERROR = ESMF_MsgType(3)
-
- TYPE ESMF_LOG
- INTEGER :: dummy
- END TYPE
-
- LOGICAL, private, save :: initialized = .false.
-
- PUBLIC ESMF_Grid, ESMF_GridComp, ESMF_State, ESMF_VM
- PUBLIC ESMF_Initialize, ESMF_Finalize, ESMF_IsInitialized
- PUBLIC ESMF_LogWrite, ESMF_LOG, ESMF_MsgType
- PUBLIC ESMF_LOG_INFO, ESMF_LOG_WARNING, ESMF_LOG_ERROR
-
-CONTAINS
-
-
-! NOOP
- SUBROUTINE ESMF_Initialize( vm, defaultCalendar, rc )
- USE esmf_basemod
- USE esmf_calendarmod
- TYPE(ESMF_VM), INTENT(IN ), OPTIONAL :: vm
- TYPE(ESMF_CalendarType), INTENT(IN ), OPTIONAL :: defaultCalendar
- INTEGER, INTENT( OUT), OPTIONAL :: rc
-
- TYPE(ESMF_CalendarType) :: defaultCalType
- INTEGER :: status
-
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- ! Initialize the default time manager calendar
- IF ( PRESENT(defaultCalendar) )THEN
- defaultCalType = defaultCalendar
- ELSE
- defaultCalType = ESMF_CAL_NOLEAP
- END IF
- allocate( defaultCal )
- defaultCal = ESMF_CalendarCreate( calendarType=defaultCalType, &
- rc=status)
-
- ! initialize tables in time manager
- CALL initdaym
-
- IF (status .ne. ESMF_SUCCESS) THEN
- PRINT *, "Error initializing the default time manager calendar"
- RETURN
- END IF
- initialized = .true.
-
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
- END SUBROUTINE ESMF_Initialize
-
-
- FUNCTION ESMF_IsInitialized()
- LOGICAL ESMF_IsInitialized
- ESMF_IsInitialized = initialized
- END FUNCTION ESMF_IsInitialized
-
-
-! NOOP
- SUBROUTINE ESMF_Finalize( rc )
- USE esmf_basemod
- INTEGER, INTENT( OUT), OPTIONAL :: rc
-#if (defined SPMD) || (defined COUP_CSM)
-#include <mpif.h>
-#endif
- LOGICAL :: flag
- INTEGER :: ier
-
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
-#if (defined SPMD) || (defined COUP_CSM)
- CALL MPI_Finalized( flag, ier )
- IF ( ier .ne. mpi_success )THEN
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- END IF
- IF ( .NOT. flag ) THEN
- CALL MPI_Finalize( ier )
- IF ( ier .ne. mpi_success )THEN
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- END IF
- END IF
-#endif
- END SUBROUTINE ESMF_Finalize
-
-! NOOP
- SUBROUTINE ESMF_LogWrite( msg, MsgType, line, file, method, log, rc )
- USE esmf_basemod
- CHARACTER(LEN=*), INTENT(IN) :: msg
- TYPE(ESMF_MsgType), INTENT(IN) :: msgtype
- INTEGER, INTENT(IN), OPTIONAL :: line
- CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: file
- CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: method
- TYPE(ESMF_LOG),TARGET,OPTIONAL :: log
- INTEGER, INTENT(OUT),OPTIONAL :: rc
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
- END SUBROUTINE ESMF_LogWrite
-
-
-END MODULE ESMF_Stubs
-
-
Copied: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Stubs.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/ESMF_Stubs.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/ESMF_Stubs.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Stubs.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,132 @@
+! Various dummy type definitions and routines for the sole purpose of
+! mimicking newer ESMF interface features without necessarily implementing
+! them.
+
+MODULE ESMF_Stubs
+
+ IMPLICIT NONE
+
+ PRIVATE
+
+! Bogus typedefs
+ TYPE ESMF_Grid
+ INTEGER :: dummy
+ END TYPE
+
+ TYPE ESMF_GridComp
+ INTEGER :: dummy
+ END TYPE
+
+ TYPE ESMF_State
+ INTEGER :: dummy
+ END TYPE
+
+ TYPE ESMF_VM
+ INTEGER :: dummy
+ END TYPE
+
+ TYPE ESMF_MsgType
+ INTEGER :: mtype
+ END TYPE
+ TYPE(ESMF_MsgType), PARAMETER :: &
+ ESMF_LOG_INFO = ESMF_MsgType(1), &
+ ESMF_LOG_WARNING = ESMF_MsgType(2), &
+ ESMF_LOG_ERROR = ESMF_MsgType(3)
+
+ TYPE ESMF_LOG
+ INTEGER :: dummy
+ END TYPE
+
+ LOGICAL, private, save :: initialized = .false.
+
+ PUBLIC ESMF_Grid, ESMF_GridComp, ESMF_State, ESMF_VM
+ PUBLIC ESMF_Initialize, ESMF_Finalize, ESMF_IsInitialized
+ PUBLIC ESMF_LogWrite, ESMF_LOG, ESMF_MsgType
+ PUBLIC ESMF_LOG_INFO, ESMF_LOG_WARNING, ESMF_LOG_ERROR
+
+CONTAINS
+
+
+! NOOP
+ SUBROUTINE ESMF_Initialize( vm, defaultCalendar, rc )
+ USE esmf_basemod
+ USE esmf_calendarmod
+ TYPE(ESMF_VM), INTENT(IN ), OPTIONAL :: vm
+ TYPE(ESMF_CalendarType), INTENT(IN ), OPTIONAL :: defaultCalendar
+ INTEGER, INTENT( OUT), OPTIONAL :: rc
+
+ TYPE(ESMF_CalendarType) :: defaultCalType
+ INTEGER :: status
+
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ ! Initialize the default time manager calendar
+ IF ( PRESENT(defaultCalendar) )THEN
+ defaultCalType = defaultCalendar
+ ELSE
+ defaultCalType = ESMF_CAL_NOLEAP
+ END IF
+ allocate( defaultCal )
+ defaultCal = ESMF_CalendarCreate( calendarType=defaultCalType, &
+ rc=status)
+
+ ! initialize tables in time manager
+ CALL initdaym
+
+ IF (status .ne. ESMF_SUCCESS) THEN
+ PRINT *, "Error initializing the default time manager calendar"
+ RETURN
+ END IF
+ initialized = .true.
+
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+ END SUBROUTINE ESMF_Initialize
+
+
+ FUNCTION ESMF_IsInitialized()
+ LOGICAL ESMF_IsInitialized
+ ESMF_IsInitialized = initialized
+ END FUNCTION ESMF_IsInitialized
+
+
+! NOOP
+ SUBROUTINE ESMF_Finalize( rc )
+ USE esmf_basemod
+ INTEGER, INTENT( OUT), OPTIONAL :: rc
+#if (defined SPMD) || (defined COUP_CSM)
+#include <mpif.h>
+#endif
+ LOGICAL :: flag
+ INTEGER :: ier
+
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+#if (defined SPMD) || (defined COUP_CSM)
+ CALL MPI_Finalized( flag, ier )
+ IF ( ier .ne. mpi_success )THEN
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ END IF
+ IF ( .NOT. flag ) THEN
+ CALL MPI_Finalize( ier )
+ IF ( ier .ne. mpi_success )THEN
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ END IF
+ END IF
+#endif
+ END SUBROUTINE ESMF_Finalize
+
+! NOOP
+ SUBROUTINE ESMF_LogWrite( msg, MsgType, line, file, method, log, rc )
+ USE esmf_basemod
+ CHARACTER(LEN=*), INTENT(IN) :: msg
+ TYPE(ESMF_MsgType), INTENT(IN) :: msgtype
+ INTEGER, INTENT(IN), OPTIONAL :: line
+ CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: file
+ CHARACTER(LEN=*), INTENT(IN), OPTIONAL :: method
+ TYPE(ESMF_LOG),TARGET,OPTIONAL :: log
+ INTEGER, INTENT(OUT),OPTIONAL :: rc
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+ END SUBROUTINE ESMF_LogWrite
+
+
+END MODULE ESMF_Stubs
+
+
Deleted: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Time.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/ESMF_Time.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Time.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,1188 +0,0 @@
-!
-! Earth System Modeling Framework
-! Copyright 2002-2003, University Corporation for Atmospheric Research,
-! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
-! Laboratory, University of Michigan, National Centers for Environmental
-! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
-! NASA Goddard Space Flight Center.
-! Licensed under the University of Illinois-NCSA license.
-!
-!==============================================================================
-!
-! ESMF Time Module
- module ESMF_TimeMod
-!
-!==============================================================================
-!
-! This file contains the Time class definition and all Time class methods.
-!
-!------------------------------------------------------------------------------
-! INCLUDES
-#include <ESMF_TimeMgr.inc>
-
-!==============================================================================
-!BOPI
-! !MODULE: ESMF_TimeMod
-!
-! !DESCRIPTION:
-! Part of Time Manager F90 API wrapper of C++ implemenation
-!
-! Defines F90 wrapper entry points for corresponding
-! C++ class {\tt ESMC\_Time} implementation
-!
-! See {\tt ../include/ESMC\_Time.h} for complete description
-!
-!------------------------------------------------------------------------------
-! !USES:
- ! inherit from ESMF base class
- use ESMF_BaseMod
-
- ! inherit from base time class
- use ESMF_BaseTimeMod
-
- ! associated derived types
- use ESMF_TimeIntervalMod
- use ESMF_CalendarMod
- use ESMF_Stubs
-
- implicit none
-!
-!------------------------------------------------------------------------------
-! !PRIVATE TYPES:
- private
-!------------------------------------------------------------------------------
-! ! ESMF_Time
-!
-! ! F90 class type to match C++ Time class in size only;
-! ! all dereferencing within class is performed by C++ implementation
-
- type ESMF_Time
- type(ESMF_BaseTime) :: basetime ! inherit base class
- ! time instant is expressed as year + basetime
- integer :: YR
- type(ESMF_Calendar), pointer :: calendar ! associated calendar
- end type
-
-!------------------------------------------------------------------------------
-! !PUBLIC TYPES:
- public ESMF_Time
-!------------------------------------------------------------------------------
-!
-! !PUBLIC MEMBER FUNCTIONS:
- public ESMF_TimeGet
- public ESMF_TimeSet
-
-! Required inherited and overridden ESMF_Base class methods
-
- public ESMF_TimeCopy
-
-! !PRIVATE MEMBER FUNCTIONS:
-
- private ESMF_TimeGetDayOfYear
- private ESMF_TimeGetDayOfYearInteger
-
-! Inherited and overloaded from ESMF_BaseTime
-
- ! NOTE: ESMF_TimeInc, ESMF_TimeDec, ESMF_TimeDiff, ESMF_TimeEQ,
- ! ESMF_TimeNE, ESMF_TimeLT, ESMF_TimeGT, ESMF_TimeLE, and
- ! ESMF_TimeGE are PUBLIC only to work around bugs in the
- ! PGI 5.1-x compilers. They should all be PRIVATE.
-
- public operator(+)
- public ESMF_TimeInc
-
- public operator(-)
- public ESMF_TimeDec
- public ESMF_TimeDec2
- public ESMF_TimeDiff
-
- public operator(.EQ.)
- public ESMF_TimeEQ
-
- public operator(.NE.)
- public ESMF_TimeNE
-
- public operator(.LT.)
- public ESMF_TimeLT
-
- public operator(.GT.)
- public ESMF_TimeGT
-
- public operator(.LE.)
- public ESMF_TimeLE
-
- public operator(.GE.)
- public ESMF_TimeGE
-
-!EOPI
-
-!==============================================================================
-!
-! INTERFACE BLOCKS
-!
-!==============================================================================
-!BOP
-! !INTERFACE:
- interface ESMF_TimeGetDayOfYear
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeGetDayOfYearInteger
-
-! !DESCRIPTION:
-! This interface overloads the {\tt ESMF\_GetDayOfYear} method
-! for the {\tt ESMF\_Time} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(+)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeInc, ESMF_TimeInc2
-
-! !DESCRIPTION:
-! This interface overloads the + operator for the {\tt ESMF\_Time} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface assignment (=)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeCopy
-
-! !DESCRIPTION:
-! This interface overloads the = operator for the {\tt ESMF\_Time} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(-)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeDec, ESMF_TimeDec2
-
-! !DESCRIPTION:
-! This interface overloads the - operator for the {\tt ESMF\_Time} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(-)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeDiff
-
-! !DESCRIPTION:
-! This interface overloads the - operator for the {\tt ESMF\_Time} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(.EQ.)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeEQ
-
-! !DESCRIPTION:
-! This interface overloads the .EQ. operator for the {\tt ESMF\_Time} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(.NE.)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeNE
-
-! !DESCRIPTION:
-! This interface overloads the .NE. operator for the {\tt ESMF\_Time} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(.LT.)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeLT
-
-! !DESCRIPTION:
-! This interface overloads the .LT. operator for the {\tt ESMF\_Time} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(.GT.)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeGT
-
-! !DESCRIPTION:
-! This interface overloads the .GT. operator for the {\tt ESMF\_Time} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(.LE.)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeLE
-
-! !DESCRIPTION:
-! This interface overloads the .LE. operator for the {\tt ESMF\_Time} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(.GE.)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeGE
-
-! !DESCRIPTION:
-! This interface overloads the .GE. operator for the {\tt ESMF\_Time} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-
-!==============================================================================
-
- contains
-
-!==============================================================================
-!
-! Generic Get/Set routines which use F90 optional arguments
-!
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeGet - Get value in user-specified units
-
-! !INTERFACE:
- subroutine ESMF_TimeGet(time, YY, YRl, MM, DD, D, Dl, H, M, S, Sl, MS, &
- US, NS, d_, h_, m_, s_, ms_, us_, ns_, Sn, Sd, &
- dayOfYear, dayOfYear_r8, dayOfYear_intvl, &
- timeString, rc)
-
-! !ARGUMENTS:
- type(ESMF_Time), intent(in) :: time
- integer, intent(out), optional :: YY
- integer(ESMF_KIND_I8), intent(out), optional :: YRl
- integer, intent(out), optional :: MM
- integer, intent(out), optional :: DD
- integer, intent(out), optional :: D
- integer(ESMF_KIND_I8), intent(out), optional :: Dl
- integer, intent(out), optional :: H
- integer, intent(out), optional :: M
- integer, intent(out), optional :: S
- integer(ESMF_KIND_I8), intent(out), optional :: Sl
- integer, intent(out), optional :: MS
- integer, intent(out), optional :: US
- integer, intent(out), optional :: NS
- double precision, intent(out), optional :: d_
- double precision, intent(out), optional :: h_
- double precision, intent(out), optional :: m_
- double precision, intent(out), optional :: s_
- double precision, intent(out), optional :: ms_
- double precision, intent(out), optional :: us_
- double precision, intent(out), optional :: ns_
- integer, intent(out), optional :: Sn
- integer, intent(out), optional :: Sd
- integer, intent(out), optional :: dayOfYear
- ! dayOfYear_r8 = 1.0 at 0Z on 1 January, 1.5 at 12Z on
- ! 1 January, etc.
- real(ESMF_KIND_R8), intent(out), optional :: dayOfYear_r8
- character (len=*), intent(out), optional :: timeString
- type(ESMF_TimeInterval), intent(out), optional :: dayOfYear_intvl
- integer, intent(out), optional :: rc
-
- type(ESMF_TimeInterval) :: day_step
- integer :: ierr
-
-! !DESCRIPTION:
-! Get the value of the {\tt ESMF\_Time} in units specified by the user
-! via F90 optional arguments.
-!
-! Time manager represents and manipulates time internally with integers
-! to maintain precision. Hence, user-specified floating point values are
-! converted internally from integers.
-!
-! See {\tt ../include/ESMC\_BaseTime.h and ../include/ESMC\_Time.h} for
-! complete description.
-!
-! The arguments are:
-! \begin{description}
-! \item[time]
-! The object instance to query
-! \item[{[YY]}]
-! Integer year CCYR (>= 32-bit)
-! \item[{[YRl]}]
-! Integer year CCYR (large, >= 64-bit)
-! \item[{[MM]}]
-! Integer month 1-12
-! \item[{[DD]}]
-! Integer day of the month 1-31
-! \item[{[D]}]
-! Integer Julian days (>= 32-bit)
-! \item[{[Dl]}]
-! Integer Julian days (large, >= 64-bit)
-! \item[{[H]}]
-! Integer hours
-! \item[{[M]}]
-! Integer minutes
-! \item[{[S]}]
-! Integer seconds (>= 32-bit)
-! \item[{[Sl]}]
-! Integer seconds (large, >= 64-bit)
-! \item[{[MS]}]
-! Integer milliseconds
-! \item[{[US]}]
-! Integer microseconds
-! \item[{[NS]}]
-! Integer nanoseconds
-! \item[{[d\_]}]
-! Double precision days
-! \item[{[h\_]}]
-! Double precision hours
-! \item[{[m\_]}]
-! Double precision minutes
-! \item[{[s\_]}]
-! Double precision seconds
-! \item[{[ms\_]}]
-! Double precision milliseconds
-! \item[{[us\_]}]
-! Double precision microseconds
-! \item[{[ns\_]}]
-! Double precision nanoseconds
-! \item[{[Sn]}]
-! Integer fractional seconds - numerator
-! \item[{[Sd]}]
-! Integer fractional seconds - denominator
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG2.1, TMG2.5.1, TMG2.5.6
-!EOP
- TYPE(ESMF_Time) :: begofyear
- INTEGER :: year, month, dayofmonth, hour, minute, second
- REAL(ESMF_KIND_R8) :: rsec
-
- ierr = ESMF_SUCCESS
-
- IF ( PRESENT( YY ) ) THEN
- YY = time%YR
- ENDIF
- IF ( PRESENT( MM ) ) THEN
- CALL timegetmonth( time, MM )
- ENDIF
- IF ( PRESENT( DD ) ) THEN
- CALL timegetdayofmonth( time, DD )
- ENDIF
-!
-!$$$ Push HMS down into ESMF_BaseTime from EVERYWHERE
-!$$$ and THEN add ESMF scaling behavior when other args are present...
- IF ( PRESENT( H ) ) THEN
- H = mod( time%basetime%S, SECONDS_PER_DAY ) / SECONDS_PER_HOUR
- ENDIF
- IF ( PRESENT( M ) ) THEN
- M = mod( time%basetime%S, SECONDS_PER_HOUR) / SECONDS_PER_MINUTE
- ENDIF
- IF ( PRESENT( S ) ) THEN
- S = mod( time%basetime%S, SECONDS_PER_MINUTE )
- ENDIF
- ! TBH: HACK to allow DD and S to behave as in ESMF 2.1.0+ when
- ! TBH: both are present and H and M are not.
- IF ( PRESENT( S ) .AND. PRESENT( DD ) ) THEN
- IF ( ( .NOT. PRESENT( H ) ) .AND. ( .NOT. PRESENT( M ) ) ) THEN
- S = mod( time%basetime%S, SECONDS_PER_DAY )
- ENDIF
- ENDIF
- IF ( PRESENT( MS ) ) THEN
- IF ( time%basetime%Sd /= 0 ) THEN
- MS = NINT( ( time%basetime%Sn*1.0D0 / time%basetime%Sd*1.0D0 ) * 1000.0D0 )
- ELSE
- MS = 0
- ENDIF
- ENDIF
- IF ( PRESENT( Sd ) .AND. PRESENT( Sn ) ) THEN
- Sd = time%basetime%Sd
- Sn = time%basetime%Sn
- ENDIF
- IF ( PRESENT( dayOfYear ) ) THEN
- CALL ESMF_TimeGetDayOfYear( time, dayOfYear, rc=ierr )
- ENDIF
- IF ( PRESENT( dayOfYear_r8 ) ) THEN
- ! 64-bit IEEE 754 has 52-bit mantisssa -- only need 25 bits to hold
- ! number of seconds in a year...
- rsec = REAL( time%basetime%S, ESMF_KIND_R8 )
- IF ( time%basetime%Sd /= 0 ) THEN
- rsec = rsec + ( REAL( time%basetime%Sn, ESMF_KIND_R8 ) / &
- REAL( time%basetime%Sd, ESMF_KIND_R8 ) )
- ENDIF
- dayOfYear_r8 = rsec / REAL( SECONDS_PER_DAY, ESMF_KIND_R8 )
- ! start at 1
- dayOfYear_r8 = dayOfYear_r8 + 1.0_ESMF_KIND_R8
- ENDIF
- IF ( PRESENT( timeString ) ) THEN
- ! This duplication for YMD is an optimization that avoids calling
- ! timegetmonth() and timegetdayofmonth() when it is not needed.
- year = time%YR
- CALL timegetmonth( time, month )
- CALL timegetdayofmonth( time, dayofmonth )
-!$$$ push HMS down into ESMF_BaseTime
- hour = mod( time%basetime%S, SECONDS_PER_DAY ) / SECONDS_PER_HOUR
- minute = mod( time%basetime%S, SECONDS_PER_HOUR) / SECONDS_PER_MINUTE
- second = mod( time%basetime%S, SECONDS_PER_MINUTE )
- CALL ESMFold_TimeGetString( year, month, dayofmonth, &
- hour, minute, second, timeString )
- ENDIF
- IF ( PRESENT( dayOfYear_intvl ) ) THEN
- year = time%YR
- CALL ESMF_TimeSet( begofyear, yy=year, mm=1, dd=1, s=0, &
- calendar=time%calendar, rc=ierr )
- IF ( ierr == ESMF_FAILURE)THEN
- rc = ierr
- RETURN
- END IF
- CALL ESMF_TimeIntervalSet( day_step, d=1, s=0, rc=ierr )
- dayOfYear_intvl = time - begofyear + day_step
- ENDIF
-
- IF ( PRESENT( rc ) ) THEN
- rc = ierr
- ENDIF
-
- end subroutine ESMF_TimeGet
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeSet - Initialize via user-specified unit set
-
-! !INTERFACE:
- subroutine ESMF_TimeSet(time, YY, YRl, MM, DD, D, Dl, H, M, S, Sl, &
- MS, US, NS, d_, h_, m_, s_, ms_, us_, ns_, &
- Sn, Sd, calendar, rc)
-
-! !ARGUMENTS:
- type(ESMF_Time), intent(inout) :: time
- integer, intent(in), optional :: YY
- integer(ESMF_KIND_I8), intent(in), optional :: YRl
- integer, intent(in), optional :: MM
- integer, intent(in), optional :: DD
- integer, intent(in), optional :: D
- integer(ESMF_KIND_I8), intent(in), optional :: Dl
- integer, intent(in), optional :: H
- integer, intent(in), optional :: M
- integer, intent(in), optional :: S
- integer(ESMF_KIND_I8), intent(in), optional :: Sl
- integer, intent(in), optional :: MS
- integer, intent(in), optional :: US
- integer, intent(in), optional :: NS
- double precision, intent(in), optional :: d_
- double precision, intent(in), optional :: h_
- double precision, intent(in), optional :: m_
- double precision, intent(in), optional :: s_
- double precision, intent(in), optional :: ms_
- double precision, intent(in), optional :: us_
- double precision, intent(in), optional :: ns_
- integer, intent(in), optional :: Sn
- integer, intent(in), optional :: Sd
- type(ESMF_Calendar), intent(in), target, optional :: calendar
- integer, intent(out), optional :: rc
- ! locals
- INTEGER :: ierr
-
-! !DESCRIPTION:
-! Initializes a {\tt ESMF\_Time} with a set of user-specified units
-! via F90 optional arguments.
-!
-! Time manager represents and manipulates time internally with integers
-! to maintain precision. Hence, user-specified floating point values are
-! converted internally to integers.
-!
-! See {\tt ../include/ESMC\_BaseTime.h and ../include/ESMC\_Time.h} for
-! complete description.
-!
-! The arguments are:
-! \begin{description}
-! \item[time]
-! The object instance to initialize
-! \item[{[YY]}]
-! Integer year CCYR (>= 32-bit)
-! \item[{[YRl]}]
-! Integer year CCYR (large, >= 64-bit)
-! \item[{[MM]}]
-! Integer month 1-12
-! \item[{[DD]}]
-! Integer day of the month 1-31
-! \item[{[D]}]
-! Integer Julian days (>= 32-bit)
-! \item[{[Dl]}]
-! Integer Julian days (large, >= 64-bit)
-! \item[{[H]}]
-! Integer hours
-! \item[{[M]}]
-! Integer minutes
-! \item[{[S]}]
-! Integer seconds (>= 32-bit)
-! \item[{[Sl]}]
-! Integer seconds (large, >= 64-bit)
-! \item[{[MS]}]
-! Integer milliseconds
-! \item[{[US]}]
-! Integer microseconds
-! \item[{[NS]}]
-! Integer nanoseconds
-! \item[{[d\_]}]
-! Double precision days
-! \item[{[h\_]}]
-! Double precision hours
-! \item[{[m\_]}]
-! Double precision minutes
-! \item[{[s\_]}]
-! Double precision seconds
-! \item[{[ms\_]}]
-! Double precision milliseconds
-! \item[{[us\_]}]
-! Double precision microseconds
-! \item[{[ns\_]}]
-! Double precision nanoseconds
-! \item[{[Sn]}]
-! Integer fractional seconds - numerator
-! \item[{[Sd]}]
-! Integer fractional seconds - denominator
-! \item[{[cal]}]
-! Associated {\tt Calendar}
-! \item[{[tz]}]
-! Associated timezone (hours offset from GMT, e.g. EST = -5)
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMGn.n.n
-!EOP
-! PRINT *,'DEBUG: BEGIN ESMF_TimeSet()'
-!$$$ push this down into ESMF_BaseTime constructor
- time%basetime%S = 0
- time%basetime%Sn = 0
- time%basetime%Sd = 0
-
- IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
- time%YR = 0
- IF ( PRESENT( YY ) ) THEN
-! PRINT *,'DEBUG: ESMF_TimeSet(): YY = ',YY
- time%YR = YY
- ENDIF
- IF ( PRESENT( MM ) ) THEN
-! PRINT *,'DEBUG: ESMF_TimeSet(): MM = ',MM
- CALL timeaddmonths( time, MM, ierr )
- IF ( ierr == ESMF_FAILURE ) THEN
- IF ( PRESENT( rc ) ) THEN
- rc = ESMF_FAILURE
- RETURN
- ENDIF
- ENDIF
-! PRINT *,'DEBUG: ESMF_TimeSet(): back from timeaddmonths'
- ENDIF
- IF ( PRESENT( DD ) ) THEN
-!$$$ no check for DD in range of days of month MM yet
-!$$$ Must separate D and DD for correct interface!
-! PRINT *,'DEBUG: ESMF_TimeSet(): DD = ',DD
- time%basetime%S = time%basetime%S + &
- ( SECONDS_PER_DAY * INT( (DD-1), ESMF_KIND_I8 ) )
- ENDIF
-!$$$ push H,M,S,Sn,Sd,MS down into ESMF_BaseTime constructor
- IF ( PRESENT( H ) ) THEN
-! PRINT *,'DEBUG: ESMF_TimeSet(): H = ',H
- time%basetime%S = time%basetime%S + &
- ( SECONDS_PER_HOUR * INT( H, ESMF_KIND_I8 ) )
- ENDIF
- IF ( PRESENT( M ) ) THEN
-! PRINT *,'DEBUG: ESMF_TimeSet(): M = ',M
- time%basetime%S = time%basetime%S + &
- ( SECONDS_PER_MINUTE * INT( M, ESMF_KIND_I8 ) )
- ENDIF
- IF ( PRESENT( S ) ) THEN
-! PRINT *,'DEBUG: ESMF_TimeSet(): S = ',S
- time%basetime%S = time%basetime%S + &
- INT( S, ESMF_KIND_I8 )
- ENDIF
- IF ( PRESENT( Sn ) .AND. ( .NOT. PRESENT( Sd ) ) ) THEN
- CALL wrf_error_fatal( &
- "ESMF_TimeSet: Must specify Sd if Sn is specified")
- ENDIF
- IF ( PRESENT( Sd ) .AND. PRESENT( MS ) ) THEN
- CALL wrf_error_fatal( &
- "ESMF_TimeSet: Must not specify both Sd and MS")
- ENDIF
- time%basetime%Sn = 0
- time%basetime%Sd = 0
- IF ( PRESENT( MS ) ) THEN
-! PRINT *,'DEBUG: ESMF_TimeSet(): MS = ',MS
- time%basetime%Sn = MS
- time%basetime%Sd = 1000_ESMF_KIND_I8
- ELSE IF ( PRESENT( Sd ) ) THEN
-! PRINT *,'DEBUG: ESMF_TimeSet(): Sd = ',Sd
- time%basetime%Sd = Sd
- IF ( PRESENT( Sn ) ) THEN
-! PRINT *,'DEBUG: ESMF_TimeSet(): Sn = ',Sn
- time%basetime%Sn = Sn
- ENDIF
- ENDIF
- IF ( PRESENT(calendar) )THEN
-! PRINT *,'DEBUG: ESMF_TimeSet(): using passed-in calendar'
-! Note that the ugly hack of wrapping the call to ESMF_CalendarInitialized()
-! inside this #ifdef is due to lack of support for compile-time initialization
-! of components of Fortran derived types. Some older compilers like PGI 5.1-x
-! do not support this F95 feature. In this case we only lose a safety check.
-#ifndef NO_DT_COMPONENT_INIT
- IF ( .not. ESMF_CalendarInitialized( calendar ) )THEN
- call wrf_error_fatal( "Error:: ESMF_CalendarCreate not "// &
- "called on input Calendar")
- END IF
-#endif
- time%Calendar => calendar
- ELSE
-! PRINT *,'DEBUG: ESMF_TimeSet(): using default calendar'
- IF ( .not. ESMF_IsInitialized() )THEN
- call wrf_error_fatal( "Error:: ESMF_Initialize not called")
- END IF
- time%Calendar => defaultCal
- END IF
-
-! PRINT *,'DEBUG: ESMF_TimeSet(): calling normalize_time()'
-!$$$DEBUG
-!IF ( time%basetime%Sd > 0 ) THEN
-! PRINT *,'DEBUG ESMF_TimeSet() before normalize: S,Sn,Sd = ', &
-! time%basetime%S, time%basetime%Sn, time%basetime%Sd
-!ENDIF
-!$$$END DEBUG
- CALL normalize_time( time )
-!$$$DEBUG
-!IF ( time%basetime%Sd > 0 ) THEN
-! PRINT *,'DEBUG ESMF_TimeSet() after normalize: S,Sn,Sd = ', &
-! time%basetime%S, time%basetime%Sn, time%basetime%Sd
-!ENDIF
-!$$$END DEBUG
-
-! PRINT *,'DEBUG: ESMF_TimeSet(): back from normalize_time()'
- IF ( PRESENT( rc ) ) THEN
- rc = ESMF_SUCCESS
- ENDIF
-
- end subroutine ESMF_TimeSet
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMFold_TimeGetString - Get time instant value in string format
-
-! !INTERFACE:
- subroutine ESMFold_TimeGetString( year, month, dayofmonth, &
- hour, minute, second, TimeString )
-
-! !ARGUMENTS:
- integer, intent(in) :: year
- integer, intent(in) :: month
- integer, intent(in) :: dayofmonth
- integer, intent(in) :: hour
- integer, intent(in) :: minute
- integer, intent(in) :: second
- character*(*), intent(out) :: TimeString
-! !DESCRIPTION:
-! Convert {\tt ESMF\_Time}'s value into ISO 8601 format YYYY-MM-DDThh:mm:ss
-!
-! The arguments are:
-! \begin{description}
-! \item[time]
-! The object instance to convert
-! \item[TimeString]
-! The string to return
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG2.4.7
-!EOP
-
-!PRINT *,'DEBUG: ESMF_TimePrint(): YR,S,Sn,Sd = ',time%YR,time%basetime%S,time%basetime%Sn,time%basetime%Sd
-!PRINT *,'DEBUG: ESMF_TimePrint(): year = ',year
-!PRINT *,'DEBUG: ESMF_TimePrint(): month, dayofmonth = ',month,dayofmonth
-!PRINT *,'DEBUG: ESMF_TimePrint(): hour = ',hour
-!PRINT *,'DEBUG: ESMF_TimePrint(): minute = ',minute
-!PRINT *,'DEBUG: ESMF_TimePrint(): second = ',second
-
-!$$$here... add negative sign for YR<0
-!$$$here... add Sn, Sd ??
-#ifdef PLANET
- write(TimeString,FMT="(I4.4,'-',I5.5,'_',I2.2,':',I2.2,':',I2.2)") &
- year,dayofmonth,hour,minute,second
-#else
- write(TimeString,FMT="(I4.4,'-',I2.2,'-',I2.2,'_',I2.2,':',I2.2,':',I2.2)") &
- year,month,dayofmonth,hour,minute,second
-#endif
-
- end subroutine ESMFold_TimeGetString
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeGetDayOfYearInteger - Get time instant's day of the year as an integer value
-!
-! !INTERFACE:
- subroutine ESMF_TimeGetDayOfYearInteger(time, DayOfYear, rc)
-!
-! !ARGUMENTS:
- type(ESMF_Time), intent(in) :: time
- integer, intent(out) :: DayOfYear
- integer, intent(out), optional :: rc
-!
-! !DESCRIPTION:
-! Get the day of the year the given {\tt ESMF\_Time} instant falls on
-! (1-365). Returned as an integer value
-!
-! The arguments are:
-! \begin{description}
-! \item[time]
-! The object instance to query
-! \item[DayOfYear]
-! The {\tt ESMF\_Time} instant's day of the year (1-365)
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-!EOP
- ! requires that time be normalized
-!$$$ bug when Sn>0? test
-!$$$ add tests
- DayOfYear = ( time%basetime%S / SECONDS_PER_DAY ) + 1
- IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
- end subroutine ESMF_TimeGetDayOfYearInteger
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeInc - Increment time instant with a time interval
-!
-! !INTERFACE:
- function ESMF_TimeInc(time, timeinterval)
-!
-! !RETURN VALUE:
- type(ESMF_Time) :: ESMF_TimeInc
-!
-! !ARGUMENTS:
- type(ESMF_Time), intent(in) :: time
- type(ESMF_TimeInterval), intent(in) :: timeinterval
-! !LOCAL:
- integer :: rc
-!
-! !DESCRIPTION:
-! Increment {\tt ESMF\_Time} instant with a {\tt ESMF\_TimeInterval},
-! return resulting {\tt ESMF\_Time} instant
-!
-! Maps overloaded (+) operator interface function to
-! {\tt ESMF\_BaseTime} base class
-!
-! The arguments are:
-! \begin{description}
-! \item[time]
-! The given {\tt ESMF\_Time} to increment
-! \item[timeinterval]
-! The {\tt ESMF\_TimeInterval} to add to the given {\tt ESMF\_Time}
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.4, TMG2.4.4, TMG2.4.5, TMG2.4.6, TMG5.1, TMG5.2, TMG7.2
-!EOP
-
- ! copy ESMF_Time specific properties (e.g. calendar, timezone)
- ESMF_TimeInc = time
-
- ! call ESMC_BaseTime base class function
- call c_ESMC_BaseTimeSum(time, timeinterval, ESMF_TimeInc)
-
- end function ESMF_TimeInc
-!
-! this is added for certain compilers that don't deal with commutativity
-!
- function ESMF_TimeInc2(timeinterval, time)
- type(ESMF_Time) :: ESMF_TimeInc2
- type(ESMF_Time), intent(in) :: time
- type(ESMF_TimeInterval), intent(in) :: timeinterval
- ESMF_TimeInc2 = ESMF_TimeInc( time, timeinterval )
- end function ESMF_TimeInc2
-!
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeDec - Decrement time instant with a time interval
-!
-! !INTERFACE:
- function ESMF_TimeDec(time, timeinterval)
-!
-! !RETURN VALUE:
- type(ESMF_Time) :: ESMF_TimeDec
-!
-! !ARGUMENTS:
- type(ESMF_Time), intent(in) :: time
- type(ESMF_TimeInterval), intent(in) :: timeinterval
-! !LOCAL:
- integer :: rc
-!
-! !DESCRIPTION:
-! Decrement {\tt ESMF\_Time} instant with a {\tt ESMF\_TimeInterval},
-! return resulting {\tt ESMF\_Time} instant
-!
-! Maps overloaded (-) operator interface function to
-! {\tt ESMF\_BaseTime} base class
-!
-! The arguments are:
-! \begin{description}
-! \item[time]
-! The given {\tt ESMF\_Time} to decrement
-! \item[timeinterval]
-! The {\tt ESMF\_TimeInterval} to subtract from the given
-! {\tt ESMF\_Time}
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.4, TMG2.4.4, TMG2.4.5, TMG2.4.6, TMG5.1, TMG5.2, TMG7.2
-!EOP
-
- ! copy ESMF_Time specific properties (e.g. calendar, timezone)
- ESMF_TimeDec = time
-
- ! call ESMC_BaseTime base class function
- call c_ESMC_BaseTimeDec(time, timeinterval, ESMF_TimeDec)
-
- end function ESMF_TimeDec
-
-!
-! this is added for certain compilers that don't deal with commutativity
-!
- function ESMF_TimeDec2(timeinterval, time)
- type(ESMF_Time) :: ESMF_TimeDec2
- type(ESMF_Time), intent(in) :: time
- type(ESMF_TimeInterval), intent(in) :: timeinterval
- ESMF_TimeDec2 = ESMF_TimeDec( time, timeinterval )
- end function ESMF_TimeDec2
-!
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeDiff - Return the difference between two time instants
-!
-! !INTERFACE:
- function ESMF_TimeDiff(time1, time2)
-!
-! !RETURN VALUE:
- type(ESMF_TimeInterval) :: ESMF_TimeDiff
-!
-! !ARGUMENTS:
- type(ESMF_Time), intent(in) :: time1
- type(ESMF_Time), intent(in) :: time2
-! !LOCAL:
- integer :: rc
-
-! !DESCRIPTION:
-! Return the {\tt ESMF\_TimeInterval} difference between two
-! {\tt ESMF\_Time} instants
-!
-! Maps overloaded (-) operator interface function to
-! {\tt ESMF\_BaseTime} base class
-!
-! The arguments are:
-! \begin{description}
-! \item[time1]
-! The first {\tt ESMF\_Time} instant
-! \item[time2]
-! The second {\tt ESMF\_Time} instant
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.4, TMG2.4.4, TMG2.4.5, TMG2.4.6, TMG5.1, TMG5.2, TMG7.2
-!EOP
-
- ! call ESMC_BaseTime base class function
- CALL ESMF_TimeIntervalSet( ESMF_TimeDiff, rc=rc )
- call c_ESMC_BaseTimeDiff(time1, time2, ESMF_TimeDiff)
-
- end function ESMF_TimeDiff
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeEQ - Compare two times for equality
-!
-! !INTERFACE:
- function ESMF_TimeEQ(time1, time2)
-!
-! !RETURN VALUE:
- logical :: ESMF_TimeEQ
-!
-! !ARGUMENTS:
- type(ESMF_Time), intent(in) :: time1
- type(ESMF_Time), intent(in) :: time2
-!
-! !DESCRIPTION:
-! Return true if both given {\tt ESMF\_Time} instants are equal, false
-! otherwise. Maps overloaded (==) operator interface function to
-! {\tt ESMF\_BaseTime} base class.
-!
-! The arguments are:
-! \begin{description}
-! \item[time1]
-! First time instant to compare
-! \item[time2]
-! Second time instant to compare
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.3, TMG2.4.3, TMG7.2
-!EOP
-
- ! invoke C to C++ entry point for ESMF_BaseTime base class function
- call c_ESMC_BaseTimeEQ(time1, time2, ESMF_TimeEQ)
-
- end function ESMF_TimeEQ
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeNE - Compare two times for non-equality
-!
-! !INTERFACE:
- function ESMF_TimeNE(time1, time2)
-!
-! !RETURN VALUE:
- logical :: ESMF_TimeNE
-!
-! !ARGUMENTS:
- type(ESMF_Time), intent(in) :: time1
- type(ESMF_Time), intent(in) :: time2
-
-! !DESCRIPTION:
-! Return true if both given {\tt ESMF\_Time} instants are not equal, false
-! otherwise. Maps overloaded (/=) operator interface function to
-! {\tt ESMF\_BaseTime} base class.
-!
-! The arguments are:
-! \begin{description}
-! \item[time1]
-! First time instant to compare
-! \item[time2]
-! Second time instant to compare
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.3, TMG2.4.3, TMG7.2
-!EOP
-
- ! call ESMC_BaseTime base class function
- call c_ESMC_BaseTimeNE(time1, time2, ESMF_TimeNE)
-
- end function ESMF_TimeNE
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeLT - Time instant 1 less than time instant 2 ?
-!
-! !INTERFACE:
- function ESMF_TimeLT(time1, time2)
-!
-! !RETURN VALUE:
- logical :: ESMF_TimeLT
-!
-! !ARGUMENTS:
- type(ESMF_Time), intent(in) :: time1
- type(ESMF_Time), intent(in) :: time2
-!
-! !DESCRIPTION:
-! Return true if first {\tt ESMF\_Time} instant is less than second
-! {\tt ESMF\_Time} instant, false otherwise. Maps overloaded (<)
-! operator interface function to {\tt ESMF\_BaseTime} base class.
-!
-! The arguments are:
-! \begin{description}
-! \item[time1]
-! First time instant to compare
-! \item[time2]
-! Second time instant to compare
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.3, TMG2.4.3, TMG7.2
-!EOP
-
- ! call ESMC_BaseTime base class function
- call c_ESMC_BaseTimeLT(time1, time2, ESMF_TimeLT)
-
- end function ESMF_TimeLT
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeGT - Time instant 1 greater than time instant 2 ?
-!
-! !INTERFACE:
- function ESMF_TimeGT(time1, time2)
-!
-! !RETURN VALUE:
- logical :: ESMF_TimeGT
-!
-! !ARGUMENTS:
- type(ESMF_Time), intent(in) :: time1
- type(ESMF_Time), intent(in) :: time2
-!
-! !DESCRIPTION:
-! Return true if first {\tt ESMF\_Time} instant is greater than second
-! {\tt ESMF\_Time} instant, false otherwise. Maps overloaded (>) operator
-! interface function to {\tt ESMF\_BaseTime} base class.
-!
-! The arguments are:
-! \begin{description}
-! \item[time1]
-! First time instant to compare
-! \item[time2]
-! Second time instant to compare
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.3, TMG2.4.3, TMG7.2
-!EOP
-
- ! call ESMC_BaseTime base class function
- call c_ESMC_BaseTimeGT(time1, time2, ESMF_TimeGT)
-
- end function ESMF_TimeGT
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeLE - Time instant 1 less than or equal to time instant 2 ?
-!
-! !INTERFACE:
- function ESMF_TimeLE(time1, time2)
-!
-! !RETURN VALUE:
- logical :: ESMF_TimeLE
-!
-! !ARGUMENTS:
- type(ESMF_Time), intent(in) :: time1
- type(ESMF_Time), intent(in) :: time2
-!
-! !DESCRIPTION:
-! Return true if first {\tt ESMF\_Time} instant is less than or equal to
-! second {\tt ESMF\_Time} instant, false otherwise. Maps overloaded (<=)
-! operator interface function to {\tt ESMF\_BaseTime} base class.
-!
-! The arguments are:
-! \begin{description}
-! \item[time1]
-! First time instant to compare
-! \item[time2]
-! Second time instant to compare
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.3, TMG2.4.3, TMG7.2
-!EOP
-
- ! call ESMC_BaseTime base class function
- call c_ESMC_BaseTimeLE(time1, time2, ESMF_TimeLE)
-
- end function ESMF_TimeLE
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeGE - Time instant 1 greater than or equal to time instant 2 ?
-!
-! !INTERFACE:
- function ESMF_TimeGE(time1, time2)
-!
-! !RETURN VALUE:
- logical :: ESMF_TimeGE
-!
-! !ARGUMENTS:
- type(ESMF_Time), intent(in) :: time1
- type(ESMF_Time), intent(in) :: time2
-!
-! !DESCRIPTION:
-! Return true if first {\tt ESMF\_Time} instant is greater than or equal to
-! second {\tt ESMF\_Time} instant, false otherwise. Maps overloaded (>=)
-! operator interface function to {\tt ESMF\_BaseTime} base class.
-!
-! The arguments are:
-! \begin{description}
-! \item[time1]
-! First time instant to compare
-! \item[time2]
-! Second time instant to compare
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.3, TMG2.4.3, TMG7.2
-!EOP
-
- ! call ESMC_BaseTime base class function
- call c_ESMC_BaseTimeGE(time1, time2, ESMF_TimeGE)
-
- end function ESMF_TimeGE
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeCopy - Copy a time-instance
-
-! !INTERFACE:
- subroutine ESMF_TimeCopy(timeout, timein)
-
-! !ARGUMENTS:
- type(ESMF_Time), intent(out) :: timeout
- type(ESMF_Time), intent(in) :: timein
-
-! !DESCRIPTION:
-! Copy a time-instance to a new instance.
-!
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMGn.n.n
-!EOP
-
- timeout%basetime = timein%basetime
- timeout%YR = timein%YR
- timeout%Calendar => timein%Calendar
-
- end subroutine ESMF_TimeCopy
-
- end module ESMF_TimeMod
Copied: branches/atmos_physics/src/external/esmf_time_f90/ESMF_Time.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/ESMF_Time.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/ESMF_Time.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_Time.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,1188 @@
+!
+! Earth System Modeling Framework
+! Copyright 2002-2003, University Corporation for Atmospheric Research,
+! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
+! Laboratory, University of Michigan, National Centers for Environmental
+! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
+! NASA Goddard Space Flight Center.
+! Licensed under the University of Illinois-NCSA license.
+!
+!==============================================================================
+!
+! ESMF Time Module
+ module ESMF_TimeMod
+!
+!==============================================================================
+!
+! This file contains the Time class definition and all Time class methods.
+!
+!------------------------------------------------------------------------------
+! INCLUDES
+#include <ESMF_TimeMgr.inc>
+
+!==============================================================================
+!BOPI
+! !MODULE: ESMF_TimeMod
+!
+! !DESCRIPTION:
+! Part of Time Manager F90 API wrapper of C++ implemenation
+!
+! Defines F90 wrapper entry points for corresponding
+! C++ class {\tt ESMC\_Time} implementation
+!
+! See {\tt ../include/ESMC\_Time.h} for complete description
+!
+!------------------------------------------------------------------------------
+! !USES:
+ ! inherit from ESMF base class
+ use ESMF_BaseMod
+
+ ! inherit from base time class
+ use ESMF_BaseTimeMod
+
+ ! associated derived types
+ use ESMF_TimeIntervalMod
+ use ESMF_CalendarMod
+ use ESMF_Stubs
+
+ implicit none
+!
+!------------------------------------------------------------------------------
+! !PRIVATE TYPES:
+ private
+!------------------------------------------------------------------------------
+! ! ESMF_Time
+!
+! ! F90 class type to match C++ Time class in size only;
+! ! all dereferencing within class is performed by C++ implementation
+
+ type ESMF_Time
+ type(ESMF_BaseTime) :: basetime ! inherit base class
+ ! time instant is expressed as year + basetime
+ integer :: YR
+ type(ESMF_Calendar), pointer :: calendar ! associated calendar
+ end type
+
+!------------------------------------------------------------------------------
+! !PUBLIC TYPES:
+ public ESMF_Time
+!------------------------------------------------------------------------------
+!
+! !PUBLIC MEMBER FUNCTIONS:
+ public ESMF_TimeGet
+ public ESMF_TimeSet
+
+! Required inherited and overridden ESMF_Base class methods
+
+ public ESMF_TimeCopy
+
+! !PRIVATE MEMBER FUNCTIONS:
+
+ private ESMF_TimeGetDayOfYear
+ private ESMF_TimeGetDayOfYearInteger
+
+! Inherited and overloaded from ESMF_BaseTime
+
+ ! NOTE: ESMF_TimeInc, ESMF_TimeDec, ESMF_TimeDiff, ESMF_TimeEQ,
+ ! ESMF_TimeNE, ESMF_TimeLT, ESMF_TimeGT, ESMF_TimeLE, and
+ ! ESMF_TimeGE are PUBLIC only to work around bugs in the
+ ! PGI 5.1-x compilers. They should all be PRIVATE.
+
+ public operator(+)
+ public ESMF_TimeInc
+
+ public operator(-)
+ public ESMF_TimeDec
+ public ESMF_TimeDec2
+ public ESMF_TimeDiff
+
+ public operator(.EQ.)
+ public ESMF_TimeEQ
+
+ public operator(.NE.)
+ public ESMF_TimeNE
+
+ public operator(.LT.)
+ public ESMF_TimeLT
+
+ public operator(.GT.)
+ public ESMF_TimeGT
+
+ public operator(.LE.)
+ public ESMF_TimeLE
+
+ public operator(.GE.)
+ public ESMF_TimeGE
+
+!EOPI
+
+!==============================================================================
+!
+! INTERFACE BLOCKS
+!
+!==============================================================================
+!BOP
+! !INTERFACE:
+ interface ESMF_TimeGetDayOfYear
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeGetDayOfYearInteger
+
+! !DESCRIPTION:
+! This interface overloads the {\tt ESMF\_GetDayOfYear} method
+! for the {\tt ESMF\_Time} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(+)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeInc, ESMF_TimeInc2
+
+! !DESCRIPTION:
+! This interface overloads the + operator for the {\tt ESMF\_Time} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface assignment (=)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeCopy
+
+! !DESCRIPTION:
+! This interface overloads the = operator for the {\tt ESMF\_Time} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(-)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeDec, ESMF_TimeDec2
+
+! !DESCRIPTION:
+! This interface overloads the - operator for the {\tt ESMF\_Time} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(-)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeDiff
+
+! !DESCRIPTION:
+! This interface overloads the - operator for the {\tt ESMF\_Time} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(.EQ.)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeEQ
+
+! !DESCRIPTION:
+! This interface overloads the .EQ. operator for the {\tt ESMF\_Time} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(.NE.)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeNE
+
+! !DESCRIPTION:
+! This interface overloads the .NE. operator for the {\tt ESMF\_Time} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(.LT.)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeLT
+
+! !DESCRIPTION:
+! This interface overloads the .LT. operator for the {\tt ESMF\_Time} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(.GT.)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeGT
+
+! !DESCRIPTION:
+! This interface overloads the .GT. operator for the {\tt ESMF\_Time} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(.LE.)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeLE
+
+! !DESCRIPTION:
+! This interface overloads the .LE. operator for the {\tt ESMF\_Time} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(.GE.)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeGE
+
+! !DESCRIPTION:
+! This interface overloads the .GE. operator for the {\tt ESMF\_Time} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+
+!==============================================================================
+
+ contains
+
+!==============================================================================
+!
+! Generic Get/Set routines which use F90 optional arguments
+!
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeGet - Get value in user-specified units
+
+! !INTERFACE:
+ subroutine ESMF_TimeGet(time, YY, YRl, MM, DD, D, Dl, H, M, S, Sl, MS, &
+ US, NS, d_, h_, m_, s_, ms_, us_, ns_, Sn, Sd, &
+ dayOfYear, dayOfYear_r8, dayOfYear_intvl, &
+ timeString, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Time), intent(in) :: time
+ integer, intent(out), optional :: YY
+ integer(ESMF_KIND_I8), intent(out), optional :: YRl
+ integer, intent(out), optional :: MM
+ integer, intent(out), optional :: DD
+ integer, intent(out), optional :: D
+ integer(ESMF_KIND_I8), intent(out), optional :: Dl
+ integer, intent(out), optional :: H
+ integer, intent(out), optional :: M
+ integer, intent(out), optional :: S
+ integer(ESMF_KIND_I8), intent(out), optional :: Sl
+ integer, intent(out), optional :: MS
+ integer, intent(out), optional :: US
+ integer, intent(out), optional :: NS
+ double precision, intent(out), optional :: d_
+ double precision, intent(out), optional :: h_
+ double precision, intent(out), optional :: m_
+ double precision, intent(out), optional :: s_
+ double precision, intent(out), optional :: ms_
+ double precision, intent(out), optional :: us_
+ double precision, intent(out), optional :: ns_
+ integer, intent(out), optional :: Sn
+ integer, intent(out), optional :: Sd
+ integer, intent(out), optional :: dayOfYear
+ ! dayOfYear_r8 = 1.0 at 0Z on 1 January, 1.5 at 12Z on
+ ! 1 January, etc.
+ real(ESMF_KIND_R8), intent(out), optional :: dayOfYear_r8
+ character (len=*), intent(out), optional :: timeString
+ type(ESMF_TimeInterval), intent(out), optional :: dayOfYear_intvl
+ integer, intent(out), optional :: rc
+
+ type(ESMF_TimeInterval) :: day_step
+ integer :: ierr
+
+! !DESCRIPTION:
+! Get the value of the {\tt ESMF\_Time} in units specified by the user
+! via F90 optional arguments.
+!
+! Time manager represents and manipulates time internally with integers
+! to maintain precision. Hence, user-specified floating point values are
+! converted internally from integers.
+!
+! See {\tt ../include/ESMC\_BaseTime.h and ../include/ESMC\_Time.h} for
+! complete description.
+!
+! The arguments are:
+! \begin{description}
+! \item[time]
+! The object instance to query
+! \item[{[YY]}]
+! Integer year CCYR (>= 32-bit)
+! \item[{[YRl]}]
+! Integer year CCYR (large, >= 64-bit)
+! \item[{[MM]}]
+! Integer month 1-12
+! \item[{[DD]}]
+! Integer day of the month 1-31
+! \item[{[D]}]
+! Integer Julian days (>= 32-bit)
+! \item[{[Dl]}]
+! Integer Julian days (large, >= 64-bit)
+! \item[{[H]}]
+! Integer hours
+! \item[{[M]}]
+! Integer minutes
+! \item[{[S]}]
+! Integer seconds (>= 32-bit)
+! \item[{[Sl]}]
+! Integer seconds (large, >= 64-bit)
+! \item[{[MS]}]
+! Integer milliseconds
+! \item[{[US]}]
+! Integer microseconds
+! \item[{[NS]}]
+! Integer nanoseconds
+! \item[{[d\_]}]
+! Double precision days
+! \item[{[h\_]}]
+! Double precision hours
+! \item[{[m\_]}]
+! Double precision minutes
+! \item[{[s\_]}]
+! Double precision seconds
+! \item[{[ms\_]}]
+! Double precision milliseconds
+! \item[{[us\_]}]
+! Double precision microseconds
+! \item[{[ns\_]}]
+! Double precision nanoseconds
+! \item[{[Sn]}]
+! Integer fractional seconds - numerator
+! \item[{[Sd]}]
+! Integer fractional seconds - denominator
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG2.1, TMG2.5.1, TMG2.5.6
+!EOP
+ TYPE(ESMF_Time) :: begofyear
+ INTEGER :: year, month, dayofmonth, hour, minute, second
+ REAL(ESMF_KIND_R8) :: rsec
+
+ ierr = ESMF_SUCCESS
+
+ IF ( PRESENT( YY ) ) THEN
+ YY = time%YR
+ ENDIF
+ IF ( PRESENT( MM ) ) THEN
+ CALL timegetmonth( time, MM )
+ ENDIF
+ IF ( PRESENT( DD ) ) THEN
+ CALL timegetdayofmonth( time, DD )
+ ENDIF
+!
+!$$$ Push HMS down into ESMF_BaseTime from EVERYWHERE
+!$$$ and THEN add ESMF scaling behavior when other args are present...
+ IF ( PRESENT( H ) ) THEN
+ H = mod( time%basetime%S, SECONDS_PER_DAY ) / SECONDS_PER_HOUR
+ ENDIF
+ IF ( PRESENT( M ) ) THEN
+ M = mod( time%basetime%S, SECONDS_PER_HOUR) / SECONDS_PER_MINUTE
+ ENDIF
+ IF ( PRESENT( S ) ) THEN
+ S = mod( time%basetime%S, SECONDS_PER_MINUTE )
+ ENDIF
+ ! TBH: HACK to allow DD and S to behave as in ESMF 2.1.0+ when
+ ! TBH: both are present and H and M are not.
+ IF ( PRESENT( S ) .AND. PRESENT( DD ) ) THEN
+ IF ( ( .NOT. PRESENT( H ) ) .AND. ( .NOT. PRESENT( M ) ) ) THEN
+ S = mod( time%basetime%S, SECONDS_PER_DAY )
+ ENDIF
+ ENDIF
+ IF ( PRESENT( MS ) ) THEN
+ IF ( time%basetime%Sd /= 0 ) THEN
+ MS = NINT( ( time%basetime%Sn*1.0D0 / time%basetime%Sd*1.0D0 ) * 1000.0D0 )
+ ELSE
+ MS = 0
+ ENDIF
+ ENDIF
+ IF ( PRESENT( Sd ) .AND. PRESENT( Sn ) ) THEN
+ Sd = time%basetime%Sd
+ Sn = time%basetime%Sn
+ ENDIF
+ IF ( PRESENT( dayOfYear ) ) THEN
+ CALL ESMF_TimeGetDayOfYear( time, dayOfYear, rc=ierr )
+ ENDIF
+ IF ( PRESENT( dayOfYear_r8 ) ) THEN
+ ! 64-bit IEEE 754 has 52-bit mantisssa -- only need 25 bits to hold
+ ! number of seconds in a year...
+ rsec = REAL( time%basetime%S, ESMF_KIND_R8 )
+ IF ( time%basetime%Sd /= 0 ) THEN
+ rsec = rsec + ( REAL( time%basetime%Sn, ESMF_KIND_R8 ) / &
+ REAL( time%basetime%Sd, ESMF_KIND_R8 ) )
+ ENDIF
+ dayOfYear_r8 = rsec / REAL( SECONDS_PER_DAY, ESMF_KIND_R8 )
+ ! start at 1
+ dayOfYear_r8 = dayOfYear_r8 + 1.0_ESMF_KIND_R8
+ ENDIF
+ IF ( PRESENT( timeString ) ) THEN
+ ! This duplication for YMD is an optimization that avoids calling
+ ! timegetmonth() and timegetdayofmonth() when it is not needed.
+ year = time%YR
+ CALL timegetmonth( time, month )
+ CALL timegetdayofmonth( time, dayofmonth )
+!$$$ push HMS down into ESMF_BaseTime
+ hour = mod( time%basetime%S, SECONDS_PER_DAY ) / SECONDS_PER_HOUR
+ minute = mod( time%basetime%S, SECONDS_PER_HOUR) / SECONDS_PER_MINUTE
+ second = mod( time%basetime%S, SECONDS_PER_MINUTE )
+ CALL ESMFold_TimeGetString( year, month, dayofmonth, &
+ hour, minute, second, timeString )
+ ENDIF
+ IF ( PRESENT( dayOfYear_intvl ) ) THEN
+ year = time%YR
+ CALL ESMF_TimeSet( begofyear, yy=year, mm=1, dd=1, s=0, &
+ calendar=time%calendar, rc=ierr )
+ IF ( ierr == ESMF_FAILURE)THEN
+ rc = ierr
+ RETURN
+ END IF
+ CALL ESMF_TimeIntervalSet( day_step, d=1, s=0, rc=ierr )
+ dayOfYear_intvl = time - begofyear + day_step
+ ENDIF
+
+ IF ( PRESENT( rc ) ) THEN
+ rc = ierr
+ ENDIF
+
+ end subroutine ESMF_TimeGet
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeSet - Initialize via user-specified unit set
+
+! !INTERFACE:
+ subroutine ESMF_TimeSet(time, YY, YRl, MM, DD, D, Dl, H, M, S, Sl, &
+ MS, US, NS, d_, h_, m_, s_, ms_, us_, ns_, &
+ Sn, Sd, calendar, rc)
+
+! !ARGUMENTS:
+ type(ESMF_Time), intent(inout) :: time
+ integer, intent(in), optional :: YY
+ integer(ESMF_KIND_I8), intent(in), optional :: YRl
+ integer, intent(in), optional :: MM
+ integer, intent(in), optional :: DD
+ integer, intent(in), optional :: D
+ integer(ESMF_KIND_I8), intent(in), optional :: Dl
+ integer, intent(in), optional :: H
+ integer, intent(in), optional :: M
+ integer, intent(in), optional :: S
+ integer(ESMF_KIND_I8), intent(in), optional :: Sl
+ integer, intent(in), optional :: MS
+ integer, intent(in), optional :: US
+ integer, intent(in), optional :: NS
+ double precision, intent(in), optional :: d_
+ double precision, intent(in), optional :: h_
+ double precision, intent(in), optional :: m_
+ double precision, intent(in), optional :: s_
+ double precision, intent(in), optional :: ms_
+ double precision, intent(in), optional :: us_
+ double precision, intent(in), optional :: ns_
+ integer, intent(in), optional :: Sn
+ integer, intent(in), optional :: Sd
+ type(ESMF_Calendar), intent(in), target, optional :: calendar
+ integer, intent(out), optional :: rc
+ ! locals
+ INTEGER :: ierr
+
+! !DESCRIPTION:
+! Initializes a {\tt ESMF\_Time} with a set of user-specified units
+! via F90 optional arguments.
+!
+! Time manager represents and manipulates time internally with integers
+! to maintain precision. Hence, user-specified floating point values are
+! converted internally to integers.
+!
+! See {\tt ../include/ESMC\_BaseTime.h and ../include/ESMC\_Time.h} for
+! complete description.
+!
+! The arguments are:
+! \begin{description}
+! \item[time]
+! The object instance to initialize
+! \item[{[YY]}]
+! Integer year CCYR (>= 32-bit)
+! \item[{[YRl]}]
+! Integer year CCYR (large, >= 64-bit)
+! \item[{[MM]}]
+! Integer month 1-12
+! \item[{[DD]}]
+! Integer day of the month 1-31
+! \item[{[D]}]
+! Integer Julian days (>= 32-bit)
+! \item[{[Dl]}]
+! Integer Julian days (large, >= 64-bit)
+! \item[{[H]}]
+! Integer hours
+! \item[{[M]}]
+! Integer minutes
+! \item[{[S]}]
+! Integer seconds (>= 32-bit)
+! \item[{[Sl]}]
+! Integer seconds (large, >= 64-bit)
+! \item[{[MS]}]
+! Integer milliseconds
+! \item[{[US]}]
+! Integer microseconds
+! \item[{[NS]}]
+! Integer nanoseconds
+! \item[{[d\_]}]
+! Double precision days
+! \item[{[h\_]}]
+! Double precision hours
+! \item[{[m\_]}]
+! Double precision minutes
+! \item[{[s\_]}]
+! Double precision seconds
+! \item[{[ms\_]}]
+! Double precision milliseconds
+! \item[{[us\_]}]
+! Double precision microseconds
+! \item[{[ns\_]}]
+! Double precision nanoseconds
+! \item[{[Sn]}]
+! Integer fractional seconds - numerator
+! \item[{[Sd]}]
+! Integer fractional seconds - denominator
+! \item[{[cal]}]
+! Associated {\tt Calendar}
+! \item[{[tz]}]
+! Associated timezone (hours offset from GMT, e.g. EST = -5)
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMGn.n.n
+!EOP
+! PRINT *,'DEBUG: BEGIN ESMF_TimeSet()'
+!$$$ push this down into ESMF_BaseTime constructor
+ time%basetime%S = 0
+ time%basetime%Sn = 0
+ time%basetime%Sd = 0
+
+ IF ( PRESENT( rc ) ) rc = ESMF_FAILURE
+ time%YR = 0
+ IF ( PRESENT( YY ) ) THEN
+! PRINT *,'DEBUG: ESMF_TimeSet(): YY = ',YY
+ time%YR = YY
+ ENDIF
+ IF ( PRESENT( MM ) ) THEN
+! PRINT *,'DEBUG: ESMF_TimeSet(): MM = ',MM
+ CALL timeaddmonths( time, MM, ierr )
+ IF ( ierr == ESMF_FAILURE ) THEN
+ IF ( PRESENT( rc ) ) THEN
+ rc = ESMF_FAILURE
+ RETURN
+ ENDIF
+ ENDIF
+! PRINT *,'DEBUG: ESMF_TimeSet(): back from timeaddmonths'
+ ENDIF
+ IF ( PRESENT( DD ) ) THEN
+!$$$ no check for DD in range of days of month MM yet
+!$$$ Must separate D and DD for correct interface!
+! PRINT *,'DEBUG: ESMF_TimeSet(): DD = ',DD
+ time%basetime%S = time%basetime%S + &
+ ( SECONDS_PER_DAY * INT( (DD-1), ESMF_KIND_I8 ) )
+ ENDIF
+!$$$ push H,M,S,Sn,Sd,MS down into ESMF_BaseTime constructor
+ IF ( PRESENT( H ) ) THEN
+! PRINT *,'DEBUG: ESMF_TimeSet(): H = ',H
+ time%basetime%S = time%basetime%S + &
+ ( SECONDS_PER_HOUR * INT( H, ESMF_KIND_I8 ) )
+ ENDIF
+ IF ( PRESENT( M ) ) THEN
+! PRINT *,'DEBUG: ESMF_TimeSet(): M = ',M
+ time%basetime%S = time%basetime%S + &
+ ( SECONDS_PER_MINUTE * INT( M, ESMF_KIND_I8 ) )
+ ENDIF
+ IF ( PRESENT( S ) ) THEN
+! PRINT *,'DEBUG: ESMF_TimeSet(): S = ',S
+ time%basetime%S = time%basetime%S + &
+ INT( S, ESMF_KIND_I8 )
+ ENDIF
+ IF ( PRESENT( Sn ) .AND. ( .NOT. PRESENT( Sd ) ) ) THEN
+ CALL wrf_error_fatal( &
+ "ESMF_TimeSet: Must specify Sd if Sn is specified")
+ ENDIF
+ IF ( PRESENT( Sd ) .AND. PRESENT( MS ) ) THEN
+ CALL wrf_error_fatal( &
+ "ESMF_TimeSet: Must not specify both Sd and MS")
+ ENDIF
+ time%basetime%Sn = 0
+ time%basetime%Sd = 0
+ IF ( PRESENT( MS ) ) THEN
+! PRINT *,'DEBUG: ESMF_TimeSet(): MS = ',MS
+ time%basetime%Sn = MS
+ time%basetime%Sd = 1000_ESMF_KIND_I8
+ ELSE IF ( PRESENT( Sd ) ) THEN
+! PRINT *,'DEBUG: ESMF_TimeSet(): Sd = ',Sd
+ time%basetime%Sd = Sd
+ IF ( PRESENT( Sn ) ) THEN
+! PRINT *,'DEBUG: ESMF_TimeSet(): Sn = ',Sn
+ time%basetime%Sn = Sn
+ ENDIF
+ ENDIF
+ IF ( PRESENT(calendar) )THEN
+! PRINT *,'DEBUG: ESMF_TimeSet(): using passed-in calendar'
+! Note that the ugly hack of wrapping the call to ESMF_CalendarInitialized()
+! inside this #ifdef is due to lack of support for compile-time initialization
+! of components of Fortran derived types. Some older compilers like PGI 5.1-x
+! do not support this F95 feature. In this case we only lose a safety check.
+#ifndef NO_DT_COMPONENT_INIT
+ IF ( .not. ESMF_CalendarInitialized( calendar ) )THEN
+ call wrf_error_fatal( "Error:: ESMF_CalendarCreate not "// &
+ "called on input Calendar")
+ END IF
+#endif
+ time%Calendar => calendar
+ ELSE
+! PRINT *,'DEBUG: ESMF_TimeSet(): using default calendar'
+ IF ( .not. ESMF_IsInitialized() )THEN
+ call wrf_error_fatal( "Error:: ESMF_Initialize not called")
+ END IF
+ time%Calendar => defaultCal
+ END IF
+
+! PRINT *,'DEBUG: ESMF_TimeSet(): calling normalize_time()'
+!$$$DEBUG
+!IF ( time%basetime%Sd > 0 ) THEN
+! PRINT *,'DEBUG ESMF_TimeSet() before normalize: S,Sn,Sd = ', &
+! time%basetime%S, time%basetime%Sn, time%basetime%Sd
+!ENDIF
+!$$$END DEBUG
+ CALL normalize_time( time )
+!$$$DEBUG
+!IF ( time%basetime%Sd > 0 ) THEN
+! PRINT *,'DEBUG ESMF_TimeSet() after normalize: S,Sn,Sd = ', &
+! time%basetime%S, time%basetime%Sn, time%basetime%Sd
+!ENDIF
+!$$$END DEBUG
+
+! PRINT *,'DEBUG: ESMF_TimeSet(): back from normalize_time()'
+ IF ( PRESENT( rc ) ) THEN
+ rc = ESMF_SUCCESS
+ ENDIF
+
+ end subroutine ESMF_TimeSet
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMFold_TimeGetString - Get time instant value in string format
+
+! !INTERFACE:
+ subroutine ESMFold_TimeGetString( year, month, dayofmonth, &
+ hour, minute, second, TimeString )
+
+! !ARGUMENTS:
+ integer, intent(in) :: year
+ integer, intent(in) :: month
+ integer, intent(in) :: dayofmonth
+ integer, intent(in) :: hour
+ integer, intent(in) :: minute
+ integer, intent(in) :: second
+ character*(*), intent(out) :: TimeString
+! !DESCRIPTION:
+! Convert {\tt ESMF\_Time}'s value into ISO 8601 format YYYY-MM-DDThh:mm:ss
+!
+! The arguments are:
+! \begin{description}
+! \item[time]
+! The object instance to convert
+! \item[TimeString]
+! The string to return
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG2.4.7
+!EOP
+
+!PRINT *,'DEBUG: ESMF_TimePrint(): YR,S,Sn,Sd = ',time%YR,time%basetime%S,time%basetime%Sn,time%basetime%Sd
+!PRINT *,'DEBUG: ESMF_TimePrint(): year = ',year
+!PRINT *,'DEBUG: ESMF_TimePrint(): month, dayofmonth = ',month,dayofmonth
+!PRINT *,'DEBUG: ESMF_TimePrint(): hour = ',hour
+!PRINT *,'DEBUG: ESMF_TimePrint(): minute = ',minute
+!PRINT *,'DEBUG: ESMF_TimePrint(): second = ',second
+
+!$$$here... add negative sign for YR<0
+!$$$here... add Sn, Sd ??
+#ifdef PLANET
+ write(TimeString,FMT="(I4.4,'-',I5.5,'_',I2.2,':',I2.2,':',I2.2)") &
+ year,dayofmonth,hour,minute,second
+#else
+ write(TimeString,FMT="(I4.4,'-',I2.2,'-',I2.2,'_',I2.2,':',I2.2,':',I2.2)") &
+ year,month,dayofmonth,hour,minute,second
+#endif
+
+ end subroutine ESMFold_TimeGetString
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeGetDayOfYearInteger - Get time instant's day of the year as an integer value
+!
+! !INTERFACE:
+ subroutine ESMF_TimeGetDayOfYearInteger(time, DayOfYear, rc)
+!
+! !ARGUMENTS:
+ type(ESMF_Time), intent(in) :: time
+ integer, intent(out) :: DayOfYear
+ integer, intent(out), optional :: rc
+!
+! !DESCRIPTION:
+! Get the day of the year the given {\tt ESMF\_Time} instant falls on
+! (1-365). Returned as an integer value
+!
+! The arguments are:
+! \begin{description}
+! \item[time]
+! The object instance to query
+! \item[DayOfYear]
+! The {\tt ESMF\_Time} instant's day of the year (1-365)
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+!EOP
+ ! requires that time be normalized
+!$$$ bug when Sn>0? test
+!$$$ add tests
+ DayOfYear = ( time%basetime%S / SECONDS_PER_DAY ) + 1
+ IF ( PRESENT( rc ) ) rc = ESMF_SUCCESS
+ end subroutine ESMF_TimeGetDayOfYearInteger
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeInc - Increment time instant with a time interval
+!
+! !INTERFACE:
+ function ESMF_TimeInc(time, timeinterval)
+!
+! !RETURN VALUE:
+ type(ESMF_Time) :: ESMF_TimeInc
+!
+! !ARGUMENTS:
+ type(ESMF_Time), intent(in) :: time
+ type(ESMF_TimeInterval), intent(in) :: timeinterval
+! !LOCAL:
+ integer :: rc
+!
+! !DESCRIPTION:
+! Increment {\tt ESMF\_Time} instant with a {\tt ESMF\_TimeInterval},
+! return resulting {\tt ESMF\_Time} instant
+!
+! Maps overloaded (+) operator interface function to
+! {\tt ESMF\_BaseTime} base class
+!
+! The arguments are:
+! \begin{description}
+! \item[time]
+! The given {\tt ESMF\_Time} to increment
+! \item[timeinterval]
+! The {\tt ESMF\_TimeInterval} to add to the given {\tt ESMF\_Time}
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.4, TMG2.4.4, TMG2.4.5, TMG2.4.6, TMG5.1, TMG5.2, TMG7.2
+!EOP
+
+ ! copy ESMF_Time specific properties (e.g. calendar, timezone)
+ ESMF_TimeInc = time
+
+ ! call ESMC_BaseTime base class function
+ call c_ESMC_BaseTimeSum(time, timeinterval, ESMF_TimeInc)
+
+ end function ESMF_TimeInc
+!
+! this is added for certain compilers that don't deal with commutativity
+!
+ function ESMF_TimeInc2(timeinterval, time)
+ type(ESMF_Time) :: ESMF_TimeInc2
+ type(ESMF_Time), intent(in) :: time
+ type(ESMF_TimeInterval), intent(in) :: timeinterval
+ ESMF_TimeInc2 = ESMF_TimeInc( time, timeinterval )
+ end function ESMF_TimeInc2
+!
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeDec - Decrement time instant with a time interval
+!
+! !INTERFACE:
+ function ESMF_TimeDec(time, timeinterval)
+!
+! !RETURN VALUE:
+ type(ESMF_Time) :: ESMF_TimeDec
+!
+! !ARGUMENTS:
+ type(ESMF_Time), intent(in) :: time
+ type(ESMF_TimeInterval), intent(in) :: timeinterval
+! !LOCAL:
+ integer :: rc
+!
+! !DESCRIPTION:
+! Decrement {\tt ESMF\_Time} instant with a {\tt ESMF\_TimeInterval},
+! return resulting {\tt ESMF\_Time} instant
+!
+! Maps overloaded (-) operator interface function to
+! {\tt ESMF\_BaseTime} base class
+!
+! The arguments are:
+! \begin{description}
+! \item[time]
+! The given {\tt ESMF\_Time} to decrement
+! \item[timeinterval]
+! The {\tt ESMF\_TimeInterval} to subtract from the given
+! {\tt ESMF\_Time}
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.4, TMG2.4.4, TMG2.4.5, TMG2.4.6, TMG5.1, TMG5.2, TMG7.2
+!EOP
+
+ ! copy ESMF_Time specific properties (e.g. calendar, timezone)
+ ESMF_TimeDec = time
+
+ ! call ESMC_BaseTime base class function
+ call c_ESMC_BaseTimeDec(time, timeinterval, ESMF_TimeDec)
+
+ end function ESMF_TimeDec
+
+!
+! this is added for certain compilers that don't deal with commutativity
+!
+ function ESMF_TimeDec2(timeinterval, time)
+ type(ESMF_Time) :: ESMF_TimeDec2
+ type(ESMF_Time), intent(in) :: time
+ type(ESMF_TimeInterval), intent(in) :: timeinterval
+ ESMF_TimeDec2 = ESMF_TimeDec( time, timeinterval )
+ end function ESMF_TimeDec2
+!
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeDiff - Return the difference between two time instants
+!
+! !INTERFACE:
+ function ESMF_TimeDiff(time1, time2)
+!
+! !RETURN VALUE:
+ type(ESMF_TimeInterval) :: ESMF_TimeDiff
+!
+! !ARGUMENTS:
+ type(ESMF_Time), intent(in) :: time1
+ type(ESMF_Time), intent(in) :: time2
+! !LOCAL:
+ integer :: rc
+
+! !DESCRIPTION:
+! Return the {\tt ESMF\_TimeInterval} difference between two
+! {\tt ESMF\_Time} instants
+!
+! Maps overloaded (-) operator interface function to
+! {\tt ESMF\_BaseTime} base class
+!
+! The arguments are:
+! \begin{description}
+! \item[time1]
+! The first {\tt ESMF\_Time} instant
+! \item[time2]
+! The second {\tt ESMF\_Time} instant
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.4, TMG2.4.4, TMG2.4.5, TMG2.4.6, TMG5.1, TMG5.2, TMG7.2
+!EOP
+
+ ! call ESMC_BaseTime base class function
+ CALL ESMF_TimeIntervalSet( ESMF_TimeDiff, rc=rc )
+ call c_ESMC_BaseTimeDiff(time1, time2, ESMF_TimeDiff)
+
+ end function ESMF_TimeDiff
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeEQ - Compare two times for equality
+!
+! !INTERFACE:
+ function ESMF_TimeEQ(time1, time2)
+!
+! !RETURN VALUE:
+ logical :: ESMF_TimeEQ
+!
+! !ARGUMENTS:
+ type(ESMF_Time), intent(in) :: time1
+ type(ESMF_Time), intent(in) :: time2
+!
+! !DESCRIPTION:
+! Return true if both given {\tt ESMF\_Time} instants are equal, false
+! otherwise. Maps overloaded (==) operator interface function to
+! {\tt ESMF\_BaseTime} base class.
+!
+! The arguments are:
+! \begin{description}
+! \item[time1]
+! First time instant to compare
+! \item[time2]
+! Second time instant to compare
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.3, TMG2.4.3, TMG7.2
+!EOP
+
+ ! invoke C to C++ entry point for ESMF_BaseTime base class function
+ call c_ESMC_BaseTimeEQ(time1, time2, ESMF_TimeEQ)
+
+ end function ESMF_TimeEQ
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeNE - Compare two times for non-equality
+!
+! !INTERFACE:
+ function ESMF_TimeNE(time1, time2)
+!
+! !RETURN VALUE:
+ logical :: ESMF_TimeNE
+!
+! !ARGUMENTS:
+ type(ESMF_Time), intent(in) :: time1
+ type(ESMF_Time), intent(in) :: time2
+
+! !DESCRIPTION:
+! Return true if both given {\tt ESMF\_Time} instants are not equal, false
+! otherwise. Maps overloaded (/=) operator interface function to
+! {\tt ESMF\_BaseTime} base class.
+!
+! The arguments are:
+! \begin{description}
+! \item[time1]
+! First time instant to compare
+! \item[time2]
+! Second time instant to compare
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.3, TMG2.4.3, TMG7.2
+!EOP
+
+ ! call ESMC_BaseTime base class function
+ call c_ESMC_BaseTimeNE(time1, time2, ESMF_TimeNE)
+
+ end function ESMF_TimeNE
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeLT - Time instant 1 less than time instant 2 ?
+!
+! !INTERFACE:
+ function ESMF_TimeLT(time1, time2)
+!
+! !RETURN VALUE:
+ logical :: ESMF_TimeLT
+!
+! !ARGUMENTS:
+ type(ESMF_Time), intent(in) :: time1
+ type(ESMF_Time), intent(in) :: time2
+!
+! !DESCRIPTION:
+! Return true if first {\tt ESMF\_Time} instant is less than second
+! {\tt ESMF\_Time} instant, false otherwise. Maps overloaded (<)
+! operator interface function to {\tt ESMF\_BaseTime} base class.
+!
+! The arguments are:
+! \begin{description}
+! \item[time1]
+! First time instant to compare
+! \item[time2]
+! Second time instant to compare
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.3, TMG2.4.3, TMG7.2
+!EOP
+
+ ! call ESMC_BaseTime base class function
+ call c_ESMC_BaseTimeLT(time1, time2, ESMF_TimeLT)
+
+ end function ESMF_TimeLT
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeGT - Time instant 1 greater than time instant 2 ?
+!
+! !INTERFACE:
+ function ESMF_TimeGT(time1, time2)
+!
+! !RETURN VALUE:
+ logical :: ESMF_TimeGT
+!
+! !ARGUMENTS:
+ type(ESMF_Time), intent(in) :: time1
+ type(ESMF_Time), intent(in) :: time2
+!
+! !DESCRIPTION:
+! Return true if first {\tt ESMF\_Time} instant is greater than second
+! {\tt ESMF\_Time} instant, false otherwise. Maps overloaded (>) operator
+! interface function to {\tt ESMF\_BaseTime} base class.
+!
+! The arguments are:
+! \begin{description}
+! \item[time1]
+! First time instant to compare
+! \item[time2]
+! Second time instant to compare
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.3, TMG2.4.3, TMG7.2
+!EOP
+
+ ! call ESMC_BaseTime base class function
+ call c_ESMC_BaseTimeGT(time1, time2, ESMF_TimeGT)
+
+ end function ESMF_TimeGT
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeLE - Time instant 1 less than or equal to time instant 2 ?
+!
+! !INTERFACE:
+ function ESMF_TimeLE(time1, time2)
+!
+! !RETURN VALUE:
+ logical :: ESMF_TimeLE
+!
+! !ARGUMENTS:
+ type(ESMF_Time), intent(in) :: time1
+ type(ESMF_Time), intent(in) :: time2
+!
+! !DESCRIPTION:
+! Return true if first {\tt ESMF\_Time} instant is less than or equal to
+! second {\tt ESMF\_Time} instant, false otherwise. Maps overloaded (<=)
+! operator interface function to {\tt ESMF\_BaseTime} base class.
+!
+! The arguments are:
+! \begin{description}
+! \item[time1]
+! First time instant to compare
+! \item[time2]
+! Second time instant to compare
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.3, TMG2.4.3, TMG7.2
+!EOP
+
+ ! call ESMC_BaseTime base class function
+ call c_ESMC_BaseTimeLE(time1, time2, ESMF_TimeLE)
+
+ end function ESMF_TimeLE
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeGE - Time instant 1 greater than or equal to time instant 2 ?
+!
+! !INTERFACE:
+ function ESMF_TimeGE(time1, time2)
+!
+! !RETURN VALUE:
+ logical :: ESMF_TimeGE
+!
+! !ARGUMENTS:
+ type(ESMF_Time), intent(in) :: time1
+ type(ESMF_Time), intent(in) :: time2
+!
+! !DESCRIPTION:
+! Return true if first {\tt ESMF\_Time} instant is greater than or equal to
+! second {\tt ESMF\_Time} instant, false otherwise. Maps overloaded (>=)
+! operator interface function to {\tt ESMF\_BaseTime} base class.
+!
+! The arguments are:
+! \begin{description}
+! \item[time1]
+! First time instant to compare
+! \item[time2]
+! Second time instant to compare
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.3, TMG2.4.3, TMG7.2
+!EOP
+
+ ! call ESMC_BaseTime base class function
+ call c_ESMC_BaseTimeGE(time1, time2, ESMF_TimeGE)
+
+ end function ESMF_TimeGE
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeCopy - Copy a time-instance
+
+! !INTERFACE:
+ subroutine ESMF_TimeCopy(timeout, timein)
+
+! !ARGUMENTS:
+ type(ESMF_Time), intent(out) :: timeout
+ type(ESMF_Time), intent(in) :: timein
+
+! !DESCRIPTION:
+! Copy a time-instance to a new instance.
+!
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMGn.n.n
+!EOP
+
+ timeout%basetime = timein%basetime
+ timeout%YR = timein%YR
+ timeout%Calendar => timein%Calendar
+
+ end subroutine ESMF_TimeCopy
+
+ end module ESMF_TimeMod
Deleted: branches/atmos_physics/src/external/esmf_time_f90/ESMF_TimeInterval.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/ESMF_TimeInterval.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_TimeInterval.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,1268 +0,0 @@
-!
-! Earth System Modeling Framework
-! Copyright 2002-2003, University Corporation for Atmospheric Research,
-! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
-! Laboratory, University of Michigan, National Centers for Environmental
-! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
-! NASA Goddard Space Flight Center.
-! Licensed under the University of Illinois-NCSA license.
-!
-!==============================================================================
-!
-! ESMF TimeInterval Module
- module ESMF_TimeIntervalMod
-!
-!==============================================================================
-!
-! This file contains the TimeInterval class definition and all TimeInterval
-! class methods.
-!
-!------------------------------------------------------------------------------
-! INCLUDES
-#include <ESMF_TimeMgr.inc>
-!
-!===============================================================================
-!BOPI
-! !MODULE: ESMF_TimeIntervalMod
-!
-! !DESCRIPTION:
-! Part of Time Manager F90 API wrapper of C++ implemenation
-!
-! Defines F90 wrapper entry points for corresponding
-! C++ implementaion of class {\tt ESMC\_TimeInterval}
-!
-! See {\tt ../include/ESMC\_TimeInterval.h} for complete description
-!
-!------------------------------------------------------------------------------
-! !USES:
- ! inherit from ESMF base class
- use ESMF_BaseMod
-
- ! inherit from base time class
- use ESMF_BaseTimeMod
-
- ! associated derived types
- use ESMF_FractionMod, only : ESMF_Fraction
- use ESMF_CalendarMod
-
- implicit none
-!
-!------------------------------------------------------------------------------
-! !PRIVATE TYPES:
- private
-!------------------------------------------------------------------------------
-! ! ESMF_TimeInterval
-!
-! ! F90 class type to match C++ TimeInterval class in size only;
-! ! all dereferencing within class is performed by C++ implementation
-
- type ESMF_TimeInterval
- ! time interval is expressed as basetime
- type(ESMF_BaseTime) :: basetime ! inherit base class
- ! Relative year and month fields support monthly or yearly time
- ! intervals. Many operations are undefined when these fields are
- ! non-zero!
- INTEGER :: YR ! relative year
- !jm Month has no meaning for an interval; get rid of it, 20100319
- ! INTEGER :: MM ! relative month
- end type
-
-!------------------------------------------------------------------------------
-! !PUBLIC TYPES:
- public ESMF_TimeInterval
-!------------------------------------------------------------------------------
-!
-! !PUBLIC MEMBER FUNCTIONS:
- public ESMF_TimeIntervalGet
- public ESMF_TimeIntervalSet
- public ESMFold_TimeIntervalGetString
- public ESMF_TimeIntervalAbsValue
- public ESMF_TimeIntervalNegAbsValue
-
-! Required inherited and overridden ESMF_Base class methods
-
-!!!!!!!!! added 20051012, JM
-! public WRFADDITION_TimeIntervalDIVQuot
-!!!!!!!!! renamed to simplify testing 20060320, TH
- public ESMF_TimeIntervalDIVQuot
-
- ! This convenience routine is only used by other modules in
- ! esmf_time_f90.
- public ESMF_TimeIntervalIsPositive
-
-
-! !PRIVATE MEMBER FUNCTIONS:
-
-! overloaded operator functions
-
- public operator(/)
- private ESMF_TimeIntervalQuotI
-
- public operator(*)
- private ESMF_TimeIntervalProdI
-
-! Inherited and overloaded from ESMF_BaseTime
-
- public operator(+)
- private ESMF_TimeIntervalSum
-
- public operator(-)
- private ESMF_TimeIntervalDiff
-
- public operator(.EQ.)
- private ESMF_TimeIntervalEQ
-
- public operator(.NE.)
- private ESMF_TimeIntervalNE
-
- public operator(.LT.)
- private ESMF_TimeIntervalLT
-
- public operator(.GT.)
- private ESMF_TimeIntervalGT
-
- public operator(.LE.)
- private ESMF_TimeIntervalLE
-
- public operator(.GE.)
- private ESMF_TimeIntervalGE
-!EOPI
-
-!==============================================================================
-!
-! INTERFACE BLOCKS
-!
-!==============================================================================
-!BOP
-! !INTERFACE:
- interface operator(*)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeIntervalProdI
-
-! !DESCRIPTION:
-! This interface overloads the * operator for the {\tt ESMF\_TimeInterval}
-! class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(/)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeIntervalQuotI
-
-! !DESCRIPTION:
-! This interface overloads the / operator for the
-! {\tt ESMF\_TimeInterval} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(+)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeIntervalSum
-
-! !DESCRIPTION:
-! This interface overloads the + operator for the
-! {\tt ESMF\_TimeInterval} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(-)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeIntervalDiff
-
-! !DESCRIPTION:
-! This interface overloads the - operator for the
-! {\tt ESMF\_TimeInterval} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(.EQ.)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeIntervalEQ
-
-! !DESCRIPTION:
-! This interface overloads the .EQ. operator for the
-! {\tt ESMF\_TimeInterval} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(.NE.)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeIntervalNE
-
-! !DESCRIPTION:
-! This interface overloads the .NE. operator for the
-! {\tt ESMF\_TimeInterval} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(.LT.)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeIntervalLT
-
-! !DESCRIPTION:
-! This interface overloads the .LT. operator for the
-! {\tt ESMF\_TimeInterval} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(.GT.)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeIntervalGT
-
-! !DESCRIPTION:
-! This interface overloads the .GT. operator for the
-! {\tt ESMF\_TimeInterval} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(.LE.)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeIntervalLE
-
-! !DESCRIPTION:
-! This interface overloads the .LE. operator for the
-! {\tt ESMF\_TimeInterval} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-!BOP
-! !INTERFACE:
- interface operator(.GE.)
-
-! !PRIVATE MEMBER FUNCTIONS:
- module procedure ESMF_TimeIntervalGE
-
-! !DESCRIPTION:
-! This interface overloads the .GE. operator for the
-! {\tt ESMF\_TimeInterval} class
-!
-!EOP
- end interface
-!
-!------------------------------------------------------------------------------
-
-!==============================================================================
-
- contains
-
-!==============================================================================
-!
-! Generic Get/Set routines which use F90 optional arguments
-!
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalGet - Get value in user-specified units
-
-! !INTERFACE:
- subroutine ESMF_TimeIntervalGet(timeinterval, D, d_r8, S, S_i8, Sn, Sd, &
- TimeString, rc )
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval
- integer, intent(out), optional :: D
- real(ESMF_KIND_R8), intent(out), optional :: d_r8
- integer(ESMF_KIND_I8), intent(out), optional :: S_i8
- integer, intent(out), optional :: S
- integer, intent(out), optional :: Sn
- integer, intent(out), optional :: Sd
- character*(*), optional, intent(out) :: TimeString
- integer, intent(out), optional :: rc
-
-
-! !DESCRIPTION:
-! Get the value of the {\tt ESMF\_TimeInterval} in units specified by the
-! user via F90 optional arguments.
-!
-! Time manager represents and manipulates time internally with integers
-! to maintain precision. Hence, user-specified floating point values are
-! converted internally from integers.
-!
-! See {\tt ../include/ESMC\_BaseTime.h} and
-! {\tt ../include/ESMC\_TimeInterval.h} for complete description.
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval]
-! The object instance to query
-! \item[{[YY]}]
-! Integer years (>= 32-bit)
-! \item[{[YYl]}]
-! Integer years (large, >= 64-bit)
-! \item[{[MO]}]
-! Integer months (>= 32-bit)
-! \item[{[MOl]}]
-! Integer months (large, >= 64-bit)
-! \item[{[D]}]
-! Integer days (>= 32-bit)
-! \item[{[Dl]}]
-! Integer days (large, >= 64-bit)
-! \item[{[H]}]
-! Integer hours
-! \item[{[M]}]
-! Integer minutes
-! \item[{[S]}]
-! Integer seconds (>= 32-bit)
-! \item[{[Sl]}]
-! Integer seconds (large, >= 64-bit)
-! \item[{[MS]}]
-! Integer milliseconds
-! \item[{[US]}]
-! Integer microseconds
-! \item[{[NS]}]
-! Integer nanoseconds
-! \item[{[d\_]}]
-! Double precision days
-! \item[{[h\_]}]
-! Double precision hours
-! \item[{[m\_]}]
-! Double precision minutes
-! \item[{[s\_]}]
-! Double precision seconds
-! \item[{[ms\_]}]
-! Double precision milliseconds
-! \item[{[us\_]}]
-! Double precision microseconds
-! \item[{[ns\_]}]
-! Double precision nanoseconds
-! \item[{[Sn]}]
-! Integer fractional seconds - numerator
-! \item[{[Sd]}]
-! Integer fractional seconds - denominator
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.1
-!
-! Added argument to output double precision seconds, S_i8
-! William.Gustafson@pnl.gov; 9-May-2008
-!
-!EOP
- INTEGER(ESMF_KIND_I8) :: seconds
- INTEGER :: ierr
-
- ierr = ESMF_SUCCESS
- seconds = timeinterval%basetime%S
- ! note that S is overwritten below (if present) if other args are also
- ! present
- IF ( PRESENT(S) ) S = seconds
- IF ( PRESENT(S_i8) ) S_i8 = seconds
- IF ( PRESENT( D ) ) THEN
- D = seconds / SECONDS_PER_DAY
- IF ( PRESENT(S) ) S = MOD( seconds, SECONDS_PER_DAY )
- IF ( PRESENT(S_i8) ) S_i8 = MOD( seconds, SECONDS_PER_DAY )
- ENDIF
- IF ( PRESENT( d_r8 ) ) THEN
- D_r8 = REAL( seconds, ESMF_KIND_R8 ) / &
- REAL( SECONDS_PER_DAY, ESMF_KIND_R8 )
- IF ( PRESENT(S) ) S = MOD( seconds, SECONDS_PER_DAY )
- IF ( PRESENT(S_i8) ) S_i8 = MOD( seconds, SECONDS_PER_DAY )
- ENDIF
- IF ( PRESENT(Sn) ) THEN
- Sn = timeinterval%basetime%Sn
- ENDIF
- IF ( PRESENT(Sd) ) THEN
- Sd = timeinterval%basetime%Sd
- ENDIF
- IF ( PRESENT( timeString ) ) THEN
- CALL ESMFold_TimeIntervalGetString( timeinterval, timeString, rc=ierr )
- ENDIF
- IF ( PRESENT(rc) ) rc = ierr
-
- end subroutine ESMF_TimeIntervalGet
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalSet - Initialize via user-specified unit set
-
-! !INTERFACE:
- subroutine ESMF_TimeIntervalSet(timeinterval, YY, YYl, MM, MOl, D, Dl, &
- H, M, S, Sl, MS, US, NS, &
- d_, h_, m_, s_, ms_, us_, ns_, &
- Sn, Sd, rc)
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(out) :: timeinterval
- integer, intent(in), optional :: YY
- integer(ESMF_KIND_I8), intent(in), optional :: YYl
- integer, intent(in), optional :: MM
- integer(ESMF_KIND_I8), intent(in), optional :: MOl
- integer, intent(in), optional :: D
- integer(ESMF_KIND_I8), intent(in), optional :: Dl
- integer, intent(in), optional :: H
- integer, intent(in), optional :: M
- integer, intent(in), optional :: S
- integer(ESMF_KIND_I8), intent(in), optional :: Sl
- integer, intent(in), optional :: MS
- integer, intent(in), optional :: US
- integer, intent(in), optional :: NS
- double precision, intent(in), optional :: d_
- double precision, intent(in), optional :: h_
- double precision, intent(in), optional :: m_
- double precision, intent(in), optional :: s_
- double precision, intent(in), optional :: ms_
- double precision, intent(in), optional :: us_
- double precision, intent(in), optional :: ns_
- integer, intent(in), optional :: Sn
- integer, intent(in), optional :: Sd
- integer, intent(out), optional :: rc
- ! locals
- INTEGER :: nfeb
-
-! !DESCRIPTION:
-! Set the value of the {\tt ESMF\_TimeInterval} in units specified by
-! the user via F90 optional arguments
-!
-! Time manager represents and manipulates time internally with integers
-! to maintain precision. Hence, user-specified floating point values are
-! converted internally to integers.
-!
-! See {\tt ../include/ESMC\_BaseTime.h} and
-! {\tt ../include/ESMC\_TimeInterval.h} for complete description.
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval]
-! The object instance to initialize
-! \item[{[YY]}]
-! Integer number of interval years (>= 32-bit)
-! \item[{[YYl]}]
-! Integer number of interval years (large, >= 64-bit)
-! \item[{[MM]}]
-! Integer number of interval months (>= 32-bit)
-! \item[{[MOl]}]
-! Integer number of interval months (large, >= 64-bit)
-! \item[{[D]}]
-! Integer number of interval days (>= 32-bit)
-! \item[{[Dl]}]
-! Integer number of interval days (large, >= 64-bit)
-! \item[{[H]}]
-! Integer hours
-! \item[{[M]}]
-! Integer minutes
-! \item[{[S]}]
-! Integer seconds (>= 32-bit)
-! \item[{[Sl]}]
-! Integer seconds (large, >= 64-bit)
-! \item[{[MS]}]
-! Integer milliseconds
-! \item[{[US]}]
-! Integer microseconds
-! \item[{[NS]}]
-! Integer nanoseconds
-! \item[{[d\_]}]
-! Double precision days
-! \item[{[h\_]}]
-! Double precision hours
-! \item[{[m\_]}]
-! Double precision minutes
-! \item[{[s\_]}]
-! Double precision seconds
-! \item[{[ms\_]}]
-! Double precision milliseconds
-! \item[{[us\_]}]
-! Double precision microseconds
-! \item[{[ns\_]}]
-! Double precision nanoseconds
-! \item[{[Sn]}]
-! Integer fractional seconds - numerator
-! \item[{[Sd]}]
-! Integer fractional seconds - denominator
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMGn.n.n
-!EOP
-
- IF ( PRESENT(rc) ) rc = ESMF_FAILURE
- ! note that YR and MM are relative
- timeinterval%YR = 0
- IF ( PRESENT( YY ) ) THEN
- timeinterval%YR = YY
- ENDIF
-!jm timeinterval%MM = 0
-!jm IF ( PRESENT( MM ) ) THEN
-!jm timeinterval%MM = MM
-!jm ENDIF
-!jm ! Rollover months to years
-!jm IF ( abs(timeinterval%MM) .GE. MONTHS_PER_YEAR ) THEN
-!jm timeinterval%YR = timeinterval%YR + timeinterval%MM/MONTHS_PER_YEAR
-!jm timeinterval%MM = mod(timeinterval%MM,MONTHS_PER_YEAR)
-!jm ENDIF
-
- timeinterval%basetime%S = 0
- ! For 365-day calendar, immediately convert years to days since we know
- ! how to do it in this case.
-!$$$ replace this hack with something saner...
- IF ( nfeb( 2004 ) == 28 ) THEN
- timeinterval%basetime%S = timeinterval%basetime%S + &
- ( 365_ESMF_KIND_I8 * &
- INT( timeinterval%YR, ESMF_KIND_I8 ) * SECONDS_PER_DAY )
- timeinterval%YR = 0
- ENDIF
- IF ( PRESENT( D ) ) THEN
- timeinterval%basetime%S = timeinterval%basetime%S + &
- ( SECONDS_PER_DAY * INT( D, ESMF_KIND_I8 ) )
- ENDIF
-!$$$ Push H,M,S,Sn,Sd,MS down into BaseTime constructor from EVERYWHERE
-!$$$ and THEN add ESMF scaling behavior when other args are present...
- IF ( PRESENT( H ) ) THEN
- timeinterval%basetime%S = timeinterval%basetime%S + &
- ( SECONDS_PER_HOUR * INT( H, ESMF_KIND_I8 ) )
- ENDIF
- IF ( PRESENT( M ) ) THEN
- timeinterval%basetime%S = timeinterval%basetime%S + &
- ( SECONDS_PER_MINUTE * INT( M, ESMF_KIND_I8 ) )
- ENDIF
- IF ( PRESENT( S ) ) THEN
- timeinterval%basetime%S = timeinterval%basetime%S + &
- INT( S, ESMF_KIND_I8 )
- ENDIF
- IF ( PRESENT( Sn ) .AND. ( .NOT. PRESENT( Sd ) ) ) THEN
- CALL wrf_error_fatal( &
- "ESMF_TimeIntervalSet: Must specify Sd if Sn is specified")
- ENDIF
- IF ( PRESENT( Sd ) .AND. PRESENT( MS ) ) THEN
- CALL wrf_error_fatal( &
- "ESMF_TimeIntervalSet: Must not specify both Sd and MS")
- ENDIF
- timeinterval%basetime%Sn = 0
- timeinterval%basetime%Sd = 0
- IF ( PRESENT( MS ) ) THEN
- timeinterval%basetime%Sn = MS
- timeinterval%basetime%Sd = 1000_ESMF_KIND_I8
- ELSE IF ( PRESENT( Sd ) ) THEN
- timeinterval%basetime%Sd = Sd
- IF ( PRESENT( Sn ) ) THEN
- timeinterval%basetime%Sn = Sn
- ENDIF
- ENDIF
- CALL normalize_timeint( timeinterval )
-
- IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
-
- end subroutine ESMF_TimeIntervalSet
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMFold_TimeIntervalGetString - Get time interval value in string format
-
-! !INTERFACE:
- subroutine ESMFold_TimeIntervalGetString(timeinterval, TimeString, rc)
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval
- character*(*), intent(out) :: TimeString
- integer, intent(out), optional :: rc
- ! locals
- integer :: signnormtimeint
- LOGICAL :: negative
- INTEGER(ESMF_KIND_I8) :: iS, iSn, iSd, H, M, S
- character (len=1) :: signstr
-
-! !DESCRIPTION:
-! Convert {\tt ESMF\_TimeInterval}'s value into string format
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval]
-! The object instance to convert
-! \item[TimeString]
-! The string to return
-! \item[{[rc]}]
-! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.9
-!EOP
-
-! NOTE: YR, MM, Sn, and Sd are not yet included in the returned string...
-!PRINT *,'DEBUG ESMFold_TimeIntervalGetString(): YR,MM,S,Sn,Sd = ', &
-! timeinterval%YR, &
-! timeinterval%MM, &
-! timeinterval%basetime%S, &
-! timeinterval%basetime%Sn, &
-! timeinterval%basetime%Sd
-
- negative = ( signnormtimeint( timeInterval ) == -1 )
- IF ( negative ) THEN
- iS = -timeinterval%basetime%S
- iSn = -timeinterval%basetime%Sn
- signstr = '-'
- ELSE
- iS = timeinterval%basetime%S
- iSn = timeinterval%basetime%Sn
- signstr = ''
- ENDIF
- iSd = timeinterval%basetime%Sd
-
- H = mod( iS, SECONDS_PER_DAY ) / SECONDS_PER_HOUR
- M = mod( iS, SECONDS_PER_HOUR) / SECONDS_PER_MINUTE
- S = mod( iS, SECONDS_PER_MINUTE )
-
-!$$$here... need to print Sn and Sd when they are used ???
-
- write(TimeString,FMT="(A,I10.10,'_',I3.3,':',I3.3,':',I3.3)") &
- TRIM(signstr), ( iS / SECONDS_PER_DAY ), H, M, S
-
-!write(0,*)'TimeIntervalGetString Sn ',timeinterval%basetime%Sn,' Sd ',timeinterval%basetime%Sd
-
- rc = ESMF_SUCCESS
-
- end subroutine ESMFold_TimeIntervalGetString
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalAbsValue - Get the absolute value of a time interval
-
-! !INTERFACE:
- function ESMF_TimeIntervalAbsValue(timeinterval)
-
-! !RETURN VALUE:
- type(ESMF_TimeInterval) :: ESMF_TimeIntervalAbsValue
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval
-! !LOCAL:
- integer :: rc
-
-! !DESCRIPTION:
-! Return a {\tt ESMF\_TimeInterval}'s absolute value.
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval]
-! The object instance to take the absolute value of.
-! Absolute value returned as value of function.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.8
-!EOP
- CALL timeintchecknormalized( timeinterval, 'ESMF_TimeIntervalAbsValue arg1' )
- ESMF_TimeIntervalAbsValue = timeinterval
-!$$$here... move implementation into BaseTime
- ESMF_TimeIntervalAbsValue%basetime%S = &
- abs(ESMF_TimeIntervalAbsValue%basetime%S)
- ESMF_TimeIntervalAbsValue%basetime%Sn = &
- abs(ESMF_TimeIntervalAbsValue%basetime%Sn )
-
- end function ESMF_TimeIntervalAbsValue
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalNegAbsValue - Get the negative absolute value of a time interval
-
-! !INTERFACE:
- function ESMF_TimeIntervalNegAbsValue(timeinterval)
-
-! !RETURN VALUE:
- type(ESMF_TimeInterval) :: ESMF_TimeIntervalNegAbsValue
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval
-! !LOCAL:
- integer :: rc
-
-! !DESCRIPTION:
-! Return a {\tt ESMF\_TimeInterval}'s negative absolute value.
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval]
-! The object instance to take the negative absolute value of.
-! Negative absolute value returned as value of function.
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.8
-!EOP
- CALL timeintchecknormalized( timeinterval, 'ESMF_TimeIntervalNegAbsValue arg1' )
-
- ESMF_TimeIntervalNegAbsValue = timeinterval
-!$$$here... move implementation into BaseTime
- ESMF_TimeIntervalNegAbsValue%basetime%S = &
- -abs(ESMF_TimeIntervalNegAbsValue%basetime%S)
- ESMF_TimeIntervalNegAbsValue%basetime%Sn = &
- -abs(ESMF_TimeIntervalNegAbsValue%basetime%Sn )
-
- end function ESMF_TimeIntervalNegAbsValue
-
-!------------------------------------------------------------------------------
-!
-! This section includes overloaded operators defined only for TimeInterval
-! (not inherited from BaseTime)
-! Note: these functions do not have a return code, since F90 forbids more
-! than 2 arguments for arithmetic overloaded operators
-!
-!------------------------------------------------------------------------------
-
-!!!!!!!!!!!!!!!!!! added jm 20051012
-! new WRF-specific function, Divide two time intervals and return the whole integer, without remainder
- function ESMF_TimeIntervalDIVQuot(timeinterval1, timeinterval2)
-
-! !RETURN VALUE:
- INTEGER :: ESMF_TimeIntervalDIVQuot
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval1
- type(ESMF_TimeInterval), intent(in) :: timeinterval2
-
-! !LOCAL
- INTEGER :: retval, isgn, rc
- type(ESMF_TimeInterval) :: zero, i1,i2
-
-! !DESCRIPTION:
-! Returns timeinterval1 divided by timeinterval2 as a fraction quotient.
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval1]
-! The dividend
-! \item[timeinterval2]
-! The divisor
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.5
-!EOP
-
- CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalDIVQuot arg1' )
- CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalDIVQuot arg2' )
-
- call ESMF_TimeIntervalSet( zero, rc=rc )
- i1 = timeinterval1
- i2 = timeinterval2
- isgn = 1
- if ( i1 .LT. zero ) then
- i1 = ESMF_TimeIntervalProdI(i1, -1)
- isgn = -isgn
- endif
- if ( i2 .LT. zero ) then
- i2 = ESMF_TimeIntervalProdI(i2, -1)
- isgn = -isgn
- endif
-! repeated subtraction
- retval = 0
- DO WHILE ( i1 .GE. i2 )
- i1 = i1 - i2
- retval = retval + 1
- ENDDO
- retval = retval * isgn
-
- ESMF_TimeIntervalDIVQuot = retval
-
- end function ESMF_TimeIntervalDIVQuot
-!!!!!!!!!!!!!!!!!!
-
-
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalQuotI - Divide time interval by an integer, return time interval result
-
-! !INTERFACE:
- function ESMF_TimeIntervalQuotI(timeinterval, divisor)
-
-! !RETURN VALUE:
- type(ESMF_TimeInterval) :: ESMF_TimeIntervalQuotI
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval
- integer, intent(in) :: divisor
-
-! !DESCRIPTION:
-! Divides a {\tt ESMF\_TimeInterval} by an integer divisor, returns
-! quotient as a {\tt ESMF\_TimeInterval}
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval]
-! The dividend
-! \item[divisor]
-! Integer divisor
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.6, TMG5.3, TMG7.2
-!EOP
-
-!PRINT *,'DEBUG ESMF_TimeIntervalQuotI() A: S,Sn,Sd = ', &
-! timeinterval%basetime%S,timeinterval%basetime%Sn,timeinterval%basetime%Sd
-!PRINT *,'DEBUG ESMF_TimeIntervalQuotI() A: divisor = ', divisor
-
- CALL timeintchecknormalized( timeinterval, 'ESMF_TimeIntervalQuotI arg1' )
-
- IF ( divisor == 0 ) THEN
- CALL wrf_error_fatal( 'ESMF_TimeIntervalQuotI: divide by zero' )
- ENDIF
- ESMF_TimeIntervalQuotI = timeinterval
-!PRINT *,'DEBUG ESMF_TimeIntervalQuotI() B: S,Sn,Sd = ', &
-! ESMF_TimeIntervalQuotI%basetime%S,ESMF_TimeIntervalQuotI%basetime%Sn,ESMF_TimeIntervalQuotI%basetime%Sd
- ESMF_TimeIntervalQuotI%basetime = &
- timeinterval%basetime / divisor
-!PRINT *,'DEBUG ESMF_TimeIntervalQuotI() C: S,Sn,Sd = ', &
-! ESMF_TimeIntervalQuotI%basetime%S,ESMF_TimeIntervalQuotI%basetime%Sn,ESMF_TimeIntervalQuotI%basetime%Sd
-
- CALL normalize_timeint( ESMF_TimeIntervalQuotI )
-!PRINT *,'DEBUG ESMF_TimeIntervalQuotI() D: S,Sn,Sd = ', &
-! ESMF_TimeIntervalQuotI%basetime%S,ESMF_TimeIntervalQuotI%basetime%Sn,ESMF_TimeIntervalQuotI%basetime%Sd
-
- end function ESMF_TimeIntervalQuotI
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalProdI - Multiply a time interval by an integer
-
-! !INTERFACE:
- function ESMF_TimeIntervalProdI(timeinterval, multiplier)
-
-! !RETURN VALUE:
- type(ESMF_TimeInterval) :: ESMF_TimeIntervalProdI
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval
- integer, intent(in) :: multiplier
-! !LOCAL:
- integer :: rc
-
-! !DESCRIPTION:
-! Multiply a {\tt ESMF\_TimeInterval} by an integer, return product as a
-! {\tt ESMF\_TimeInterval}
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval]
-! The multiplicand
-! \item[mutliplier]
-! Integer multiplier
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.7, TMG7.2
-!EOP
- CALL timeintchecknormalized( timeinterval, 'ESMF_TimeIntervalProdI arg1' )
-
- CALL ESMF_TimeIntervalSet( ESMF_TimeIntervalProdI, rc=rc )
-!$$$move this into overloaded operator(*) in BaseTime
- ESMF_TimeIntervalProdI%basetime%S = &
- timeinterval%basetime%S * INT( multiplier, ESMF_KIND_I8 )
- ESMF_TimeIntervalProdI%basetime%Sn = &
- timeinterval%basetime%Sn * INT( multiplier, ESMF_KIND_I8 )
- ! Don't multiply Sd
- ESMF_TimeIntervalProdI%basetime%Sd = timeinterval%basetime%Sd
- CALL normalize_timeint( ESMF_TimeIntervalProdI )
-
- end function ESMF_TimeIntervalProdI
-
-!------------------------------------------------------------------------------
-!
-! This section includes the inherited ESMF_BaseTime class overloaded operators
-!
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalSum - Add two time intervals together
-
-! !INTERFACE:
- function ESMF_TimeIntervalSum(timeinterval1, timeinterval2)
-
-! !RETURN VALUE:
- type(ESMF_TimeInterval) :: ESMF_TimeIntervalSum
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval1
- type(ESMF_TimeInterval), intent(in) :: timeinterval2
-! !LOCAL:
- integer :: rc
-! !DESCRIPTION:
-! Add two {\tt ESMF\_TimeIntervals}, return sum as a
-! {\tt ESMF\_TimeInterval}. Maps overloaded (+) operator interface
-! function to {\tt ESMF\_BaseTime} base class.
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval1]
-! The augend
-! \item[timeinterval2]
-! The addend
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.4, TMG2.4.4, TMG2.4.5, TMG2.4.6, TMG5.1, TMG5.2,
-! TMG7.2
-!EOP
- CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalSum arg1' )
- CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalSum arg2' )
-
- ESMF_TimeIntervalSum = timeinterval1
- ESMF_TimeIntervalSum%basetime = ESMF_TimeIntervalSum%basetime + &
- timeinterval2%basetime
-
- CALL normalize_timeint( ESMF_TimeIntervalSum )
-
- end function ESMF_TimeIntervalSum
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalDiff - Subtract one time interval from another
-
-! !INTERFACE:
- function ESMF_TimeIntervalDiff(timeinterval1, timeinterval2)
-
-! !RETURN VALUE:
- type(ESMF_TimeInterval) :: ESMF_TimeIntervalDiff
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval1
- type(ESMF_TimeInterval), intent(in) :: timeinterval2
-! !LOCAL:
- integer :: rc
-! !DESCRIPTION:
-! Subtract timeinterval2 from timeinterval1, return remainder as a
-! {\tt ESMF\_TimeInterval}.
-! Map overloaded (-) operator interface function to {\tt ESMF\_BaseTime}
-! base class.
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval1]
-! The minuend
-! \item[timeinterval2]
-! The subtrahend
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.4, TMG2.4.4, TMG2.4.5, TMG2.4.6, TMG5.1, TMG5.2, TMG7.2
-!EOP
- CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalDiff arg1' )
- CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalDiff arg2' )
-
- ESMF_TimeIntervalDiff = timeinterval1
- ESMF_TimeIntervalDiff%basetime = ESMF_TimeIntervalDiff%basetime - &
- timeinterval2%basetime
- CALL normalize_timeint( ESMF_TimeIntervalDiff )
-
- end function ESMF_TimeIntervalDiff
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalEQ - Compare two time intervals for equality
-
-! !INTERFACE:
- function ESMF_TimeIntervalEQ(timeinterval1, timeinterval2)
-!
-! !RETURN VALUE:
- logical :: ESMF_TimeIntervalEQ
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval1
- type(ESMF_TimeInterval), intent(in) :: timeinterval2
-
-!DESCRIPTION:
-! Return true if both given time intervals are equal, false otherwise.
-! Maps overloaded (==) operator interface function to {\tt ESMF\_BaseTime}
-! base class.
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval1]
-! First time interval to compare
-! \item[timeinterval2]
-! Second time interval to compare
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.3, TMG2.4.3, TMG7.2
-!EOP
- CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalEQ arg1' )
- CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalEQ arg2' )
-
-!$$$here... move all this out of Meat.F90 ?
- ! call ESMC_BaseTime base class function
- call c_ESMC_BaseTimeIntEQ(timeinterval1, timeinterval2, ESMF_TimeIntervalEQ)
-
- end function ESMF_TimeIntervalEQ
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalNE - Compare two time intervals for inequality
-
-! !INTERFACE:
- function ESMF_TimeIntervalNE(timeinterval1, timeinterval2)
-!
-! !RETURN VALUE:
- logical :: ESMF_TimeIntervalNE
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval1
- type(ESMF_TimeInterval), intent(in) :: timeinterval2
-
-! !DESCRIPTION:
-! Return true if both given time intervals are not equal, false otherwise.
-! Maps overloaded (/=) operator interface function to {\tt ESMF\_BaseTime}
-! base class.
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval1]
-! First time interval to compare
-! \item[timeinterval2]
-! Second time interval to compare
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.3, TMG2.4.3, TMG7.2
-!EOP
- CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalNE arg1' )
- CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalNE arg2' )
-
- ! call ESMC_BaseTime base class function
- call c_ESMC_BaseTimeIntNE(timeinterval1, timeinterval2, ESMF_TimeIntervalNE)
-
- end function ESMF_TimeIntervalNE
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalLT - Time interval 1 less than time interval 2 ?
-
-! !INTERFACE:
- function ESMF_TimeIntervalLT(timeinterval1, timeinterval2)
-!
-! !RETURN VALUE:
- logical :: ESMF_TimeIntervalLT
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval1
- type(ESMF_TimeInterval), intent(in) :: timeinterval2
-
-! !DESCRIPTION:
-! Return true if first time interval is less than second time interval,
-! false otherwise. Maps overloaded (<) operator interface function to
-! {\tt ESMF\_BaseTime} base class.
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval1]
-! First time interval to compare
-! \item[timeinterval2]
-! Second time interval to compare
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.3, TMG2.4.3, TMG7.2
-!EOP
- CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalLT arg1' )
- CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalLT arg2' )
-
- ! call ESMC_BaseTime base class function
- call c_ESMC_BaseTimeIntLT(timeinterval1, timeinterval2, ESMF_TimeIntervalLT)
-
- end function ESMF_TimeIntervalLT
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalGT - Time interval 1 greater than time interval 2?
-
-! !INTERFACE:
- function ESMF_TimeIntervalGT(timeinterval1, timeinterval2)
-!
-! !RETURN VALUE:
- logical :: ESMF_TimeIntervalGT
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval1
- type(ESMF_TimeInterval), intent(in) :: timeinterval2
-
-! !DESCRIPTION:
-! Return true if first time interval is greater than second time interval,
-! false otherwise. Maps overloaded (>) operator interface function to
-! {\tt ESMF\_BaseTime} base class.
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval1]
-! First time interval to compare
-! \item[timeinterval2]
-! Second time interval to compare
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.3, TMG2.4.3, TMG7.2
-!EOP
- CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalGT arg1' )
- CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalGT arg2' )
-
- ! call ESMC_BaseTime base class function
- call c_ESMC_BaseTimeIntGT(timeinterval1, timeinterval2, ESMF_TimeIntervalGT)
-
- end function ESMF_TimeIntervalGT
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalLE - Time interval 1 less than or equal to time interval 2 ?
-
-! !INTERFACE:
- function ESMF_TimeIntervalLE(timeinterval1, timeinterval2)
-
-! !RETURN VALUE:
- logical :: ESMF_TimeIntervalLE
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval1
- type(ESMF_TimeInterval), intent(in) :: timeinterval2
-
-! !DESCRIPTION:
-! Return true if first time interval is less than or equal to second time
-! interval, false otherwise.
-! Maps overloaded (<=) operator interface function to {\tt ESMF\_BaseTime}
-! base class.
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval1]
-! First time interval to compare
-! \item[timeinterval2]
-! Second time interval to compare
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.3, TMG2.4.3, TMG7.2
-!EOP
- CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalLE arg1' )
- CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalLE arg2' )
-
- ! call ESMC_BaseTime base class function
- call c_ESMC_BaseTimeIntLE(timeinterval1, timeinterval2, ESMF_TimeIntervalLE)
-
- end function ESMF_TimeIntervalLE
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalGE - Time interval 1 greater than or equal to time interval 2 ?
-
-! !INTERFACE:
- function ESMF_TimeIntervalGE(timeinterval1, timeinterval2)
-!
-! !RETURN VALUE:
- logical :: ESMF_TimeIntervalGE
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval1
- type(ESMF_TimeInterval), intent(in) :: timeinterval2
-
-! !DESCRIPTION:
-! Return true if first time interval is greater than or equal to second
-! time interval, false otherwise. Maps overloaded (>=) operator interface
-! function to {\tt ESMF\_BaseTime} base class.
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval1]
-! First time interval to compare
-! \item[timeinterval2]
-! Second time interval to compare
-! \end{description}
-!
-! !REQUIREMENTS:
-! TMG1.5.3, TMG2.4.3, TMG7.2
-!EOP
- CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalGE arg1' )
- CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalGE arg2' )
-
- ! call ESMC_BaseTime base class function
- call c_ESMC_BaseTimeIntGE(timeinterval1, timeinterval2, ESMF_TimeIntervalGE)
-
- end function ESMF_TimeIntervalGE
-
-
-!------------------------------------------------------------------------------
-!BOP
-! !IROUTINE: ESMF_TimeIntervalIsPositive - Time interval greater than zero?
-
-! !INTERFACE:
- function ESMF_TimeIntervalIsPositive(timeinterval)
-!
-! !RETURN VALUE:
- logical :: ESMF_TimeIntervalIsPositive
-
-! !ARGUMENTS:
- type(ESMF_TimeInterval), intent(in) :: timeinterval
-
-! !LOCALS:
- type(ESMF_TimeInterval) :: zerotimeint
- integer :: rcint
-
-! !DESCRIPTION:
-! Return true if time interval is greater than zero,
-! false otherwise.
-!
-! The arguments are:
-! \begin{description}
-! \item[timeinterval]
-! Time interval to compare
-! \end{description}
-!EOP
- CALL timeintchecknormalized( timeinterval, &
- 'ESMF_TimeIntervalIsPositive arg' )
-
- CALL ESMF_TimeIntervalSet ( zerotimeint, rc=rcint )
- IF ( rcint /= ESMF_SUCCESS ) THEN
- CALL wrf_error_fatal( &
- 'ESMF_TimeIntervalIsPositive: ESMF_TimeIntervalSet failed' )
- ENDIF
-! hack for bug in PGI 5.1-x
-! ESMF_TimeIntervalIsPositive = timeinterval > zerotimeint
- ESMF_TimeIntervalIsPositive = ESMF_TimeIntervalGT( timeinterval, &
- zerotimeint )
- end function ESMF_TimeIntervalIsPositive
-
- end module ESMF_TimeIntervalMod
-
-
Copied: branches/atmos_physics/src/external/esmf_time_f90/ESMF_TimeInterval.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/ESMF_TimeInterval.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/ESMF_TimeInterval.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_TimeInterval.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,1268 @@
+!
+! Earth System Modeling Framework
+! Copyright 2002-2003, University Corporation for Atmospheric Research,
+! Massachusetts Institute of Technology, Geophysical Fluid Dynamics
+! Laboratory, University of Michigan, National Centers for Environmental
+! Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
+! NASA Goddard Space Flight Center.
+! Licensed under the University of Illinois-NCSA license.
+!
+!==============================================================================
+!
+! ESMF TimeInterval Module
+ module ESMF_TimeIntervalMod
+!
+!==============================================================================
+!
+! This file contains the TimeInterval class definition and all TimeInterval
+! class methods.
+!
+!------------------------------------------------------------------------------
+! INCLUDES
+#include <ESMF_TimeMgr.inc>
+!
+!===============================================================================
+!BOPI
+! !MODULE: ESMF_TimeIntervalMod
+!
+! !DESCRIPTION:
+! Part of Time Manager F90 API wrapper of C++ implemenation
+!
+! Defines F90 wrapper entry points for corresponding
+! C++ implementaion of class {\tt ESMC\_TimeInterval}
+!
+! See {\tt ../include/ESMC\_TimeInterval.h} for complete description
+!
+!------------------------------------------------------------------------------
+! !USES:
+ ! inherit from ESMF base class
+ use ESMF_BaseMod
+
+ ! inherit from base time class
+ use ESMF_BaseTimeMod
+
+ ! associated derived types
+ use ESMF_FractionMod, only : ESMF_Fraction
+ use ESMF_CalendarMod
+
+ implicit none
+!
+!------------------------------------------------------------------------------
+! !PRIVATE TYPES:
+ private
+!------------------------------------------------------------------------------
+! ! ESMF_TimeInterval
+!
+! ! F90 class type to match C++ TimeInterval class in size only;
+! ! all dereferencing within class is performed by C++ implementation
+
+ type ESMF_TimeInterval
+ ! time interval is expressed as basetime
+ type(ESMF_BaseTime) :: basetime ! inherit base class
+ ! Relative year and month fields support monthly or yearly time
+ ! intervals. Many operations are undefined when these fields are
+ ! non-zero!
+ INTEGER :: YR ! relative year
+ !jm Month has no meaning for an interval; get rid of it, 20100319
+ ! INTEGER :: MM ! relative month
+ end type
+
+!------------------------------------------------------------------------------
+! !PUBLIC TYPES:
+ public ESMF_TimeInterval
+!------------------------------------------------------------------------------
+!
+! !PUBLIC MEMBER FUNCTIONS:
+ public ESMF_TimeIntervalGet
+ public ESMF_TimeIntervalSet
+ public ESMFold_TimeIntervalGetString
+ public ESMF_TimeIntervalAbsValue
+ public ESMF_TimeIntervalNegAbsValue
+
+! Required inherited and overridden ESMF_Base class methods
+
+!!!!!!!!! added 20051012, JM
+! public WRFADDITION_TimeIntervalDIVQuot
+!!!!!!!!! renamed to simplify testing 20060320, TH
+ public ESMF_TimeIntervalDIVQuot
+
+ ! This convenience routine is only used by other modules in
+ ! esmf_time_f90.
+ public ESMF_TimeIntervalIsPositive
+
+
+! !PRIVATE MEMBER FUNCTIONS:
+
+! overloaded operator functions
+
+ public operator(/)
+ private ESMF_TimeIntervalQuotI
+
+ public operator(*)
+ private ESMF_TimeIntervalProdI
+
+! Inherited and overloaded from ESMF_BaseTime
+
+ public operator(+)
+ private ESMF_TimeIntervalSum
+
+ public operator(-)
+ private ESMF_TimeIntervalDiff
+
+ public operator(.EQ.)
+ private ESMF_TimeIntervalEQ
+
+ public operator(.NE.)
+ private ESMF_TimeIntervalNE
+
+ public operator(.LT.)
+ private ESMF_TimeIntervalLT
+
+ public operator(.GT.)
+ private ESMF_TimeIntervalGT
+
+ public operator(.LE.)
+ private ESMF_TimeIntervalLE
+
+ public operator(.GE.)
+ private ESMF_TimeIntervalGE
+!EOPI
+
+!==============================================================================
+!
+! INTERFACE BLOCKS
+!
+!==============================================================================
+!BOP
+! !INTERFACE:
+ interface operator(*)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeIntervalProdI
+
+! !DESCRIPTION:
+! This interface overloads the * operator for the {\tt ESMF\_TimeInterval}
+! class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(/)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeIntervalQuotI
+
+! !DESCRIPTION:
+! This interface overloads the / operator for the
+! {\tt ESMF\_TimeInterval} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(+)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeIntervalSum
+
+! !DESCRIPTION:
+! This interface overloads the + operator for the
+! {\tt ESMF\_TimeInterval} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(-)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeIntervalDiff
+
+! !DESCRIPTION:
+! This interface overloads the - operator for the
+! {\tt ESMF\_TimeInterval} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(.EQ.)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeIntervalEQ
+
+! !DESCRIPTION:
+! This interface overloads the .EQ. operator for the
+! {\tt ESMF\_TimeInterval} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(.NE.)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeIntervalNE
+
+! !DESCRIPTION:
+! This interface overloads the .NE. operator for the
+! {\tt ESMF\_TimeInterval} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(.LT.)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeIntervalLT
+
+! !DESCRIPTION:
+! This interface overloads the .LT. operator for the
+! {\tt ESMF\_TimeInterval} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(.GT.)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeIntervalGT
+
+! !DESCRIPTION:
+! This interface overloads the .GT. operator for the
+! {\tt ESMF\_TimeInterval} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(.LE.)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeIntervalLE
+
+! !DESCRIPTION:
+! This interface overloads the .LE. operator for the
+! {\tt ESMF\_TimeInterval} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+!BOP
+! !INTERFACE:
+ interface operator(.GE.)
+
+! !PRIVATE MEMBER FUNCTIONS:
+ module procedure ESMF_TimeIntervalGE
+
+! !DESCRIPTION:
+! This interface overloads the .GE. operator for the
+! {\tt ESMF\_TimeInterval} class
+!
+!EOP
+ end interface
+!
+!------------------------------------------------------------------------------
+
+!==============================================================================
+
+ contains
+
+!==============================================================================
+!
+! Generic Get/Set routines which use F90 optional arguments
+!
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalGet - Get value in user-specified units
+
+! !INTERFACE:
+ subroutine ESMF_TimeIntervalGet(timeinterval, D, d_r8, S, S_i8, Sn, Sd, &
+ TimeString, rc )
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval
+ integer, intent(out), optional :: D
+ real(ESMF_KIND_R8), intent(out), optional :: d_r8
+ integer(ESMF_KIND_I8), intent(out), optional :: S_i8
+ integer, intent(out), optional :: S
+ integer, intent(out), optional :: Sn
+ integer, intent(out), optional :: Sd
+ character*(*), optional, intent(out) :: TimeString
+ integer, intent(out), optional :: rc
+
+
+! !DESCRIPTION:
+! Get the value of the {\tt ESMF\_TimeInterval} in units specified by the
+! user via F90 optional arguments.
+!
+! Time manager represents and manipulates time internally with integers
+! to maintain precision. Hence, user-specified floating point values are
+! converted internally from integers.
+!
+! See {\tt ../include/ESMC\_BaseTime.h} and
+! {\tt ../include/ESMC\_TimeInterval.h} for complete description.
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval]
+! The object instance to query
+! \item[{[YY]}]
+! Integer years (>= 32-bit)
+! \item[{[YYl]}]
+! Integer years (large, >= 64-bit)
+! \item[{[MO]}]
+! Integer months (>= 32-bit)
+! \item[{[MOl]}]
+! Integer months (large, >= 64-bit)
+! \item[{[D]}]
+! Integer days (>= 32-bit)
+! \item[{[Dl]}]
+! Integer days (large, >= 64-bit)
+! \item[{[H]}]
+! Integer hours
+! \item[{[M]}]
+! Integer minutes
+! \item[{[S]}]
+! Integer seconds (>= 32-bit)
+! \item[{[Sl]}]
+! Integer seconds (large, >= 64-bit)
+! \item[{[MS]}]
+! Integer milliseconds
+! \item[{[US]}]
+! Integer microseconds
+! \item[{[NS]}]
+! Integer nanoseconds
+! \item[{[d\_]}]
+! Double precision days
+! \item[{[h\_]}]
+! Double precision hours
+! \item[{[m\_]}]
+! Double precision minutes
+! \item[{[s\_]}]
+! Double precision seconds
+! \item[{[ms\_]}]
+! Double precision milliseconds
+! \item[{[us\_]}]
+! Double precision microseconds
+! \item[{[ns\_]}]
+! Double precision nanoseconds
+! \item[{[Sn]}]
+! Integer fractional seconds - numerator
+! \item[{[Sd]}]
+! Integer fractional seconds - denominator
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.1
+!
+! Added argument to output double precision seconds, S_i8
+! William.Gustafson@pnl.gov; 9-May-2008
+!
+!EOP
+ INTEGER(ESMF_KIND_I8) :: seconds
+ INTEGER :: ierr
+
+ ierr = ESMF_SUCCESS
+ seconds = timeinterval%basetime%S
+ ! note that S is overwritten below (if present) if other args are also
+ ! present
+ IF ( PRESENT(S) ) S = seconds
+ IF ( PRESENT(S_i8) ) S_i8 = seconds
+ IF ( PRESENT( D ) ) THEN
+ D = seconds / SECONDS_PER_DAY
+ IF ( PRESENT(S) ) S = MOD( seconds, SECONDS_PER_DAY )
+ IF ( PRESENT(S_i8) ) S_i8 = MOD( seconds, SECONDS_PER_DAY )
+ ENDIF
+ IF ( PRESENT( d_r8 ) ) THEN
+ D_r8 = REAL( seconds, ESMF_KIND_R8 ) / &
+ REAL( SECONDS_PER_DAY, ESMF_KIND_R8 )
+ IF ( PRESENT(S) ) S = MOD( seconds, SECONDS_PER_DAY )
+ IF ( PRESENT(S_i8) ) S_i8 = MOD( seconds, SECONDS_PER_DAY )
+ ENDIF
+ IF ( PRESENT(Sn) ) THEN
+ Sn = timeinterval%basetime%Sn
+ ENDIF
+ IF ( PRESENT(Sd) ) THEN
+ Sd = timeinterval%basetime%Sd
+ ENDIF
+ IF ( PRESENT( timeString ) ) THEN
+ CALL ESMFold_TimeIntervalGetString( timeinterval, timeString, rc=ierr )
+ ENDIF
+ IF ( PRESENT(rc) ) rc = ierr
+
+ end subroutine ESMF_TimeIntervalGet
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalSet - Initialize via user-specified unit set
+
+! !INTERFACE:
+ subroutine ESMF_TimeIntervalSet(timeinterval, YY, YYl, MM, MOl, D, Dl, &
+ H, M, S, Sl, MS, US, NS, &
+ d_, h_, m_, s_, ms_, us_, ns_, &
+ Sn, Sd, rc)
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(out) :: timeinterval
+ integer, intent(in), optional :: YY
+ integer(ESMF_KIND_I8), intent(in), optional :: YYl
+ integer, intent(in), optional :: MM
+ integer(ESMF_KIND_I8), intent(in), optional :: MOl
+ integer, intent(in), optional :: D
+ integer(ESMF_KIND_I8), intent(in), optional :: Dl
+ integer, intent(in), optional :: H
+ integer, intent(in), optional :: M
+ integer, intent(in), optional :: S
+ integer(ESMF_KIND_I8), intent(in), optional :: Sl
+ integer, intent(in), optional :: MS
+ integer, intent(in), optional :: US
+ integer, intent(in), optional :: NS
+ double precision, intent(in), optional :: d_
+ double precision, intent(in), optional :: h_
+ double precision, intent(in), optional :: m_
+ double precision, intent(in), optional :: s_
+ double precision, intent(in), optional :: ms_
+ double precision, intent(in), optional :: us_
+ double precision, intent(in), optional :: ns_
+ integer, intent(in), optional :: Sn
+ integer, intent(in), optional :: Sd
+ integer, intent(out), optional :: rc
+ ! locals
+ INTEGER :: nfeb
+
+! !DESCRIPTION:
+! Set the value of the {\tt ESMF\_TimeInterval} in units specified by
+! the user via F90 optional arguments
+!
+! Time manager represents and manipulates time internally with integers
+! to maintain precision. Hence, user-specified floating point values are
+! converted internally to integers.
+!
+! See {\tt ../include/ESMC\_BaseTime.h} and
+! {\tt ../include/ESMC\_TimeInterval.h} for complete description.
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval]
+! The object instance to initialize
+! \item[{[YY]}]
+! Integer number of interval years (>= 32-bit)
+! \item[{[YYl]}]
+! Integer number of interval years (large, >= 64-bit)
+! \item[{[MM]}]
+! Integer number of interval months (>= 32-bit)
+! \item[{[MOl]}]
+! Integer number of interval months (large, >= 64-bit)
+! \item[{[D]}]
+! Integer number of interval days (>= 32-bit)
+! \item[{[Dl]}]
+! Integer number of interval days (large, >= 64-bit)
+! \item[{[H]}]
+! Integer hours
+! \item[{[M]}]
+! Integer minutes
+! \item[{[S]}]
+! Integer seconds (>= 32-bit)
+! \item[{[Sl]}]
+! Integer seconds (large, >= 64-bit)
+! \item[{[MS]}]
+! Integer milliseconds
+! \item[{[US]}]
+! Integer microseconds
+! \item[{[NS]}]
+! Integer nanoseconds
+! \item[{[d\_]}]
+! Double precision days
+! \item[{[h\_]}]
+! Double precision hours
+! \item[{[m\_]}]
+! Double precision minutes
+! \item[{[s\_]}]
+! Double precision seconds
+! \item[{[ms\_]}]
+! Double precision milliseconds
+! \item[{[us\_]}]
+! Double precision microseconds
+! \item[{[ns\_]}]
+! Double precision nanoseconds
+! \item[{[Sn]}]
+! Integer fractional seconds - numerator
+! \item[{[Sd]}]
+! Integer fractional seconds - denominator
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMGn.n.n
+!EOP
+
+ IF ( PRESENT(rc) ) rc = ESMF_FAILURE
+ ! note that YR and MM are relative
+ timeinterval%YR = 0
+ IF ( PRESENT( YY ) ) THEN
+ timeinterval%YR = YY
+ ENDIF
+!jm timeinterval%MM = 0
+!jm IF ( PRESENT( MM ) ) THEN
+!jm timeinterval%MM = MM
+!jm ENDIF
+!jm ! Rollover months to years
+!jm IF ( abs(timeinterval%MM) .GE. MONTHS_PER_YEAR ) THEN
+!jm timeinterval%YR = timeinterval%YR + timeinterval%MM/MONTHS_PER_YEAR
+!jm timeinterval%MM = mod(timeinterval%MM,MONTHS_PER_YEAR)
+!jm ENDIF
+
+ timeinterval%basetime%S = 0
+ ! For 365-day calendar, immediately convert years to days since we know
+ ! how to do it in this case.
+!$$$ replace this hack with something saner...
+ IF ( nfeb( 2004 ) == 28 ) THEN
+ timeinterval%basetime%S = timeinterval%basetime%S + &
+ ( 365_ESMF_KIND_I8 * &
+ INT( timeinterval%YR, ESMF_KIND_I8 ) * SECONDS_PER_DAY )
+ timeinterval%YR = 0
+ ENDIF
+ IF ( PRESENT( D ) ) THEN
+ timeinterval%basetime%S = timeinterval%basetime%S + &
+ ( SECONDS_PER_DAY * INT( D, ESMF_KIND_I8 ) )
+ ENDIF
+!$$$ Push H,M,S,Sn,Sd,MS down into BaseTime constructor from EVERYWHERE
+!$$$ and THEN add ESMF scaling behavior when other args are present...
+ IF ( PRESENT( H ) ) THEN
+ timeinterval%basetime%S = timeinterval%basetime%S + &
+ ( SECONDS_PER_HOUR * INT( H, ESMF_KIND_I8 ) )
+ ENDIF
+ IF ( PRESENT( M ) ) THEN
+ timeinterval%basetime%S = timeinterval%basetime%S + &
+ ( SECONDS_PER_MINUTE * INT( M, ESMF_KIND_I8 ) )
+ ENDIF
+ IF ( PRESENT( S ) ) THEN
+ timeinterval%basetime%S = timeinterval%basetime%S + &
+ INT( S, ESMF_KIND_I8 )
+ ENDIF
+ IF ( PRESENT( Sn ) .AND. ( .NOT. PRESENT( Sd ) ) ) THEN
+ CALL wrf_error_fatal( &
+ "ESMF_TimeIntervalSet: Must specify Sd if Sn is specified")
+ ENDIF
+ IF ( PRESENT( Sd ) .AND. PRESENT( MS ) ) THEN
+ CALL wrf_error_fatal( &
+ "ESMF_TimeIntervalSet: Must not specify both Sd and MS")
+ ENDIF
+ timeinterval%basetime%Sn = 0
+ timeinterval%basetime%Sd = 0
+ IF ( PRESENT( MS ) ) THEN
+ timeinterval%basetime%Sn = MS
+ timeinterval%basetime%Sd = 1000_ESMF_KIND_I8
+ ELSE IF ( PRESENT( Sd ) ) THEN
+ timeinterval%basetime%Sd = Sd
+ IF ( PRESENT( Sn ) ) THEN
+ timeinterval%basetime%Sn = Sn
+ ENDIF
+ ENDIF
+ CALL normalize_timeint( timeinterval )
+
+ IF ( PRESENT(rc) ) rc = ESMF_SUCCESS
+
+ end subroutine ESMF_TimeIntervalSet
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMFold_TimeIntervalGetString - Get time interval value in string format
+
+! !INTERFACE:
+ subroutine ESMFold_TimeIntervalGetString(timeinterval, TimeString, rc)
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval
+ character*(*), intent(out) :: TimeString
+ integer, intent(out), optional :: rc
+ ! locals
+ integer :: signnormtimeint
+ LOGICAL :: negative
+ INTEGER(ESMF_KIND_I8) :: iS, iSn, iSd, H, M, S
+ character (len=1) :: signstr
+
+! !DESCRIPTION:
+! Convert {\tt ESMF\_TimeInterval}'s value into string format
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval]
+! The object instance to convert
+! \item[TimeString]
+! The string to return
+! \item[{[rc]}]
+! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.9
+!EOP
+
+! NOTE: YR, MM, Sn, and Sd are not yet included in the returned string...
+!PRINT *,'DEBUG ESMFold_TimeIntervalGetString(): YR,MM,S,Sn,Sd = ', &
+! timeinterval%YR, &
+! timeinterval%MM, &
+! timeinterval%basetime%S, &
+! timeinterval%basetime%Sn, &
+! timeinterval%basetime%Sd
+
+ negative = ( signnormtimeint( timeInterval ) == -1 )
+ IF ( negative ) THEN
+ iS = -timeinterval%basetime%S
+ iSn = -timeinterval%basetime%Sn
+ signstr = '-'
+ ELSE
+ iS = timeinterval%basetime%S
+ iSn = timeinterval%basetime%Sn
+ signstr = ''
+ ENDIF
+ iSd = timeinterval%basetime%Sd
+
+ H = mod( iS, SECONDS_PER_DAY ) / SECONDS_PER_HOUR
+ M = mod( iS, SECONDS_PER_HOUR) / SECONDS_PER_MINUTE
+ S = mod( iS, SECONDS_PER_MINUTE )
+
+!$$$here... need to print Sn and Sd when they are used ???
+
+ write(TimeString,FMT="(A,I10.10,'_',I3.3,':',I3.3,':',I3.3)") &
+ TRIM(signstr), ( iS / SECONDS_PER_DAY ), H, M, S
+
+!write(0,*)'TimeIntervalGetString Sn ',timeinterval%basetime%Sn,' Sd ',timeinterval%basetime%Sd
+
+ rc = ESMF_SUCCESS
+
+ end subroutine ESMFold_TimeIntervalGetString
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalAbsValue - Get the absolute value of a time interval
+
+! !INTERFACE:
+ function ESMF_TimeIntervalAbsValue(timeinterval)
+
+! !RETURN VALUE:
+ type(ESMF_TimeInterval) :: ESMF_TimeIntervalAbsValue
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval
+! !LOCAL:
+ integer :: rc
+
+! !DESCRIPTION:
+! Return a {\tt ESMF\_TimeInterval}'s absolute value.
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval]
+! The object instance to take the absolute value of.
+! Absolute value returned as value of function.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.8
+!EOP
+ CALL timeintchecknormalized( timeinterval, 'ESMF_TimeIntervalAbsValue arg1' )
+ ESMF_TimeIntervalAbsValue = timeinterval
+!$$$here... move implementation into BaseTime
+ ESMF_TimeIntervalAbsValue%basetime%S = &
+ abs(ESMF_TimeIntervalAbsValue%basetime%S)
+ ESMF_TimeIntervalAbsValue%basetime%Sn = &
+ abs(ESMF_TimeIntervalAbsValue%basetime%Sn )
+
+ end function ESMF_TimeIntervalAbsValue
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalNegAbsValue - Get the negative absolute value of a time interval
+
+! !INTERFACE:
+ function ESMF_TimeIntervalNegAbsValue(timeinterval)
+
+! !RETURN VALUE:
+ type(ESMF_TimeInterval) :: ESMF_TimeIntervalNegAbsValue
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval
+! !LOCAL:
+ integer :: rc
+
+! !DESCRIPTION:
+! Return a {\tt ESMF\_TimeInterval}'s negative absolute value.
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval]
+! The object instance to take the negative absolute value of.
+! Negative absolute value returned as value of function.
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.8
+!EOP
+ CALL timeintchecknormalized( timeinterval, 'ESMF_TimeIntervalNegAbsValue arg1' )
+
+ ESMF_TimeIntervalNegAbsValue = timeinterval
+!$$$here... move implementation into BaseTime
+ ESMF_TimeIntervalNegAbsValue%basetime%S = &
+ -abs(ESMF_TimeIntervalNegAbsValue%basetime%S)
+ ESMF_TimeIntervalNegAbsValue%basetime%Sn = &
+ -abs(ESMF_TimeIntervalNegAbsValue%basetime%Sn )
+
+ end function ESMF_TimeIntervalNegAbsValue
+
+!------------------------------------------------------------------------------
+!
+! This section includes overloaded operators defined only for TimeInterval
+! (not inherited from BaseTime)
+! Note: these functions do not have a return code, since F90 forbids more
+! than 2 arguments for arithmetic overloaded operators
+!
+!------------------------------------------------------------------------------
+
+!!!!!!!!!!!!!!!!!! added jm 20051012
+! new WRF-specific function, Divide two time intervals and return the whole integer, without remainder
+ function ESMF_TimeIntervalDIVQuot(timeinterval1, timeinterval2)
+
+! !RETURN VALUE:
+ INTEGER :: ESMF_TimeIntervalDIVQuot
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval1
+ type(ESMF_TimeInterval), intent(in) :: timeinterval2
+
+! !LOCAL
+ INTEGER :: retval, isgn, rc
+ type(ESMF_TimeInterval) :: zero, i1,i2
+
+! !DESCRIPTION:
+! Returns timeinterval1 divided by timeinterval2 as a fraction quotient.
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval1]
+! The dividend
+! \item[timeinterval2]
+! The divisor
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.5
+!EOP
+
+ CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalDIVQuot arg1' )
+ CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalDIVQuot arg2' )
+
+ call ESMF_TimeIntervalSet( zero, rc=rc )
+ i1 = timeinterval1
+ i2 = timeinterval2
+ isgn = 1
+ if ( i1 .LT. zero ) then
+ i1 = ESMF_TimeIntervalProdI(i1, -1)
+ isgn = -isgn
+ endif
+ if ( i2 .LT. zero ) then
+ i2 = ESMF_TimeIntervalProdI(i2, -1)
+ isgn = -isgn
+ endif
+! repeated subtraction
+ retval = 0
+ DO WHILE ( i1 .GE. i2 )
+ i1 = i1 - i2
+ retval = retval + 1
+ ENDDO
+ retval = retval * isgn
+
+ ESMF_TimeIntervalDIVQuot = retval
+
+ end function ESMF_TimeIntervalDIVQuot
+!!!!!!!!!!!!!!!!!!
+
+
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalQuotI - Divide time interval by an integer, return time interval result
+
+! !INTERFACE:
+ function ESMF_TimeIntervalQuotI(timeinterval, divisor)
+
+! !RETURN VALUE:
+ type(ESMF_TimeInterval) :: ESMF_TimeIntervalQuotI
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval
+ integer, intent(in) :: divisor
+
+! !DESCRIPTION:
+! Divides a {\tt ESMF\_TimeInterval} by an integer divisor, returns
+! quotient as a {\tt ESMF\_TimeInterval}
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval]
+! The dividend
+! \item[divisor]
+! Integer divisor
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.6, TMG5.3, TMG7.2
+!EOP
+
+!PRINT *,'DEBUG ESMF_TimeIntervalQuotI() A: S,Sn,Sd = ', &
+! timeinterval%basetime%S,timeinterval%basetime%Sn,timeinterval%basetime%Sd
+!PRINT *,'DEBUG ESMF_TimeIntervalQuotI() A: divisor = ', divisor
+
+ CALL timeintchecknormalized( timeinterval, 'ESMF_TimeIntervalQuotI arg1' )
+
+ IF ( divisor == 0 ) THEN
+ CALL wrf_error_fatal( 'ESMF_TimeIntervalQuotI: divide by zero' )
+ ENDIF
+ ESMF_TimeIntervalQuotI = timeinterval
+!PRINT *,'DEBUG ESMF_TimeIntervalQuotI() B: S,Sn,Sd = ', &
+! ESMF_TimeIntervalQuotI%basetime%S,ESMF_TimeIntervalQuotI%basetime%Sn,ESMF_TimeIntervalQuotI%basetime%Sd
+ ESMF_TimeIntervalQuotI%basetime = &
+ timeinterval%basetime / divisor
+!PRINT *,'DEBUG ESMF_TimeIntervalQuotI() C: S,Sn,Sd = ', &
+! ESMF_TimeIntervalQuotI%basetime%S,ESMF_TimeIntervalQuotI%basetime%Sn,ESMF_TimeIntervalQuotI%basetime%Sd
+
+ CALL normalize_timeint( ESMF_TimeIntervalQuotI )
+!PRINT *,'DEBUG ESMF_TimeIntervalQuotI() D: S,Sn,Sd = ', &
+! ESMF_TimeIntervalQuotI%basetime%S,ESMF_TimeIntervalQuotI%basetime%Sn,ESMF_TimeIntervalQuotI%basetime%Sd
+
+ end function ESMF_TimeIntervalQuotI
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalProdI - Multiply a time interval by an integer
+
+! !INTERFACE:
+ function ESMF_TimeIntervalProdI(timeinterval, multiplier)
+
+! !RETURN VALUE:
+ type(ESMF_TimeInterval) :: ESMF_TimeIntervalProdI
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval
+ integer, intent(in) :: multiplier
+! !LOCAL:
+ integer :: rc
+
+! !DESCRIPTION:
+! Multiply a {\tt ESMF\_TimeInterval} by an integer, return product as a
+! {\tt ESMF\_TimeInterval}
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval]
+! The multiplicand
+! \item[mutliplier]
+! Integer multiplier
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.7, TMG7.2
+!EOP
+ CALL timeintchecknormalized( timeinterval, 'ESMF_TimeIntervalProdI arg1' )
+
+ CALL ESMF_TimeIntervalSet( ESMF_TimeIntervalProdI, rc=rc )
+!$$$move this into overloaded operator(*) in BaseTime
+ ESMF_TimeIntervalProdI%basetime%S = &
+ timeinterval%basetime%S * INT( multiplier, ESMF_KIND_I8 )
+ ESMF_TimeIntervalProdI%basetime%Sn = &
+ timeinterval%basetime%Sn * INT( multiplier, ESMF_KIND_I8 )
+ ! Don't multiply Sd
+ ESMF_TimeIntervalProdI%basetime%Sd = timeinterval%basetime%Sd
+ CALL normalize_timeint( ESMF_TimeIntervalProdI )
+
+ end function ESMF_TimeIntervalProdI
+
+!------------------------------------------------------------------------------
+!
+! This section includes the inherited ESMF_BaseTime class overloaded operators
+!
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalSum - Add two time intervals together
+
+! !INTERFACE:
+ function ESMF_TimeIntervalSum(timeinterval1, timeinterval2)
+
+! !RETURN VALUE:
+ type(ESMF_TimeInterval) :: ESMF_TimeIntervalSum
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval1
+ type(ESMF_TimeInterval), intent(in) :: timeinterval2
+! !LOCAL:
+ integer :: rc
+! !DESCRIPTION:
+! Add two {\tt ESMF\_TimeIntervals}, return sum as a
+! {\tt ESMF\_TimeInterval}. Maps overloaded (+) operator interface
+! function to {\tt ESMF\_BaseTime} base class.
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval1]
+! The augend
+! \item[timeinterval2]
+! The addend
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.4, TMG2.4.4, TMG2.4.5, TMG2.4.6, TMG5.1, TMG5.2,
+! TMG7.2
+!EOP
+ CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalSum arg1' )
+ CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalSum arg2' )
+
+ ESMF_TimeIntervalSum = timeinterval1
+ ESMF_TimeIntervalSum%basetime = ESMF_TimeIntervalSum%basetime + &
+ timeinterval2%basetime
+
+ CALL normalize_timeint( ESMF_TimeIntervalSum )
+
+ end function ESMF_TimeIntervalSum
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalDiff - Subtract one time interval from another
+
+! !INTERFACE:
+ function ESMF_TimeIntervalDiff(timeinterval1, timeinterval2)
+
+! !RETURN VALUE:
+ type(ESMF_TimeInterval) :: ESMF_TimeIntervalDiff
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval1
+ type(ESMF_TimeInterval), intent(in) :: timeinterval2
+! !LOCAL:
+ integer :: rc
+! !DESCRIPTION:
+! Subtract timeinterval2 from timeinterval1, return remainder as a
+! {\tt ESMF\_TimeInterval}.
+! Map overloaded (-) operator interface function to {\tt ESMF\_BaseTime}
+! base class.
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval1]
+! The minuend
+! \item[timeinterval2]
+! The subtrahend
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.4, TMG2.4.4, TMG2.4.5, TMG2.4.6, TMG5.1, TMG5.2, TMG7.2
+!EOP
+ CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalDiff arg1' )
+ CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalDiff arg2' )
+
+ ESMF_TimeIntervalDiff = timeinterval1
+ ESMF_TimeIntervalDiff%basetime = ESMF_TimeIntervalDiff%basetime - &
+ timeinterval2%basetime
+ CALL normalize_timeint( ESMF_TimeIntervalDiff )
+
+ end function ESMF_TimeIntervalDiff
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalEQ - Compare two time intervals for equality
+
+! !INTERFACE:
+ function ESMF_TimeIntervalEQ(timeinterval1, timeinterval2)
+!
+! !RETURN VALUE:
+ logical :: ESMF_TimeIntervalEQ
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval1
+ type(ESMF_TimeInterval), intent(in) :: timeinterval2
+
+!DESCRIPTION:
+! Return true if both given time intervals are equal, false otherwise.
+! Maps overloaded (==) operator interface function to {\tt ESMF\_BaseTime}
+! base class.
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval1]
+! First time interval to compare
+! \item[timeinterval2]
+! Second time interval to compare
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.3, TMG2.4.3, TMG7.2
+!EOP
+ CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalEQ arg1' )
+ CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalEQ arg2' )
+
+!$$$here... move all this out of Meat.F90 ?
+ ! call ESMC_BaseTime base class function
+ call c_ESMC_BaseTimeIntEQ(timeinterval1, timeinterval2, ESMF_TimeIntervalEQ)
+
+ end function ESMF_TimeIntervalEQ
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalNE - Compare two time intervals for inequality
+
+! !INTERFACE:
+ function ESMF_TimeIntervalNE(timeinterval1, timeinterval2)
+!
+! !RETURN VALUE:
+ logical :: ESMF_TimeIntervalNE
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval1
+ type(ESMF_TimeInterval), intent(in) :: timeinterval2
+
+! !DESCRIPTION:
+! Return true if both given time intervals are not equal, false otherwise.
+! Maps overloaded (/=) operator interface function to {\tt ESMF\_BaseTime}
+! base class.
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval1]
+! First time interval to compare
+! \item[timeinterval2]
+! Second time interval to compare
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.3, TMG2.4.3, TMG7.2
+!EOP
+ CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalNE arg1' )
+ CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalNE arg2' )
+
+ ! call ESMC_BaseTime base class function
+ call c_ESMC_BaseTimeIntNE(timeinterval1, timeinterval2, ESMF_TimeIntervalNE)
+
+ end function ESMF_TimeIntervalNE
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalLT - Time interval 1 less than time interval 2 ?
+
+! !INTERFACE:
+ function ESMF_TimeIntervalLT(timeinterval1, timeinterval2)
+!
+! !RETURN VALUE:
+ logical :: ESMF_TimeIntervalLT
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval1
+ type(ESMF_TimeInterval), intent(in) :: timeinterval2
+
+! !DESCRIPTION:
+! Return true if first time interval is less than second time interval,
+! false otherwise. Maps overloaded (<) operator interface function to
+! {\tt ESMF\_BaseTime} base class.
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval1]
+! First time interval to compare
+! \item[timeinterval2]
+! Second time interval to compare
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.3, TMG2.4.3, TMG7.2
+!EOP
+ CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalLT arg1' )
+ CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalLT arg2' )
+
+ ! call ESMC_BaseTime base class function
+ call c_ESMC_BaseTimeIntLT(timeinterval1, timeinterval2, ESMF_TimeIntervalLT)
+
+ end function ESMF_TimeIntervalLT
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalGT - Time interval 1 greater than time interval 2?
+
+! !INTERFACE:
+ function ESMF_TimeIntervalGT(timeinterval1, timeinterval2)
+!
+! !RETURN VALUE:
+ logical :: ESMF_TimeIntervalGT
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval1
+ type(ESMF_TimeInterval), intent(in) :: timeinterval2
+
+! !DESCRIPTION:
+! Return true if first time interval is greater than second time interval,
+! false otherwise. Maps overloaded (>) operator interface function to
+! {\tt ESMF\_BaseTime} base class.
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval1]
+! First time interval to compare
+! \item[timeinterval2]
+! Second time interval to compare
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.3, TMG2.4.3, TMG7.2
+!EOP
+ CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalGT arg1' )
+ CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalGT arg2' )
+
+ ! call ESMC_BaseTime base class function
+ call c_ESMC_BaseTimeIntGT(timeinterval1, timeinterval2, ESMF_TimeIntervalGT)
+
+ end function ESMF_TimeIntervalGT
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalLE - Time interval 1 less than or equal to time interval 2 ?
+
+! !INTERFACE:
+ function ESMF_TimeIntervalLE(timeinterval1, timeinterval2)
+
+! !RETURN VALUE:
+ logical :: ESMF_TimeIntervalLE
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval1
+ type(ESMF_TimeInterval), intent(in) :: timeinterval2
+
+! !DESCRIPTION:
+! Return true if first time interval is less than or equal to second time
+! interval, false otherwise.
+! Maps overloaded (<=) operator interface function to {\tt ESMF\_BaseTime}
+! base class.
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval1]
+! First time interval to compare
+! \item[timeinterval2]
+! Second time interval to compare
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.3, TMG2.4.3, TMG7.2
+!EOP
+ CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalLE arg1' )
+ CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalLE arg2' )
+
+ ! call ESMC_BaseTime base class function
+ call c_ESMC_BaseTimeIntLE(timeinterval1, timeinterval2, ESMF_TimeIntervalLE)
+
+ end function ESMF_TimeIntervalLE
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalGE - Time interval 1 greater than or equal to time interval 2 ?
+
+! !INTERFACE:
+ function ESMF_TimeIntervalGE(timeinterval1, timeinterval2)
+!
+! !RETURN VALUE:
+ logical :: ESMF_TimeIntervalGE
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval1
+ type(ESMF_TimeInterval), intent(in) :: timeinterval2
+
+! !DESCRIPTION:
+! Return true if first time interval is greater than or equal to second
+! time interval, false otherwise. Maps overloaded (>=) operator interface
+! function to {\tt ESMF\_BaseTime} base class.
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval1]
+! First time interval to compare
+! \item[timeinterval2]
+! Second time interval to compare
+! \end{description}
+!
+! !REQUIREMENTS:
+! TMG1.5.3, TMG2.4.3, TMG7.2
+!EOP
+ CALL timeintchecknormalized( timeinterval1, 'ESMF_TimeIntervalGE arg1' )
+ CALL timeintchecknormalized( timeinterval2, 'ESMF_TimeIntervalGE arg2' )
+
+ ! call ESMC_BaseTime base class function
+ call c_ESMC_BaseTimeIntGE(timeinterval1, timeinterval2, ESMF_TimeIntervalGE)
+
+ end function ESMF_TimeIntervalGE
+
+
+!------------------------------------------------------------------------------
+!BOP
+! !IROUTINE: ESMF_TimeIntervalIsPositive - Time interval greater than zero?
+
+! !INTERFACE:
+ function ESMF_TimeIntervalIsPositive(timeinterval)
+!
+! !RETURN VALUE:
+ logical :: ESMF_TimeIntervalIsPositive
+
+! !ARGUMENTS:
+ type(ESMF_TimeInterval), intent(in) :: timeinterval
+
+! !LOCALS:
+ type(ESMF_TimeInterval) :: zerotimeint
+ integer :: rcint
+
+! !DESCRIPTION:
+! Return true if time interval is greater than zero,
+! false otherwise.
+!
+! The arguments are:
+! \begin{description}
+! \item[timeinterval]
+! Time interval to compare
+! \end{description}
+!EOP
+ CALL timeintchecknormalized( timeinterval, &
+ 'ESMF_TimeIntervalIsPositive arg' )
+
+ CALL ESMF_TimeIntervalSet ( zerotimeint, rc=rcint )
+ IF ( rcint /= ESMF_SUCCESS ) THEN
+ CALL wrf_error_fatal( &
+ 'ESMF_TimeIntervalIsPositive: ESMF_TimeIntervalSet failed' )
+ ENDIF
+! hack for bug in PGI 5.1-x
+! ESMF_TimeIntervalIsPositive = timeinterval > zerotimeint
+ ESMF_TimeIntervalIsPositive = ESMF_TimeIntervalGT( timeinterval, &
+ zerotimeint )
+ end function ESMF_TimeIntervalIsPositive
+
+ end module ESMF_TimeIntervalMod
+
+
Deleted: branches/atmos_physics/src/external/esmf_time_f90/ESMF_TimeMgr.inc
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/ESMF_TimeMgr.inc        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_TimeMgr.inc        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,61 +0,0 @@
-#if 0
-
-Earth System Modeling Framework
-Copyright 2002-2003, University Corporation for Atmospheric Research,
-Massachusetts Institute of Technology, Geophysical Fluid Dynamics
-Laboratory, University of Michigan, National Centers for Environmental
-Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
-NASA Goddard Space Flight Center.
-Licensed under the University of Illinois-NCSA license.
-
-Do not have C++ or F90 style comments in here because this file is processed
-by both C++ and F90 compilers.
-#endif
-
-#ifndef ESMF_TimeMgr_INC
-#define ESMF_TimeMgr_INC
-
-#if 0
-!BOP
--------------------------------------------------------------------------
-
- !DESCRIPTION:
-
- ESMF TimeMgr include file for F90
- The code in this file implements constants and macros for the TimeMgr...
-
--------------------------------------------------------------------------
-!EOP
-#endif
-
-#include <ESMF_Macros.inc>
-
-#define SECONDS_PER_DAY 86400_ESMF_KIND_I8
-#define SECONDS_PER_HOUR 3600_ESMF_KIND_I8
-#define SECONDS_PER_MINUTE 60_ESMF_KIND_I8
-#define HOURS_PER_DAY 24_ESMF_KIND_I8
-
-! Note that MAX_ALARMS must match MAX_WRF_ALARMS defined in
-! ../../frame/module_domain.F !!! Eliminate this dependence with
-! grow-as-you-go AlarmList in ESMF_Clock...
-#define MAX_HISTORY 10
-#define MAX_ALARMS (2*(MAX_HISTORY)+10)
-
-! TBH: TODO: Hook this into the WRF build so WRF can use either "no-leap" or
-! TBH: Gregorian calendar. Now WRF is hard-wired to use Gregorian.
-!#undef NO_LEAP_CALENDAR
-!#ifdef COUP_CSM
-!#define NO_LEAP_CALENDAR
-!#endif
-
-! TBH: When NO_DT_COMPONENT_INIT is set, code that uses F95 compile-time
-! TBH: initialization of components of derived types is not included.
-! TBH: Some older compilers like PGI 5.x do not support this F95
-! TBH: feature.
-!#ifdef NO_LEAP_CALENDAR
-!#undef NO_DT_COMPONENT_INIT
-!#else
-!#define NO_DT_COMPONENT_INIT
-!#endif
-
-#endif
Copied: branches/atmos_physics/src/external/esmf_time_f90/ESMF_TimeMgr.inc (from rev 968, trunk/mpas/src/external/esmf_time_f90/ESMF_TimeMgr.inc)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/ESMF_TimeMgr.inc         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/ESMF_TimeMgr.inc        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,61 @@
+#if 0
+
+Earth System Modeling Framework
+Copyright 2002-2003, University Corporation for Atmospheric Research,
+Massachusetts Institute of Technology, Geophysical Fluid Dynamics
+Laboratory, University of Michigan, National Centers for Environmental
+Prediction, Los Alamos National Laboratory, Argonne National Laboratory,
+NASA Goddard Space Flight Center.
+Licensed under the University of Illinois-NCSA license.
+
+Do not have C++ or F90 style comments in here because this file is processed
+by both C++ and F90 compilers.
+#endif
+
+#ifndef ESMF_TimeMgr_INC
+#define ESMF_TimeMgr_INC
+
+#if 0
+!BOP
+-------------------------------------------------------------------------
+
+ !DESCRIPTION:
+
+ ESMF TimeMgr include file for F90
+ The code in this file implements constants and macros for the TimeMgr...
+
+-------------------------------------------------------------------------
+!EOP
+#endif
+
+#include <ESMF_Macros.inc>
+
+#define SECONDS_PER_DAY 86400_ESMF_KIND_I8
+#define SECONDS_PER_HOUR 3600_ESMF_KIND_I8
+#define SECONDS_PER_MINUTE 60_ESMF_KIND_I8
+#define HOURS_PER_DAY 24_ESMF_KIND_I8
+
+! Note that MAX_ALARMS must match MAX_WRF_ALARMS defined in
+! ../../frame/module_domain.F !!! Eliminate this dependence with
+! grow-as-you-go AlarmList in ESMF_Clock...
+#define MAX_HISTORY 10
+#define MAX_ALARMS (2*(MAX_HISTORY)+10)
+
+! TBH: TODO: Hook this into the WRF build so WRF can use either "no-leap" or
+! TBH: Gregorian calendar. Now WRF is hard-wired to use Gregorian.
+!#undef NO_LEAP_CALENDAR
+!#ifdef COUP_CSM
+!#define NO_LEAP_CALENDAR
+!#endif
+
+! TBH: When NO_DT_COMPONENT_INIT is set, code that uses F95 compile-time
+! TBH: initialization of components of derived types is not included.
+! TBH: Some older compilers like PGI 5.x do not support this F95
+! TBH: feature.
+!#ifdef NO_LEAP_CALENDAR
+!#undef NO_DT_COMPONENT_INIT
+!#else
+!#define NO_DT_COMPONENT_INIT
+!#endif
+
+#endif
Deleted: branches/atmos_physics/src/external/esmf_time_f90/Makefile
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/Makefile        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/Makefile        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,104 +0,0 @@
-# To build this by itself, use the make target esmf_time_f90_only
-# from the top-level WRF Makefile.
-# > cd ../..
-# configure
-# make esmf_time_f90_only
-
-.SUFFIXES: .F90 .o .f
-
-# get rid of single quotes after comments
-# WARNING: This will break if a quoted string is followed by a comment that has
-# a single quote.
-SED_FTN = sed -e "/\!.*'/s/'//g"
-
-RM = /bin/rm -f
-AR = ar
-RANLIB = ranlib
-FGREP = fgrep -iq
-
-OBJS = ESMF_Alarm.o ESMF_BaseTime.o ESMF_Clock.o ESMF_Time.o \
- Meat.o ESMF_Base.o ESMF_Calendar.o ESMF_Fraction.o \
- ESMF_TimeInterval.o ESMF_Stubs.o ESMF_Mod.o \
- module_symbols_util.o \
-        module_utility.o ESMF_AlarmClock.o
-
-default: libesmf_time.a
-
-tests: Test1_ESMF.exe Test1_WRFU.exe
-
-libesmf_time.a : $(OBJS)
-        $(RM) libesmf_time.a
-        if [ "$(AR)" != "lib.exe" ] ; then \
- $(AR) ru libesmf_time.a $(OBJS) ; \
- else \
- $(AR) /out:libesmf_time.a $(OBJS) ; \
- fi
-        $(RANLIB) libesmf_time.a
-
-Test1_ESMF.f : Test1.F90
-        $(RM) Test1_ESMF.b Test1_ESMF.f
-        cp Test1.F90 Test1_ESMF.b
-        $(CPP) -C -P -I. Test1_ESMF.b > Test1_ESMF.f
-
-Test1_ESMF.exe : libesmf_time.a Test1_ESMF.o
-        $(FC) -o Test1_ESMF.exe Test1_ESMF.o libesmf_time.a
-
-Test1_WRFU.f : Test1.F90
-        $(RM) Test1_WRFU.b Test1_WRFU.f
-        sed -e "s/ESMF_Mod/module_utility/g" -e "s/ESMF_/WRFU_/g" Test1.F90 > Test1_WRFU.b
-        $(CPP) -C -P -I. Test1_WRFU.b > Test1_WRFU.f
-
-Test1_WRFU.exe : libesmf_time.a Test1_WRFU.o
-        $(FC) -o Test1_WRFU.exe Test1_WRFU.o libesmf_time.a
-
-.F90.o :
-        $(RM) $@
-        $(SED_FTN) $*.F90 > $*.b
-        $(CPP) -C -P -I. $*.b > $*.f
-        $(RM) $*.b
-        $(FC) -o $@ -c $*.f
-
-.F90.f :
-        $(RM) $@
-        $(SED_FTN) $*.F90 > $*.b
-        $(CPP) -C -P -I. $*.b > $*.f
-        $(RM) $*.b
-
-.f.o :
-        $(RM) $@
-        $(RM) $*.b
-        $(FC) -c $*.f
-
-clean : testclean
-
-testclean:
-        $(RM) *.b *.f *.o *.obj *.i libesmf_time.a *.mod Test1*.exe
-
-superclean: testclean
-        $(RM) Test1*.out make_tests.out
-
-# DEPENDENCIES : only dependencies after this line
-
-#$$$ update dependencies!
-
-ESMF_Alarm.o : ESMF_BaseTime.o ESMF_Time.o ESMF_TimeInterval.o
-ESMF_BaseTime.o : ESMF_Base.o
-ESMF_Clock.o : ESMF_BaseTime.o ESMF_Time.o ESMF_TimeInterval.o
-ESMF_AlarmClock.o : ESMF_Alarm.o ESMF_Clock.o
-ESMF_Time.o : ESMF_BaseTime.o ESMF_TimeInterval.o ESMF_Calendar.o \
- ESMF_Stubs.o
-ESMF_Base.o :
-ESMF_Calendar.o : ESMF_BaseTime.o
-ESMF_Fraction.o : ESMF_BaseTime.o
-ESMF_TimeInterval.o : ESMF_BaseTime.o ESMF_Calendar.o ESMF_Fraction.o
-ESMF_Mod.o : ESMF_Alarm.o ESMF_BaseTime.o ESMF_Clock.o ESMF_Time.o \
- ESMF_Base.o ESMF_Calendar.o ESMF_Fraction.o \
- ESMF_TimeInterval.o Meat.o ESMF_Stubs.o ESMF_AlarmClock.o
-Meat.o : ESMF_Alarm.o ESMF_BaseTime.o ESMF_Clock.o ESMF_Time.o \
- ESMF_Base.o ESMF_Calendar.o ESMF_Fraction.o \
- ESMF_TimeInterval.o
-ESMF_Stubs.o : ESMF_Base.o ESMF_Calendar.o
-module_utility.o : ESMF_Mod.o module_symbols_util.o
-module_symbols_util.o : ESMF_Mod.o
-Test1.o : module_utility.o
-
Copied: branches/atmos_physics/src/external/esmf_time_f90/Makefile (from rev 968, trunk/mpas/src/external/esmf_time_f90/Makefile)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/Makefile         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/Makefile        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,104 @@
+# To build this by itself, use the make target esmf_time_f90_only
+# from the top-level WRF Makefile.
+# > cd ../..
+# configure
+# make esmf_time_f90_only
+
+.SUFFIXES: .F90 .o .f
+
+# get rid of single quotes after comments
+# WARNING: This will break if a quoted string is followed by a comment that has
+# a single quote.
+SED_FTN = sed -e "/\!.*'/s/'//g"
+
+RM = /bin/rm -f
+AR = ar
+RANLIB = ranlib
+FGREP = fgrep -iq
+
+OBJS = ESMF_Alarm.o ESMF_BaseTime.o ESMF_Clock.o ESMF_Time.o \
+ Meat.o ESMF_Base.o ESMF_Calendar.o ESMF_Fraction.o \
+ ESMF_TimeInterval.o ESMF_Stubs.o ESMF_Mod.o \
+ module_symbols_util.o \
+        module_utility.o ESMF_AlarmClock.o
+
+default: libesmf_time.a
+
+tests: Test1_ESMF.exe Test1_WRFU.exe
+
+libesmf_time.a : $(OBJS)
+        $(RM) libesmf_time.a
+        if [ "$(AR)" != "lib.exe" ] ; then \
+ $(AR) ru libesmf_time.a $(OBJS) ; \
+ else \
+ $(AR) /out:libesmf_time.a $(OBJS) ; \
+ fi
+        $(RANLIB) libesmf_time.a
+
+Test1_ESMF.f : Test1.F90
+        $(RM) Test1_ESMF.b Test1_ESMF.f
+        cp Test1.F90 Test1_ESMF.b
+        $(CPP) -C -P -I. Test1_ESMF.b > Test1_ESMF.f
+
+Test1_ESMF.exe : libesmf_time.a Test1_ESMF.o
+        $(FC) -o Test1_ESMF.exe Test1_ESMF.o libesmf_time.a
+
+Test1_WRFU.f : Test1.F90
+        $(RM) Test1_WRFU.b Test1_WRFU.f
+        sed -e "s/ESMF_Mod/module_utility/g" -e "s/ESMF_/WRFU_/g" Test1.F90 > Test1_WRFU.b
+        $(CPP) -C -P -I. Test1_WRFU.b > Test1_WRFU.f
+
+Test1_WRFU.exe : libesmf_time.a Test1_WRFU.o
+        $(FC) -o Test1_WRFU.exe Test1_WRFU.o libesmf_time.a
+
+.F90.o :
+        $(RM) $@
+        $(SED_FTN) $*.F90 > $*.b
+        $(CPP) -C -P -I. $*.b > $*.f
+        $(RM) $*.b
+        $(FC) -o $@ -c $*.f
+
+.F90.f :
+        $(RM) $@
+        $(SED_FTN) $*.F90 > $*.b
+        $(CPP) -C -P -I. $*.b > $*.f
+        $(RM) $*.b
+
+.f.o :
+        $(RM) $@
+        $(RM) $*.b
+        $(FC) -c $*.f
+
+clean : testclean
+
+testclean:
+        $(RM) *.b *.f *.o *.obj *.i libesmf_time.a *.mod Test1*.exe
+
+superclean: testclean
+        $(RM) Test1*.out make_tests.out
+
+# DEPENDENCIES : only dependencies after this line
+
+#$$$ update dependencies!
+
+ESMF_Alarm.o : ESMF_BaseTime.o ESMF_Time.o ESMF_TimeInterval.o
+ESMF_BaseTime.o : ESMF_Base.o
+ESMF_Clock.o : ESMF_BaseTime.o ESMF_Time.o ESMF_TimeInterval.o
+ESMF_AlarmClock.o : ESMF_Alarm.o ESMF_Clock.o
+ESMF_Time.o : ESMF_BaseTime.o ESMF_TimeInterval.o ESMF_Calendar.o \
+ ESMF_Stubs.o
+ESMF_Base.o :
+ESMF_Calendar.o : ESMF_BaseTime.o
+ESMF_Fraction.o : ESMF_BaseTime.o
+ESMF_TimeInterval.o : ESMF_BaseTime.o ESMF_Calendar.o ESMF_Fraction.o
+ESMF_Mod.o : ESMF_Alarm.o ESMF_BaseTime.o ESMF_Clock.o ESMF_Time.o \
+ ESMF_Base.o ESMF_Calendar.o ESMF_Fraction.o \
+ ESMF_TimeInterval.o Meat.o ESMF_Stubs.o ESMF_AlarmClock.o
+Meat.o : ESMF_Alarm.o ESMF_BaseTime.o ESMF_Clock.o ESMF_Time.o \
+ ESMF_Base.o ESMF_Calendar.o ESMF_Fraction.o \
+ ESMF_TimeInterval.o
+ESMF_Stubs.o : ESMF_Base.o ESMF_Calendar.o
+module_utility.o : ESMF_Mod.o module_symbols_util.o
+module_symbols_util.o : ESMF_Mod.o
+Test1.o : module_utility.o
+
Deleted: branches/atmos_physics/src/external/esmf_time_f90/Meat.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/Meat.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/Meat.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,918 +0,0 @@
-#include <ESMF_TimeMgr.inc>
-
-! Factor so abs(Sn) < Sd and ensure that signs of S and Sn match.
-! Also, enforce consistency.
-! YR and MM fields are ignored.
-
-SUBROUTINE normalize_basetime( basetime )
- USE esmf_basemod
- USE esmf_basetimemod
- IMPLICIT NONE
- TYPE(ESMF_BaseTime), INTENT(INOUT) :: basetime
-!PRINT *,'DEBUG: BEGIN normalize_basetime()'
- ! Consistency check...
- IF ( basetime%Sd < 0 ) THEN
- CALL wrf_error_fatal( &
- 'normalize_basetime: denominator of seconds cannot be negative' )
- ENDIF
- IF ( ( basetime%Sd == 0 ) .AND. ( basetime%Sn .NE. 0 ) ) THEN
- CALL wrf_error_fatal( &
- 'normalize_basetime: denominator of seconds cannot be zero when numerator is non-zero' )
- ENDIF
- ! factor so abs(Sn) < Sd
- IF ( basetime%Sd > 0 ) THEN
- IF ( ABS( basetime%Sn ) .GE. basetime%Sd ) THEN
-!PRINT *,'DEBUG: normalize_basetime() A1: S,Sn,Sd = ',basetime%S,basetime%Sn,basetime%Sd
- basetime%S = basetime%S + ( basetime%Sn / basetime%Sd )
- basetime%Sn = mod( basetime%Sn, basetime%Sd )
-!PRINT *,'DEBUG: normalize_basetime() A2: S,Sn,Sd = ',basetime%S,basetime%Sn,basetime%Sd
- ENDIF
- ! change sign of Sn if it does not match S
- IF ( ( basetime%S > 0 ) .AND. ( basetime%Sn < 0 ) ) THEN
-!PRINT *,'DEBUG: normalize_basetime() B1: S,Sn,Sd = ',basetime%S,basetime%Sn,basetime%Sd
- basetime%S = basetime%S - 1_ESMF_KIND_I8
- basetime%Sn = basetime%Sn + basetime%Sd
-!PRINT *,'DEBUG: normalize_basetime() B2: S,Sn,Sd = ',basetime%S,basetime%Sn,basetime%Sd
- ENDIF
- IF ( ( basetime%S < 0 ) .AND. ( basetime%Sn > 0 ) ) THEN
-!PRINT *,'DEBUG: normalize_basetime() C1: S,Sn,Sd = ',basetime%S,basetime%Sn,basetime%Sd
- basetime%S = basetime%S + 1_ESMF_KIND_I8
- basetime%Sn = basetime%Sn - basetime%Sd
-!PRINT *,'DEBUG: normalize_basetime() C2: S,Sn,Sd = ',basetime%S,basetime%Sn,basetime%Sd
- ENDIF
- ENDIF
-!PRINT *,'DEBUG: END normalize_basetime()'
-END SUBROUTINE normalize_basetime
-
-
-
-! A normalized time has time%basetime >= 0, time%basetime less than the current
-! year expressed as a timeInterval, and time%YR can take any value
-SUBROUTINE normalize_time( time )
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_timemod
- IMPLICIT NONE
- TYPE(ESMF_Time), INTENT(INOUT) :: time
- INTEGER(ESMF_KIND_I8) :: nsecondsinyear
- ! locals
- TYPE(ESMF_BaseTime) :: cmptime, zerotime
- INTEGER :: rc
- LOGICAL :: done
-
- ! first, normalize basetime
- ! this will force abs(Sn) < Sd and ensure that signs of S and Sn match
- CALL normalize_basetime( time%basetime )
-
-!$$$ add tests for these edge cases
-
- ! next, underflow negative seconds into YEARS
- ! time%basetime must end up non-negative
-!$$$ push this down into ESMF_BaseTime constructor
- zerotime%S = 0
- zerotime%Sn = 0
- zerotime%Sd = 0
- DO WHILE ( time%basetime < zerotime )
- time%YR = time%YR - 1
-!$$$ push this down into ESMF_BaseTime constructor
- cmptime%S = nsecondsinyear( time%YR )
- cmptime%Sn = 0
- cmptime%Sd = 0
- time%basetime = time%basetime + cmptime
- ENDDO
-
- ! next, overflow seconds into YEARS
- done = .FALSE.
- DO WHILE ( .NOT. done )
-!$$$ push this down into ESMF_BaseTime constructor
- cmptime%S = nsecondsinyear( time%YR )
- cmptime%Sn = 0
- cmptime%Sd = 0
- IF ( time%basetime >= cmptime ) THEN
- time%basetime = time%basetime - cmptime
- time%YR = time%YR + 1
- ELSE
- done = .TRUE.
- ENDIF
- ENDDO
-END SUBROUTINE normalize_time
-
-
-
-SUBROUTINE normalize_timeint( timeInt )
- USE esmf_basetimemod
- USE esmf_timeintervalmod
- IMPLICIT NONE
- TYPE(ESMF_TimeInterval), INTENT(INOUT) :: timeInt
-
- ! normalize basetime
- ! this will force abs(Sn) < Sd and ensure that signs of S and Sn match
- ! YR and MM are ignored
- CALL normalize_basetime( timeInt%basetime )
-END SUBROUTINE normalize_timeint
-
-
-
-
-FUNCTION signnormtimeint ( timeInt )
- ! Compute the sign of a time interval.
- ! YR and MM fields are *IGNORED*.
- ! returns 1, 0, or -1 or exits if timeInt fields have inconsistent signs.
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_timeintervalmod
- IMPLICIT NONE
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeInt
- INTEGER :: signnormtimeint
- LOGICAL :: positive, negative
-
- positive = .FALSE.
- negative = .FALSE.
- signnormtimeint = 0
- ! Note that Sd is required to be non-negative. This is enforced in
- ! normalize_timeint().
- ! Note that Sn is required to be zero when Sd is zero. This is enforced
- ! in normalize_timeint().
- IF ( ( timeInt%basetime%S > 0 ) .OR. &
- ( timeInt%basetime%Sn > 0 ) ) THEN
- positive = .TRUE.
- ENDIF
- IF ( ( timeInt%basetime%S < 0 ) .OR. &
- ( timeInt%basetime%Sn < 0 ) ) THEN
- negative = .TRUE.
- ENDIF
- IF ( positive .AND. negative ) THEN
- CALL wrf_error_fatal( &
- 'signnormtimeint: signs of fields cannot be mixed' )
- ELSE IF ( positive ) THEN
- signnormtimeint = 1
- ELSE IF ( negative ) THEN
- signnormtimeint = -1
- ENDIF
-END FUNCTION signnormtimeint
-
-
-! Exits with error message if timeInt is not normalized.
-SUBROUTINE timeintchecknormalized( timeInt, msgstr )
- USE esmf_timeintervalmod
- IMPLICIT NONE
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeInt
- CHARACTER(LEN=*), INTENT(IN) :: msgstr
- ! locals
- CHARACTER(LEN=256) :: outstr
- IF ( ( timeInt%YR /= 0 ) ) THEN
- outstr = 'un-normalized TimeInterval not allowed: '//TRIM(msgstr)
- CALL wrf_error_fatal( outstr )
- ENDIF
-END SUBROUTINE timeintchecknormalized
-
-
-! added from share/module_date_time in WRF.
-FUNCTION nfeb ( year ) RESULT (num_days)
- ! Compute the number of days in February for the given year
- IMPLICIT NONE
- INTEGER :: year
- INTEGER :: num_days
-! TBH: TODO: Replace this hack with run-time decision based on
-! TBH: TODO: passed-in calendar.
-#ifdef NO_LEAP_CALENDAR
- num_days = 28 ! By default, February has 28 days ...
-#else
- num_days = 28 ! By default, February has 28 days ...
- IF (MOD(year,4).eq.0) THEN
- num_days = 29 ! But every four years, it has 29 days ...
- IF (MOD(year,100).eq.0) THEN
- num_days = 28 ! Except every 100 years, when it has 28 days ...
- IF (MOD(year,400).eq.0) THEN
- num_days = 29 ! Except every 400 years, when it has 29 days.
- END IF
- END IF
- END IF
-#endif
-END FUNCTION nfeb
-
-
-
-FUNCTION ndaysinyear ( year ) RESULT (num_diy)
- ! Compute the number of days in the given year
- IMPLICIT NONE
- INTEGER, INTENT(IN) :: year
- INTEGER :: num_diy
- INTEGER :: nfeb
-#if defined MARS
- num_diy = 669
-#elif defined TITAN
- num_diy = 686
-#else
- IF ( nfeb( year ) .EQ. 29 ) THEN
- num_diy = 366
- ELSE
- num_diy = 365
- ENDIF
-#endif
-END FUNCTION ndaysinyear
-
-
-
-FUNCTION nsecondsinyear ( year ) RESULT (numseconds)
- ! Compute the number of seconds in the given year
- USE esmf_basemod
- IMPLICIT NONE
- INTEGER, INTENT(IN) :: year
- INTEGER(ESMF_KIND_I8) :: numseconds
- INTEGER :: ndaysinyear
- numseconds = SECONDS_PER_DAY * INT( ndaysinyear(year) , ESMF_KIND_I8 )
-END FUNCTION nsecondsinyear
-
-
-
-SUBROUTINE initdaym
- USE esmf_basemod
- USE esmf_basetimemod
- USE ESMF_CalendarMod, only : months_per_year, mday, daym, mdaycum, monthbdys, &
- mdayleap, mdayleapcum, monthbdysleap, daymleap
- IMPLICIT NONE
- INTEGER i,j,m
- m = 1
- mdaycum(0) = 0
-!$$$ push this down into ESMF_BaseTime constructor
- monthbdys(0)%S = 0
- monthbdys(0)%Sn = 0
- monthbdys(0)%Sd = 0
- DO i = 1,MONTHS_PER_YEAR
- DO j = 1,mday(i)
- daym(m) = i
- m = m + 1
- ENDDO
- mdaycum(i) = mdaycum(i-1) + mday(i)
-!$$$ push this down into ESMF_BaseTime constructor
- monthbdys(i)%S = SECONDS_PER_DAY * INT( mdaycum(i), ESMF_KIND_I8 )
- monthbdys(i)%Sn = 0
- monthbdys(i)%Sd = 0
- ENDDO
- m = 1
- mdayleapcum(0) = 0
-!$$$ push this down into ESMF_BaseTime constructor
- monthbdysleap(0)%S = 0
- monthbdysleap(0)%Sn = 0
- monthbdysleap(0)%Sd = 0
- DO i = 1,MONTHS_PER_YEAR
- DO j = 1,mdayleap(i)
- daymleap(m) = i
- m = m + 1
- ENDDO
- mdayleapcum(i) = mdayleapcum(i-1) + mdayleap(i)
-!$$$ push this down into ESMF_BaseTime constructor
- monthbdysleap(i)%S = SECONDS_PER_DAY * INT( mdayleapcum(i), ESMF_KIND_I8 )
- monthbdysleap(i)%Sn = 0
- monthbdysleap(i)%Sd = 0
- ENDDO
-END SUBROUTINE initdaym
-
-
-!$$$ useful, but not used at the moment...
-SUBROUTINE compute_dayinyear(YR,MM,DD,dayinyear)
- use ESMF_CalendarMod, only : mday
-IMPLICIT NONE
- INTEGER, INTENT(IN) :: YR,MM,DD ! DD is day of month
- INTEGER, INTENT(OUT) :: dayinyear
- INTEGER i
- integer nfeb
-
-#ifdef PLANET
- dayinyear = DD
-#else
- dayinyear = 0
- DO i = 1,MM-1
- if (i.eq.2) then
- dayinyear = dayinyear + nfeb(YR)
- else
- dayinyear = dayinyear + mday(i)
- endif
- ENDDO
- dayinyear = dayinyear + DD
-#endif
-END SUBROUTINE compute_dayinyear
-
-
-
-SUBROUTINE timegetmonth( time, MM )
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_timemod
- USE ESMF_CalendarMod, only : MONTHS_PER_YEAR, monthbdys, monthbdysleap
- IMPLICIT NONE
- TYPE(ESMF_Time), INTENT(IN) :: time
- INTEGER, INTENT(OUT) :: MM
- ! locals
- INTEGER :: nfeb
- INTEGER :: i
-#if defined PLANET
- MM = 0
-#else
- MM = -1
- IF ( nfeb(time%YR) == 29 ) THEN
- DO i = 1,MONTHS_PER_YEAR
- IF ( ( time%basetime >= monthbdysleap(i-1) ) .AND. ( time%basetime < monthbdysleap(i) ) ) THEN
- MM = i
- EXIT
- ENDIF
- ENDDO
- ELSE
- DO i = 1,MONTHS_PER_YEAR
- IF ( ( time%basetime >= monthbdys(i-1) ) .AND. ( time%basetime < monthbdys(i) ) ) THEN
- MM = i
- EXIT
- ENDIF
- ENDDO
- ENDIF
-#endif
- IF ( MM == -1 ) THEN
- CALL wrf_error_fatal( 'timegetmonth: could not extract month of year from time' )
- ENDIF
-END SUBROUTINE timegetmonth
-
-
-!$$$ may need to change dependencies in Makefile...
-
-SUBROUTINE timegetdayofmonth( time, DD )
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_timemod
- USE esmf_calendarmod, only : monthbdys, monthbdysleap
- IMPLICIT NONE
- TYPE(ESMF_Time), INTENT(IN) :: time
- INTEGER, INTENT(OUT) :: DD
- ! locals
- INTEGER :: nfeb
- INTEGER :: MM
- TYPE(ESMF_BaseTime) :: tmpbasetime
-#if defined PLANET
- tmpbasetime = time%basetime
-#else
- CALL timegetmonth( time, MM )
- IF ( nfeb(time%YR) == 29 ) THEN
- tmpbasetime = time%basetime - monthbdysleap(MM-1)
- ELSE
- tmpbasetime = time%basetime - monthbdys(MM-1)
- ENDIF
-#endif
- DD = ( tmpbasetime%S / SECONDS_PER_DAY ) + 1
-END SUBROUTINE timegetdayofmonth
-
-
-! Increment Time by number of seconds between start of year and start
-! of month MM.
-! 1 <= MM <= 12
-! Time is NOT normalized.
-SUBROUTINE timeaddmonths( time, MM, ierr )
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_timemod
- USE esmf_calendarmod, only : MONTHS_PER_YEAR, monthbdys, monthbdysleap
- IMPLICIT NONE
- TYPE(ESMF_Time), INTENT(INOUT) :: time
- INTEGER, INTENT(IN) :: MM
- INTEGER, INTENT(OUT) :: ierr
- ! locals
- INTEGER :: nfeb
- ierr = ESMF_SUCCESS
-! PRINT *,'DEBUG: BEGIN timeaddmonths()'
-#if defined PLANET
-! time%basetime = time%basetime
-#else
- IF ( ( MM < 1 ) .OR. ( MM > MONTHS_PER_YEAR ) ) THEN
- ierr = ESMF_FAILURE
- ELSE
- IF ( nfeb(time%YR) == 29 ) THEN
- time%basetime = time%basetime + monthbdysleap(MM-1)
- ELSE
- time%basetime = time%basetime + monthbdys(MM-1)
- ENDIF
- ENDIF
-#endif
-END SUBROUTINE timeaddmonths
-
-
-! Increment Time by number of seconds in the current month.
-! Time is NOT normalized.
-SUBROUTINE timeincmonth( time )
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_timemod
- USE esmf_calendarmod, only : mday, mdayleap
- IMPLICIT NONE
- TYPE(ESMF_Time), INTENT(INOUT) :: time
- ! locals
- INTEGER :: nfeb
- INTEGER :: MM
-#if defined PLANET
-! time%basetime%S = time%basetime%S
-#else
- CALL timegetmonth( time, MM )
- IF ( nfeb(time%YR) == 29 ) THEN
- time%basetime%S = time%basetime%S + &
- ( INT( mdayleap(MM), ESMF_KIND_I8 ) * SECONDS_PER_DAY )
- ELSE
- time%basetime%S = time%basetime%S + &
- ( INT( mday(MM), ESMF_KIND_I8 ) * SECONDS_PER_DAY )
- ENDIF
-#endif
-END SUBROUTINE timeincmonth
-
-
-
-! Decrement Time by number of seconds in the previous month.
-! Time is NOT normalized.
-SUBROUTINE timedecmonth( time )
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_timemod
- USE esmf_calendarmod, only : mday, months_per_year, mdayleap
- IMPLICIT NONE
- TYPE(ESMF_Time), INTENT(INOUT) :: time
- ! locals
- INTEGER :: nfeb
- INTEGER :: MM
-#if defined PLANET
-! time%basetime%S = time%basetime%S
-#else
- CALL timegetmonth( time, MM ) ! current month, 1-12
- ! find previous month
- MM = MM - 1
- IF ( MM == 0 ) THEN
- ! wrap around Jan -> Dec
- MM = MONTHS_PER_YEAR
- ENDIF
- IF ( nfeb(time%YR) == 29 ) THEN
- time%basetime%S = time%basetime%S - &
- ( INT( mdayleap(MM), ESMF_KIND_I8 ) * SECONDS_PER_DAY )
- ELSE
- time%basetime%S = time%basetime%S - &
- ( INT( mday(MM), ESMF_KIND_I8 ) * SECONDS_PER_DAY )
- ENDIF
-#endif
-END SUBROUTINE timedecmonth
-
-
-
-! spaceship operator for Times
-SUBROUTINE timecmp(time1, time2, retval )
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_timemod
- IMPLICIT NONE
- INTEGER, INTENT(OUT) :: retval
-!
-! !ARGUMENTS:
- TYPE(ESMF_Time), INTENT(IN) :: time1
- TYPE(ESMF_Time), INTENT(IN) :: time2
- IF ( time1%YR .GT. time2%YR ) THEN ; retval = 1 ; RETURN ; ENDIF
- IF ( time1%YR .LT. time2%YR ) THEN ; retval = -1 ; RETURN ; ENDIF
- CALL seccmp( time1%basetime%S, time1%basetime%Sn, time1%basetime%Sd, &
- time2%basetime%S, time2%basetime%Sn, time2%basetime%Sd, &
- retval )
-END SUBROUTINE timecmp
-
-
-
-! spaceship operator for TimeIntervals
-SUBROUTINE timeintcmp(timeint1, timeint2, retval )
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_timeintervalmod
- IMPLICIT NONE
- INTEGER, INTENT(OUT) :: retval
-!
-! !ARGUMENTS:
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint1
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint2
- CALL timeintchecknormalized( timeint1, 'timeintcmp arg1' )
- CALL timeintchecknormalized( timeint2, 'timeintcmp arg2' )
- CALL seccmp( timeint1%basetime%S, timeint1%basetime%Sn, &
- timeint1%basetime%Sd, &
- timeint2%basetime%S, timeint2%basetime%Sn, &
- timeint2%basetime%Sd, retval )
-END SUBROUTINE timeintcmp
-
-
-
-! spaceship operator for seconds + Sn/Sd
-SUBROUTINE seccmp(S1, Sn1, Sd1, S2, Sn2, Sd2, retval )
- USE esmf_basemod
- IMPLICIT NONE
- INTEGER, INTENT(OUT) :: retval
-!
-! !ARGUMENTS:
- INTEGER(ESMF_KIND_I8), INTENT(IN) :: S1, Sn1, Sd1
- INTEGER(ESMF_KIND_I8), INTENT(IN) :: S2, Sn2, Sd2
-! local
- INTEGER(ESMF_KIND_I8) :: lcd, n1, n2
-
- n1 = Sn1
- n2 = Sn2
- if ( ( n1 .ne. 0 ) .or. ( n2 .ne. 0 ) ) then
- CALL compute_lcd( Sd1, Sd2, lcd )
- if ( Sd1 .ne. 0 ) n1 = n1 * ( lcd / Sd1 )
- if ( Sd2 .ne. 0 ) n2 = n2 * ( lcd / Sd2 )
- endif
-
- if ( S1 .GT. S2 ) retval = 1
- if ( S1 .LT. S2 ) retval = -1
- IF ( S1 .EQ. S2 ) THEN
- IF (n1 .GT. n2) retval = 1
- IF (n1 .LT. n2) retval = -1
- IF (n1 .EQ. n2) retval = 0
- ENDIF
-END SUBROUTINE seccmp
-
-
-SUBROUTINE c_esmc_basetimeeq (time1, time2, outflag)
- USE esmf_alarmmod
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_calendarmod
- USE esmf_clockmod
- USE esmf_fractionmod
- USE esmf_timeintervalmod
- USE esmf_timemod
-IMPLICIT NONE
- logical, intent(OUT) :: outflag
- type(ESMF_Time), intent(in) :: time1
- type(ESMF_Time), intent(in) :: time2
- integer res
- CALL timecmp(time1,time2,res)
- outflag = (res .EQ. 0)
-END SUBROUTINE c_esmc_basetimeeq
-SUBROUTINE c_esmc_basetimege(time1, time2, outflag)
- USE esmf_alarmmod
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_calendarmod
- USE esmf_clockmod
- USE esmf_fractionmod
- USE esmf_timeintervalmod
- USE esmf_timemod
- logical, intent(OUT) :: outflag
- type(ESMF_Time), intent(in) :: time1
- type(ESMF_Time), intent(in) :: time2
- integer res
- CALL timecmp(time1,time2,res)
- outflag = (res .EQ. 1 .OR. res .EQ. 0)
-END SUBROUTINE c_esmc_basetimege
-SUBROUTINE c_esmc_basetimegt(time1, time2, outflag)
- USE esmf_alarmmod
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_calendarmod
- USE esmf_clockmod
- USE esmf_fractionmod
- USE esmf_timeintervalmod
- USE esmf_timemod
-IMPLICIT NONE
- logical, intent(OUT) :: outflag
- type(ESMF_Time), intent(in) :: time1
- type(ESMF_Time), intent(in) :: time2
- integer res
- CALL timecmp(time1,time2,res)
- outflag = (res .EQ. 1)
-END SUBROUTINE c_esmc_basetimegt
-SUBROUTINE c_esmc_basetimele(time1, time2, outflag)
- USE esmf_alarmmod
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_calendarmod
- USE esmf_clockmod
- USE esmf_fractionmod
- USE esmf_timeintervalmod
- USE esmf_timemod
-IMPLICIT NONE
- logical, intent(OUT) :: outflag
- type(ESMF_Time), intent(in) :: time1
- type(ESMF_Time), intent(in) :: time2
- integer res
- CALL timecmp(time1,time2,res)
- outflag = (res .EQ. -1 .OR. res .EQ. 0)
-END SUBROUTINE c_esmc_basetimele
-SUBROUTINE c_esmc_basetimelt(time1, time2, outflag)
- USE esmf_alarmmod
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_calendarmod
- USE esmf_clockmod
- USE esmf_fractionmod
- USE esmf_timeintervalmod
- USE esmf_timemod
-IMPLICIT NONE
- logical, intent(OUT) :: outflag
- type(ESMF_Time), intent(in) :: time1
- type(ESMF_Time), intent(in) :: time2
- integer res
- CALL timecmp(time1,time2,res)
- outflag = (res .EQ. -1)
-END SUBROUTINE c_esmc_basetimelt
-SUBROUTINE c_esmc_basetimene(time1, time2, outflag)
- USE esmf_alarmmod
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_calendarmod
- USE esmf_clockmod
- USE esmf_fractionmod
- USE esmf_timeintervalmod
- USE esmf_timemod
-IMPLICIT NONE
- logical, intent(OUT) :: outflag
- type(ESMF_Time), intent(in) :: time1
- type(ESMF_Time), intent(in) :: time2
- integer res
- CALL timecmp(time1,time2,res)
- outflag = (res .NE. 0)
-END SUBROUTINE c_esmc_basetimene
-
-SUBROUTINE c_esmc_basetimeinteq(timeint1, timeint2, outflag)
- USE esmf_timeintervalmod
- IMPLICIT NONE
- LOGICAL, INTENT(OUT) :: outflag
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint1
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint2
- INTEGER :: res
- CALL timeintcmp(timeint1,timeint2,res)
- outflag = (res .EQ. 0)
-END SUBROUTINE c_esmc_basetimeinteq
-SUBROUTINE c_esmc_basetimeintne(timeint1, timeint2, outflag)
- USE esmf_timeintervalmod
- IMPLICIT NONE
- LOGICAL, INTENT(OUT) :: outflag
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint1
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint2
- INTEGER :: res
- CALL timeintcmp(timeint1,timeint2,res)
- outflag = (res .NE. 0)
-END SUBROUTINE c_esmc_basetimeintne
-SUBROUTINE c_esmc_basetimeintlt(timeint1, timeint2, outflag)
- USE esmf_timeintervalmod
- IMPLICIT NONE
- LOGICAL, INTENT(OUT) :: outflag
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint1
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint2
- INTEGER :: res
- CALL timeintcmp(timeint1,timeint2,res)
- outflag = (res .LT. 0)
-END SUBROUTINE c_esmc_basetimeintlt
-SUBROUTINE c_esmc_basetimeintgt(timeint1, timeint2, outflag)
- USE esmf_timeintervalmod
- IMPLICIT NONE
- LOGICAL, INTENT(OUT) :: outflag
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint1
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint2
- INTEGER :: res
- CALL timeintcmp(timeint1,timeint2,res)
- outflag = (res .GT. 0)
-END SUBROUTINE c_esmc_basetimeintgt
-SUBROUTINE c_esmc_basetimeintle(timeint1, timeint2, outflag)
- USE esmf_timeintervalmod
- IMPLICIT NONE
- LOGICAL, INTENT(OUT) :: outflag
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint1
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint2
- INTEGER :: res
- CALL timeintcmp(timeint1,timeint2,res)
- outflag = (res .LE. 0)
-END SUBROUTINE c_esmc_basetimeintle
-SUBROUTINE c_esmc_basetimeintge(timeint1, timeint2, outflag)
- USE esmf_timeintervalmod
- IMPLICIT NONE
- LOGICAL, INTENT(OUT) :: outflag
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint1
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint2
- INTEGER :: res
- CALL timeintcmp(timeint1,timeint2,res)
- outflag = (res .GE. 0)
-END SUBROUTINE c_esmc_basetimeintge
-
-SUBROUTINE compute_lcd( e1, e2, lcd )
- USE esmf_basemod
- IMPLICIT NONE
- INTEGER(ESMF_KIND_I8), INTENT(IN) :: e1, e2
- INTEGER(ESMF_KIND_I8), INTENT(OUT) :: lcd
- INTEGER, PARAMETER :: nprimes = 9
- INTEGER(ESMF_KIND_I8), DIMENSION(nprimes), PARAMETER :: primes = (/2,3,5,7,11,13,17,19,23/)
- INTEGER i
- INTEGER(ESMF_KIND_I8) d1, d2, p
-
- d1 = e1 ; d2 = e2
- IF ( d1 .EQ. 0 .AND. d2 .EQ. 0 ) THEN ; lcd = 1 ; RETURN ; ENDIF
- IF ( d1 .EQ. 0 ) d1 = d2
- IF ( d2 .EQ. 0 ) d2 = d1
- IF ( d1 .EQ. d2 ) THEN ; lcd = d1 ; RETURN ; ENDIF
- lcd = d1 * d2
- DO i = 1, nprimes
- p = primes(i)
- DO WHILE (lcd/p .NE. 0 .AND. &
- mod(lcd/p,d1) .EQ. 0 .AND. mod(lcd/p,d2) .EQ. 0)
- lcd = lcd / p
- END DO
- ENDDO
-END SUBROUTINE compute_lcd
-
-SUBROUTINE simplify( ni, di, no, do )
- USE esmf_basemod
- IMPLICIT NONE
- INTEGER(ESMF_KIND_I8), INTENT(IN) :: ni, di
- INTEGER(ESMF_KIND_I8), INTENT(OUT) :: no, do
- INTEGER, PARAMETER :: nprimes = 9
- INTEGER(ESMF_KIND_I8), DIMENSION(nprimes), PARAMETER :: primes = (/2,3,5,7,11,13,17,19,23/)
- INTEGER(ESMF_KIND_I8) :: pr, d, n
- INTEGER :: np
- LOGICAL keepgoing
- IF ( ni .EQ. 0 ) THEN
- do = 1
- no = 0
- RETURN
- ENDIF
- IF ( mod( di , ni ) .EQ. 0 ) THEN
- do = di / ni
- no = 1
- RETURN
- ENDIF
- d = di
- n = ni
- DO np = 1, nprimes
- pr = primes(np)
- keepgoing = .TRUE.
- DO WHILE ( keepgoing )
- keepgoing = .FALSE.
- IF ( d/pr .NE. 0 .AND. n/pr .NE. 0 .AND. MOD(d,pr) .EQ. 0 .AND. MOD(n,pr) .EQ. 0 ) THEN
- d = d / pr
- n = n / pr
- keepgoing = .TRUE.
- ENDIF
- ENDDO
- ENDDO
- do = d
- no = n
- RETURN
-END SUBROUTINE simplify
-
-
-!$$$ this should be named "c_esmc_timesum" or something less misleading
-SUBROUTINE c_esmc_basetimesum( time1, timeinterval, timeOut )
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_timeintervalmod
- USE esmf_timemod
- IMPLICIT NONE
- TYPE(ESMF_Time), INTENT(IN) :: time1
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeinterval
- TYPE(ESMF_Time), INTENT(INOUT) :: timeOut
- ! locals
- INTEGER :: m
- timeOut = time1
- timeOut%basetime = timeOut%basetime + timeinterval%basetime
-#if 0
-!jm Month has no meaning for a timeinterval; removed 20100319
-#if defined PLANET
- ! Do nothing...
-#else
- DO m = 1, abs(timeinterval%MM)
- IF ( timeinterval%MM > 0 ) THEN
- CALL timeincmonth( timeOut )
- ELSE
- CALL timedecmonth( timeOut )
- ENDIF
- ENDDO
-#endif
-#endif
- timeOut%YR = timeOut%YR + timeinterval%YR
- CALL normalize_time( timeOut )
-END SUBROUTINE c_esmc_basetimesum
-
-
-!$$$ this should be named "c_esmc_timedec" or something less misleading
-SUBROUTINE c_esmc_basetimedec( time1, timeinterval, timeOut )
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_timeintervalmod
- USE esmf_timemod
- IMPLICIT NONE
- TYPE(ESMF_Time), INTENT(IN) :: time1
- TYPE(ESMF_TimeInterval), INTENT(IN) :: timeinterval
- TYPE(ESMF_Time), INTENT(OUT) :: timeOut
- ! locals
- TYPE (ESMF_TimeInterval) :: neginterval
- neginterval = timeinterval
-!$$$push this down into a unary negation operator on TimeInterval
- neginterval%basetime%S = -neginterval%basetime%S
- neginterval%basetime%Sn = -neginterval%basetime%Sn
- neginterval%YR = -neginterval%YR
-#if 0
-!jm month has no meaning for an interval; removed 20100319
-#ifndef PLANET
- neginterval%MM = -neginterval%MM
-#endif
-#endif
- timeOut = time1 + neginterval
-END SUBROUTINE c_esmc_basetimedec
-
-
-!$$$ this should be named "c_esmc_timediff" or something less misleading
-SUBROUTINE c_esmc_basetimediff( time1, time2, timeIntOut )
- USE esmf_basemod
- USE esmf_basetimemod
- USE esmf_timeintervalmod
- USE esmf_timemod
- IMPLICIT NONE
- TYPE(ESMF_Time), INTENT(IN) :: time1
- TYPE(ESMF_Time), INTENT(IN) :: time2
- TYPE(ESMF_TimeInterval), INTENT(OUT) :: timeIntOut
- ! locals
- INTEGER(ESMF_KIND_I8) :: nsecondsinyear
- INTEGER :: yr
- CALL ESMF_TimeIntervalSet( timeIntOut )
- timeIntOut%basetime = time1%basetime - time2%basetime
- ! convert difference in years to basetime...
- IF ( time1%YR > time2%YR ) THEN
- DO yr = time2%YR, ( time1%YR - 1 )
- timeIntOut%basetime%S = timeIntOut%basetime%S + nsecondsinyear( yr )
- ENDDO
- ELSE IF ( time2%YR > time1%YR ) THEN
- DO yr = time1%YR, ( time2%YR - 1 )
- timeIntOut%basetime%S = timeIntOut%basetime%S - nsecondsinyear( yr )
- ENDDO
- ENDIF
-!$$$ add tests for multi-year differences
- CALL normalize_timeint( timeIntOut )
-END SUBROUTINE c_esmc_basetimediff
-
-
-! some extra wrf stuff
-
-
-! Convert fraction to string with leading sign.
-! If fraction simplifies to a whole number or if
-! denominator is zero, return empty string.
-! INTEGER*8 interface.
-SUBROUTINE fraction_to_stringi8( numerator, denominator, frac_str )
- USE ESMF_basemod
- IMPLICIT NONE
- INTEGER(ESMF_KIND_I8), INTENT(IN) :: numerator
- INTEGER(ESMF_KIND_I8), INTENT(IN) :: denominator
- CHARACTER (LEN=*), INTENT(OUT) :: frac_str
- IF ( denominator > 0 ) THEN
- IF ( mod( numerator, denominator ) /= 0 ) THEN
- IF ( numerator > 0 ) THEN
- WRITE(frac_str,FMT="('+',I2.2,'/',I2.2)") abs(numerator), denominator
- ELSE ! numerator < 0
- WRITE(frac_str,FMT="('-',I2.2,'/',I2.2)") abs(numerator), denominator
- ENDIF
- ELSE ! includes numerator == 0 case
- frac_str = ''
- ENDIF
- ELSE ! no-fraction case
- frac_str = ''
- ENDIF
-END SUBROUTINE fraction_to_stringi8
-
-
-! Convert fraction to string with leading sign.
-! If fraction simplifies to a whole number or if
-! denominator is zero, return empty string.
-! INTEGER interface.
-SUBROUTINE fraction_to_string( numerator, denominator, frac_str )
- USE ESMF_basemod
- IMPLICIT NONE
- INTEGER, INTENT(IN) :: numerator
- INTEGER, INTENT(IN) :: denominator
- CHARACTER (LEN=*), INTENT(OUT) :: frac_str
- ! locals
- INTEGER(ESMF_KIND_I8) :: numerator_i8, denominator_i8
- numerator_i8 = INT( numerator, ESMF_KIND_I8 )
- denominator_i8 = INT( denominator, ESMF_KIND_I8 )
- CALL fraction_to_stringi8( numerator_i8, denominator_i8, frac_str )
-END SUBROUTINE fraction_to_string
-
-
-SUBROUTINE print_a_time( time )
- use ESMF_basemod
- use ESMF_Timemod
- IMPLICIT NONE
- type(ESMF_Time) time
- character*128 :: s
- integer rc
- CALL ESMF_TimeGet( time, timeString=s, rc=rc )
- print *,'Print a time|',TRIM(s),'|'
- return
-END SUBROUTINE print_a_time
-
-SUBROUTINE print_a_timeinterval( time )
- use ESMF_basemod
- use ESMF_TimeIntervalmod
- IMPLICIT NONE
- type(ESMF_TimeInterval) time
- character*128 :: s
- integer rc
- CALL ESMFold_TimeIntervalGetString( time, s, rc )
- print *,'Print a time interval|',TRIM(s),'|'
- return
-END SUBROUTINE print_a_timeinterval
-
Copied: branches/atmos_physics/src/external/esmf_time_f90/Meat.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/Meat.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/Meat.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/Meat.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,918 @@
+#include <ESMF_TimeMgr.inc>
+
+! Factor so abs(Sn) < Sd and ensure that signs of S and Sn match.
+! Also, enforce consistency.
+! YR and MM fields are ignored.
+
+SUBROUTINE normalize_basetime( basetime )
+ USE esmf_basemod
+ USE esmf_basetimemod
+ IMPLICIT NONE
+ TYPE(ESMF_BaseTime), INTENT(INOUT) :: basetime
+!PRINT *,'DEBUG: BEGIN normalize_basetime()'
+ ! Consistency check...
+ IF ( basetime%Sd < 0 ) THEN
+ CALL wrf_error_fatal( &
+ 'normalize_basetime: denominator of seconds cannot be negative' )
+ ENDIF
+ IF ( ( basetime%Sd == 0 ) .AND. ( basetime%Sn .NE. 0 ) ) THEN
+ CALL wrf_error_fatal( &
+ 'normalize_basetime: denominator of seconds cannot be zero when numerator is non-zero' )
+ ENDIF
+ ! factor so abs(Sn) < Sd
+ IF ( basetime%Sd > 0 ) THEN
+ IF ( ABS( basetime%Sn ) .GE. basetime%Sd ) THEN
+!PRINT *,'DEBUG: normalize_basetime() A1: S,Sn,Sd = ',basetime%S,basetime%Sn,basetime%Sd
+ basetime%S = basetime%S + ( basetime%Sn / basetime%Sd )
+ basetime%Sn = mod( basetime%Sn, basetime%Sd )
+!PRINT *,'DEBUG: normalize_basetime() A2: S,Sn,Sd = ',basetime%S,basetime%Sn,basetime%Sd
+ ENDIF
+ ! change sign of Sn if it does not match S
+ IF ( ( basetime%S > 0 ) .AND. ( basetime%Sn < 0 ) ) THEN
+!PRINT *,'DEBUG: normalize_basetime() B1: S,Sn,Sd = ',basetime%S,basetime%Sn,basetime%Sd
+ basetime%S = basetime%S - 1_ESMF_KIND_I8
+ basetime%Sn = basetime%Sn + basetime%Sd
+!PRINT *,'DEBUG: normalize_basetime() B2: S,Sn,Sd = ',basetime%S,basetime%Sn,basetime%Sd
+ ENDIF
+ IF ( ( basetime%S < 0 ) .AND. ( basetime%Sn > 0 ) ) THEN
+!PRINT *,'DEBUG: normalize_basetime() C1: S,Sn,Sd = ',basetime%S,basetime%Sn,basetime%Sd
+ basetime%S = basetime%S + 1_ESMF_KIND_I8
+ basetime%Sn = basetime%Sn - basetime%Sd
+!PRINT *,'DEBUG: normalize_basetime() C2: S,Sn,Sd = ',basetime%S,basetime%Sn,basetime%Sd
+ ENDIF
+ ENDIF
+!PRINT *,'DEBUG: END normalize_basetime()'
+END SUBROUTINE normalize_basetime
+
+
+
+! A normalized time has time%basetime >= 0, time%basetime less than the current
+! year expressed as a timeInterval, and time%YR can take any value
+SUBROUTINE normalize_time( time )
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_timemod
+ IMPLICIT NONE
+ TYPE(ESMF_Time), INTENT(INOUT) :: time
+ INTEGER(ESMF_KIND_I8) :: nsecondsinyear
+ ! locals
+ TYPE(ESMF_BaseTime) :: cmptime, zerotime
+ INTEGER :: rc
+ LOGICAL :: done
+
+ ! first, normalize basetime
+ ! this will force abs(Sn) < Sd and ensure that signs of S and Sn match
+ CALL normalize_basetime( time%basetime )
+
+!$$$ add tests for these edge cases
+
+ ! next, underflow negative seconds into YEARS
+ ! time%basetime must end up non-negative
+!$$$ push this down into ESMF_BaseTime constructor
+ zerotime%S = 0
+ zerotime%Sn = 0
+ zerotime%Sd = 0
+ DO WHILE ( time%basetime < zerotime )
+ time%YR = time%YR - 1
+!$$$ push this down into ESMF_BaseTime constructor
+ cmptime%S = nsecondsinyear( time%YR )
+ cmptime%Sn = 0
+ cmptime%Sd = 0
+ time%basetime = time%basetime + cmptime
+ ENDDO
+
+ ! next, overflow seconds into YEARS
+ done = .FALSE.
+ DO WHILE ( .NOT. done )
+!$$$ push this down into ESMF_BaseTime constructor
+ cmptime%S = nsecondsinyear( time%YR )
+ cmptime%Sn = 0
+ cmptime%Sd = 0
+ IF ( time%basetime >= cmptime ) THEN
+ time%basetime = time%basetime - cmptime
+ time%YR = time%YR + 1
+ ELSE
+ done = .TRUE.
+ ENDIF
+ ENDDO
+END SUBROUTINE normalize_time
+
+
+
+SUBROUTINE normalize_timeint( timeInt )
+ USE esmf_basetimemod
+ USE esmf_timeintervalmod
+ IMPLICIT NONE
+ TYPE(ESMF_TimeInterval), INTENT(INOUT) :: timeInt
+
+ ! normalize basetime
+ ! this will force abs(Sn) < Sd and ensure that signs of S and Sn match
+ ! YR and MM are ignored
+ CALL normalize_basetime( timeInt%basetime )
+END SUBROUTINE normalize_timeint
+
+
+
+
+FUNCTION signnormtimeint ( timeInt )
+ ! Compute the sign of a time interval.
+ ! YR and MM fields are *IGNORED*.
+ ! returns 1, 0, or -1 or exits if timeInt fields have inconsistent signs.
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_timeintervalmod
+ IMPLICIT NONE
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeInt
+ INTEGER :: signnormtimeint
+ LOGICAL :: positive, negative
+
+ positive = .FALSE.
+ negative = .FALSE.
+ signnormtimeint = 0
+ ! Note that Sd is required to be non-negative. This is enforced in
+ ! normalize_timeint().
+ ! Note that Sn is required to be zero when Sd is zero. This is enforced
+ ! in normalize_timeint().
+ IF ( ( timeInt%basetime%S > 0 ) .OR. &
+ ( timeInt%basetime%Sn > 0 ) ) THEN
+ positive = .TRUE.
+ ENDIF
+ IF ( ( timeInt%basetime%S < 0 ) .OR. &
+ ( timeInt%basetime%Sn < 0 ) ) THEN
+ negative = .TRUE.
+ ENDIF
+ IF ( positive .AND. negative ) THEN
+ CALL wrf_error_fatal( &
+ 'signnormtimeint: signs of fields cannot be mixed' )
+ ELSE IF ( positive ) THEN
+ signnormtimeint = 1
+ ELSE IF ( negative ) THEN
+ signnormtimeint = -1
+ ENDIF
+END FUNCTION signnormtimeint
+
+
+! Exits with error message if timeInt is not normalized.
+SUBROUTINE timeintchecknormalized( timeInt, msgstr )
+ USE esmf_timeintervalmod
+ IMPLICIT NONE
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeInt
+ CHARACTER(LEN=*), INTENT(IN) :: msgstr
+ ! locals
+ CHARACTER(LEN=256) :: outstr
+ IF ( ( timeInt%YR /= 0 ) ) THEN
+ outstr = 'un-normalized TimeInterval not allowed: '//TRIM(msgstr)
+ CALL wrf_error_fatal( outstr )
+ ENDIF
+END SUBROUTINE timeintchecknormalized
+
+
+! added from share/module_date_time in WRF.
+FUNCTION nfeb ( year ) RESULT (num_days)
+ ! Compute the number of days in February for the given year
+ IMPLICIT NONE
+ INTEGER :: year
+ INTEGER :: num_days
+! TBH: TODO: Replace this hack with run-time decision based on
+! TBH: TODO: passed-in calendar.
+#ifdef NO_LEAP_CALENDAR
+ num_days = 28 ! By default, February has 28 days ...
+#else
+ num_days = 28 ! By default, February has 28 days ...
+ IF (MOD(year,4).eq.0) THEN
+ num_days = 29 ! But every four years, it has 29 days ...
+ IF (MOD(year,100).eq.0) THEN
+ num_days = 28 ! Except every 100 years, when it has 28 days ...
+ IF (MOD(year,400).eq.0) THEN
+ num_days = 29 ! Except every 400 years, when it has 29 days.
+ END IF
+ END IF
+ END IF
+#endif
+END FUNCTION nfeb
+
+
+
+FUNCTION ndaysinyear ( year ) RESULT (num_diy)
+ ! Compute the number of days in the given year
+ IMPLICIT NONE
+ INTEGER, INTENT(IN) :: year
+ INTEGER :: num_diy
+ INTEGER :: nfeb
+#if defined MARS
+ num_diy = 669
+#elif defined TITAN
+ num_diy = 686
+#else
+ IF ( nfeb( year ) .EQ. 29 ) THEN
+ num_diy = 366
+ ELSE
+ num_diy = 365
+ ENDIF
+#endif
+END FUNCTION ndaysinyear
+
+
+
+FUNCTION nsecondsinyear ( year ) RESULT (numseconds)
+ ! Compute the number of seconds in the given year
+ USE esmf_basemod
+ IMPLICIT NONE
+ INTEGER, INTENT(IN) :: year
+ INTEGER(ESMF_KIND_I8) :: numseconds
+ INTEGER :: ndaysinyear
+ numseconds = SECONDS_PER_DAY * INT( ndaysinyear(year) , ESMF_KIND_I8 )
+END FUNCTION nsecondsinyear
+
+
+
+SUBROUTINE initdaym
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE ESMF_CalendarMod, only : months_per_year, mday, daym, mdaycum, monthbdys, &
+ mdayleap, mdayleapcum, monthbdysleap, daymleap
+ IMPLICIT NONE
+ INTEGER i,j,m
+ m = 1
+ mdaycum(0) = 0
+!$$$ push this down into ESMF_BaseTime constructor
+ monthbdys(0)%S = 0
+ monthbdys(0)%Sn = 0
+ monthbdys(0)%Sd = 0
+ DO i = 1,MONTHS_PER_YEAR
+ DO j = 1,mday(i)
+ daym(m) = i
+ m = m + 1
+ ENDDO
+ mdaycum(i) = mdaycum(i-1) + mday(i)
+!$$$ push this down into ESMF_BaseTime constructor
+ monthbdys(i)%S = SECONDS_PER_DAY * INT( mdaycum(i), ESMF_KIND_I8 )
+ monthbdys(i)%Sn = 0
+ monthbdys(i)%Sd = 0
+ ENDDO
+ m = 1
+ mdayleapcum(0) = 0
+!$$$ push this down into ESMF_BaseTime constructor
+ monthbdysleap(0)%S = 0
+ monthbdysleap(0)%Sn = 0
+ monthbdysleap(0)%Sd = 0
+ DO i = 1,MONTHS_PER_YEAR
+ DO j = 1,mdayleap(i)
+ daymleap(m) = i
+ m = m + 1
+ ENDDO
+ mdayleapcum(i) = mdayleapcum(i-1) + mdayleap(i)
+!$$$ push this down into ESMF_BaseTime constructor
+ monthbdysleap(i)%S = SECONDS_PER_DAY * INT( mdayleapcum(i), ESMF_KIND_I8 )
+ monthbdysleap(i)%Sn = 0
+ monthbdysleap(i)%Sd = 0
+ ENDDO
+END SUBROUTINE initdaym
+
+
+!$$$ useful, but not used at the moment...
+SUBROUTINE compute_dayinyear(YR,MM,DD,dayinyear)
+ use ESMF_CalendarMod, only : mday
+IMPLICIT NONE
+ INTEGER, INTENT(IN) :: YR,MM,DD ! DD is day of month
+ INTEGER, INTENT(OUT) :: dayinyear
+ INTEGER i
+ integer nfeb
+
+#ifdef PLANET
+ dayinyear = DD
+#else
+ dayinyear = 0
+ DO i = 1,MM-1
+ if (i.eq.2) then
+ dayinyear = dayinyear + nfeb(YR)
+ else
+ dayinyear = dayinyear + mday(i)
+ endif
+ ENDDO
+ dayinyear = dayinyear + DD
+#endif
+END SUBROUTINE compute_dayinyear
+
+
+
+SUBROUTINE timegetmonth( time, MM )
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_timemod
+ USE ESMF_CalendarMod, only : MONTHS_PER_YEAR, monthbdys, monthbdysleap
+ IMPLICIT NONE
+ TYPE(ESMF_Time), INTENT(IN) :: time
+ INTEGER, INTENT(OUT) :: MM
+ ! locals
+ INTEGER :: nfeb
+ INTEGER :: i
+#if defined PLANET
+ MM = 0
+#else
+ MM = -1
+ IF ( nfeb(time%YR) == 29 ) THEN
+ DO i = 1,MONTHS_PER_YEAR
+ IF ( ( time%basetime >= monthbdysleap(i-1) ) .AND. ( time%basetime < monthbdysleap(i) ) ) THEN
+ MM = i
+ EXIT
+ ENDIF
+ ENDDO
+ ELSE
+ DO i = 1,MONTHS_PER_YEAR
+ IF ( ( time%basetime >= monthbdys(i-1) ) .AND. ( time%basetime < monthbdys(i) ) ) THEN
+ MM = i
+ EXIT
+ ENDIF
+ ENDDO
+ ENDIF
+#endif
+ IF ( MM == -1 ) THEN
+ CALL wrf_error_fatal( 'timegetmonth: could not extract month of year from time' )
+ ENDIF
+END SUBROUTINE timegetmonth
+
+
+!$$$ may need to change dependencies in Makefile...
+
+SUBROUTINE timegetdayofmonth( time, DD )
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_timemod
+ USE esmf_calendarmod, only : monthbdys, monthbdysleap
+ IMPLICIT NONE
+ TYPE(ESMF_Time), INTENT(IN) :: time
+ INTEGER, INTENT(OUT) :: DD
+ ! locals
+ INTEGER :: nfeb
+ INTEGER :: MM
+ TYPE(ESMF_BaseTime) :: tmpbasetime
+#if defined PLANET
+ tmpbasetime = time%basetime
+#else
+ CALL timegetmonth( time, MM )
+ IF ( nfeb(time%YR) == 29 ) THEN
+ tmpbasetime = time%basetime - monthbdysleap(MM-1)
+ ELSE
+ tmpbasetime = time%basetime - monthbdys(MM-1)
+ ENDIF
+#endif
+ DD = ( tmpbasetime%S / SECONDS_PER_DAY ) + 1
+END SUBROUTINE timegetdayofmonth
+
+
+! Increment Time by number of seconds between start of year and start
+! of month MM.
+! 1 <= MM <= 12
+! Time is NOT normalized.
+SUBROUTINE timeaddmonths( time, MM, ierr )
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_timemod
+ USE esmf_calendarmod, only : MONTHS_PER_YEAR, monthbdys, monthbdysleap
+ IMPLICIT NONE
+ TYPE(ESMF_Time), INTENT(INOUT) :: time
+ INTEGER, INTENT(IN) :: MM
+ INTEGER, INTENT(OUT) :: ierr
+ ! locals
+ INTEGER :: nfeb
+ ierr = ESMF_SUCCESS
+! PRINT *,'DEBUG: BEGIN timeaddmonths()'
+#if defined PLANET
+! time%basetime = time%basetime
+#else
+ IF ( ( MM < 1 ) .OR. ( MM > MONTHS_PER_YEAR ) ) THEN
+ ierr = ESMF_FAILURE
+ ELSE
+ IF ( nfeb(time%YR) == 29 ) THEN
+ time%basetime = time%basetime + monthbdysleap(MM-1)
+ ELSE
+ time%basetime = time%basetime + monthbdys(MM-1)
+ ENDIF
+ ENDIF
+#endif
+END SUBROUTINE timeaddmonths
+
+
+! Increment Time by number of seconds in the current month.
+! Time is NOT normalized.
+SUBROUTINE timeincmonth( time )
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_timemod
+ USE esmf_calendarmod, only : mday, mdayleap
+ IMPLICIT NONE
+ TYPE(ESMF_Time), INTENT(INOUT) :: time
+ ! locals
+ INTEGER :: nfeb
+ INTEGER :: MM
+#if defined PLANET
+! time%basetime%S = time%basetime%S
+#else
+ CALL timegetmonth( time, MM )
+ IF ( nfeb(time%YR) == 29 ) THEN
+ time%basetime%S = time%basetime%S + &
+ ( INT( mdayleap(MM), ESMF_KIND_I8 ) * SECONDS_PER_DAY )
+ ELSE
+ time%basetime%S = time%basetime%S + &
+ ( INT( mday(MM), ESMF_KIND_I8 ) * SECONDS_PER_DAY )
+ ENDIF
+#endif
+END SUBROUTINE timeincmonth
+
+
+
+! Decrement Time by number of seconds in the previous month.
+! Time is NOT normalized.
+SUBROUTINE timedecmonth( time )
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_timemod
+ USE esmf_calendarmod, only : mday, months_per_year, mdayleap
+ IMPLICIT NONE
+ TYPE(ESMF_Time), INTENT(INOUT) :: time
+ ! locals
+ INTEGER :: nfeb
+ INTEGER :: MM
+#if defined PLANET
+! time%basetime%S = time%basetime%S
+#else
+ CALL timegetmonth( time, MM ) ! current month, 1-12
+ ! find previous month
+ MM = MM - 1
+ IF ( MM == 0 ) THEN
+ ! wrap around Jan -> Dec
+ MM = MONTHS_PER_YEAR
+ ENDIF
+ IF ( nfeb(time%YR) == 29 ) THEN
+ time%basetime%S = time%basetime%S - &
+ ( INT( mdayleap(MM), ESMF_KIND_I8 ) * SECONDS_PER_DAY )
+ ELSE
+ time%basetime%S = time%basetime%S - &
+ ( INT( mday(MM), ESMF_KIND_I8 ) * SECONDS_PER_DAY )
+ ENDIF
+#endif
+END SUBROUTINE timedecmonth
+
+
+
+! spaceship operator for Times
+SUBROUTINE timecmp(time1, time2, retval )
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_timemod
+ IMPLICIT NONE
+ INTEGER, INTENT(OUT) :: retval
+!
+! !ARGUMENTS:
+ TYPE(ESMF_Time), INTENT(IN) :: time1
+ TYPE(ESMF_Time), INTENT(IN) :: time2
+ IF ( time1%YR .GT. time2%YR ) THEN ; retval = 1 ; RETURN ; ENDIF
+ IF ( time1%YR .LT. time2%YR ) THEN ; retval = -1 ; RETURN ; ENDIF
+ CALL seccmp( time1%basetime%S, time1%basetime%Sn, time1%basetime%Sd, &
+ time2%basetime%S, time2%basetime%Sn, time2%basetime%Sd, &
+ retval )
+END SUBROUTINE timecmp
+
+
+
+! spaceship operator for TimeIntervals
+SUBROUTINE timeintcmp(timeint1, timeint2, retval )
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_timeintervalmod
+ IMPLICIT NONE
+ INTEGER, INTENT(OUT) :: retval
+!
+! !ARGUMENTS:
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint1
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint2
+ CALL timeintchecknormalized( timeint1, 'timeintcmp arg1' )
+ CALL timeintchecknormalized( timeint2, 'timeintcmp arg2' )
+ CALL seccmp( timeint1%basetime%S, timeint1%basetime%Sn, &
+ timeint1%basetime%Sd, &
+ timeint2%basetime%S, timeint2%basetime%Sn, &
+ timeint2%basetime%Sd, retval )
+END SUBROUTINE timeintcmp
+
+
+
+! spaceship operator for seconds + Sn/Sd
+SUBROUTINE seccmp(S1, Sn1, Sd1, S2, Sn2, Sd2, retval )
+ USE esmf_basemod
+ IMPLICIT NONE
+ INTEGER, INTENT(OUT) :: retval
+!
+! !ARGUMENTS:
+ INTEGER(ESMF_KIND_I8), INTENT(IN) :: S1, Sn1, Sd1
+ INTEGER(ESMF_KIND_I8), INTENT(IN) :: S2, Sn2, Sd2
+! local
+ INTEGER(ESMF_KIND_I8) :: lcd, n1, n2
+
+ n1 = Sn1
+ n2 = Sn2
+ if ( ( n1 .ne. 0 ) .or. ( n2 .ne. 0 ) ) then
+ CALL compute_lcd( Sd1, Sd2, lcd )
+ if ( Sd1 .ne. 0 ) n1 = n1 * ( lcd / Sd1 )
+ if ( Sd2 .ne. 0 ) n2 = n2 * ( lcd / Sd2 )
+ endif
+
+ if ( S1 .GT. S2 ) retval = 1
+ if ( S1 .LT. S2 ) retval = -1
+ IF ( S1 .EQ. S2 ) THEN
+ IF (n1 .GT. n2) retval = 1
+ IF (n1 .LT. n2) retval = -1
+ IF (n1 .EQ. n2) retval = 0
+ ENDIF
+END SUBROUTINE seccmp
+
+
+SUBROUTINE c_esmc_basetimeeq (time1, time2, outflag)
+ USE esmf_alarmmod
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_calendarmod
+ USE esmf_clockmod
+ USE esmf_fractionmod
+ USE esmf_timeintervalmod
+ USE esmf_timemod
+IMPLICIT NONE
+ logical, intent(OUT) :: outflag
+ type(ESMF_Time), intent(in) :: time1
+ type(ESMF_Time), intent(in) :: time2
+ integer res
+ CALL timecmp(time1,time2,res)
+ outflag = (res .EQ. 0)
+END SUBROUTINE c_esmc_basetimeeq
+SUBROUTINE c_esmc_basetimege(time1, time2, outflag)
+ USE esmf_alarmmod
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_calendarmod
+ USE esmf_clockmod
+ USE esmf_fractionmod
+ USE esmf_timeintervalmod
+ USE esmf_timemod
+ logical, intent(OUT) :: outflag
+ type(ESMF_Time), intent(in) :: time1
+ type(ESMF_Time), intent(in) :: time2
+ integer res
+ CALL timecmp(time1,time2,res)
+ outflag = (res .EQ. 1 .OR. res .EQ. 0)
+END SUBROUTINE c_esmc_basetimege
+SUBROUTINE c_esmc_basetimegt(time1, time2, outflag)
+ USE esmf_alarmmod
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_calendarmod
+ USE esmf_clockmod
+ USE esmf_fractionmod
+ USE esmf_timeintervalmod
+ USE esmf_timemod
+IMPLICIT NONE
+ logical, intent(OUT) :: outflag
+ type(ESMF_Time), intent(in) :: time1
+ type(ESMF_Time), intent(in) :: time2
+ integer res
+ CALL timecmp(time1,time2,res)
+ outflag = (res .EQ. 1)
+END SUBROUTINE c_esmc_basetimegt
+SUBROUTINE c_esmc_basetimele(time1, time2, outflag)
+ USE esmf_alarmmod
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_calendarmod
+ USE esmf_clockmod
+ USE esmf_fractionmod
+ USE esmf_timeintervalmod
+ USE esmf_timemod
+IMPLICIT NONE
+ logical, intent(OUT) :: outflag
+ type(ESMF_Time), intent(in) :: time1
+ type(ESMF_Time), intent(in) :: time2
+ integer res
+ CALL timecmp(time1,time2,res)
+ outflag = (res .EQ. -1 .OR. res .EQ. 0)
+END SUBROUTINE c_esmc_basetimele
+SUBROUTINE c_esmc_basetimelt(time1, time2, outflag)
+ USE esmf_alarmmod
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_calendarmod
+ USE esmf_clockmod
+ USE esmf_fractionmod
+ USE esmf_timeintervalmod
+ USE esmf_timemod
+IMPLICIT NONE
+ logical, intent(OUT) :: outflag
+ type(ESMF_Time), intent(in) :: time1
+ type(ESMF_Time), intent(in) :: time2
+ integer res
+ CALL timecmp(time1,time2,res)
+ outflag = (res .EQ. -1)
+END SUBROUTINE c_esmc_basetimelt
+SUBROUTINE c_esmc_basetimene(time1, time2, outflag)
+ USE esmf_alarmmod
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_calendarmod
+ USE esmf_clockmod
+ USE esmf_fractionmod
+ USE esmf_timeintervalmod
+ USE esmf_timemod
+IMPLICIT NONE
+ logical, intent(OUT) :: outflag
+ type(ESMF_Time), intent(in) :: time1
+ type(ESMF_Time), intent(in) :: time2
+ integer res
+ CALL timecmp(time1,time2,res)
+ outflag = (res .NE. 0)
+END SUBROUTINE c_esmc_basetimene
+
+SUBROUTINE c_esmc_basetimeinteq(timeint1, timeint2, outflag)
+ USE esmf_timeintervalmod
+ IMPLICIT NONE
+ LOGICAL, INTENT(OUT) :: outflag
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint1
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint2
+ INTEGER :: res
+ CALL timeintcmp(timeint1,timeint2,res)
+ outflag = (res .EQ. 0)
+END SUBROUTINE c_esmc_basetimeinteq
+SUBROUTINE c_esmc_basetimeintne(timeint1, timeint2, outflag)
+ USE esmf_timeintervalmod
+ IMPLICIT NONE
+ LOGICAL, INTENT(OUT) :: outflag
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint1
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint2
+ INTEGER :: res
+ CALL timeintcmp(timeint1,timeint2,res)
+ outflag = (res .NE. 0)
+END SUBROUTINE c_esmc_basetimeintne
+SUBROUTINE c_esmc_basetimeintlt(timeint1, timeint2, outflag)
+ USE esmf_timeintervalmod
+ IMPLICIT NONE
+ LOGICAL, INTENT(OUT) :: outflag
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint1
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint2
+ INTEGER :: res
+ CALL timeintcmp(timeint1,timeint2,res)
+ outflag = (res .LT. 0)
+END SUBROUTINE c_esmc_basetimeintlt
+SUBROUTINE c_esmc_basetimeintgt(timeint1, timeint2, outflag)
+ USE esmf_timeintervalmod
+ IMPLICIT NONE
+ LOGICAL, INTENT(OUT) :: outflag
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint1
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint2
+ INTEGER :: res
+ CALL timeintcmp(timeint1,timeint2,res)
+ outflag = (res .GT. 0)
+END SUBROUTINE c_esmc_basetimeintgt
+SUBROUTINE c_esmc_basetimeintle(timeint1, timeint2, outflag)
+ USE esmf_timeintervalmod
+ IMPLICIT NONE
+ LOGICAL, INTENT(OUT) :: outflag
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint1
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint2
+ INTEGER :: res
+ CALL timeintcmp(timeint1,timeint2,res)
+ outflag = (res .LE. 0)
+END SUBROUTINE c_esmc_basetimeintle
+SUBROUTINE c_esmc_basetimeintge(timeint1, timeint2, outflag)
+ USE esmf_timeintervalmod
+ IMPLICIT NONE
+ LOGICAL, INTENT(OUT) :: outflag
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint1
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeint2
+ INTEGER :: res
+ CALL timeintcmp(timeint1,timeint2,res)
+ outflag = (res .GE. 0)
+END SUBROUTINE c_esmc_basetimeintge
+
+SUBROUTINE compute_lcd( e1, e2, lcd )
+ USE esmf_basemod
+ IMPLICIT NONE
+ INTEGER(ESMF_KIND_I8), INTENT(IN) :: e1, e2
+ INTEGER(ESMF_KIND_I8), INTENT(OUT) :: lcd
+ INTEGER, PARAMETER :: nprimes = 9
+ INTEGER(ESMF_KIND_I8), DIMENSION(nprimes), PARAMETER :: primes = (/2,3,5,7,11,13,17,19,23/)
+ INTEGER i
+ INTEGER(ESMF_KIND_I8) d1, d2, p
+
+ d1 = e1 ; d2 = e2
+ IF ( d1 .EQ. 0 .AND. d2 .EQ. 0 ) THEN ; lcd = 1 ; RETURN ; ENDIF
+ IF ( d1 .EQ. 0 ) d1 = d2
+ IF ( d2 .EQ. 0 ) d2 = d1
+ IF ( d1 .EQ. d2 ) THEN ; lcd = d1 ; RETURN ; ENDIF
+ lcd = d1 * d2
+ DO i = 1, nprimes
+ p = primes(i)
+ DO WHILE (lcd/p .NE. 0 .AND. &
+ mod(lcd/p,d1) .EQ. 0 .AND. mod(lcd/p,d2) .EQ. 0)
+ lcd = lcd / p
+ END DO
+ ENDDO
+END SUBROUTINE compute_lcd
+
+SUBROUTINE simplify( ni, di, no, do )
+ USE esmf_basemod
+ IMPLICIT NONE
+ INTEGER(ESMF_KIND_I8), INTENT(IN) :: ni, di
+ INTEGER(ESMF_KIND_I8), INTENT(OUT) :: no, do
+ INTEGER, PARAMETER :: nprimes = 9
+ INTEGER(ESMF_KIND_I8), DIMENSION(nprimes), PARAMETER :: primes = (/2,3,5,7,11,13,17,19,23/)
+ INTEGER(ESMF_KIND_I8) :: pr, d, n
+ INTEGER :: np
+ LOGICAL keepgoing
+ IF ( ni .EQ. 0 ) THEN
+ do = 1
+ no = 0
+ RETURN
+ ENDIF
+ IF ( mod( di , ni ) .EQ. 0 ) THEN
+ do = di / ni
+ no = 1
+ RETURN
+ ENDIF
+ d = di
+ n = ni
+ DO np = 1, nprimes
+ pr = primes(np)
+ keepgoing = .TRUE.
+ DO WHILE ( keepgoing )
+ keepgoing = .FALSE.
+ IF ( d/pr .NE. 0 .AND. n/pr .NE. 0 .AND. MOD(d,pr) .EQ. 0 .AND. MOD(n,pr) .EQ. 0 ) THEN
+ d = d / pr
+ n = n / pr
+ keepgoing = .TRUE.
+ ENDIF
+ ENDDO
+ ENDDO
+ do = d
+ no = n
+ RETURN
+END SUBROUTINE simplify
+
+
+!$$$ this should be named "c_esmc_timesum" or something less misleading
+SUBROUTINE c_esmc_basetimesum( time1, timeinterval, timeOut )
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_timeintervalmod
+ USE esmf_timemod
+ IMPLICIT NONE
+ TYPE(ESMF_Time), INTENT(IN) :: time1
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeinterval
+ TYPE(ESMF_Time), INTENT(INOUT) :: timeOut
+ ! locals
+ INTEGER :: m
+ timeOut = time1
+ timeOut%basetime = timeOut%basetime + timeinterval%basetime
+#if 0
+!jm Month has no meaning for a timeinterval; removed 20100319
+#if defined PLANET
+ ! Do nothing...
+#else
+ DO m = 1, abs(timeinterval%MM)
+ IF ( timeinterval%MM > 0 ) THEN
+ CALL timeincmonth( timeOut )
+ ELSE
+ CALL timedecmonth( timeOut )
+ ENDIF
+ ENDDO
+#endif
+#endif
+ timeOut%YR = timeOut%YR + timeinterval%YR
+ CALL normalize_time( timeOut )
+END SUBROUTINE c_esmc_basetimesum
+
+
+!$$$ this should be named "c_esmc_timedec" or something less misleading
+SUBROUTINE c_esmc_basetimedec( time1, timeinterval, timeOut )
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_timeintervalmod
+ USE esmf_timemod
+ IMPLICIT NONE
+ TYPE(ESMF_Time), INTENT(IN) :: time1
+ TYPE(ESMF_TimeInterval), INTENT(IN) :: timeinterval
+ TYPE(ESMF_Time), INTENT(OUT) :: timeOut
+ ! locals
+ TYPE (ESMF_TimeInterval) :: neginterval
+ neginterval = timeinterval
+!$$$push this down into a unary negation operator on TimeInterval
+ neginterval%basetime%S = -neginterval%basetime%S
+ neginterval%basetime%Sn = -neginterval%basetime%Sn
+ neginterval%YR = -neginterval%YR
+#if 0
+!jm month has no meaning for an interval; removed 20100319
+#ifndef PLANET
+ neginterval%MM = -neginterval%MM
+#endif
+#endif
+ timeOut = time1 + neginterval
+END SUBROUTINE c_esmc_basetimedec
+
+
+!$$$ this should be named "c_esmc_timediff" or something less misleading
+SUBROUTINE c_esmc_basetimediff( time1, time2, timeIntOut )
+ USE esmf_basemod
+ USE esmf_basetimemod
+ USE esmf_timeintervalmod
+ USE esmf_timemod
+ IMPLICIT NONE
+ TYPE(ESMF_Time), INTENT(IN) :: time1
+ TYPE(ESMF_Time), INTENT(IN) :: time2
+ TYPE(ESMF_TimeInterval), INTENT(OUT) :: timeIntOut
+ ! locals
+ INTEGER(ESMF_KIND_I8) :: nsecondsinyear
+ INTEGER :: yr
+ CALL ESMF_TimeIntervalSet( timeIntOut )
+ timeIntOut%basetime = time1%basetime - time2%basetime
+ ! convert difference in years to basetime...
+ IF ( time1%YR > time2%YR ) THEN
+ DO yr = time2%YR, ( time1%YR - 1 )
+ timeIntOut%basetime%S = timeIntOut%basetime%S + nsecondsinyear( yr )
+ ENDDO
+ ELSE IF ( time2%YR > time1%YR ) THEN
+ DO yr = time1%YR, ( time2%YR - 1 )
+ timeIntOut%basetime%S = timeIntOut%basetime%S - nsecondsinyear( yr )
+ ENDDO
+ ENDIF
+!$$$ add tests for multi-year differences
+ CALL normalize_timeint( timeIntOut )
+END SUBROUTINE c_esmc_basetimediff
+
+
+! some extra wrf stuff
+
+
+! Convert fraction to string with leading sign.
+! If fraction simplifies to a whole number or if
+! denominator is zero, return empty string.
+! INTEGER*8 interface.
+SUBROUTINE fraction_to_stringi8( numerator, denominator, frac_str )
+ USE ESMF_basemod
+ IMPLICIT NONE
+ INTEGER(ESMF_KIND_I8), INTENT(IN) :: numerator
+ INTEGER(ESMF_KIND_I8), INTENT(IN) :: denominator
+ CHARACTER (LEN=*), INTENT(OUT) :: frac_str
+ IF ( denominator > 0 ) THEN
+ IF ( mod( numerator, denominator ) /= 0 ) THEN
+ IF ( numerator > 0 ) THEN
+ WRITE(frac_str,FMT="('+',I2.2,'/',I2.2)") abs(numerator), denominator
+ ELSE ! numerator < 0
+ WRITE(frac_str,FMT="('-',I2.2,'/',I2.2)") abs(numerator), denominator
+ ENDIF
+ ELSE ! includes numerator == 0 case
+ frac_str = ''
+ ENDIF
+ ELSE ! no-fraction case
+ frac_str = ''
+ ENDIF
+END SUBROUTINE fraction_to_stringi8
+
+
+! Convert fraction to string with leading sign.
+! If fraction simplifies to a whole number or if
+! denominator is zero, return empty string.
+! INTEGER interface.
+SUBROUTINE fraction_to_string( numerator, denominator, frac_str )
+ USE ESMF_basemod
+ IMPLICIT NONE
+ INTEGER, INTENT(IN) :: numerator
+ INTEGER, INTENT(IN) :: denominator
+ CHARACTER (LEN=*), INTENT(OUT) :: frac_str
+ ! locals
+ INTEGER(ESMF_KIND_I8) :: numerator_i8, denominator_i8
+ numerator_i8 = INT( numerator, ESMF_KIND_I8 )
+ denominator_i8 = INT( denominator, ESMF_KIND_I8 )
+ CALL fraction_to_stringi8( numerator_i8, denominator_i8, frac_str )
+END SUBROUTINE fraction_to_string
+
+
+SUBROUTINE print_a_time( time )
+ use ESMF_basemod
+ use ESMF_Timemod
+ IMPLICIT NONE
+ type(ESMF_Time) time
+ character*128 :: s
+ integer rc
+ CALL ESMF_TimeGet( time, timeString=s, rc=rc )
+ print *,'Print a time|',TRIM(s),'|'
+ return
+END SUBROUTINE print_a_time
+
+SUBROUTINE print_a_timeinterval( time )
+ use ESMF_basemod
+ use ESMF_TimeIntervalmod
+ IMPLICIT NONE
+ type(ESMF_TimeInterval) time
+ character*128 :: s
+ integer rc
+ CALL ESMFold_TimeIntervalGetString( time, s, rc )
+ print *,'Print a time interval|',TRIM(s),'|'
+ return
+END SUBROUTINE print_a_timeinterval
+
Deleted: branches/atmos_physics/src/external/esmf_time_f90/Test1.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/Test1.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/Test1.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,1718 +0,0 @@
-!
-! Sub-system tests for esmf_time_f90
-!
-! Someday, switch over to funit!
-!
-
-MODULE my_tests
- USE ESMF_Mod
- IMPLICIT NONE
-
- ! Set this to .TRUE. to make wrf_error_fatal3() print a message on failure
- ! instead of stopping the program. Use for testing only (since we cannot
- ! catch exceptions in Fortran90!!)
- LOGICAL :: WRF_ERROR_FATAL_PRINT = .FALSE.
-
-CONTAINS
-
- ! Test printing of an ESMF_Time or ESMF_TimeInterval object.
- !
- ! Correct results are also passed in through this interface and compared
- ! with computed results. PASS/FAIL messages are printed.
- !
- SUBROUTINE test_print( t_yy, t_mm, t_dd, t_h, t_m, t_s, t_sn, t_sd, &
- ti_yy, ti_mm, ti_dd, ti_h, ti_m, ti_s, ti_sn, ti_sd, &
- res_str, testname, expect_error )
- INTEGER, INTENT(IN), OPTIONAL :: t_YY
- INTEGER, INTENT(IN), OPTIONAL :: t_MM ! month
- INTEGER, INTENT(IN), OPTIONAL :: t_DD ! day of month
- INTEGER, INTENT(IN), OPTIONAL :: t_H
- INTEGER, INTENT(IN), OPTIONAL :: t_M
- INTEGER, INTENT(IN), OPTIONAL :: t_S
- INTEGER, INTENT(IN), OPTIONAL :: t_Sn
- INTEGER, INTENT(IN), OPTIONAL :: t_Sd
- INTEGER, INTENT(IN), OPTIONAL :: ti_YY
- INTEGER, INTENT(IN), OPTIONAL :: ti_MM ! month
- INTEGER, INTENT(IN), OPTIONAL :: ti_DD ! day of month
- INTEGER, INTENT(IN), OPTIONAL :: ti_H
- INTEGER, INTENT(IN), OPTIONAL :: ti_M
- INTEGER, INTENT(IN), OPTIONAL :: ti_S
- INTEGER, INTENT(IN), OPTIONAL :: ti_Sn
- INTEGER, INTENT(IN), OPTIONAL :: ti_Sd
- CHARACTER (LEN=*), INTENT(IN) :: res_str
- CHARACTER (LEN=*), INTENT(IN), OPTIONAL :: testname
- LOGICAL, OPTIONAL, INTENT(IN) :: expect_error
- ! locals
- INTEGER :: it_YY
- INTEGER :: it_MM ! month
- INTEGER :: it_DD ! day of month
- INTEGER :: it_H
- INTEGER :: it_M
- INTEGER :: it_S
- INTEGER :: it_Sn
- INTEGER :: it_Sd
- INTEGER :: iti_YY
- INTEGER :: iti_MM ! month
- INTEGER :: iti_DD ! day of month
- INTEGER :: iti_H
- INTEGER :: iti_M
- INTEGER :: iti_S
- INTEGER :: iti_Sn
- INTEGER :: iti_Sd
- LOGICAL :: is_t
- LOGICAL :: is_ti
- CHARACTER (LEN=512) :: itestname
- LOGICAL :: iexpect_error
- INTEGER rc
- TYPE(ESMF_Time) :: t
- TYPE(ESMF_TimeInterval) :: ti
- CHARACTER(LEN=ESMF_MAXSTR) :: str, computed_str, frac_str
- CHARACTER(LEN=17) :: type_str
- INTEGER :: res_len, computed_len, Sn, Sd
- LOGICAL :: test_passed
-
-! PRINT *,'DEBUG: BEGIN test_print()'
- it_YY = 0
- it_MM = 1
- it_DD = 1
- it_H = 0
- it_M = 0
- it_S = 0
- it_Sn = 0
- it_Sd = 0
- iti_YY = 0
- iti_MM = 0
- iti_DD = 0
- iti_H = 0
- iti_M = 0
- iti_S = 0
- iti_Sn = 0
- iti_Sd = 0
- itestname = ''
- iexpect_error = .FALSE.
-
- IF ( PRESENT( t_YY ) ) it_YY = t_YY
- IF ( PRESENT( t_MM ) ) it_MM = t_MM
- IF ( PRESENT( t_DD ) ) it_DD = t_DD
- IF ( PRESENT( t_H ) ) it_H = t_H
- IF ( PRESENT( t_M ) ) it_M = t_M
- IF ( PRESENT( t_S ) ) it_S = t_S
- IF ( PRESENT( t_Sn ) ) it_Sn = t_Sn
- IF ( PRESENT( t_Sd ) ) it_Sd = t_Sd
- IF ( PRESENT( ti_YY ) ) iti_YY = ti_YY
- IF ( PRESENT( ti_MM ) ) iti_MM = ti_MM
- IF ( PRESENT( ti_DD ) ) iti_DD = ti_DD
- IF ( PRESENT( ti_H ) ) iti_H = ti_H
- IF ( PRESENT( ti_M ) ) iti_M = ti_M
- IF ( PRESENT( ti_S ) ) iti_S = ti_S
- IF ( PRESENT( ti_Sn ) ) iti_Sn = ti_Sn
- IF ( PRESENT( ti_Sd ) ) iti_Sd = ti_Sd
- IF ( PRESENT( testname ) ) itestname = TRIM(testname)
- IF ( PRESENT( expect_error ) ) iexpect_error = expect_error
-
- ! Ensure that optional arguments are consistent...
- is_t = ( PRESENT( t_YY ) .OR. PRESENT( t_MM ) .OR. &
- PRESENT( t_DD ) .OR. PRESENT( t_H ) .OR. &
- PRESENT( t_M ) .OR. PRESENT( t_S ) .OR. &
- PRESENT( t_Sn ) .OR. PRESENT( t_Sd ) )
- is_ti = ( PRESENT( ti_YY ) .OR. PRESENT( ti_MM ) .OR. &
- PRESENT( ti_DD ) .OR. PRESENT( ti_H ) .OR. &
- PRESENT( ti_M ) .OR. PRESENT( ti_S ) .OR. &
- PRESENT( ti_Sn ) .OR. PRESENT( ti_Sd ) )
- IF ( is_t .EQV. is_ti ) THEN
- CALL wrf_error_fatal3( __FILE__ , __LINE__ , &
- 'ERROR test_print: inconsistent args' )
- ENDIF
-
-!PRINT *,'DEBUG: test_print(): init objects'
- ! Initialize object to be tested
- ! modify behavior of wrf_error_fatal3 for tests expected to fail
- IF ( iexpect_error ) WRF_ERROR_FATAL_PRINT = .TRUE.
- Sn = 0
- Sd = 0
- IF ( is_t ) THEN
- type_str = 'ESMF_Time'
-!PRINT *,'DEBUG: test_print(): calling ESMF_TimeSet()'
-!PRINT *,'DEBUG: test_print(): YY,MM,DD,H,M,S,Sn,Sd = ', it_YY,it_MM,it_DD,it_H,it_M,it_S,it_Sn,it_Sd
- CALL ESMF_TimeSet( t, YY=it_YY, MM=it_MM, DD=it_DD , &
- H=it_H, M=it_M, S=it_S, Sn=it_Sn, Sd=it_Sd, rc=rc )
-!PRINT *,'DEBUG: test_print(): back from ESMF_TimeSet()'
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeSet() ', &
- __FILE__ , &
- __LINE__ )
-!PRINT *,'DEBUG: test_print(): calling ESMF_TimeGet()'
- CALL ESMF_TimeGet( t, timeString=computed_str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
-!PRINT *,'DEBUG: test_print(): back from ESMF_TimeGet(), computed_str = ',TRIM(computed_str)
- ELSE
- type_str = 'ESMF_TimeInterval'
-!PRINT *,'DEBUG: test_print(): calling ESMF_TimeIntervalSet()'
- CALL ESMF_TimeIntervalSet( ti, YY=iti_YY, MM=iti_MM, &
- D=iti_DD , &
- H=iti_H, M=iti_M, &
- S=iti_S, Sn=iti_Sn, Sd=iti_Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeIntervalSet() ', &
- __FILE__ , &
- __LINE__ )
-!PRINT *,'DEBUG: test_print(): calling ESMF_TimeIntervalGet()'
- CALL ESMF_TimeIntervalGet( ti, timeString=computed_str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- ENDIF
- ! handle fractions
- IF ( Sd > 0 ) THEN
- IF ( Sn > 0 ) THEN
- WRITE(frac_str,FMT="('+',I2.2,'/',I2.2)") abs(Sn), Sd
- ELSE IF ( Sn < 0 ) THEN
- WRITE(frac_str,FMT="('-',I2.2,'/',I2.2)") abs(Sn), Sd
- ELSE
- frac_str = ''
- ENDIF
- computed_str = TRIM(computed_str)//TRIM(frac_str)
- ENDIF
- ! restore default behavior of wrf_error_fatal3
- IF ( iexpect_error ) WRF_ERROR_FATAL_PRINT = .FALSE.
-!PRINT *,'DEBUG: test_print(): done init objects'
-
-!PRINT *,'DEBUG: test_print(): check result'
- ! check result
- test_passed = .FALSE.
- res_len = LEN_TRIM(res_str)
- computed_len = LEN_TRIM(computed_str)
- IF ( res_len == computed_len ) THEN
- IF ( computed_str(1:computed_len) == res_str(1:res_len) ) THEN
- test_passed = .TRUE.
- ENDIF
- ENDIF
- IF ( test_passed ) THEN
- WRITE(*,FMT='(A)') 'PASS: '//TRIM(itestname)
- ELSE
- WRITE(*,'(9A)') 'FAIL: ',TRIM(itestname),': printing ',TRIM(type_str), &
- ' expected <', TRIM(res_str),'> but computed <',TRIM(computed_str),'>'
- ENDIF
-!PRINT *,'DEBUG: END test_print()'
-
- END SUBROUTINE test_print
-
-
-
- ! Test the following arithmetic operations on ESMF_Time and
- ! ESMF_TimeInterval objects:
- ! ESMF_Time = ESMF_Time + ESMF_TimeInterval
- ! ESMF_Time = ESMF_TimeInterval + ESMF_Time
- ! ESMF_Time = ESMF_Time - ESMF_TimeInterval
- ! ESMF_TimeInterval = ESMF_Time - ESMF_Time
- ! ESMF_TimeInterval = ESMF_TimeInterval + ESMF_TimeInterval
- ! ESMF_TimeInterval = ESMF_TimeInterval - ESMF_TimeInterval
- ! ESMF_TimeInterval = ESMF_TimeInterval * INTEGER
- ! ESMF_TimeInterval = ESMF_TimeInterval / INTEGER
- !
- ! Correct results are also passed in through this interface and compared
- ! with computed results. PASS/FAIL messages are printed.
- !
- ! Operations are expressed as res = op1 +|- op2
- !
- SUBROUTINE test_arithmetic( add_op, multiply_op, &
- op1_t_yy, op1_t_mm, op1_t_dd, op1_t_h, op1_t_m, op1_t_s, op1_t_sn, op1_t_sd, &
- op1_ti_yy, op1_ti_mm, op1_ti_dd, op1_ti_h, op1_ti_m, op1_ti_s, op1_ti_sn, op1_ti_sd, &
- op2_t_yy, op2_t_mm, op2_t_dd, op2_t_h, op2_t_m, op2_t_s, op2_t_sn, op2_t_sd, &
- op2_ti_yy, op2_ti_mm, op2_ti_dd, op2_ti_h, op2_ti_m, op2_ti_s, op2_ti_sn, op2_ti_sd, &
- op2_int, &
- res_t_yy, res_t_mm, res_t_dd, res_t_h, res_t_m, res_t_s, res_t_sn, res_t_sd, &
- res_ti_yy, res_ti_mm, res_ti_dd, res_ti_h, res_ti_m, res_ti_s, res_ti_sn, res_ti_sd, &
- res_int, testname, expect_error )
- LOGICAL, INTENT(IN), OPTIONAL :: add_op ! .TRUE.=add, .FALSE.=subtract
- LOGICAL, INTENT(IN), OPTIONAL :: multiply_op ! .TRUE.=multiply, .FALSE.=divide
- INTEGER, INTENT(IN), OPTIONAL :: op1_t_YY
- INTEGER, INTENT(IN), OPTIONAL :: op1_t_MM ! month
- INTEGER, INTENT(IN), OPTIONAL :: op1_t_DD ! day of month
- INTEGER, INTENT(IN), OPTIONAL :: op1_t_H
- INTEGER, INTENT(IN), OPTIONAL :: op1_t_M
- INTEGER, INTENT(IN), OPTIONAL :: op1_t_S
- INTEGER, INTENT(IN), OPTIONAL :: op1_t_Sn
- INTEGER, INTENT(IN), OPTIONAL :: op1_t_Sd
- INTEGER, INTENT(IN), OPTIONAL :: op1_ti_YY
- INTEGER, INTENT(IN), OPTIONAL :: op1_ti_MM ! month
- INTEGER, INTENT(IN), OPTIONAL :: op1_ti_DD ! day of month
- INTEGER, INTENT(IN), OPTIONAL :: op1_ti_H
- INTEGER, INTENT(IN), OPTIONAL :: op1_ti_M
- INTEGER, INTENT(IN), OPTIONAL :: op1_ti_S
- INTEGER, INTENT(IN), OPTIONAL :: op1_ti_Sn
- INTEGER, INTENT(IN), OPTIONAL :: op1_ti_Sd
- INTEGER, INTENT(IN), OPTIONAL :: op2_t_YY
- INTEGER, INTENT(IN), OPTIONAL :: op2_t_MM ! month
- INTEGER, INTENT(IN), OPTIONAL :: op2_t_DD ! day of month
- INTEGER, INTENT(IN), OPTIONAL :: op2_t_H
- INTEGER, INTENT(IN), OPTIONAL :: op2_t_M
- INTEGER, INTENT(IN), OPTIONAL :: op2_t_S
- INTEGER, INTENT(IN), OPTIONAL :: op2_t_Sn
- INTEGER, INTENT(IN), OPTIONAL :: op2_t_Sd
- INTEGER, INTENT(IN), OPTIONAL :: op2_ti_YY
- INTEGER, INTENT(IN), OPTIONAL :: op2_ti_MM ! month
- INTEGER, INTENT(IN), OPTIONAL :: op2_ti_DD ! day of month
- INTEGER, INTENT(IN), OPTIONAL :: op2_ti_H
- INTEGER, INTENT(IN), OPTIONAL :: op2_ti_M
- INTEGER, INTENT(IN), OPTIONAL :: op2_ti_S
- INTEGER, INTENT(IN), OPTIONAL :: op2_ti_Sn
- INTEGER, INTENT(IN), OPTIONAL :: op2_ti_Sd
- INTEGER, INTENT(IN), OPTIONAL :: op2_int
- INTEGER, INTENT(IN), OPTIONAL :: res_t_YY
- INTEGER, INTENT(IN), OPTIONAL :: res_t_MM ! month
- INTEGER, INTENT(IN), OPTIONAL :: res_t_DD ! day of month
- INTEGER, INTENT(IN), OPTIONAL :: res_t_H
- INTEGER, INTENT(IN), OPTIONAL :: res_t_M
- INTEGER, INTENT(IN), OPTIONAL :: res_t_S
- INTEGER, INTENT(IN), OPTIONAL :: res_t_Sn
- INTEGER, INTENT(IN), OPTIONAL :: res_t_Sd
- INTEGER, INTENT(IN), OPTIONAL :: res_ti_YY
- INTEGER, INTENT(IN), OPTIONAL :: res_ti_MM ! month
- INTEGER, INTENT(IN), OPTIONAL :: res_ti_DD ! day of month
- INTEGER, INTENT(IN), OPTIONAL :: res_ti_H
- INTEGER, INTENT(IN), OPTIONAL :: res_ti_M
- INTEGER, INTENT(IN), OPTIONAL :: res_ti_S
- INTEGER, INTENT(IN), OPTIONAL :: res_ti_Sn
- INTEGER, INTENT(IN), OPTIONAL :: res_ti_Sd
- INTEGER, INTENT(IN), OPTIONAL :: res_int
- CHARACTER (LEN=*), OPTIONAL, INTENT(IN) :: testname
- LOGICAL, OPTIONAL, INTENT(IN) :: expect_error
- ! locals
- LOGICAL :: iadd_op
- LOGICAL :: isubtract_op
- LOGICAL :: imultiply_op
- LOGICAL :: idivide_op
- INTEGER :: iop1_t_YY
- INTEGER :: iop1_t_MM ! month
- INTEGER :: iop1_t_DD ! day of month
- INTEGER :: iop1_t_H
- INTEGER :: iop1_t_M
- INTEGER :: iop1_t_S
- INTEGER :: iop1_t_Sn
- INTEGER :: iop1_t_Sd
- INTEGER :: iop1_ti_YY
- INTEGER :: iop1_ti_MM ! month
- INTEGER :: iop1_ti_DD ! day of month
- INTEGER :: iop1_ti_H
- INTEGER :: iop1_ti_M
- INTEGER :: iop1_ti_S
- INTEGER :: iop1_ti_Sn
- INTEGER :: iop1_ti_Sd
- INTEGER :: iop2_t_YY
- INTEGER :: iop2_t_MM ! month
- INTEGER :: iop2_t_DD ! day of month
- INTEGER :: iop2_t_H
- INTEGER :: iop2_t_M
- INTEGER :: iop2_t_S
- INTEGER :: iop2_t_Sn
- INTEGER :: iop2_t_Sd
- INTEGER :: iop2_ti_YY
- INTEGER :: iop2_ti_MM ! month
- INTEGER :: iop2_ti_DD ! day of month
- INTEGER :: iop2_ti_H
- INTEGER :: iop2_ti_M
- INTEGER :: iop2_ti_S
- INTEGER :: iop2_ti_Sn
- INTEGER :: iop2_ti_Sd
- INTEGER :: ires_t_YY
- INTEGER :: ires_t_MM ! month
- INTEGER :: ires_t_DD ! day of month
- INTEGER :: ires_t_H
- INTEGER :: ires_t_M
- INTEGER :: ires_t_S
- INTEGER :: ires_t_Sn
- INTEGER :: ires_t_Sd
- INTEGER :: ires_ti_YY
- INTEGER :: ires_ti_MM ! month
- INTEGER :: ires_ti_DD ! day of month
- INTEGER :: ires_ti_H
- INTEGER :: ires_ti_M
- INTEGER :: ires_ti_S
- INTEGER :: ires_ti_Sn
- INTEGER :: ires_ti_Sd
- LOGICAL :: op1_is_t , op2_is_t , res_is_t
- LOGICAL :: op1_is_ti, op2_is_ti, res_is_ti, op2_is_int
- LOGICAL :: res_is_int
- INTEGER :: num_ops, num_op1, num_op2, num_res
- LOGICAL :: unsupported_op, test_passed
- CHARACTER (LEN=512) :: itestname
- LOGICAL :: iexpect_error
- INTEGER :: rc
- INTEGER :: computed_int, Sn, Sd
- TYPE(ESMF_Time) :: op1_t , op2_t , res_t, computed_t
- TYPE(ESMF_TimeInterval) :: op1_ti, op2_ti, res_ti, computed_ti
- CHARACTER(LEN=ESMF_MAXSTR) :: str, op1_str, op2_str, res_str, computed_str, frac_str
- CHARACTER(LEN=1) :: op_str
- CHARACTER(LEN=17) :: op1_type_str, op2_type_str, res_type_str
-
- iadd_op = .FALSE.
- isubtract_op = .FALSE.
- imultiply_op = .FALSE.
- idivide_op = .FALSE.
- iop1_t_YY = 0
- iop1_t_MM = 1
- iop1_t_DD = 1
- iop1_t_H = 0
- iop1_t_M = 0
- iop1_t_S = 0
- iop1_t_Sn = 0
- iop1_t_Sd = 0
- iop1_ti_YY = 0
- iop1_ti_MM = 0
- iop1_ti_DD = 0
- iop1_ti_H = 0
- iop1_ti_M = 0
- iop1_ti_S = 0
- iop1_ti_Sn = 0
- iop1_ti_Sd = 0
- iop2_t_YY = 0
- iop2_t_MM = 1
- iop2_t_DD = 1
- iop2_t_H = 0
- iop2_t_M = 0
- iop2_t_S = 0
- iop2_t_Sn = 0
- iop2_t_Sd = 0
- iop2_ti_YY = 0
- iop2_ti_MM = 0
- iop2_ti_DD = 0
- iop2_ti_H = 0
- iop2_ti_M = 0
- iop2_ti_S = 0
- iop2_ti_Sn = 0
- iop2_ti_Sd = 0
- ires_t_YY = 0
- ires_t_MM = 1
- ires_t_DD = 1
- ires_t_H = 0
- ires_t_M = 0
- ires_t_S = 0
- ires_t_Sn = 0
- ires_t_Sd = 0
- ires_ti_YY = 0
- ires_ti_MM = 0
- ires_ti_DD = 0
- ires_ti_H = 0
- ires_ti_M = 0
- ires_ti_S = 0
- ires_ti_Sn = 0
- ires_ti_Sd = 0
- itestname = ''
- iexpect_error = .FALSE.
-
- IF ( PRESENT( add_op ) ) THEN
- iadd_op = add_op
- isubtract_op = ( .NOT. add_op )
- ENDIF
- IF ( PRESENT( multiply_op ) ) THEN
- imultiply_op = multiply_op
- idivide_op = ( .NOT. multiply_op )
- ENDIF
- num_ops = 0
- IF ( iadd_op ) num_ops = num_ops + 1
- IF ( isubtract_op ) num_ops = num_ops + 1
- IF ( imultiply_op ) num_ops = num_ops + 1
- IF ( idivide_op ) num_ops = num_ops + 1
- IF ( num_ops /= 1 ) THEN
- CALL wrf_error_fatal3( __FILE__ , __LINE__ , &
- 'ERROR test_arithmetic: inconsistent operation' )
- ENDIF
- IF ( PRESENT( op1_t_YY ) ) iop1_t_YY = op1_t_YY
- IF ( PRESENT( op1_t_MM ) ) iop1_t_MM = op1_t_MM
- IF ( PRESENT( op1_t_DD ) ) iop1_t_DD = op1_t_DD
- IF ( PRESENT( op1_t_H ) ) iop1_t_H = op1_t_H
- IF ( PRESENT( op1_t_M ) ) iop1_t_M = op1_t_M
- IF ( PRESENT( op1_t_S ) ) iop1_t_S = op1_t_S
- IF ( PRESENT( op1_t_Sn ) ) iop1_t_Sn = op1_t_Sn
- IF ( PRESENT( op1_t_Sd ) ) iop1_t_Sd = op1_t_Sd
- IF ( PRESENT( op1_ti_YY ) ) iop1_ti_YY = op1_ti_YY
- IF ( PRESENT( op1_ti_MM ) ) iop1_ti_MM = op1_ti_MM
- IF ( PRESENT( op1_ti_DD ) ) iop1_ti_DD = op1_ti_DD
- IF ( PRESENT( op1_ti_H ) ) iop1_ti_H = op1_ti_H
- IF ( PRESENT( op1_ti_M ) ) iop1_ti_M = op1_ti_M
- IF ( PRESENT( op1_ti_S ) ) iop1_ti_S = op1_ti_S
- IF ( PRESENT( op1_ti_Sn ) ) iop1_ti_Sn = op1_ti_Sn
- IF ( PRESENT( op1_ti_Sd ) ) iop1_ti_Sd = op1_ti_Sd
- IF ( PRESENT( op2_t_YY ) ) iop2_t_YY = op2_t_YY
- IF ( PRESENT( op2_t_MM ) ) iop2_t_MM = op2_t_MM
- IF ( PRESENT( op2_t_DD ) ) iop2_t_DD = op2_t_DD
- IF ( PRESENT( op2_t_H ) ) iop2_t_H = op2_t_H
- IF ( PRESENT( op2_t_M ) ) iop2_t_M = op2_t_M
- IF ( PRESENT( op2_t_S ) ) iop2_t_S = op2_t_S
- IF ( PRESENT( op2_t_Sn ) ) iop2_t_Sn = op2_t_Sn
- IF ( PRESENT( op2_t_Sd ) ) iop2_t_Sd = op2_t_Sd
- IF ( PRESENT( op2_ti_YY ) ) iop2_ti_YY = op2_ti_YY
- IF ( PRESENT( op2_ti_MM ) ) iop2_ti_MM = op2_ti_MM
- IF ( PRESENT( op2_ti_DD ) ) iop2_ti_DD = op2_ti_DD
- IF ( PRESENT( op2_ti_H ) ) iop2_ti_H = op2_ti_H
- IF ( PRESENT( op2_ti_M ) ) iop2_ti_M = op2_ti_M
- IF ( PRESENT( op2_ti_S ) ) iop2_ti_S = op2_ti_S
- IF ( PRESENT( op2_ti_Sn ) ) iop2_ti_Sn = op2_ti_Sn
- IF ( PRESENT( op2_ti_Sd ) ) iop2_ti_Sd = op2_ti_Sd
- IF ( PRESENT( res_t_YY ) ) ires_t_YY = res_t_YY
- IF ( PRESENT( res_t_MM ) ) ires_t_MM = res_t_MM
- IF ( PRESENT( res_t_DD ) ) ires_t_DD = res_t_DD
- IF ( PRESENT( res_t_H ) ) ires_t_H = res_t_H
- IF ( PRESENT( res_t_M ) ) ires_t_M = res_t_M
- IF ( PRESENT( res_t_S ) ) ires_t_S = res_t_S
- IF ( PRESENT( res_t_Sn ) ) ires_t_Sn = res_t_Sn
- IF ( PRESENT( res_t_Sd ) ) ires_t_Sd = res_t_Sd
- IF ( PRESENT( res_ti_YY ) ) ires_ti_YY = res_ti_YY
- IF ( PRESENT( res_ti_MM ) ) ires_ti_MM = res_ti_MM
- IF ( PRESENT( res_ti_DD ) ) ires_ti_DD = res_ti_DD
- IF ( PRESENT( res_ti_H ) ) ires_ti_H = res_ti_H
- IF ( PRESENT( res_ti_M ) ) ires_ti_M = res_ti_M
- IF ( PRESENT( res_ti_S ) ) ires_ti_S = res_ti_S
- IF ( PRESENT( res_ti_Sn ) ) ires_ti_Sn = res_ti_Sn
- IF ( PRESENT( res_ti_Sd ) ) ires_ti_Sd = res_ti_Sd
- IF ( PRESENT( testname ) ) itestname = TRIM(testname)
- IF ( PRESENT( expect_error ) ) iexpect_error = expect_error
-
- ! Ensure that optional arguments are consistent...
- op1_is_t = ( PRESENT( op1_t_YY ) .OR. PRESENT( op1_t_MM ) .OR. &
- PRESENT( op1_t_DD ) .OR. PRESENT( op1_t_H ) .OR. &
- PRESENT( op1_t_M ) .OR. PRESENT( op1_t_S ) .OR. &
- PRESENT( op1_t_Sn ) .OR. PRESENT( op1_t_Sd ) )
- op1_is_ti = ( PRESENT( op1_ti_YY ) .OR. PRESENT( op1_ti_MM ) .OR. &
- PRESENT( op1_ti_DD ) .OR. PRESENT( op1_ti_H ) .OR. &
- PRESENT( op1_ti_M ) .OR. PRESENT( op1_ti_S ) .OR. &
- PRESENT( op1_ti_Sn ) .OR. PRESENT( op1_ti_Sd ) )
- op2_is_t = ( PRESENT( op2_t_YY ) .OR. PRESENT( op2_t_MM ) .OR. &
- PRESENT( op2_t_DD ) .OR. PRESENT( op2_t_H ) .OR. &
- PRESENT( op2_t_M ) .OR. PRESENT( op2_t_S ) .OR. &
- PRESENT( op2_t_Sn ) .OR. PRESENT( op2_t_Sd ) )
- op2_is_ti = ( PRESENT( op2_ti_YY ) .OR. PRESENT( op2_ti_MM ) .OR. &
- PRESENT( op2_ti_DD ) .OR. PRESENT( op2_ti_H ) .OR. &
- PRESENT( op2_ti_M ) .OR. PRESENT( op2_ti_S ) .OR. &
- PRESENT( op2_ti_Sn ) .OR. PRESENT( op2_ti_Sd ) )
- op2_is_int = ( PRESENT( op2_int ) )
- res_is_t = ( PRESENT( res_t_YY ) .OR. PRESENT( res_t_MM ) .OR. &
- PRESENT( res_t_DD ) .OR. PRESENT( res_t_H ) .OR. &
- PRESENT( res_t_M ) .OR. PRESENT( res_t_S ) .OR. &
- PRESENT( res_t_Sn ) .OR. PRESENT( res_t_Sd ) )
- res_is_ti = ( PRESENT( res_ti_YY ) .OR. PRESENT( res_ti_MM ) .OR. &
- PRESENT( res_ti_DD ) .OR. PRESENT( res_ti_H ) .OR. &
- PRESENT( res_ti_M ) .OR. PRESENT( res_ti_S ) .OR. &
- PRESENT( res_ti_Sn ) .OR. PRESENT( res_ti_Sd ) )
- res_is_int = ( PRESENT( res_int ) )
- num_op1 = 0
- IF ( op1_is_t ) num_op1 = num_op1 + 1
- IF ( op1_is_ti ) num_op1 = num_op1 + 1
- IF ( num_op1 /= 1 ) THEN
- CALL wrf_error_fatal3( __FILE__ , __LINE__ , &
- 'ERROR test_arithmetic: inconsistent args for op1' )
- ENDIF
- num_op2 = 0
- IF ( op2_is_t ) num_op2 = num_op2 + 1
- IF ( op2_is_ti ) num_op2 = num_op2 + 1
- IF ( op2_is_int ) num_op2 = num_op2 + 1
- IF ( num_op2 /= 1 ) THEN
- CALL wrf_error_fatal3( __FILE__ , __LINE__ , &
- 'ERROR test_arithmetic: inconsistent args for op2' )
- ENDIF
- num_res = 0
- IF ( res_is_t ) num_res = num_res + 1
- IF ( res_is_ti ) num_res = num_res + 1
- IF ( res_is_int ) num_res = num_res + 1
- IF ( num_res /= 1 ) THEN
- CALL wrf_error_fatal3( __FILE__ , __LINE__ , &
- 'ERROR test_arithmetic: inconsistent args for result' )
- ENDIF
-
- ! Initialize op1
- IF ( op1_is_t ) THEN
- op1_type_str = 'ESMF_Time'
- CALL ESMF_TimeSet( op1_t, YY=iop1_t_YY, MM=iop1_t_MM, DD=iop1_t_DD , &
- H=iop1_t_H, M=iop1_t_M, S=iop1_t_S, Sn=iop1_t_Sn, Sd=iop1_t_Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeSet() ', &
- __FILE__ , &
- __LINE__ )
- CALL ESMF_TimeGet( op1_t, timeString=op1_str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- ! handle fractions
- CALL fraction_to_string( Sn, Sd, frac_str )
- op1_str = TRIM(op1_str)//TRIM(frac_str)
- ELSE
- op1_type_str = 'ESMF_TimeInterval'
- CALL ESMF_TimeIntervalSet( op1_ti, YY=iop1_ti_YY, MM=iop1_ti_MM, &
- D=iop1_ti_DD , &
- H=iop1_ti_H, M=iop1_ti_M, &
- S=iop1_ti_S, Sn=iop1_ti_Sn, Sd=iop1_ti_Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeIntervalSet() ', &
- __FILE__ , &
- __LINE__ )
- CALL ESMF_TimeIntervalGet( op1_ti, timeString=op1_str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- ! handle fractions
- CALL fraction_to_string( Sn, Sd, frac_str )
- op1_str = TRIM(op1_str)//TRIM(frac_str)
- ENDIF
- ! Initialize op2
- IF ( op2_is_t ) THEN
- op2_type_str = 'ESMF_Time'
- CALL ESMF_TimeSet( op2_t, YY=iop2_t_YY, MM=iop2_t_MM, DD=iop2_t_DD , &
- H=iop2_t_H, M=iop2_t_M, S=iop2_t_S, Sn=iop2_t_Sn, Sd=iop2_t_Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeSet() ', &
- __FILE__ , &
- __LINE__ )
- CALL ESMF_TimeGet( op2_t, timeString=op2_str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- ! handle fractions
- CALL fraction_to_string( Sn, Sd, frac_str )
- op2_str = TRIM(op2_str)//TRIM(frac_str)
- ELSE IF ( op2_is_ti ) THEN
- op2_type_str = 'ESMF_TimeInterval'
- CALL ESMF_TimeIntervalSet( op2_ti, YY=iop2_ti_YY, MM=iop2_ti_MM, &
- D=iop2_ti_DD , &
- H=iop2_ti_H, M=iop2_ti_M, &
- S=iop2_ti_S, Sn=iop2_ti_Sn, Sd=iop2_ti_Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeIntervalSet() ', &
- __FILE__ , &
- __LINE__ )
- CALL ESMF_TimeIntervalGet( op2_ti, timeString=op2_str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- ! handle fractions
- CALL fraction_to_string( Sn, Sd, frac_str )
- op2_str = TRIM(op2_str)//TRIM(frac_str)
- ELSE
- op2_type_str = 'INTEGER'
- IF ( op2_int > 0 ) THEN
- WRITE(op2_str,FMT="('+',I8.8)") ABS(op2_int)
- ELSE
- WRITE(op2_str,FMT="('-',I8.8)") ABS(op2_int)
- ENDIF
- ENDIF
- ! Initialize res
- IF ( res_is_t ) THEN ! result is ESMF_Time
- res_type_str = 'ESMF_Time'
- CALL ESMF_TimeSet( res_t, YY=ires_t_YY, MM=ires_t_MM, DD=ires_t_DD , &
- H=ires_t_H, M=ires_t_M, S=ires_t_S, Sn=ires_t_Sn, Sd=ires_t_Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeSet() ', &
- __FILE__ , &
- __LINE__ )
- CALL ESMF_TimeGet( res_t, timeString=res_str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- ! handle fractions
- CALL fraction_to_string( Sn, Sd, frac_str )
- res_str = TRIM(res_str)//TRIM(frac_str)
- ELSE IF ( res_is_ti ) THEN ! result is ESMF_TimeInterval
- res_type_str = 'ESMF_TimeInterval'
- CALL ESMF_TimeIntervalSet( res_ti, YY=ires_ti_YY, MM=ires_ti_MM, &
- D=ires_ti_DD , &
- H=ires_ti_H, M=ires_ti_M, &
- S=ires_ti_S, Sn=ires_ti_Sn, Sd=ires_ti_Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeIntervalSet() ', &
- __FILE__ , &
- __LINE__ )
- CALL ESMF_TimeIntervalGet( res_ti, timeString=res_str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- ! handle fractions
- CALL fraction_to_string( Sn, Sd, frac_str )
- res_str = TRIM(res_str)//TRIM(frac_str)
- ELSE ! result is INTEGER
- res_type_str = 'INTEGER'
- IF ( res_int > 0 ) THEN
- WRITE(res_str,FMT="('+',I8.8)") ABS(res_int)
- ELSE
- WRITE(res_str,FMT="('-',I8.8)") ABS(res_int)
- ENDIF
- ENDIF
-
- ! perform requested operation
- unsupported_op = .FALSE.
- ! modify behavior of wrf_error_fatal3 for operator being tested
- IF ( iexpect_error ) WRF_ERROR_FATAL_PRINT = .TRUE.
- ! add
- IF ( iadd_op ) THEN
- op_str = '+'
- IF ( res_is_t ) THEN ! result is ESMF_Time
- IF ( op1_is_t .AND. op2_is_ti ) THEN
- ! ESMF_Time = ESMF_Time + ESMF_TimeInterval
- computed_t = op1_t + op2_ti
- ELSE IF ( op1_is_ti .AND. op2_is_t ) THEN
- ! ESMF_Time = ESMF_TimeInterval + ESMF_Time
- computed_t = op1_ti + op2_t
- ELSE
- unsupported_op = .TRUE.
- ENDIF
- ELSE ! result is ESMF_TimeInterval
- IF ( op1_is_ti .AND. op2_is_ti ) THEN
- ! ESMF_TimeInterval = ESMF_TimeInterval + ESMF_TimeInterval
- computed_ti = op1_ti + op2_ti
- ELSE
- unsupported_op = .TRUE.
- ENDIF
- ENDIF
- ! subtract
- ELSE IF ( isubtract_op ) THEN
- op_str = '-'
- IF ( res_is_t ) THEN ! result is ESMF_Time
- IF ( op1_is_t .AND. op2_is_ti ) THEN
- ! ESMF_Time = ESMF_Time - ESMF_TimeInterval
- computed_t = op1_t - op2_ti
- ELSE
- unsupported_op = .TRUE.
- ENDIF
- ELSE ! result is ESMF_TimeInterval
- IF ( op1_is_t .AND. op2_is_t ) THEN
- ! ESMF_TimeInterval = ESMF_Time - ESMF_Time
- computed_ti = op1_t - op2_t
- ELSE IF ( op1_is_ti .AND. op2_is_ti ) THEN
- ! ESMF_TimeInterval = ESMF_TimeInterval - ESMF_TimeInterval
- computed_ti = op1_ti - op2_ti
- ELSE
- unsupported_op = .TRUE.
- ENDIF
- ENDIF
- ELSE IF ( imultiply_op ) THEN
- op_str = '*'
- IF ( res_is_ti ) THEN ! result is ESMF_TimeInterval
- IF ( op1_is_ti .AND. op2_is_int ) THEN
- ! ESMF_TimeInterval = ESMF_TimeInterval * INTEGER
- computed_ti = op1_ti * op2_int
- ELSE
- unsupported_op = .TRUE.
- ENDIF
- ENDIF
- ELSE IF ( idivide_op ) THEN
- op_str = '/'
- IF ( res_is_ti ) THEN ! result is ESMF_TimeInterval
- IF ( op1_is_ti .AND. op2_is_int ) THEN
- ! ESMF_TimeInterval = ESMF_TimeInterval / INTEGER
- computed_ti = op1_ti / op2_int
- ELSE
- unsupported_op = .TRUE.
- ENDIF
- ELSE IF ( res_is_int ) THEN ! result is INTEGER
- IF ( op1_is_ti .AND. op2_is_ti ) THEN
- ! INTEGER = ESMF_TimeInterval / ESMF_TimeInterval
- ! number of whole time intervals
- computed_int = ESMF_TimeIntervalDIVQuot( op1_ti , op2_ti )
- ELSE
- unsupported_op = .TRUE.
- ENDIF
- ENDIF
- ENDIF
- ! restore default behavior of wrf_error_fatal3
- IF ( iexpect_error ) WRF_ERROR_FATAL_PRINT = .FALSE.
- IF ( unsupported_op ) THEN
- WRITE(str,*) 'ERROR test_arithmetic ',TRIM(itestname), &
- ': unsupported operation (', &
- TRIM(res_type_str),' = ',TRIM(op1_type_str),' ',TRIM(op_str),' ', &
- TRIM(op2_type_str),')'
- CALL wrf_error_fatal3( __FILE__ , __LINE__ , str )
- ENDIF
-
- ! check result
- test_passed = .FALSE.
- IF ( res_is_t ) THEN ! result is ESMF_Time
- IF ( computed_t == res_t ) THEN
- test_passed = .TRUE.
- ELSE
- CALL ESMF_TimeGet( computed_t, timeString=computed_str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- ! handle fractions
- CALL fraction_to_string( Sn, Sd, frac_str )
- computed_str = TRIM(computed_str)//TRIM(frac_str)
- ENDIF
- ELSE IF ( res_is_ti ) THEN ! result is ESMF_TimeInterval
- IF ( computed_ti == res_ti ) THEN
- test_passed = .TRUE.
- ELSE
- CALL ESMF_TimeIntervalGet( computed_ti, timeString=computed_str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- ! handle fractions
- CALL fraction_to_string( Sn, Sd, frac_str )
- computed_str = TRIM(computed_str)//TRIM(frac_str)
- ENDIF
- ELSE ! result is INTEGER
- IF ( computed_int == res_int ) THEN
- test_passed = .TRUE.
- ELSE
- IF ( computed_int > 0 ) THEN
- WRITE(computed_str,FMT="('+',I8.8)") ABS(computed_int)
- ELSE
- WRITE(computed_str,FMT="('-',I8.8)") ABS(computed_int)
- ENDIF
- ENDIF
- ENDIF
- IF ( test_passed ) THEN
- WRITE(*,FMT='(A)') 'PASS: '//TRIM(itestname)
- ELSE
- WRITE(*,*) 'FAIL: ',TRIM(itestname),': (', &
- TRIM(res_type_str),' = ',TRIM(op1_type_str),' ',TRIM(op_str),' ', &
- TRIM(op2_type_str),') expected ', &
- TRIM(res_str),' = ',TRIM(op1_str),' ',TRIM(op_str),' ', &
- TRIM(op2_str),' but computed ',TRIM(computed_str)
- ENDIF
-
- END SUBROUTINE test_arithmetic
-
-
-
- ! simple clock creation and advance with add-subtract tests thrown in
- ! no self checks (yet)
- SUBROUTINE test_clock_advance( &
- start_yy, start_mm, start_dd, start_h, start_m, start_s, &
- stop_yy, stop_mm, stop_dd, stop_h, stop_m, stop_s, &
- timestep_d, timestep_h, timestep_m, timestep_s, timestep_sn, timestep_sd, &
- testname, increment_S, increment_Sn, increment_Sd )
- INTEGER, INTENT(IN), OPTIONAL :: start_YY
- INTEGER, INTENT(IN), OPTIONAL :: start_MM ! month
- INTEGER, INTENT(IN), OPTIONAL :: start_DD ! day of month
- INTEGER, INTENT(IN), OPTIONAL :: start_H
- INTEGER, INTENT(IN), OPTIONAL :: start_M
- INTEGER, INTENT(IN), OPTIONAL :: start_S
- INTEGER, INTENT(IN), OPTIONAL :: stop_YY
- INTEGER, INTENT(IN), OPTIONAL :: stop_MM ! month
- INTEGER, INTENT(IN), OPTIONAL :: stop_DD ! day of month
- INTEGER, INTENT(IN), OPTIONAL :: stop_H
- INTEGER, INTENT(IN), OPTIONAL :: stop_M
- INTEGER, INTENT(IN), OPTIONAL :: stop_S
- INTEGER, INTENT(IN), OPTIONAL :: timestep_D ! day
- INTEGER, INTENT(IN), OPTIONAL :: timestep_H
- INTEGER, INTENT(IN), OPTIONAL :: timestep_M
- INTEGER, INTENT(IN), OPTIONAL :: timestep_S
- INTEGER, INTENT(IN), OPTIONAL :: timestep_Sn
- INTEGER, INTENT(IN), OPTIONAL :: timestep_Sd
- CHARACTER (LEN=*), OPTIONAL, INTENT(IN) :: testname
- INTEGER, INTENT(IN), OPTIONAL :: increment_S ! add and subtract this
- INTEGER, INTENT(IN), OPTIONAL :: increment_Sn ! value each time step
- INTEGER, INTENT(IN), OPTIONAL :: increment_Sd
-
- ! locals
- INTEGER :: istart_YY
- INTEGER :: istart_MM ! month
- INTEGER :: istart_DD ! day of month
- INTEGER :: istart_H
- INTEGER :: istart_M
- INTEGER :: istart_S
- INTEGER :: istop_YY
- INTEGER :: istop_MM ! month
- INTEGER :: istop_DD ! day of month
- INTEGER :: istop_H
- INTEGER :: istop_M
- INTEGER :: istop_S
- INTEGER :: itimestep_D ! day
- INTEGER :: itimestep_H
- INTEGER :: itimestep_M
- INTEGER :: itimestep_S
- INTEGER :: itimestep_Sn
- INTEGER :: itimestep_Sd
- CHARACTER (LEN=512) :: itestname, itestfullname
- INTEGER :: iincrement_S
- INTEGER :: iincrement_Sn
- INTEGER :: iincrement_Sd
- INTEGER :: Sn, Sd
- INTEGER rc
- TYPE(ESMF_Time) :: start_time, stop_time, current_time
- TYPE(ESMF_Clock), POINTER :: domain_clock
- TYPE(ESMF_TimeInterval) :: timestep, increment
- TYPE(ESMF_Time) :: add_time, subtract_time
- INTEGER :: itimestep
- REAL(ESMF_KIND_R8) :: dayr8
- CHARACTER(LEN=ESMF_MAXSTR) :: str, frac_str
-
- istart_YY = 0
- istart_MM = 1
- istart_DD = 1
- istart_H = 0
- istart_M = 0
- istart_S = 0
- istop_YY = 0
- istop_MM = 1
- istop_DD = 1
- istop_H = 0
- istop_M = 0
- istop_S = 0
- itimestep_D = 0
- itimestep_H = 0
- itimestep_M = 0
- itimestep_S = 0
- itimestep_Sn = 0
- itimestep_Sd = 0
- itestname = ''
- iincrement_S = 0
- iincrement_Sn = 0
- iincrement_Sd = 0
-
- IF ( PRESENT( start_YY ) ) istart_YY = start_YY
- IF ( PRESENT( start_MM ) ) istart_MM = start_MM
- IF ( PRESENT( start_DD ) ) istart_DD = start_DD
- IF ( PRESENT( start_H ) ) istart_H = start_H
- IF ( PRESENT( start_M ) ) istart_M = start_M
- IF ( PRESENT( start_S ) ) istart_S = start_S
- IF ( PRESENT( stop_YY ) ) istop_YY = stop_YY
- IF ( PRESENT( stop_MM ) ) istop_MM = stop_MM
- IF ( PRESENT( stop_DD ) ) istop_DD = stop_DD
- IF ( PRESENT( stop_H ) ) istop_H = stop_H
- IF ( PRESENT( stop_M ) ) istop_M = stop_M
- IF ( PRESENT( stop_S ) ) istop_S = stop_S
- IF ( PRESENT( timestep_D ) ) itimestep_D = timestep_D
- IF ( PRESENT( timestep_H ) ) itimestep_H = timestep_H
- IF ( PRESENT( timestep_M ) ) itimestep_M = timestep_M
- IF ( PRESENT( timestep_S ) ) itimestep_S = timestep_S
- IF ( PRESENT( timestep_Sn ) ) itimestep_Sn = timestep_Sn
- IF ( PRESENT( timestep_Sd ) ) itimestep_Sd = timestep_Sd
- IF ( PRESENT( testname ) ) itestname = TRIM(testname)//'_'
- IF ( PRESENT( increment_S ) ) iincrement_S = increment_S
- IF ( PRESENT( increment_Sn ) ) iincrement_Sn = increment_Sn
- IF ( PRESENT( increment_Sd ) ) iincrement_Sd = increment_Sd
-
- ! Initialize start time, stop time, time step, clock for simple case.
- itestfullname = TRIM(itestname)//'SETUP'
- CALL ESMF_TimeSet( start_time, YY=istart_YY, MM=istart_MM, DD=istart_DD , &
- H=istart_H, M=istart_M, S=istart_S, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeSet() ', &
- __FILE__ , &
- __LINE__ )
-
- CALL ESMF_TimeGet( start_time, timeString=str, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': start_time = <',TRIM(str),'>'
-
- CALL ESMF_TimeSet( stop_time, YY=istop_YY, MM=istop_MM, DD=istop_DD , &
- H=istop_H, M=istop_M, S=istop_S, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeSet() ', &
- __FILE__ , &
- __LINE__ )
-
- CALL ESMF_TimeGet( stop_time, timeString=str, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': stop_time = <',TRIM(str),'>'
-
- CALL ESMF_TimeIntervalSet( timestep, D=itimestep_D, H=itimestep_H, &
- M=itimestep_M, S=itimestep_S, &
- Sn=itimestep_Sn, Sd=itimestep_Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeIntervalSet() ', &
- __FILE__ , &
- __LINE__ )
-
- CALL ESMF_TimeIntervalGet( timestep, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeIntervalGet() ', &
- __FILE__ , &
- __LINE__ )
- ! handle fractions
- CALL fraction_to_string( Sn, Sd, frac_str )
- str = TRIM(str)//TRIM(frac_str)
- WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': timestep = <',TRIM(str),'>'
-
- CALL ESMF_TimeIntervalSet( increment, S=iincrement_S, &
- Sn=iincrement_Sn, Sd=iincrement_Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeIntervalSet() ', &
- __FILE__ , &
- __LINE__ )
-
- CALL ESMF_TimeIntervalGet( increment, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeIntervalGet() ', &
- __FILE__ , &
- __LINE__ )
- ! handle fractions
- CALL fraction_to_string( Sn, Sd, frac_str )
- str = TRIM(str)//TRIM(frac_str)
- WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': increment = <',TRIM(str),'>'
-
- ALLOCATE( domain_clock )
- domain_clock = ESMF_ClockCreate( TimeStep= timestep, &
- StartTime=start_time, &
- StopTime= stop_time, &
- rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_ClockCreate() ', &
- __FILE__ , &
- __LINE__ )
-
- CALL ESMF_ClockGet( domain_clock, CurrTime=current_time, &
- rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_ClockGet() ', &
- __FILE__ , &
- __LINE__ )
-
- CALL ESMF_TimeGet( current_time, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- CALL fraction_to_string( Sn, Sd, frac_str )
- str = TRIM(str)//TRIM(frac_str)
- WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': clock current_time = <',TRIM(str),'>'
-
- CALL ESMF_TimeGet( current_time, dayOfYear_r8=dayr8, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- WRITE(*,FMT='(A,A,F10.6,A)') TRIM(itestfullname),': current_time dayOfYear_r8 = < ',dayr8,' >'
-
- subtract_time = current_time - increment
- CALL ESMF_TimeGet( subtract_time, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- CALL fraction_to_string( Sn, Sd, frac_str )
- str = TRIM(str)//TRIM(frac_str)
- WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': current_time-increment = <',TRIM(str),'>'
-
- add_time = current_time + increment
- CALL ESMF_TimeGet( add_time, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- CALL fraction_to_string( Sn, Sd, frac_str )
- str = TRIM(str)//TRIM(frac_str)
- WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': current_time+increment = <',TRIM(str),'>'
-
- ! Advance clock.
- itestfullname = TRIM(itestname)//'ADVANCE'
- itimestep = 0
- DO WHILE ( .NOT. ESMF_ClockIsStopTime(domain_clock ,rc=rc) )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_ClockIsStopTime() ', &
- __FILE__ , &
- __LINE__ )
- itimestep = itimestep + 1
-
- CALL ESMF_ClockAdvance( domain_clock, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_ClockAdvance() ', &
- __FILE__ , &
- __LINE__ )
-
- CALL ESMF_ClockGet( domain_clock, CurrTime=current_time, &
- rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_ClockGet() ', &
- __FILE__ , &
- __LINE__ )
-
- CALL ESMF_TimeGet( current_time, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- CALL fraction_to_string( Sn, Sd, frac_str )
- str = TRIM(str)//TRIM(frac_str)
- WRITE(*,FMT='(A,A,I6.6,A,A,A)') TRIM(itestfullname),': count = ', &
- itimestep,' current_time = <',TRIM(str),'>'
-
- subtract_time = current_time - increment
- CALL ESMF_TimeGet( subtract_time, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- CALL fraction_to_string( Sn, Sd, frac_str )
- str = TRIM(str)//TRIM(frac_str)
- WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': current_time-increment = <',TRIM(str),'>'
-
- add_time = current_time + increment
- CALL ESMF_TimeGet( add_time, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- TRIM(itestfullname)//'ESMF_TimeGet() ', &
- __FILE__ , &
- __LINE__ )
- CALL fraction_to_string( Sn, Sd, frac_str )
- str = TRIM(str)//TRIM(frac_str)
- WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': current_time+increment = <',TRIM(str),'>'
-
- ENDDO
-
- DEALLOCATE( domain_clock )
-
- END SUBROUTINE test_clock_advance
-
-END MODULE my_tests
-
-
-#if defined( TIME_F90_ONLY )
-
-! TBH: Improve the build of Test1.exe to use WRF versions of these
-! TBH: routines and remove these hacked-in duplicates!!
-
-SUBROUTINE wrf_abort
- IMPLICIT NONE
-#if defined( DM_PARALLEL ) && ! defined( STUBMPI )
- INCLUDE 'mpif.h'
- INTEGER ierr
- CALL mpi_abort(MPI_COMM_WORLD,1,ierr)
-#else
- STOP
-#endif
-END SUBROUTINE wrf_abort
-
-SUBROUTINE wrf_message( str )
- IMPLICIT NONE
- CHARACTER*(*) str
-#if defined( DM_PARALLEL ) && ! defined( STUBMPI)
- write(0,*) str
-#endif
- print*, str
-END SUBROUTINE wrf_message
-
-! intentionally write to stderr only
-SUBROUTINE wrf_message2( str )
- IMPLICIT NONE
- CHARACTER*(*) str
- write(0,*) str
-END SUBROUTINE wrf_message2
-
-SUBROUTINE wrf_error_fatal3( file_str, line, str )
- USE my_tests
- IMPLICIT NONE
- CHARACTER*(*) file_str
- INTEGER , INTENT (IN) :: line ! only print file and line if line > 0
- CHARACTER*(*) str
- CHARACTER*256 :: line_str
- write(line_str,'(i6)') line
- ! special behavior for testing since Fortran cannot catch exceptions
- IF ( WRF_ERROR_FATAL_PRINT ) THEN
- ! just print message and continue
- CALL wrf_message( 'ERROR IN FILE: '//TRIM(file_str)//' LINE: '//TRIM(line_str) )
- ELSE
- ! normal behavior
-#if defined( DM_PARALLEL ) && ! defined( STUBMPI )
- CALL wrf_message( '-------------- FATAL CALLED ---------------' )
- ! only print file and line if line is positive
- IF ( line > 0 ) THEN
- CALL wrf_message( 'FATAL CALLED FROM FILE: '//file_str//' LINE: '//TRIM(line_str) )
- ENDIF
- CALL wrf_message( str )
- CALL wrf_message( '-------------------------------------------' )
-#else
- CALL wrf_message2( '-------------- FATAL CALLED ---------------' )
- ! only print file and line if line is positive
- IF ( line > 0 ) THEN
- CALL wrf_message( 'FATAL CALLED FROM FILE: '//file_str//' LINE: '//TRIM(line_str) )
- ENDIF
- CALL wrf_message2( str )
- CALL wrf_message2( '-------------------------------------------' )
-#endif
- CALL wrf_abort
- ENDIF
-END SUBROUTINE wrf_error_fatal3
-
-SUBROUTINE wrf_error_fatal( str )
- IMPLICIT NONE
- CHARACTER*(*) str
- CALL wrf_error_fatal3 ( ' ', 0, str )
-END SUBROUTINE wrf_error_fatal
-
-#endif
-
-
-! Check to see if expected value == actual value
-! If not, print message and exit.
-SUBROUTINE test_check_error( expected, actual, str, file_str, line )
- IMPLICIT NONE
- INTEGER , INTENT (IN) :: expected
- INTEGER , INTENT (IN) :: actual
- CHARACTER*(*) str
- CHARACTER*(*) file_str
- INTEGER , INTENT (IN) :: line
- CHARACTER (LEN=512) :: rc_str
- CHARACTER (LEN=512) :: str_with_rc
- IF ( expected .ne. actual ) THEN
- WRITE (rc_str,*) ' Routine returned error code = ',actual
- str_with_rc = 'FAIL: '//TRIM(str)//TRIM(rc_str)
- CALL wrf_error_fatal3( file_str, line, str_with_rc )
- ENDIF
-END SUBROUTINE test_check_error
-
-
-
-PROGRAM time_manager_test
- USE ESMF_Mod
- USE my_tests
- IMPLICIT NONE
- INTEGER :: rc
-
- PRINT *,'BEGIN TEST SUITE'
-
- CALL ESMF_Initialize( defaultCalendar=ESMF_CAL_GREGORIAN, rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- 'ESMF_Initialize() ', &
- __FILE__ , &
- __LINE__ )
-! PRINT *,'DEBUG: back from ESMF_Initialize(), rc = ',rc
-
-! CALL test_print( t_yy, t_mm, t_dd, t_h, t_m, t_s, &
-! ti_yy, ti_mm, ti_dd, ti_h, ti_m, ti_s, &
-! res_str, testname )
-
- ! Print times
- ! "vanilla" tests
-! PRINT *,'DEBUG: calling 1st test_print()'
- CALL test_print( t_yy=2001, t_mm=12, t_dd=3, t_h=1, t_m=20, t_s=10, &
- res_str='2001-12-03_01:20:10', testname='printT_1' )
-! PRINT *,'DEBUG: back from 1st test_print()'
- CALL test_print( t_yy=0, t_mm=1, t_dd=1, t_h=0, t_m=0, t_s=0, &
- res_str='0000-01-01_00:00:00', testname='printT_2' )
- CALL test_print( t_yy=2003, t_mm=12, t_dd=30, t_h=23, t_m=59, t_s=50, &
- res_str='2003-12-30_23:59:50', testname='printT_3' )
- CALL test_print( t_yy=2003, t_mm=12, t_dd=31, t_h=23, t_m=59, t_s=50, &
- res_str='2003-12-31_23:59:50', testname='printT_4' )
- CALL test_print( t_yy=2004, t_mm=12, t_dd=30, t_h=23, t_m=59, t_s=50, &
- res_str='2004-12-30_23:59:50', testname='printT_5' )
- CALL test_print( t_yy=2004, t_mm=12, t_dd=31, t_h=23, t_m=59, t_s=50, &
- res_str='2004-12-31_23:59:50', testname='printT_6' )
-!$$$ NOTE that this fails -- need to fix up output string for negative year
-! CALL test_print( t_yy=-2004, t_mm=12, t_dd=31, t_h=23, t_m=59, t_s=50, &
-! res_str='-2004-12-31_23:59:50', testname='printT_6' )
-
- ! these test default behavior of test harness
- CALL test_print( t_s=0, &
- res_str='0000-01-01_00:00:00', testname='printT_D1' )
- CALL test_print( t_yy=0, &
- res_str='0000-01-01_00:00:00', testname='printT_D2' )
-
- ! fractions
- CALL test_print( t_yy=2001, t_mm=12, t_dd=3, t_h=1, t_m=20, t_s=10, &
- t_sn=1, t_sd=3, &
- res_str='2001-12-03_01:20:10+01/03', testname='printT_F1' )
- CALL test_print( t_yy=2001, t_mm=12, t_dd=3, t_h=1, t_m=20, t_s=10, &
- t_sn=4, t_sd=3, &
- res_str='2001-12-03_01:20:11+01/03', testname='printT_F2' )
- CALL test_print( t_yy=2001, t_mm=12, t_dd=3, t_h=1, t_m=20, t_s=10, &
- t_sn=12, t_sd=3, &
- res_str='2001-12-03_01:20:14', testname='printT_F3' )
- CALL test_print( t_yy=2001, t_mm=12, t_dd=3, t_h=1, t_m=20, t_s=10, &
- t_sn=-1, t_sd=3, &
- res_str='2001-12-03_01:20:09+02/03', testname='printT_F4' )
-
- ! ERROR, MM out of range
-!$$$here... fix so this just prints "ERROR: <testname>" in failure case
-!$$$here... also need "expect_fail" to reverse sense of PASS/FAIL message for
-!$$$here... tests that should fail
-! CALL test_print( t_yy=2001, t_mm=13, t_dd=3, t_h=1, t_m=20, t_s=10, &
-! res_str='2002-01-03_01:20:10', testname='printT_E1', expect_error=.TRUE. )
-
- ! Print time intervals
- ! "vanilla" tests
- CALL test_print( ti_yy=0, ti_mm=0, ti_dd=0, ti_h=0, ti_m=0, ti_s=0, &
- res_str='0000000000_000:000:000', testname='printTI_1' )
- CALL test_print( ti_yy=0, ti_mm=0, ti_dd=500, ti_h=0, ti_m=0, ti_s=7270, &
- res_str='0000000500_002:001:010', testname='printTI_2' )
-
- ! these test default behavior of test harness
- CALL test_print( ti_s=0, &
- res_str='0000000000_000:000:000', testname='printTI_D1' )
- CALL test_print( ti_yy=0, &
- res_str='0000000000_000:000:000', testname='printTI_D2' )
-
- ! these test negative values
- CALL test_print( ti_yy=0000, ti_mm=0, ti_dd=-3, ti_h=-1, ti_m=-20, ti_s=-10, &
- res_str='-0000000003_001:020:010', testname='printTI_N1' )
-
- ! these test mixed values
- CALL test_print( ti_yy=0000, ti_mm=0, ti_dd=-3, ti_h=1, ti_m=20, ti_s=10, &
- res_str='-0000000002_022:039:050', testname='printTI_M1' )
-
- ! fractions
- CALL test_print( ti_yy=0000, ti_mm=0, ti_dd=3, ti_h=1, ti_m=20, ti_s=10, &
- ti_sn=1, ti_sd=3, &
- res_str='0000000003_001:020:010+01/03', testname='printTI_F1' )
- CALL test_print( ti_yy=0000, ti_mm=0, ti_dd=3, ti_h=1, ti_m=20, ti_s=10, &
- ti_sn=5, ti_sd=3, &
- res_str='0000000003_001:020:011+02/03', testname='printTI_F2' )
- CALL test_print( ti_yy=0000, ti_mm=0, ti_dd=-3, ti_h=-1, ti_m=-20, ti_s=-10, &
- ti_sn=-1, ti_sd=3, &
- res_str='-0000000003_001:020:010-01/03', testname='printTI_F3' )
- CALL test_print( ti_yy=0000, ti_mm=0, ti_dd=-3, ti_h=-1, ti_m=-20, ti_s=-10, &
- ti_sn=1, ti_sd=3, &
- res_str='-0000000003_001:020:009-02/03', testname='printTI_F4' )
-
- ! these test non-normalized values
-! CALL test_print( ti_yy=2001, ti_mm=1, ti_dd=3, ti_h=1, ti_m=20, ti_s=10, &
-! res_str='02001-001-003_001:020:010', testname='printTI_NN1', expect_error=.TRUE. )
-! CALL test_print( ti_yy=2001, ti_mm=12, ti_dd=3, ti_h=1, ti_m=20, ti_s=10, &
-! res_str='02002-000-003_001:020:010', testname='printTI_NN2', expect_error=.TRUE. )
-! CALL test_print( ti_yy=2002, ti_mm=5, ti_dd=500, ti_h=0, ti_m=0, ti_s=7270, &
-! res_str='02002-005-500_002:001:010', testname='printTI_NN3', expect_error=.TRUE. )
-
- ! Addition tests
- ! ESMF_Time = ESMF_Time + ESMF_TimeInterval
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2001, op1_t_mm=12, op1_t_dd=3, op1_t_h=1, op1_t_m=20, op1_t_s=10, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=3, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2001, res_t_mm=12, res_t_dd=3, res_t_h=4, res_t_m=30, res_t_s=20, &
- testname='AddT_T_TI1' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2001, op1_t_mm=12, op1_t_dd=31, op1_t_h=22, op1_t_m=30, op1_t_s=00, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2002, res_t_mm= 1, res_t_dd=1, res_t_h=2, res_t_m=40, res_t_s=10, &
- testname='AddT_T_TI2' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2003, op1_t_mm=12, op1_t_dd=31, op1_t_h=22, op1_t_m=30, op1_t_s=00, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2004, res_t_mm= 1, res_t_dd=1, res_t_h=2, res_t_m=40, res_t_s=10, &
- testname='AddT_T_TI3' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2004, op1_t_mm=12, op1_t_dd=31, op1_t_h=22, op1_t_m=30, op1_t_s=00, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2005, res_t_mm= 1, res_t_dd=1, res_t_h=2, res_t_m=40, res_t_s=10, &
- testname='AddT_T_TI4' )
- ! this case hung after the CCSM contribution
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2004, op1_t_mm=12, op1_t_dd=30, op1_t_h=22, op1_t_m=30, op1_t_s=00, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2004, res_t_mm=12, res_t_dd=31, res_t_h=2, res_t_m=40, res_t_s=10, &
- testname='AddT_T_TI5' )
-! NOTE: CCSM folks need to decide what it means to add "1 month" to Feb. 29. And all the
-! other very similar cases. Then, write this unit test!
-! CALL test_arithmetic( add_op=.TRUE., &
-! op1_t_yy=2004, op1_t_mm=12, op1_t_dd=31, op1_t_h=22, op1_t_m=30, op1_t_s=00, &
-! op2_ti_yy= 2, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
-! res_t_yy=2007, res_t_mm= 1, res_t_dd=1, res_t_h=2, res_t_m=40, res_t_s=10, &
-! testname='AddT_T_TI6' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2004, op1_t_mm=12, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=365, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2005, res_t_mm=12, res_t_dd=30, res_t_h=8, res_t_m=40, res_t_s=10, &
- testname='AddT_T_TI7' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2004, op1_t_mm=12, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=367, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2006, res_t_mm=01, res_t_dd=01, res_t_h=8, res_t_m=40, res_t_s=10, &
- testname='AddT_T_TI8' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2003, op1_t_mm=12, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=365, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2004, res_t_mm=12, res_t_dd=29, res_t_h=8, res_t_m=40, res_t_s=10, &
- testname='AddT_T_TI9' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2003, op1_t_mm=12, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=366, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2004, res_t_mm=12, res_t_dd=30, res_t_h=8, res_t_m=40, res_t_s=10, &
- testname='AddT_T_TI10' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2003, op1_t_mm=12, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=367, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2004, res_t_mm=12, res_t_dd=31, res_t_h=8, res_t_m=40, res_t_s=10, &
- testname='AddT_T_TI11' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2003, op1_t_mm=12, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=368, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2005, res_t_mm=01, res_t_dd=01, res_t_h=8, res_t_m=40, res_t_s=10, &
- testname='AddT_T_TI12' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2004, op1_t_mm=03, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=365, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2005, res_t_mm=03, res_t_dd=30, res_t_h=8, res_t_m=40, res_t_s=10, &
- testname='AddT_T_TI13' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2004, op1_t_mm=03, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=365, op2_ti_h=22, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2005, res_t_mm=03, res_t_dd=31, res_t_h=2, res_t_m=40, res_t_s=10, &
- testname='AddT_T_TI14' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2004, op1_t_mm=03, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=366, op2_ti_h=22, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2005, res_t_mm=04, res_t_dd=01, res_t_h=2, res_t_m=40, res_t_s=10, &
- testname='AddT_T_TI15' )
- ! ESMF_Time = ESMF_Time + ESMF_TimeInterval with fractions
- CALL test_arithmetic( add_op=.TRUE., &
- op1_t_yy=2004, op1_t_mm=12, op1_t_dd=31, op1_t_h=22, op1_t_m=30, op1_t_s=00, &
- op1_t_sn=01, op1_t_sd=03, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
- op2_ti_sn=01, op2_ti_sd=03, &
- res_t_yy=2005, res_t_mm= 1, res_t_dd=1, res_t_h=2, res_t_m=40, res_t_s=10, &
- res_t_sn=02, res_t_sd=03, &
- testname='AddT_T_TI_F1' )
- ! this should fail (and does)
-! CALL test_arithmetic( add_op=.TRUE., &
-! op1_t_yy=2004, op1_t_mm=12, op1_t_dd=31, op1_t_h=22, op1_t_m=30, op1_t_s=00, &
-! op1_t_sn=01, op1_t_sd=03, &
-! op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
-! op2_ti_sn=01, op2_ti_sd=03, &
-! res_t_yy=2005, res_t_mm= 1, res_t_dd=1, res_t_h=2, res_t_m=40, res_t_s=10, &
-! res_t_sn=01, res_t_sd=03, &
-! testname='AddT_T_TI_F2' )
- ! ESMF_Time = ESMF_TimeInterval + ESMF_Time
- CALL test_arithmetic( add_op=.TRUE., &
- op1_ti_yy= 0, op1_ti_mm= 0, op1_ti_dd=0, op1_ti_h=3, op1_ti_m=10, op1_ti_s=10, &
- op2_t_yy=2001, op2_t_mm=12, op2_t_dd=3, op2_t_h=1, op2_t_m=20, op2_t_s=10, &
- res_t_yy=2001, res_t_mm=12, res_t_dd=3, res_t_h=4, res_t_m=30, res_t_s=20, &
- testname='AddT_TI_T1' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_ti_yy= 0, op1_ti_mm= 0, op1_ti_dd=0, op1_ti_h=4, op1_ti_m=10, op1_ti_s=10, &
- op2_t_yy=2001, op2_t_mm=12, op2_t_dd=31, op2_t_h=22, op2_t_m=30, op2_t_s=00, &
- res_t_yy=2002, res_t_mm= 1, res_t_dd=1, res_t_h=2, res_t_m=40, res_t_s=10, &
- testname='AddT_TI_T2' )
- ! ESMF_TimeInterval = ESMF_TimeInterval + ESMF_TimeInterval
- CALL test_arithmetic( add_op=.TRUE., &
- op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=3, op1_ti_h=1, op1_ti_m=20, op1_ti_s=10, &
- op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=1, op2_ti_h=1, op2_ti_m=10, op2_ti_s=10, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=4, res_ti_h=2, res_ti_m=30, res_ti_s=20, &
- testname='AddTI_TI_TI1' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=-3, op1_ti_h=-1, op1_ti_m=-20, op1_ti_s=-10, &
- op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=1, op2_ti_h=1, op2_ti_m=10, op2_ti_s=10, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=-2, res_ti_h=0, res_ti_m=-10, res_ti_s=00, &
- testname='AddTI_TI_TI2' )
- CALL test_arithmetic( add_op=.TRUE., &
- op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=-3, op1_ti_h=-1, op1_ti_m=-20, op1_ti_s=-10, &
- op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=-1, op2_ti_h=-1, op2_ti_m=-10, op2_ti_s=-10, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=-4, res_ti_h=-2, res_ti_m=-30, res_ti_s=-20, &
- testname='AddTI_TI_TI3' )
-
- ! Subtraction tests
- ! ESMF_Time = ESMF_Time - ESMF_TimeInterval
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2001, op1_t_mm=12, op1_t_dd=3, op1_t_h=1, op1_t_m=20, op1_t_s=10, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=3, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2001, res_t_mm=12, res_t_dd=2, res_t_h=22, res_t_m=10, res_t_s=0, &
- testname='SubtractT_T_TI1' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2005, op1_t_mm=1, op1_t_dd=1, op1_t_h=0, op1_t_m=00, op1_t_s=0, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=0, op2_ti_m=00, op2_ti_s=10, &
- res_t_yy=2004, res_t_mm=12, res_t_dd=31, res_t_h=23, res_t_m=59, res_t_s=50, &
- testname='SubtractT_T_TI2' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2004, op1_t_mm=1, op1_t_dd=1, op1_t_h=0, op1_t_m=00, op1_t_s=0, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=0, op2_ti_m=00, op2_ti_s=10, &
- res_t_yy=2003, res_t_mm=12, res_t_dd=31, res_t_h=23, res_t_m=59, res_t_s=50, &
- testname='SubtractT_T_TI3' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2003, op1_t_mm=1, op1_t_dd=1, op1_t_h=0, op1_t_m=00, op1_t_s=0, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=0, op2_ti_m=00, op2_ti_s=10, &
- res_t_yy=2002, res_t_mm=12, res_t_dd=31, res_t_h=23, res_t_m=59, res_t_s=50, &
- testname='SubtractT_T_TI4' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2005, op1_t_mm=04, op1_t_dd=01, op1_t_h=2, op1_t_m=40, op1_t_s=10, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=366, op2_ti_h=22, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2004, res_t_mm=03, res_t_dd=30, res_t_h=4, res_t_m=30, res_t_s=00, &
- testname='SubtractT_T_TI5' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2006, op1_t_mm=01, op1_t_dd=01, op1_t_h=8, op1_t_m=40, op1_t_s=10, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=367, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
- res_t_yy=2004, res_t_mm=12, res_t_dd=30, res_t_h=4, res_t_m=30, res_t_s=00, &
- testname='SubtractT_T_TI6' )
- ! ESMF_Time = ESMF_Time - ESMF_TimeInterval with fractions
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2005, op1_t_mm=01, op1_t_dd=01, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
- op1_t_sn=00, op1_t_sd=00, &
- op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=0, op2_ti_m=00, op2_ti_s=01, &
- op2_ti_sn=01, op2_ti_sd=03, &
- res_t_yy=2004, res_t_mm=12, res_t_dd=31, res_t_h=23, res_t_m=59, res_t_s=58, &
- res_t_sn=02, res_t_sd=03, &
- testname='SubtractT_T_TI_F1' )
- ! ESMF_TimeInterval = ESMF_Time - ESMF_Time
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2001, op1_t_mm=12, op1_t_dd=3, op1_t_h=1, op1_t_m=20, op1_t_s=10, &
- op2_t_yy=2001, op2_t_mm=12, op2_t_dd=1, op2_t_h=1, op2_t_m=10, op2_t_s=10, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=2, res_ti_h=0, res_ti_m=10, res_ti_s=0, &
- testname='SubtractTI_T_T1' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2002, op1_t_mm=1, op1_t_dd=1, op1_t_h=0, op1_t_m=00, op1_t_s=00, &
- op2_t_yy=2001, op2_t_mm=12, op2_t_dd=31, op2_t_h=23, op2_t_m=59, op2_t_s=50, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=0, res_ti_h=0, res_ti_m=00, res_ti_s=10, &
- testname='SubtractTI_T_T2' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2005, op1_t_mm=1, op1_t_dd=1, op1_t_h=0, op1_t_m=00, op1_t_s=00, &
- op2_t_yy=2004, op2_t_mm=12, op2_t_dd=31, op2_t_h=23, op2_t_m=59, op2_t_s=50, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=0, res_ti_h=0, res_ti_m=00, res_ti_s=10, &
- testname='SubtractTI_T_T3' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2003, op1_t_mm=03, op1_t_dd=01, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
- op2_t_yy=2003, op2_t_mm=02, op2_t_dd=28, op2_t_h=23, op2_t_m=59, op2_t_s=50, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=0, res_ti_h=0, res_ti_m=00, res_ti_s=10, &
- testname='SubtractTI_T_T4' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2004, op1_t_mm=03, op1_t_dd=01, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
- op2_t_yy=2004, op2_t_mm=02, op2_t_dd=28, op2_t_h=23, op2_t_m=59, op2_t_s=50, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=1, res_ti_h=0, res_ti_m=00, res_ti_s=10, &
- testname='SubtractTI_T_T5' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2002, op1_t_mm=02, op1_t_dd=28, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
- op2_t_yy=2002, op2_t_mm=02, op2_t_dd=28, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=0, res_ti_h=0, res_ti_m=00, res_ti_s=00, &
- testname='SubtractTI_T_T6' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2003, op1_t_mm=02, op1_t_dd=28, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
- op2_t_yy=2002, op2_t_mm=02, op2_t_dd=28, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=365, res_ti_h=0, res_ti_m=00, res_ti_s=00, &
- testname='SubtractTI_T_T7' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2004, op1_t_mm=02, op1_t_dd=28, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
- op2_t_yy=2003, op2_t_mm=02, op2_t_dd=28, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=365, res_ti_h=0, res_ti_m=00, res_ti_s=00, &
- testname='SubtractTI_T_T8' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2005, op1_t_mm=02, op1_t_dd=28, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
- op2_t_yy=2004, op2_t_mm=02, op2_t_dd=28, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=366, res_ti_h=0, res_ti_m=00, res_ti_s=00, &
- testname='SubtractTI_T_T9' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2003, op1_t_mm=03, op1_t_dd=01, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
- op2_t_yy=2002, op2_t_mm=02, op2_t_dd=28, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=366, res_ti_h=0, res_ti_m=00, res_ti_s=00, &
- testname='SubtractTI_T_T10' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2005, op1_t_mm=03, op1_t_dd=01, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
- op2_t_yy=2004, op2_t_mm=02, op2_t_dd=28, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=367, res_ti_h=0, res_ti_m=00, res_ti_s=00, &
- testname='SubtractTI_T_T11' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2005, op1_t_mm=03, op1_t_dd=01, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
- op2_t_yy=2004, op2_t_mm=02, op2_t_dd=28, op2_t_h=23, op2_t_m=59, op2_t_s=50, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=366, res_ti_h=0, res_ti_m=00, res_ti_s=10, &
- testname='SubtractTI_T_T12' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=2004, op1_t_mm=02, op1_t_dd=28, op1_t_h=23, op1_t_m=59, op1_t_s=50, &
- op2_t_yy=2005, op2_t_mm=03, op2_t_dd=01, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=-366, res_ti_h=0, res_ti_m=00, res_ti_s=-10, &
- testname='SubtractTI_T_T13' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_t_yy=-2002, op1_t_mm=02, op1_t_dd=28, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
- op2_t_yy=-2002, op2_t_mm=02, op2_t_dd=28, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=0, res_ti_h=0, res_ti_m=00, res_ti_s=00, &
- testname='SubtractTI_T_T14' )
- ! ESMF_TimeInterval = ESMF_TimeInterval - ESMF_TimeInterval
- CALL test_arithmetic( add_op=.FALSE., &
- op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=3, op1_ti_h=1, op1_ti_m=20, op1_ti_s=10, &
- op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=1, op2_ti_h=1, op2_ti_m=10, op2_ti_s=10, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=2, res_ti_h=0, res_ti_m=10, res_ti_s=0, &
- testname='SubtractTI_TI_TI1' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=3, op1_ti_h=1, op1_ti_m=20, op1_ti_s=10, &
- op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=-1, op2_ti_h=-1, op2_ti_m=-10, op2_ti_s=-10, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=4, res_ti_h=2, res_ti_m=30, res_ti_s=20, &
- testname='SubtractTI_TI_TI2' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=-1, op1_ti_h=-1, op1_ti_m=-10, op1_ti_s=-10, &
- op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=-3, op2_ti_h=-1, op2_ti_m=-20, op2_ti_s=-10, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=2, res_ti_h=0, res_ti_m=10, res_ti_s=00, &
- testname='SubtractTI_TI_TI3' )
- ! Negative result ESMF_TimeInterval = ESMF_TimeInterval - ESMF_TimeInterval
- CALL test_arithmetic( add_op=.FALSE., &
- op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=1, op1_ti_h=1, op1_ti_m=10, op1_ti_s=10, &
- op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=3, op2_ti_h=1, op2_ti_m=20, op2_ti_s=10, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=-2, res_ti_h=0, res_ti_m=-10, res_ti_s=0, &
- testname='SubtractTI_TI_TIN1' )
- CALL test_arithmetic( add_op=.FALSE., &
- op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=-1, op1_ti_h=-1, op1_ti_m=-10, op1_ti_s=-10, &
- op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=3, op2_ti_h=1, op2_ti_m=20, op2_ti_s=10, &
- res_ti_yy=0000, res_ti_mm=00, res_ti_dd=-4, res_ti_h=-2, res_ti_m=-30, res_ti_s=-20, &
- testname='SubtractTI_TI_TIN2' )
-
- ! Un-normalized ESMF_TimeInterval = ESMF_TimeInterval - ESMF_TimeInterval
- ! this is an error
-! CALL test_arithmetic( add_op=.FALSE., &
-! op1_ti_yy=2001, op1_ti_mm=11, op1_ti_dd=3, op1_ti_h=1, op1_ti_m=20, op1_ti_s=10, &
-! op2_ti_yy=2001, op2_ti_mm=11, op2_ti_dd=1, op2_ti_h=1, op2_ti_m=10, op2_ti_s=10, &
-! res_ti_yy=0000, res_ti_mm=00, res_ti_dd=2, res_ti_h=0, res_ti_m=10, res_ti_s=0, &
-! testname='SubtractTI_TI_TIU1', expect_error=.TRUE. )
-
- ! this one should FAIL, and does
-! CALL test_arithmetic( add_op=.TRUE., &
-! op1_t_yy=2001, op1_t_mm=12, op1_t_dd=3, op1_t_h=1, op1_t_m=20, op1_t_s=10, &
-! op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=3, op2_ti_m=10, op2_ti_s=10, &
-! res_t_yy=2002, res_t_mm=12, res_t_dd=3, res_t_h=4, res_t_m=30, res_t_s=20, &
-! testname='AddTT1' )
-
- ! Multiplication tests
- ! ESMF_TimeInterval = ESMF_TimeInterval * INTEGER
- CALL test_arithmetic( multiply_op=.TRUE., &
- op1_ti_dd=3, op1_ti_h=12, op1_ti_m=18, op1_ti_s=33, &
- op2_int=2, &
- res_ti_dd=6, res_ti_h=24, res_ti_m=37, res_ti_s=06, &
- testname='MultiplyTI_TI_INT1' )
- CALL test_arithmetic( multiply_op=.TRUE., &
- op1_ti_dd=350, op1_ti_h=23, op1_ti_m=50, op1_ti_s=50, &
- op2_int=2, &
- res_ti_dd=701, res_ti_h=23, res_ti_m=41, res_ti_s=40,&
- testname='MultiplyTI_TI_INT2' )
- CALL test_arithmetic( multiply_op=.TRUE., &
- op1_ti_s=01, op1_ti_sn=03, op1_ti_sd=04, &
- op2_int=8, &
- res_ti_s=14, &
- testname='MultiplyTI_TI_INT3' )
-
- ! Division tests
- ! ESMF_TimeInterval = ESMF_TimeInterval / INTEGER
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_dd=3, op1_ti_h=12, op1_ti_m=18, op1_ti_s=33, &
- op2_int=3, &
- res_ti_dd=1, res_ti_h=04, res_ti_m=06, res_ti_s=11, &
- testname='DivideTI_TI_INT1' )
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_dd=3, op1_ti_h=12, op1_ti_m=18, op1_ti_s=33, &
- op2_int=4, &
- res_ti_dd=0, res_ti_h=21, res_ti_m=04, res_ti_s=38, &
- res_ti_sn=1, res_ti_sd=4, &
- testname='DivideTI_TI_INT2' )
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_s=01, op1_ti_sn=03, op1_ti_sd=04, &
- op2_int=5, &
- res_ti_s=0, res_ti_sn=7, res_ti_sd=20, &
- testname='DivideTI_TI_INT3' )
- ! INTEGER = ESMF_TimeInterval / ESMF_TimeInterval
- ! this operator truncates to whole integers
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_dd=3, op1_ti_h=12, op1_ti_m=18, op1_ti_s=33, &
- op2_ti_dd=3, op2_ti_h=12, op2_ti_m=18, op2_ti_s=33, &
- res_int=1, &
- testname='DivideINT_TI_TI1' )
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_dd=6, op1_ti_h=24, op1_ti_m=36, op1_ti_s=66, &
- op2_ti_dd=3, op2_ti_h=12, op2_ti_m=18, op2_ti_s=33, &
- res_int=2, &
- testname='DivideINT_TI_TI2' )
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_dd=0, op1_ti_h=00, op1_ti_m=00, op1_ti_s=00, &
- op2_ti_dd=3, op2_ti_h=12, op2_ti_m=18, op2_ti_s=33, &
- res_int=0, &
- testname='DivideINT_TI_TI3' )
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_dd=1, op1_ti_h=00, op1_ti_m=00, op1_ti_s=00, &
- op2_ti_dd=0, op2_ti_h=01, op2_ti_m=00, op2_ti_s=00, &
- res_int=24, &
- testname='DivideINT_TI_TI4' )
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_dd=1, op1_ti_h=00, op1_ti_m=00, op1_ti_s=00, &
- op2_ti_dd=0, op2_ti_h=00, op2_ti_m=01, op2_ti_s=00, &
- res_int=1440, &
- testname='DivideINT_TI_TI5' )
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_dd=1, op1_ti_h=00, op1_ti_m=00, op1_ti_s=00, &
- op2_ti_dd=0, op2_ti_h=00, op2_ti_m=00, op2_ti_s=01, &
- res_int=86400, &
- testname='DivideINT_TI_TI6' )
- ! rounding
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_dd=0, op1_ti_h=00, op1_ti_m=00, op1_ti_s=03, &
- op2_ti_dd=0, op2_ti_h=00, op2_ti_m=00, op2_ti_s=02, &
- res_int=1, &
- testname='DivideINT_TI_TIR1' )
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_dd=1, op1_ti_h=00, op1_ti_m=00, op1_ti_s=02, &
- op2_ti_dd=1, op2_ti_h=00, op2_ti_m=00, op2_ti_s=03, &
- res_int=0, &
- testname='DivideINT_TI_TIR2' )
- ! fractional operands
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_m=00, op1_ti_s=00, op1_ti_sn=03, op1_ti_sd=04, &
- op2_ti_m=00, op2_ti_s=00, op2_ti_sn=03, op2_ti_sd=04, &
- res_int=1, &
- testname='DivideINT_TI_TIF1' )
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_m=00, op1_ti_s=00, op1_ti_sn=06, op1_ti_sd=08, &
- op2_ti_m=00, op2_ti_s=00, op2_ti_sn=03, op2_ti_sd=04, &
- res_int=1, &
- testname='DivideINT_TI_TIF2' )
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_m=00, op1_ti_s=00, op1_ti_sn=03, op1_ti_sd=04, &
- op2_ti_m=00, op2_ti_s=00, op2_ti_sn=04, op2_ti_sd=03, &
- res_int=0, &
- testname='DivideINT_TI_TIF3' )
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_m=00, op1_ti_s=02, op1_ti_sn=03, op1_ti_sd=04, &
- op2_ti_m=00, op2_ti_s=01, op2_ti_sn=01, op2_ti_sd=03, &
- res_int=2, &
- testname='DivideINT_TI_TIF4' )
- ! negative operands
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_dd=-6, op1_ti_h=-24, op1_ti_m=-36, op1_ti_s=-66, &
- op2_ti_dd=3, op2_ti_h=12, op2_ti_m=18, op2_ti_s=33, &
- res_int=-2, &
- testname='DivideINT_TI_TIN1' )
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_dd=6, op1_ti_h=24, op1_ti_m=36, op1_ti_s=66, &
- op2_ti_dd=-3, op2_ti_h=-12, op2_ti_m=-18, op2_ti_s=-33, &
- res_int=-2, &
- testname='DivideINT_TI_TIN2' )
- CALL test_arithmetic( multiply_op=.FALSE., &
- op1_ti_dd=-6, op1_ti_h=-24, op1_ti_m=-36, op1_ti_s=-66, &
- op2_ti_dd=-3, op2_ti_h=-12, op2_ti_m=-18, op2_ti_s=-33, &
- res_int=2, &
- testname='DivideINT_TI_TIN3' )
-
-!$$$here... modify these to add self-test PASS/FAIL output
- CALL test_clock_advance( &
- start_yy=2002, start_mm=12, start_dd=27, start_h=3, start_m=0, start_s=0, &
- stop_yy=2002, stop_mm=12, stop_dd=28, stop_h=8, stop_m=0, stop_s=0, &
- timestep_d=0, timestep_h=0, timestep_m=0, timestep_s=600, &
- testname="SimpleClockAdvance" )
-
- CALL test_clock_advance( &
- start_yy=2003, start_mm=12, start_dd=29, start_h=9, start_m=0, start_s=0, &
- stop_yy=2004, stop_mm=1, stop_dd=2, stop_h=9, stop_m=0, stop_s=0, &
- timestep_d=0, timestep_h=0, timestep_m=0, timestep_s=3600, &
- testname="StdYearClockAdvance", increment_S=10 )
-
- CALL test_clock_advance( &
- start_yy=2004, start_mm=12, start_dd=29, start_h=9, start_m=0, start_s=0, &
- stop_yy=2005, stop_mm=1, stop_dd=2, stop_h=9, stop_m=0, stop_s=0, &
- timestep_d=0, timestep_h=0, timestep_m=0, timestep_s=3600, &
- testname="LeapYearClockAdvance", increment_S=10 )
-
- ! NRCM domain 3 case: 120 seconds / 9
- ! 18 timesteps through end of leap year
- CALL test_clock_advance( &
- start_yy=2004, start_mm=12, start_dd=31, start_h=23, start_m=58, start_s=0,&
- stop_yy=2005, stop_mm=1, stop_dd=1, stop_h=0, stop_m=2, stop_s=0, &
- timestep_d=0, timestep_h=0, timestep_m=0, timestep_s=13, &
- timestep_sn=1, timestep_sd=3, &
- testname="LeapYearFractionClockAdvance", &
- increment_S=1, increment_Sn=1, increment_Sd=3 )
-
- CALL ESMF_Finalize( rc=rc )
- CALL test_check_error( ESMF_SUCCESS, rc, &
- 'ESMF_Finalize() ', &
- __FILE__ , &
- __LINE__ )
-
- PRINT *,'END TEST SUITE'
-
-END PROGRAM time_manager_test
-
Copied: branches/atmos_physics/src/external/esmf_time_f90/Test1.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/Test1.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/Test1.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/Test1.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,1718 @@
+!
+! Sub-system tests for esmf_time_f90
+!
+! Someday, switch over to funit!
+!
+
+MODULE my_tests
+ USE ESMF_Mod
+ IMPLICIT NONE
+
+ ! Set this to .TRUE. to make wrf_error_fatal3() print a message on failure
+ ! instead of stopping the program. Use for testing only (since we cannot
+ ! catch exceptions in Fortran90!!)
+ LOGICAL :: WRF_ERROR_FATAL_PRINT = .FALSE.
+
+CONTAINS
+
+ ! Test printing of an ESMF_Time or ESMF_TimeInterval object.
+ !
+ ! Correct results are also passed in through this interface and compared
+ ! with computed results. PASS/FAIL messages are printed.
+ !
+ SUBROUTINE test_print( t_yy, t_mm, t_dd, t_h, t_m, t_s, t_sn, t_sd, &
+ ti_yy, ti_mm, ti_dd, ti_h, ti_m, ti_s, ti_sn, ti_sd, &
+ res_str, testname, expect_error )
+ INTEGER, INTENT(IN), OPTIONAL :: t_YY
+ INTEGER, INTENT(IN), OPTIONAL :: t_MM ! month
+ INTEGER, INTENT(IN), OPTIONAL :: t_DD ! day of month
+ INTEGER, INTENT(IN), OPTIONAL :: t_H
+ INTEGER, INTENT(IN), OPTIONAL :: t_M
+ INTEGER, INTENT(IN), OPTIONAL :: t_S
+ INTEGER, INTENT(IN), OPTIONAL :: t_Sn
+ INTEGER, INTENT(IN), OPTIONAL :: t_Sd
+ INTEGER, INTENT(IN), OPTIONAL :: ti_YY
+ INTEGER, INTENT(IN), OPTIONAL :: ti_MM ! month
+ INTEGER, INTENT(IN), OPTIONAL :: ti_DD ! day of month
+ INTEGER, INTENT(IN), OPTIONAL :: ti_H
+ INTEGER, INTENT(IN), OPTIONAL :: ti_M
+ INTEGER, INTENT(IN), OPTIONAL :: ti_S
+ INTEGER, INTENT(IN), OPTIONAL :: ti_Sn
+ INTEGER, INTENT(IN), OPTIONAL :: ti_Sd
+ CHARACTER (LEN=*), INTENT(IN) :: res_str
+ CHARACTER (LEN=*), INTENT(IN), OPTIONAL :: testname
+ LOGICAL, OPTIONAL, INTENT(IN) :: expect_error
+ ! locals
+ INTEGER :: it_YY
+ INTEGER :: it_MM ! month
+ INTEGER :: it_DD ! day of month
+ INTEGER :: it_H
+ INTEGER :: it_M
+ INTEGER :: it_S
+ INTEGER :: it_Sn
+ INTEGER :: it_Sd
+ INTEGER :: iti_YY
+ INTEGER :: iti_MM ! month
+ INTEGER :: iti_DD ! day of month
+ INTEGER :: iti_H
+ INTEGER :: iti_M
+ INTEGER :: iti_S
+ INTEGER :: iti_Sn
+ INTEGER :: iti_Sd
+ LOGICAL :: is_t
+ LOGICAL :: is_ti
+ CHARACTER (LEN=512) :: itestname
+ LOGICAL :: iexpect_error
+ INTEGER rc
+ TYPE(ESMF_Time) :: t
+ TYPE(ESMF_TimeInterval) :: ti
+ CHARACTER(LEN=ESMF_MAXSTR) :: str, computed_str, frac_str
+ CHARACTER(LEN=17) :: type_str
+ INTEGER :: res_len, computed_len, Sn, Sd
+ LOGICAL :: test_passed
+
+! PRINT *,'DEBUG: BEGIN test_print()'
+ it_YY = 0
+ it_MM = 1
+ it_DD = 1
+ it_H = 0
+ it_M = 0
+ it_S = 0
+ it_Sn = 0
+ it_Sd = 0
+ iti_YY = 0
+ iti_MM = 0
+ iti_DD = 0
+ iti_H = 0
+ iti_M = 0
+ iti_S = 0
+ iti_Sn = 0
+ iti_Sd = 0
+ itestname = ''
+ iexpect_error = .FALSE.
+
+ IF ( PRESENT( t_YY ) ) it_YY = t_YY
+ IF ( PRESENT( t_MM ) ) it_MM = t_MM
+ IF ( PRESENT( t_DD ) ) it_DD = t_DD
+ IF ( PRESENT( t_H ) ) it_H = t_H
+ IF ( PRESENT( t_M ) ) it_M = t_M
+ IF ( PRESENT( t_S ) ) it_S = t_S
+ IF ( PRESENT( t_Sn ) ) it_Sn = t_Sn
+ IF ( PRESENT( t_Sd ) ) it_Sd = t_Sd
+ IF ( PRESENT( ti_YY ) ) iti_YY = ti_YY
+ IF ( PRESENT( ti_MM ) ) iti_MM = ti_MM
+ IF ( PRESENT( ti_DD ) ) iti_DD = ti_DD
+ IF ( PRESENT( ti_H ) ) iti_H = ti_H
+ IF ( PRESENT( ti_M ) ) iti_M = ti_M
+ IF ( PRESENT( ti_S ) ) iti_S = ti_S
+ IF ( PRESENT( ti_Sn ) ) iti_Sn = ti_Sn
+ IF ( PRESENT( ti_Sd ) ) iti_Sd = ti_Sd
+ IF ( PRESENT( testname ) ) itestname = TRIM(testname)
+ IF ( PRESENT( expect_error ) ) iexpect_error = expect_error
+
+ ! Ensure that optional arguments are consistent...
+ is_t = ( PRESENT( t_YY ) .OR. PRESENT( t_MM ) .OR. &
+ PRESENT( t_DD ) .OR. PRESENT( t_H ) .OR. &
+ PRESENT( t_M ) .OR. PRESENT( t_S ) .OR. &
+ PRESENT( t_Sn ) .OR. PRESENT( t_Sd ) )
+ is_ti = ( PRESENT( ti_YY ) .OR. PRESENT( ti_MM ) .OR. &
+ PRESENT( ti_DD ) .OR. PRESENT( ti_H ) .OR. &
+ PRESENT( ti_M ) .OR. PRESENT( ti_S ) .OR. &
+ PRESENT( ti_Sn ) .OR. PRESENT( ti_Sd ) )
+ IF ( is_t .EQV. is_ti ) THEN
+ CALL wrf_error_fatal3( __FILE__ , __LINE__ , &
+ 'ERROR test_print: inconsistent args' )
+ ENDIF
+
+!PRINT *,'DEBUG: test_print(): init objects'
+ ! Initialize object to be tested
+ ! modify behavior of wrf_error_fatal3 for tests expected to fail
+ IF ( iexpect_error ) WRF_ERROR_FATAL_PRINT = .TRUE.
+ Sn = 0
+ Sd = 0
+ IF ( is_t ) THEN
+ type_str = 'ESMF_Time'
+!PRINT *,'DEBUG: test_print(): calling ESMF_TimeSet()'
+!PRINT *,'DEBUG: test_print(): YY,MM,DD,H,M,S,Sn,Sd = ', it_YY,it_MM,it_DD,it_H,it_M,it_S,it_Sn,it_Sd
+ CALL ESMF_TimeSet( t, YY=it_YY, MM=it_MM, DD=it_DD , &
+ H=it_H, M=it_M, S=it_S, Sn=it_Sn, Sd=it_Sd, rc=rc )
+!PRINT *,'DEBUG: test_print(): back from ESMF_TimeSet()'
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeSet() ', &
+ __FILE__ , &
+ __LINE__ )
+!PRINT *,'DEBUG: test_print(): calling ESMF_TimeGet()'
+ CALL ESMF_TimeGet( t, timeString=computed_str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+!PRINT *,'DEBUG: test_print(): back from ESMF_TimeGet(), computed_str = ',TRIM(computed_str)
+ ELSE
+ type_str = 'ESMF_TimeInterval'
+!PRINT *,'DEBUG: test_print(): calling ESMF_TimeIntervalSet()'
+ CALL ESMF_TimeIntervalSet( ti, YY=iti_YY, MM=iti_MM, &
+ D=iti_DD , &
+ H=iti_H, M=iti_M, &
+ S=iti_S, Sn=iti_Sn, Sd=iti_Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeIntervalSet() ', &
+ __FILE__ , &
+ __LINE__ )
+!PRINT *,'DEBUG: test_print(): calling ESMF_TimeIntervalGet()'
+ CALL ESMF_TimeIntervalGet( ti, timeString=computed_str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ ENDIF
+ ! handle fractions
+ IF ( Sd > 0 ) THEN
+ IF ( Sn > 0 ) THEN
+ WRITE(frac_str,FMT="('+',I2.2,'/',I2.2)") abs(Sn), Sd
+ ELSE IF ( Sn < 0 ) THEN
+ WRITE(frac_str,FMT="('-',I2.2,'/',I2.2)") abs(Sn), Sd
+ ELSE
+ frac_str = ''
+ ENDIF
+ computed_str = TRIM(computed_str)//TRIM(frac_str)
+ ENDIF
+ ! restore default behavior of wrf_error_fatal3
+ IF ( iexpect_error ) WRF_ERROR_FATAL_PRINT = .FALSE.
+!PRINT *,'DEBUG: test_print(): done init objects'
+
+!PRINT *,'DEBUG: test_print(): check result'
+ ! check result
+ test_passed = .FALSE.
+ res_len = LEN_TRIM(res_str)
+ computed_len = LEN_TRIM(computed_str)
+ IF ( res_len == computed_len ) THEN
+ IF ( computed_str(1:computed_len) == res_str(1:res_len) ) THEN
+ test_passed = .TRUE.
+ ENDIF
+ ENDIF
+ IF ( test_passed ) THEN
+ WRITE(*,FMT='(A)') 'PASS: '//TRIM(itestname)
+ ELSE
+ WRITE(*,'(9A)') 'FAIL: ',TRIM(itestname),': printing ',TRIM(type_str), &
+ ' expected <', TRIM(res_str),'> but computed <',TRIM(computed_str),'>'
+ ENDIF
+!PRINT *,'DEBUG: END test_print()'
+
+ END SUBROUTINE test_print
+
+
+
+ ! Test the following arithmetic operations on ESMF_Time and
+ ! ESMF_TimeInterval objects:
+ ! ESMF_Time = ESMF_Time + ESMF_TimeInterval
+ ! ESMF_Time = ESMF_TimeInterval + ESMF_Time
+ ! ESMF_Time = ESMF_Time - ESMF_TimeInterval
+ ! ESMF_TimeInterval = ESMF_Time - ESMF_Time
+ ! ESMF_TimeInterval = ESMF_TimeInterval + ESMF_TimeInterval
+ ! ESMF_TimeInterval = ESMF_TimeInterval - ESMF_TimeInterval
+ ! ESMF_TimeInterval = ESMF_TimeInterval * INTEGER
+ ! ESMF_TimeInterval = ESMF_TimeInterval / INTEGER
+ !
+ ! Correct results are also passed in through this interface and compared
+ ! with computed results. PASS/FAIL messages are printed.
+ !
+ ! Operations are expressed as res = op1 +|- op2
+ !
+ SUBROUTINE test_arithmetic( add_op, multiply_op, &
+ op1_t_yy, op1_t_mm, op1_t_dd, op1_t_h, op1_t_m, op1_t_s, op1_t_sn, op1_t_sd, &
+ op1_ti_yy, op1_ti_mm, op1_ti_dd, op1_ti_h, op1_ti_m, op1_ti_s, op1_ti_sn, op1_ti_sd, &
+ op2_t_yy, op2_t_mm, op2_t_dd, op2_t_h, op2_t_m, op2_t_s, op2_t_sn, op2_t_sd, &
+ op2_ti_yy, op2_ti_mm, op2_ti_dd, op2_ti_h, op2_ti_m, op2_ti_s, op2_ti_sn, op2_ti_sd, &
+ op2_int, &
+ res_t_yy, res_t_mm, res_t_dd, res_t_h, res_t_m, res_t_s, res_t_sn, res_t_sd, &
+ res_ti_yy, res_ti_mm, res_ti_dd, res_ti_h, res_ti_m, res_ti_s, res_ti_sn, res_ti_sd, &
+ res_int, testname, expect_error )
+ LOGICAL, INTENT(IN), OPTIONAL :: add_op ! .TRUE.=add, .FALSE.=subtract
+ LOGICAL, INTENT(IN), OPTIONAL :: multiply_op ! .TRUE.=multiply, .FALSE.=divide
+ INTEGER, INTENT(IN), OPTIONAL :: op1_t_YY
+ INTEGER, INTENT(IN), OPTIONAL :: op1_t_MM ! month
+ INTEGER, INTENT(IN), OPTIONAL :: op1_t_DD ! day of month
+ INTEGER, INTENT(IN), OPTIONAL :: op1_t_H
+ INTEGER, INTENT(IN), OPTIONAL :: op1_t_M
+ INTEGER, INTENT(IN), OPTIONAL :: op1_t_S
+ INTEGER, INTENT(IN), OPTIONAL :: op1_t_Sn
+ INTEGER, INTENT(IN), OPTIONAL :: op1_t_Sd
+ INTEGER, INTENT(IN), OPTIONAL :: op1_ti_YY
+ INTEGER, INTENT(IN), OPTIONAL :: op1_ti_MM ! month
+ INTEGER, INTENT(IN), OPTIONAL :: op1_ti_DD ! day of month
+ INTEGER, INTENT(IN), OPTIONAL :: op1_ti_H
+ INTEGER, INTENT(IN), OPTIONAL :: op1_ti_M
+ INTEGER, INTENT(IN), OPTIONAL :: op1_ti_S
+ INTEGER, INTENT(IN), OPTIONAL :: op1_ti_Sn
+ INTEGER, INTENT(IN), OPTIONAL :: op1_ti_Sd
+ INTEGER, INTENT(IN), OPTIONAL :: op2_t_YY
+ INTEGER, INTENT(IN), OPTIONAL :: op2_t_MM ! month
+ INTEGER, INTENT(IN), OPTIONAL :: op2_t_DD ! day of month
+ INTEGER, INTENT(IN), OPTIONAL :: op2_t_H
+ INTEGER, INTENT(IN), OPTIONAL :: op2_t_M
+ INTEGER, INTENT(IN), OPTIONAL :: op2_t_S
+ INTEGER, INTENT(IN), OPTIONAL :: op2_t_Sn
+ INTEGER, INTENT(IN), OPTIONAL :: op2_t_Sd
+ INTEGER, INTENT(IN), OPTIONAL :: op2_ti_YY
+ INTEGER, INTENT(IN), OPTIONAL :: op2_ti_MM ! month
+ INTEGER, INTENT(IN), OPTIONAL :: op2_ti_DD ! day of month
+ INTEGER, INTENT(IN), OPTIONAL :: op2_ti_H
+ INTEGER, INTENT(IN), OPTIONAL :: op2_ti_M
+ INTEGER, INTENT(IN), OPTIONAL :: op2_ti_S
+ INTEGER, INTENT(IN), OPTIONAL :: op2_ti_Sn
+ INTEGER, INTENT(IN), OPTIONAL :: op2_ti_Sd
+ INTEGER, INTENT(IN), OPTIONAL :: op2_int
+ INTEGER, INTENT(IN), OPTIONAL :: res_t_YY
+ INTEGER, INTENT(IN), OPTIONAL :: res_t_MM ! month
+ INTEGER, INTENT(IN), OPTIONAL :: res_t_DD ! day of month
+ INTEGER, INTENT(IN), OPTIONAL :: res_t_H
+ INTEGER, INTENT(IN), OPTIONAL :: res_t_M
+ INTEGER, INTENT(IN), OPTIONAL :: res_t_S
+ INTEGER, INTENT(IN), OPTIONAL :: res_t_Sn
+ INTEGER, INTENT(IN), OPTIONAL :: res_t_Sd
+ INTEGER, INTENT(IN), OPTIONAL :: res_ti_YY
+ INTEGER, INTENT(IN), OPTIONAL :: res_ti_MM ! month
+ INTEGER, INTENT(IN), OPTIONAL :: res_ti_DD ! day of month
+ INTEGER, INTENT(IN), OPTIONAL :: res_ti_H
+ INTEGER, INTENT(IN), OPTIONAL :: res_ti_M
+ INTEGER, INTENT(IN), OPTIONAL :: res_ti_S
+ INTEGER, INTENT(IN), OPTIONAL :: res_ti_Sn
+ INTEGER, INTENT(IN), OPTIONAL :: res_ti_Sd
+ INTEGER, INTENT(IN), OPTIONAL :: res_int
+ CHARACTER (LEN=*), OPTIONAL, INTENT(IN) :: testname
+ LOGICAL, OPTIONAL, INTENT(IN) :: expect_error
+ ! locals
+ LOGICAL :: iadd_op
+ LOGICAL :: isubtract_op
+ LOGICAL :: imultiply_op
+ LOGICAL :: idivide_op
+ INTEGER :: iop1_t_YY
+ INTEGER :: iop1_t_MM ! month
+ INTEGER :: iop1_t_DD ! day of month
+ INTEGER :: iop1_t_H
+ INTEGER :: iop1_t_M
+ INTEGER :: iop1_t_S
+ INTEGER :: iop1_t_Sn
+ INTEGER :: iop1_t_Sd
+ INTEGER :: iop1_ti_YY
+ INTEGER :: iop1_ti_MM ! month
+ INTEGER :: iop1_ti_DD ! day of month
+ INTEGER :: iop1_ti_H
+ INTEGER :: iop1_ti_M
+ INTEGER :: iop1_ti_S
+ INTEGER :: iop1_ti_Sn
+ INTEGER :: iop1_ti_Sd
+ INTEGER :: iop2_t_YY
+ INTEGER :: iop2_t_MM ! month
+ INTEGER :: iop2_t_DD ! day of month
+ INTEGER :: iop2_t_H
+ INTEGER :: iop2_t_M
+ INTEGER :: iop2_t_S
+ INTEGER :: iop2_t_Sn
+ INTEGER :: iop2_t_Sd
+ INTEGER :: iop2_ti_YY
+ INTEGER :: iop2_ti_MM ! month
+ INTEGER :: iop2_ti_DD ! day of month
+ INTEGER :: iop2_ti_H
+ INTEGER :: iop2_ti_M
+ INTEGER :: iop2_ti_S
+ INTEGER :: iop2_ti_Sn
+ INTEGER :: iop2_ti_Sd
+ INTEGER :: ires_t_YY
+ INTEGER :: ires_t_MM ! month
+ INTEGER :: ires_t_DD ! day of month
+ INTEGER :: ires_t_H
+ INTEGER :: ires_t_M
+ INTEGER :: ires_t_S
+ INTEGER :: ires_t_Sn
+ INTEGER :: ires_t_Sd
+ INTEGER :: ires_ti_YY
+ INTEGER :: ires_ti_MM ! month
+ INTEGER :: ires_ti_DD ! day of month
+ INTEGER :: ires_ti_H
+ INTEGER :: ires_ti_M
+ INTEGER :: ires_ti_S
+ INTEGER :: ires_ti_Sn
+ INTEGER :: ires_ti_Sd
+ LOGICAL :: op1_is_t , op2_is_t , res_is_t
+ LOGICAL :: op1_is_ti, op2_is_ti, res_is_ti, op2_is_int
+ LOGICAL :: res_is_int
+ INTEGER :: num_ops, num_op1, num_op2, num_res
+ LOGICAL :: unsupported_op, test_passed
+ CHARACTER (LEN=512) :: itestname
+ LOGICAL :: iexpect_error
+ INTEGER :: rc
+ INTEGER :: computed_int, Sn, Sd
+ TYPE(ESMF_Time) :: op1_t , op2_t , res_t, computed_t
+ TYPE(ESMF_TimeInterval) :: op1_ti, op2_ti, res_ti, computed_ti
+ CHARACTER(LEN=ESMF_MAXSTR) :: str, op1_str, op2_str, res_str, computed_str, frac_str
+ CHARACTER(LEN=1) :: op_str
+ CHARACTER(LEN=17) :: op1_type_str, op2_type_str, res_type_str
+
+ iadd_op = .FALSE.
+ isubtract_op = .FALSE.
+ imultiply_op = .FALSE.
+ idivide_op = .FALSE.
+ iop1_t_YY = 0
+ iop1_t_MM = 1
+ iop1_t_DD = 1
+ iop1_t_H = 0
+ iop1_t_M = 0
+ iop1_t_S = 0
+ iop1_t_Sn = 0
+ iop1_t_Sd = 0
+ iop1_ti_YY = 0
+ iop1_ti_MM = 0
+ iop1_ti_DD = 0
+ iop1_ti_H = 0
+ iop1_ti_M = 0
+ iop1_ti_S = 0
+ iop1_ti_Sn = 0
+ iop1_ti_Sd = 0
+ iop2_t_YY = 0
+ iop2_t_MM = 1
+ iop2_t_DD = 1
+ iop2_t_H = 0
+ iop2_t_M = 0
+ iop2_t_S = 0
+ iop2_t_Sn = 0
+ iop2_t_Sd = 0
+ iop2_ti_YY = 0
+ iop2_ti_MM = 0
+ iop2_ti_DD = 0
+ iop2_ti_H = 0
+ iop2_ti_M = 0
+ iop2_ti_S = 0
+ iop2_ti_Sn = 0
+ iop2_ti_Sd = 0
+ ires_t_YY = 0
+ ires_t_MM = 1
+ ires_t_DD = 1
+ ires_t_H = 0
+ ires_t_M = 0
+ ires_t_S = 0
+ ires_t_Sn = 0
+ ires_t_Sd = 0
+ ires_ti_YY = 0
+ ires_ti_MM = 0
+ ires_ti_DD = 0
+ ires_ti_H = 0
+ ires_ti_M = 0
+ ires_ti_S = 0
+ ires_ti_Sn = 0
+ ires_ti_Sd = 0
+ itestname = ''
+ iexpect_error = .FALSE.
+
+ IF ( PRESENT( add_op ) ) THEN
+ iadd_op = add_op
+ isubtract_op = ( .NOT. add_op )
+ ENDIF
+ IF ( PRESENT( multiply_op ) ) THEN
+ imultiply_op = multiply_op
+ idivide_op = ( .NOT. multiply_op )
+ ENDIF
+ num_ops = 0
+ IF ( iadd_op ) num_ops = num_ops + 1
+ IF ( isubtract_op ) num_ops = num_ops + 1
+ IF ( imultiply_op ) num_ops = num_ops + 1
+ IF ( idivide_op ) num_ops = num_ops + 1
+ IF ( num_ops /= 1 ) THEN
+ CALL wrf_error_fatal3( __FILE__ , __LINE__ , &
+ 'ERROR test_arithmetic: inconsistent operation' )
+ ENDIF
+ IF ( PRESENT( op1_t_YY ) ) iop1_t_YY = op1_t_YY
+ IF ( PRESENT( op1_t_MM ) ) iop1_t_MM = op1_t_MM
+ IF ( PRESENT( op1_t_DD ) ) iop1_t_DD = op1_t_DD
+ IF ( PRESENT( op1_t_H ) ) iop1_t_H = op1_t_H
+ IF ( PRESENT( op1_t_M ) ) iop1_t_M = op1_t_M
+ IF ( PRESENT( op1_t_S ) ) iop1_t_S = op1_t_S
+ IF ( PRESENT( op1_t_Sn ) ) iop1_t_Sn = op1_t_Sn
+ IF ( PRESENT( op1_t_Sd ) ) iop1_t_Sd = op1_t_Sd
+ IF ( PRESENT( op1_ti_YY ) ) iop1_ti_YY = op1_ti_YY
+ IF ( PRESENT( op1_ti_MM ) ) iop1_ti_MM = op1_ti_MM
+ IF ( PRESENT( op1_ti_DD ) ) iop1_ti_DD = op1_ti_DD
+ IF ( PRESENT( op1_ti_H ) ) iop1_ti_H = op1_ti_H
+ IF ( PRESENT( op1_ti_M ) ) iop1_ti_M = op1_ti_M
+ IF ( PRESENT( op1_ti_S ) ) iop1_ti_S = op1_ti_S
+ IF ( PRESENT( op1_ti_Sn ) ) iop1_ti_Sn = op1_ti_Sn
+ IF ( PRESENT( op1_ti_Sd ) ) iop1_ti_Sd = op1_ti_Sd
+ IF ( PRESENT( op2_t_YY ) ) iop2_t_YY = op2_t_YY
+ IF ( PRESENT( op2_t_MM ) ) iop2_t_MM = op2_t_MM
+ IF ( PRESENT( op2_t_DD ) ) iop2_t_DD = op2_t_DD
+ IF ( PRESENT( op2_t_H ) ) iop2_t_H = op2_t_H
+ IF ( PRESENT( op2_t_M ) ) iop2_t_M = op2_t_M
+ IF ( PRESENT( op2_t_S ) ) iop2_t_S = op2_t_S
+ IF ( PRESENT( op2_t_Sn ) ) iop2_t_Sn = op2_t_Sn
+ IF ( PRESENT( op2_t_Sd ) ) iop2_t_Sd = op2_t_Sd
+ IF ( PRESENT( op2_ti_YY ) ) iop2_ti_YY = op2_ti_YY
+ IF ( PRESENT( op2_ti_MM ) ) iop2_ti_MM = op2_ti_MM
+ IF ( PRESENT( op2_ti_DD ) ) iop2_ti_DD = op2_ti_DD
+ IF ( PRESENT( op2_ti_H ) ) iop2_ti_H = op2_ti_H
+ IF ( PRESENT( op2_ti_M ) ) iop2_ti_M = op2_ti_M
+ IF ( PRESENT( op2_ti_S ) ) iop2_ti_S = op2_ti_S
+ IF ( PRESENT( op2_ti_Sn ) ) iop2_ti_Sn = op2_ti_Sn
+ IF ( PRESENT( op2_ti_Sd ) ) iop2_ti_Sd = op2_ti_Sd
+ IF ( PRESENT( res_t_YY ) ) ires_t_YY = res_t_YY
+ IF ( PRESENT( res_t_MM ) ) ires_t_MM = res_t_MM
+ IF ( PRESENT( res_t_DD ) ) ires_t_DD = res_t_DD
+ IF ( PRESENT( res_t_H ) ) ires_t_H = res_t_H
+ IF ( PRESENT( res_t_M ) ) ires_t_M = res_t_M
+ IF ( PRESENT( res_t_S ) ) ires_t_S = res_t_S
+ IF ( PRESENT( res_t_Sn ) ) ires_t_Sn = res_t_Sn
+ IF ( PRESENT( res_t_Sd ) ) ires_t_Sd = res_t_Sd
+ IF ( PRESENT( res_ti_YY ) ) ires_ti_YY = res_ti_YY
+ IF ( PRESENT( res_ti_MM ) ) ires_ti_MM = res_ti_MM
+ IF ( PRESENT( res_ti_DD ) ) ires_ti_DD = res_ti_DD
+ IF ( PRESENT( res_ti_H ) ) ires_ti_H = res_ti_H
+ IF ( PRESENT( res_ti_M ) ) ires_ti_M = res_ti_M
+ IF ( PRESENT( res_ti_S ) ) ires_ti_S = res_ti_S
+ IF ( PRESENT( res_ti_Sn ) ) ires_ti_Sn = res_ti_Sn
+ IF ( PRESENT( res_ti_Sd ) ) ires_ti_Sd = res_ti_Sd
+ IF ( PRESENT( testname ) ) itestname = TRIM(testname)
+ IF ( PRESENT( expect_error ) ) iexpect_error = expect_error
+
+ ! Ensure that optional arguments are consistent...
+ op1_is_t = ( PRESENT( op1_t_YY ) .OR. PRESENT( op1_t_MM ) .OR. &
+ PRESENT( op1_t_DD ) .OR. PRESENT( op1_t_H ) .OR. &
+ PRESENT( op1_t_M ) .OR. PRESENT( op1_t_S ) .OR. &
+ PRESENT( op1_t_Sn ) .OR. PRESENT( op1_t_Sd ) )
+ op1_is_ti = ( PRESENT( op1_ti_YY ) .OR. PRESENT( op1_ti_MM ) .OR. &
+ PRESENT( op1_ti_DD ) .OR. PRESENT( op1_ti_H ) .OR. &
+ PRESENT( op1_ti_M ) .OR. PRESENT( op1_ti_S ) .OR. &
+ PRESENT( op1_ti_Sn ) .OR. PRESENT( op1_ti_Sd ) )
+ op2_is_t = ( PRESENT( op2_t_YY ) .OR. PRESENT( op2_t_MM ) .OR. &
+ PRESENT( op2_t_DD ) .OR. PRESENT( op2_t_H ) .OR. &
+ PRESENT( op2_t_M ) .OR. PRESENT( op2_t_S ) .OR. &
+ PRESENT( op2_t_Sn ) .OR. PRESENT( op2_t_Sd ) )
+ op2_is_ti = ( PRESENT( op2_ti_YY ) .OR. PRESENT( op2_ti_MM ) .OR. &
+ PRESENT( op2_ti_DD ) .OR. PRESENT( op2_ti_H ) .OR. &
+ PRESENT( op2_ti_M ) .OR. PRESENT( op2_ti_S ) .OR. &
+ PRESENT( op2_ti_Sn ) .OR. PRESENT( op2_ti_Sd ) )
+ op2_is_int = ( PRESENT( op2_int ) )
+ res_is_t = ( PRESENT( res_t_YY ) .OR. PRESENT( res_t_MM ) .OR. &
+ PRESENT( res_t_DD ) .OR. PRESENT( res_t_H ) .OR. &
+ PRESENT( res_t_M ) .OR. PRESENT( res_t_S ) .OR. &
+ PRESENT( res_t_Sn ) .OR. PRESENT( res_t_Sd ) )
+ res_is_ti = ( PRESENT( res_ti_YY ) .OR. PRESENT( res_ti_MM ) .OR. &
+ PRESENT( res_ti_DD ) .OR. PRESENT( res_ti_H ) .OR. &
+ PRESENT( res_ti_M ) .OR. PRESENT( res_ti_S ) .OR. &
+ PRESENT( res_ti_Sn ) .OR. PRESENT( res_ti_Sd ) )
+ res_is_int = ( PRESENT( res_int ) )
+ num_op1 = 0
+ IF ( op1_is_t ) num_op1 = num_op1 + 1
+ IF ( op1_is_ti ) num_op1 = num_op1 + 1
+ IF ( num_op1 /= 1 ) THEN
+ CALL wrf_error_fatal3( __FILE__ , __LINE__ , &
+ 'ERROR test_arithmetic: inconsistent args for op1' )
+ ENDIF
+ num_op2 = 0
+ IF ( op2_is_t ) num_op2 = num_op2 + 1
+ IF ( op2_is_ti ) num_op2 = num_op2 + 1
+ IF ( op2_is_int ) num_op2 = num_op2 + 1
+ IF ( num_op2 /= 1 ) THEN
+ CALL wrf_error_fatal3( __FILE__ , __LINE__ , &
+ 'ERROR test_arithmetic: inconsistent args for op2' )
+ ENDIF
+ num_res = 0
+ IF ( res_is_t ) num_res = num_res + 1
+ IF ( res_is_ti ) num_res = num_res + 1
+ IF ( res_is_int ) num_res = num_res + 1
+ IF ( num_res /= 1 ) THEN
+ CALL wrf_error_fatal3( __FILE__ , __LINE__ , &
+ 'ERROR test_arithmetic: inconsistent args for result' )
+ ENDIF
+
+ ! Initialize op1
+ IF ( op1_is_t ) THEN
+ op1_type_str = 'ESMF_Time'
+ CALL ESMF_TimeSet( op1_t, YY=iop1_t_YY, MM=iop1_t_MM, DD=iop1_t_DD , &
+ H=iop1_t_H, M=iop1_t_M, S=iop1_t_S, Sn=iop1_t_Sn, Sd=iop1_t_Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeSet() ', &
+ __FILE__ , &
+ __LINE__ )
+ CALL ESMF_TimeGet( op1_t, timeString=op1_str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ ! handle fractions
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ op1_str = TRIM(op1_str)//TRIM(frac_str)
+ ELSE
+ op1_type_str = 'ESMF_TimeInterval'
+ CALL ESMF_TimeIntervalSet( op1_ti, YY=iop1_ti_YY, MM=iop1_ti_MM, &
+ D=iop1_ti_DD , &
+ H=iop1_ti_H, M=iop1_ti_M, &
+ S=iop1_ti_S, Sn=iop1_ti_Sn, Sd=iop1_ti_Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeIntervalSet() ', &
+ __FILE__ , &
+ __LINE__ )
+ CALL ESMF_TimeIntervalGet( op1_ti, timeString=op1_str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ ! handle fractions
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ op1_str = TRIM(op1_str)//TRIM(frac_str)
+ ENDIF
+ ! Initialize op2
+ IF ( op2_is_t ) THEN
+ op2_type_str = 'ESMF_Time'
+ CALL ESMF_TimeSet( op2_t, YY=iop2_t_YY, MM=iop2_t_MM, DD=iop2_t_DD , &
+ H=iop2_t_H, M=iop2_t_M, S=iop2_t_S, Sn=iop2_t_Sn, Sd=iop2_t_Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeSet() ', &
+ __FILE__ , &
+ __LINE__ )
+ CALL ESMF_TimeGet( op2_t, timeString=op2_str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ ! handle fractions
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ op2_str = TRIM(op2_str)//TRIM(frac_str)
+ ELSE IF ( op2_is_ti ) THEN
+ op2_type_str = 'ESMF_TimeInterval'
+ CALL ESMF_TimeIntervalSet( op2_ti, YY=iop2_ti_YY, MM=iop2_ti_MM, &
+ D=iop2_ti_DD , &
+ H=iop2_ti_H, M=iop2_ti_M, &
+ S=iop2_ti_S, Sn=iop2_ti_Sn, Sd=iop2_ti_Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeIntervalSet() ', &
+ __FILE__ , &
+ __LINE__ )
+ CALL ESMF_TimeIntervalGet( op2_ti, timeString=op2_str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ ! handle fractions
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ op2_str = TRIM(op2_str)//TRIM(frac_str)
+ ELSE
+ op2_type_str = 'INTEGER'
+ IF ( op2_int > 0 ) THEN
+ WRITE(op2_str,FMT="('+',I8.8)") ABS(op2_int)
+ ELSE
+ WRITE(op2_str,FMT="('-',I8.8)") ABS(op2_int)
+ ENDIF
+ ENDIF
+ ! Initialize res
+ IF ( res_is_t ) THEN ! result is ESMF_Time
+ res_type_str = 'ESMF_Time'
+ CALL ESMF_TimeSet( res_t, YY=ires_t_YY, MM=ires_t_MM, DD=ires_t_DD , &
+ H=ires_t_H, M=ires_t_M, S=ires_t_S, Sn=ires_t_Sn, Sd=ires_t_Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeSet() ', &
+ __FILE__ , &
+ __LINE__ )
+ CALL ESMF_TimeGet( res_t, timeString=res_str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ ! handle fractions
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ res_str = TRIM(res_str)//TRIM(frac_str)
+ ELSE IF ( res_is_ti ) THEN ! result is ESMF_TimeInterval
+ res_type_str = 'ESMF_TimeInterval'
+ CALL ESMF_TimeIntervalSet( res_ti, YY=ires_ti_YY, MM=ires_ti_MM, &
+ D=ires_ti_DD , &
+ H=ires_ti_H, M=ires_ti_M, &
+ S=ires_ti_S, Sn=ires_ti_Sn, Sd=ires_ti_Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeIntervalSet() ', &
+ __FILE__ , &
+ __LINE__ )
+ CALL ESMF_TimeIntervalGet( res_ti, timeString=res_str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ ! handle fractions
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ res_str = TRIM(res_str)//TRIM(frac_str)
+ ELSE ! result is INTEGER
+ res_type_str = 'INTEGER'
+ IF ( res_int > 0 ) THEN
+ WRITE(res_str,FMT="('+',I8.8)") ABS(res_int)
+ ELSE
+ WRITE(res_str,FMT="('-',I8.8)") ABS(res_int)
+ ENDIF
+ ENDIF
+
+ ! perform requested operation
+ unsupported_op = .FALSE.
+ ! modify behavior of wrf_error_fatal3 for operator being tested
+ IF ( iexpect_error ) WRF_ERROR_FATAL_PRINT = .TRUE.
+ ! add
+ IF ( iadd_op ) THEN
+ op_str = '+'
+ IF ( res_is_t ) THEN ! result is ESMF_Time
+ IF ( op1_is_t .AND. op2_is_ti ) THEN
+ ! ESMF_Time = ESMF_Time + ESMF_TimeInterval
+ computed_t = op1_t + op2_ti
+ ELSE IF ( op1_is_ti .AND. op2_is_t ) THEN
+ ! ESMF_Time = ESMF_TimeInterval + ESMF_Time
+ computed_t = op1_ti + op2_t
+ ELSE
+ unsupported_op = .TRUE.
+ ENDIF
+ ELSE ! result is ESMF_TimeInterval
+ IF ( op1_is_ti .AND. op2_is_ti ) THEN
+ ! ESMF_TimeInterval = ESMF_TimeInterval + ESMF_TimeInterval
+ computed_ti = op1_ti + op2_ti
+ ELSE
+ unsupported_op = .TRUE.
+ ENDIF
+ ENDIF
+ ! subtract
+ ELSE IF ( isubtract_op ) THEN
+ op_str = '-'
+ IF ( res_is_t ) THEN ! result is ESMF_Time
+ IF ( op1_is_t .AND. op2_is_ti ) THEN
+ ! ESMF_Time = ESMF_Time - ESMF_TimeInterval
+ computed_t = op1_t - op2_ti
+ ELSE
+ unsupported_op = .TRUE.
+ ENDIF
+ ELSE ! result is ESMF_TimeInterval
+ IF ( op1_is_t .AND. op2_is_t ) THEN
+ ! ESMF_TimeInterval = ESMF_Time - ESMF_Time
+ computed_ti = op1_t - op2_t
+ ELSE IF ( op1_is_ti .AND. op2_is_ti ) THEN
+ ! ESMF_TimeInterval = ESMF_TimeInterval - ESMF_TimeInterval
+ computed_ti = op1_ti - op2_ti
+ ELSE
+ unsupported_op = .TRUE.
+ ENDIF
+ ENDIF
+ ELSE IF ( imultiply_op ) THEN
+ op_str = '*'
+ IF ( res_is_ti ) THEN ! result is ESMF_TimeInterval
+ IF ( op1_is_ti .AND. op2_is_int ) THEN
+ ! ESMF_TimeInterval = ESMF_TimeInterval * INTEGER
+ computed_ti = op1_ti * op2_int
+ ELSE
+ unsupported_op = .TRUE.
+ ENDIF
+ ENDIF
+ ELSE IF ( idivide_op ) THEN
+ op_str = '/'
+ IF ( res_is_ti ) THEN ! result is ESMF_TimeInterval
+ IF ( op1_is_ti .AND. op2_is_int ) THEN
+ ! ESMF_TimeInterval = ESMF_TimeInterval / INTEGER
+ computed_ti = op1_ti / op2_int
+ ELSE
+ unsupported_op = .TRUE.
+ ENDIF
+ ELSE IF ( res_is_int ) THEN ! result is INTEGER
+ IF ( op1_is_ti .AND. op2_is_ti ) THEN
+ ! INTEGER = ESMF_TimeInterval / ESMF_TimeInterval
+ ! number of whole time intervals
+ computed_int = ESMF_TimeIntervalDIVQuot( op1_ti , op2_ti )
+ ELSE
+ unsupported_op = .TRUE.
+ ENDIF
+ ENDIF
+ ENDIF
+ ! restore default behavior of wrf_error_fatal3
+ IF ( iexpect_error ) WRF_ERROR_FATAL_PRINT = .FALSE.
+ IF ( unsupported_op ) THEN
+ WRITE(str,*) 'ERROR test_arithmetic ',TRIM(itestname), &
+ ': unsupported operation (', &
+ TRIM(res_type_str),' = ',TRIM(op1_type_str),' ',TRIM(op_str),' ', &
+ TRIM(op2_type_str),')'
+ CALL wrf_error_fatal3( __FILE__ , __LINE__ , str )
+ ENDIF
+
+ ! check result
+ test_passed = .FALSE.
+ IF ( res_is_t ) THEN ! result is ESMF_Time
+ IF ( computed_t == res_t ) THEN
+ test_passed = .TRUE.
+ ELSE
+ CALL ESMF_TimeGet( computed_t, timeString=computed_str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ ! handle fractions
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ computed_str = TRIM(computed_str)//TRIM(frac_str)
+ ENDIF
+ ELSE IF ( res_is_ti ) THEN ! result is ESMF_TimeInterval
+ IF ( computed_ti == res_ti ) THEN
+ test_passed = .TRUE.
+ ELSE
+ CALL ESMF_TimeIntervalGet( computed_ti, timeString=computed_str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ ! handle fractions
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ computed_str = TRIM(computed_str)//TRIM(frac_str)
+ ENDIF
+ ELSE ! result is INTEGER
+ IF ( computed_int == res_int ) THEN
+ test_passed = .TRUE.
+ ELSE
+ IF ( computed_int > 0 ) THEN
+ WRITE(computed_str,FMT="('+',I8.8)") ABS(computed_int)
+ ELSE
+ WRITE(computed_str,FMT="('-',I8.8)") ABS(computed_int)
+ ENDIF
+ ENDIF
+ ENDIF
+ IF ( test_passed ) THEN
+ WRITE(*,FMT='(A)') 'PASS: '//TRIM(itestname)
+ ELSE
+ WRITE(*,*) 'FAIL: ',TRIM(itestname),': (', &
+ TRIM(res_type_str),' = ',TRIM(op1_type_str),' ',TRIM(op_str),' ', &
+ TRIM(op2_type_str),') expected ', &
+ TRIM(res_str),' = ',TRIM(op1_str),' ',TRIM(op_str),' ', &
+ TRIM(op2_str),' but computed ',TRIM(computed_str)
+ ENDIF
+
+ END SUBROUTINE test_arithmetic
+
+
+
+ ! simple clock creation and advance with add-subtract tests thrown in
+ ! no self checks (yet)
+ SUBROUTINE test_clock_advance( &
+ start_yy, start_mm, start_dd, start_h, start_m, start_s, &
+ stop_yy, stop_mm, stop_dd, stop_h, stop_m, stop_s, &
+ timestep_d, timestep_h, timestep_m, timestep_s, timestep_sn, timestep_sd, &
+ testname, increment_S, increment_Sn, increment_Sd )
+ INTEGER, INTENT(IN), OPTIONAL :: start_YY
+ INTEGER, INTENT(IN), OPTIONAL :: start_MM ! month
+ INTEGER, INTENT(IN), OPTIONAL :: start_DD ! day of month
+ INTEGER, INTENT(IN), OPTIONAL :: start_H
+ INTEGER, INTENT(IN), OPTIONAL :: start_M
+ INTEGER, INTENT(IN), OPTIONAL :: start_S
+ INTEGER, INTENT(IN), OPTIONAL :: stop_YY
+ INTEGER, INTENT(IN), OPTIONAL :: stop_MM ! month
+ INTEGER, INTENT(IN), OPTIONAL :: stop_DD ! day of month
+ INTEGER, INTENT(IN), OPTIONAL :: stop_H
+ INTEGER, INTENT(IN), OPTIONAL :: stop_M
+ INTEGER, INTENT(IN), OPTIONAL :: stop_S
+ INTEGER, INTENT(IN), OPTIONAL :: timestep_D ! day
+ INTEGER, INTENT(IN), OPTIONAL :: timestep_H
+ INTEGER, INTENT(IN), OPTIONAL :: timestep_M
+ INTEGER, INTENT(IN), OPTIONAL :: timestep_S
+ INTEGER, INTENT(IN), OPTIONAL :: timestep_Sn
+ INTEGER, INTENT(IN), OPTIONAL :: timestep_Sd
+ CHARACTER (LEN=*), OPTIONAL, INTENT(IN) :: testname
+ INTEGER, INTENT(IN), OPTIONAL :: increment_S ! add and subtract this
+ INTEGER, INTENT(IN), OPTIONAL :: increment_Sn ! value each time step
+ INTEGER, INTENT(IN), OPTIONAL :: increment_Sd
+
+ ! locals
+ INTEGER :: istart_YY
+ INTEGER :: istart_MM ! month
+ INTEGER :: istart_DD ! day of month
+ INTEGER :: istart_H
+ INTEGER :: istart_M
+ INTEGER :: istart_S
+ INTEGER :: istop_YY
+ INTEGER :: istop_MM ! month
+ INTEGER :: istop_DD ! day of month
+ INTEGER :: istop_H
+ INTEGER :: istop_M
+ INTEGER :: istop_S
+ INTEGER :: itimestep_D ! day
+ INTEGER :: itimestep_H
+ INTEGER :: itimestep_M
+ INTEGER :: itimestep_S
+ INTEGER :: itimestep_Sn
+ INTEGER :: itimestep_Sd
+ CHARACTER (LEN=512) :: itestname, itestfullname
+ INTEGER :: iincrement_S
+ INTEGER :: iincrement_Sn
+ INTEGER :: iincrement_Sd
+ INTEGER :: Sn, Sd
+ INTEGER rc
+ TYPE(ESMF_Time) :: start_time, stop_time, current_time
+ TYPE(ESMF_Clock), POINTER :: domain_clock
+ TYPE(ESMF_TimeInterval) :: timestep, increment
+ TYPE(ESMF_Time) :: add_time, subtract_time
+ INTEGER :: itimestep
+ REAL(ESMF_KIND_R8) :: dayr8
+ CHARACTER(LEN=ESMF_MAXSTR) :: str, frac_str
+
+ istart_YY = 0
+ istart_MM = 1
+ istart_DD = 1
+ istart_H = 0
+ istart_M = 0
+ istart_S = 0
+ istop_YY = 0
+ istop_MM = 1
+ istop_DD = 1
+ istop_H = 0
+ istop_M = 0
+ istop_S = 0
+ itimestep_D = 0
+ itimestep_H = 0
+ itimestep_M = 0
+ itimestep_S = 0
+ itimestep_Sn = 0
+ itimestep_Sd = 0
+ itestname = ''
+ iincrement_S = 0
+ iincrement_Sn = 0
+ iincrement_Sd = 0
+
+ IF ( PRESENT( start_YY ) ) istart_YY = start_YY
+ IF ( PRESENT( start_MM ) ) istart_MM = start_MM
+ IF ( PRESENT( start_DD ) ) istart_DD = start_DD
+ IF ( PRESENT( start_H ) ) istart_H = start_H
+ IF ( PRESENT( start_M ) ) istart_M = start_M
+ IF ( PRESENT( start_S ) ) istart_S = start_S
+ IF ( PRESENT( stop_YY ) ) istop_YY = stop_YY
+ IF ( PRESENT( stop_MM ) ) istop_MM = stop_MM
+ IF ( PRESENT( stop_DD ) ) istop_DD = stop_DD
+ IF ( PRESENT( stop_H ) ) istop_H = stop_H
+ IF ( PRESENT( stop_M ) ) istop_M = stop_M
+ IF ( PRESENT( stop_S ) ) istop_S = stop_S
+ IF ( PRESENT( timestep_D ) ) itimestep_D = timestep_D
+ IF ( PRESENT( timestep_H ) ) itimestep_H = timestep_H
+ IF ( PRESENT( timestep_M ) ) itimestep_M = timestep_M
+ IF ( PRESENT( timestep_S ) ) itimestep_S = timestep_S
+ IF ( PRESENT( timestep_Sn ) ) itimestep_Sn = timestep_Sn
+ IF ( PRESENT( timestep_Sd ) ) itimestep_Sd = timestep_Sd
+ IF ( PRESENT( testname ) ) itestname = TRIM(testname)//'_'
+ IF ( PRESENT( increment_S ) ) iincrement_S = increment_S
+ IF ( PRESENT( increment_Sn ) ) iincrement_Sn = increment_Sn
+ IF ( PRESENT( increment_Sd ) ) iincrement_Sd = increment_Sd
+
+ ! Initialize start time, stop time, time step, clock for simple case.
+ itestfullname = TRIM(itestname)//'SETUP'
+ CALL ESMF_TimeSet( start_time, YY=istart_YY, MM=istart_MM, DD=istart_DD , &
+ H=istart_H, M=istart_M, S=istart_S, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeSet() ', &
+ __FILE__ , &
+ __LINE__ )
+
+ CALL ESMF_TimeGet( start_time, timeString=str, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': start_time = <',TRIM(str),'>'
+
+ CALL ESMF_TimeSet( stop_time, YY=istop_YY, MM=istop_MM, DD=istop_DD , &
+ H=istop_H, M=istop_M, S=istop_S, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeSet() ', &
+ __FILE__ , &
+ __LINE__ )
+
+ CALL ESMF_TimeGet( stop_time, timeString=str, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': stop_time = <',TRIM(str),'>'
+
+ CALL ESMF_TimeIntervalSet( timestep, D=itimestep_D, H=itimestep_H, &
+ M=itimestep_M, S=itimestep_S, &
+ Sn=itimestep_Sn, Sd=itimestep_Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeIntervalSet() ', &
+ __FILE__ , &
+ __LINE__ )
+
+ CALL ESMF_TimeIntervalGet( timestep, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeIntervalGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ ! handle fractions
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ str = TRIM(str)//TRIM(frac_str)
+ WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': timestep = <',TRIM(str),'>'
+
+ CALL ESMF_TimeIntervalSet( increment, S=iincrement_S, &
+ Sn=iincrement_Sn, Sd=iincrement_Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeIntervalSet() ', &
+ __FILE__ , &
+ __LINE__ )
+
+ CALL ESMF_TimeIntervalGet( increment, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeIntervalGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ ! handle fractions
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ str = TRIM(str)//TRIM(frac_str)
+ WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': increment = <',TRIM(str),'>'
+
+ ALLOCATE( domain_clock )
+ domain_clock = ESMF_ClockCreate( TimeStep= timestep, &
+ StartTime=start_time, &
+ StopTime= stop_time, &
+ rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_ClockCreate() ', &
+ __FILE__ , &
+ __LINE__ )
+
+ CALL ESMF_ClockGet( domain_clock, CurrTime=current_time, &
+ rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_ClockGet() ', &
+ __FILE__ , &
+ __LINE__ )
+
+ CALL ESMF_TimeGet( current_time, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ str = TRIM(str)//TRIM(frac_str)
+ WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': clock current_time = <',TRIM(str),'>'
+
+ CALL ESMF_TimeGet( current_time, dayOfYear_r8=dayr8, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ WRITE(*,FMT='(A,A,F10.6,A)') TRIM(itestfullname),': current_time dayOfYear_r8 = < ',dayr8,' >'
+
+ subtract_time = current_time - increment
+ CALL ESMF_TimeGet( subtract_time, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ str = TRIM(str)//TRIM(frac_str)
+ WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': current_time-increment = <',TRIM(str),'>'
+
+ add_time = current_time + increment
+ CALL ESMF_TimeGet( add_time, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ str = TRIM(str)//TRIM(frac_str)
+ WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': current_time+increment = <',TRIM(str),'>'
+
+ ! Advance clock.
+ itestfullname = TRIM(itestname)//'ADVANCE'
+ itimestep = 0
+ DO WHILE ( .NOT. ESMF_ClockIsStopTime(domain_clock ,rc=rc) )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_ClockIsStopTime() ', &
+ __FILE__ , &
+ __LINE__ )
+ itimestep = itimestep + 1
+
+ CALL ESMF_ClockAdvance( domain_clock, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_ClockAdvance() ', &
+ __FILE__ , &
+ __LINE__ )
+
+ CALL ESMF_ClockGet( domain_clock, CurrTime=current_time, &
+ rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_ClockGet() ', &
+ __FILE__ , &
+ __LINE__ )
+
+ CALL ESMF_TimeGet( current_time, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ str = TRIM(str)//TRIM(frac_str)
+ WRITE(*,FMT='(A,A,I6.6,A,A,A)') TRIM(itestfullname),': count = ', &
+ itimestep,' current_time = <',TRIM(str),'>'
+
+ subtract_time = current_time - increment
+ CALL ESMF_TimeGet( subtract_time, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ str = TRIM(str)//TRIM(frac_str)
+ WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': current_time-increment = <',TRIM(str),'>'
+
+ add_time = current_time + increment
+ CALL ESMF_TimeGet( add_time, timeString=str, Sn=Sn, Sd=Sd, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ TRIM(itestfullname)//'ESMF_TimeGet() ', &
+ __FILE__ , &
+ __LINE__ )
+ CALL fraction_to_string( Sn, Sd, frac_str )
+ str = TRIM(str)//TRIM(frac_str)
+ WRITE(*,FMT='(A,A,A,A)') TRIM(itestfullname),': current_time+increment = <',TRIM(str),'>'
+
+ ENDDO
+
+ DEALLOCATE( domain_clock )
+
+ END SUBROUTINE test_clock_advance
+
+END MODULE my_tests
+
+
+#if defined( TIME_F90_ONLY )
+
+! TBH: Improve the build of Test1.exe to use WRF versions of these
+! TBH: routines and remove these hacked-in duplicates!!
+
+SUBROUTINE wrf_abort
+ IMPLICIT NONE
+#if defined( DM_PARALLEL ) && ! defined( STUBMPI )
+ INCLUDE 'mpif.h'
+ INTEGER ierr
+ CALL mpi_abort(MPI_COMM_WORLD,1,ierr)
+#else
+ STOP
+#endif
+END SUBROUTINE wrf_abort
+
+SUBROUTINE wrf_message( str )
+ IMPLICIT NONE
+ CHARACTER*(*) str
+#if defined( DM_PARALLEL ) && ! defined( STUBMPI)
+ write(0,*) str
+#endif
+ print*, str
+END SUBROUTINE wrf_message
+
+! intentionally write to stderr only
+SUBROUTINE wrf_message2( str )
+ IMPLICIT NONE
+ CHARACTER*(*) str
+ write(0,*) str
+END SUBROUTINE wrf_message2
+
+SUBROUTINE wrf_error_fatal3( file_str, line, str )
+ USE my_tests
+ IMPLICIT NONE
+ CHARACTER*(*) file_str
+ INTEGER , INTENT (IN) :: line ! only print file and line if line > 0
+ CHARACTER*(*) str
+ CHARACTER*256 :: line_str
+ write(line_str,'(i6)') line
+ ! special behavior for testing since Fortran cannot catch exceptions
+ IF ( WRF_ERROR_FATAL_PRINT ) THEN
+ ! just print message and continue
+ CALL wrf_message( 'ERROR IN FILE: '//TRIM(file_str)//' LINE: '//TRIM(line_str) )
+ ELSE
+ ! normal behavior
+#if defined( DM_PARALLEL ) && ! defined( STUBMPI )
+ CALL wrf_message( '-------------- FATAL CALLED ---------------' )
+ ! only print file and line if line is positive
+ IF ( line > 0 ) THEN
+ CALL wrf_message( 'FATAL CALLED FROM FILE: '//file_str//' LINE: '//TRIM(line_str) )
+ ENDIF
+ CALL wrf_message( str )
+ CALL wrf_message( '-------------------------------------------' )
+#else
+ CALL wrf_message2( '-------------- FATAL CALLED ---------------' )
+ ! only print file and line if line is positive
+ IF ( line > 0 ) THEN
+ CALL wrf_message( 'FATAL CALLED FROM FILE: '//file_str//' LINE: '//TRIM(line_str) )
+ ENDIF
+ CALL wrf_message2( str )
+ CALL wrf_message2( '-------------------------------------------' )
+#endif
+ CALL wrf_abort
+ ENDIF
+END SUBROUTINE wrf_error_fatal3
+
+SUBROUTINE wrf_error_fatal( str )
+ IMPLICIT NONE
+ CHARACTER*(*) str
+ CALL wrf_error_fatal3 ( ' ', 0, str )
+END SUBROUTINE wrf_error_fatal
+
+#endif
+
+
+! Check to see if expected value == actual value
+! If not, print message and exit.
+SUBROUTINE test_check_error( expected, actual, str, file_str, line )
+ IMPLICIT NONE
+ INTEGER , INTENT (IN) :: expected
+ INTEGER , INTENT (IN) :: actual
+ CHARACTER*(*) str
+ CHARACTER*(*) file_str
+ INTEGER , INTENT (IN) :: line
+ CHARACTER (LEN=512) :: rc_str
+ CHARACTER (LEN=512) :: str_with_rc
+ IF ( expected .ne. actual ) THEN
+ WRITE (rc_str,*) ' Routine returned error code = ',actual
+ str_with_rc = 'FAIL: '//TRIM(str)//TRIM(rc_str)
+ CALL wrf_error_fatal3( file_str, line, str_with_rc )
+ ENDIF
+END SUBROUTINE test_check_error
+
+
+
+PROGRAM time_manager_test
+ USE ESMF_Mod
+ USE my_tests
+ IMPLICIT NONE
+ INTEGER :: rc
+
+ PRINT *,'BEGIN TEST SUITE'
+
+ CALL ESMF_Initialize( defaultCalendar=ESMF_CAL_GREGORIAN, rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ 'ESMF_Initialize() ', &
+ __FILE__ , &
+ __LINE__ )
+! PRINT *,'DEBUG: back from ESMF_Initialize(), rc = ',rc
+
+! CALL test_print( t_yy, t_mm, t_dd, t_h, t_m, t_s, &
+! ti_yy, ti_mm, ti_dd, ti_h, ti_m, ti_s, &
+! res_str, testname )
+
+ ! Print times
+ ! "vanilla" tests
+! PRINT *,'DEBUG: calling 1st test_print()'
+ CALL test_print( t_yy=2001, t_mm=12, t_dd=3, t_h=1, t_m=20, t_s=10, &
+ res_str='2001-12-03_01:20:10', testname='printT_1' )
+! PRINT *,'DEBUG: back from 1st test_print()'
+ CALL test_print( t_yy=0, t_mm=1, t_dd=1, t_h=0, t_m=0, t_s=0, &
+ res_str='0000-01-01_00:00:00', testname='printT_2' )
+ CALL test_print( t_yy=2003, t_mm=12, t_dd=30, t_h=23, t_m=59, t_s=50, &
+ res_str='2003-12-30_23:59:50', testname='printT_3' )
+ CALL test_print( t_yy=2003, t_mm=12, t_dd=31, t_h=23, t_m=59, t_s=50, &
+ res_str='2003-12-31_23:59:50', testname='printT_4' )
+ CALL test_print( t_yy=2004, t_mm=12, t_dd=30, t_h=23, t_m=59, t_s=50, &
+ res_str='2004-12-30_23:59:50', testname='printT_5' )
+ CALL test_print( t_yy=2004, t_mm=12, t_dd=31, t_h=23, t_m=59, t_s=50, &
+ res_str='2004-12-31_23:59:50', testname='printT_6' )
+!$$$ NOTE that this fails -- need to fix up output string for negative year
+! CALL test_print( t_yy=-2004, t_mm=12, t_dd=31, t_h=23, t_m=59, t_s=50, &
+! res_str='-2004-12-31_23:59:50', testname='printT_6' )
+
+ ! these test default behavior of test harness
+ CALL test_print( t_s=0, &
+ res_str='0000-01-01_00:00:00', testname='printT_D1' )
+ CALL test_print( t_yy=0, &
+ res_str='0000-01-01_00:00:00', testname='printT_D2' )
+
+ ! fractions
+ CALL test_print( t_yy=2001, t_mm=12, t_dd=3, t_h=1, t_m=20, t_s=10, &
+ t_sn=1, t_sd=3, &
+ res_str='2001-12-03_01:20:10+01/03', testname='printT_F1' )
+ CALL test_print( t_yy=2001, t_mm=12, t_dd=3, t_h=1, t_m=20, t_s=10, &
+ t_sn=4, t_sd=3, &
+ res_str='2001-12-03_01:20:11+01/03', testname='printT_F2' )
+ CALL test_print( t_yy=2001, t_mm=12, t_dd=3, t_h=1, t_m=20, t_s=10, &
+ t_sn=12, t_sd=3, &
+ res_str='2001-12-03_01:20:14', testname='printT_F3' )
+ CALL test_print( t_yy=2001, t_mm=12, t_dd=3, t_h=1, t_m=20, t_s=10, &
+ t_sn=-1, t_sd=3, &
+ res_str='2001-12-03_01:20:09+02/03', testname='printT_F4' )
+
+ ! ERROR, MM out of range
+!$$$here... fix so this just prints "ERROR: <testname>" in failure case
+!$$$here... also need "expect_fail" to reverse sense of PASS/FAIL message for
+!$$$here... tests that should fail
+! CALL test_print( t_yy=2001, t_mm=13, t_dd=3, t_h=1, t_m=20, t_s=10, &
+! res_str='2002-01-03_01:20:10', testname='printT_E1', expect_error=.TRUE. )
+
+ ! Print time intervals
+ ! "vanilla" tests
+ CALL test_print( ti_yy=0, ti_mm=0, ti_dd=0, ti_h=0, ti_m=0, ti_s=0, &
+ res_str='0000000000_000:000:000', testname='printTI_1' )
+ CALL test_print( ti_yy=0, ti_mm=0, ti_dd=500, ti_h=0, ti_m=0, ti_s=7270, &
+ res_str='0000000500_002:001:010', testname='printTI_2' )
+
+ ! these test default behavior of test harness
+ CALL test_print( ti_s=0, &
+ res_str='0000000000_000:000:000', testname='printTI_D1' )
+ CALL test_print( ti_yy=0, &
+ res_str='0000000000_000:000:000', testname='printTI_D2' )
+
+ ! these test negative values
+ CALL test_print( ti_yy=0000, ti_mm=0, ti_dd=-3, ti_h=-1, ti_m=-20, ti_s=-10, &
+ res_str='-0000000003_001:020:010', testname='printTI_N1' )
+
+ ! these test mixed values
+ CALL test_print( ti_yy=0000, ti_mm=0, ti_dd=-3, ti_h=1, ti_m=20, ti_s=10, &
+ res_str='-0000000002_022:039:050', testname='printTI_M1' )
+
+ ! fractions
+ CALL test_print( ti_yy=0000, ti_mm=0, ti_dd=3, ti_h=1, ti_m=20, ti_s=10, &
+ ti_sn=1, ti_sd=3, &
+ res_str='0000000003_001:020:010+01/03', testname='printTI_F1' )
+ CALL test_print( ti_yy=0000, ti_mm=0, ti_dd=3, ti_h=1, ti_m=20, ti_s=10, &
+ ti_sn=5, ti_sd=3, &
+ res_str='0000000003_001:020:011+02/03', testname='printTI_F2' )
+ CALL test_print( ti_yy=0000, ti_mm=0, ti_dd=-3, ti_h=-1, ti_m=-20, ti_s=-10, &
+ ti_sn=-1, ti_sd=3, &
+ res_str='-0000000003_001:020:010-01/03', testname='printTI_F3' )
+ CALL test_print( ti_yy=0000, ti_mm=0, ti_dd=-3, ti_h=-1, ti_m=-20, ti_s=-10, &
+ ti_sn=1, ti_sd=3, &
+ res_str='-0000000003_001:020:009-02/03', testname='printTI_F4' )
+
+ ! these test non-normalized values
+! CALL test_print( ti_yy=2001, ti_mm=1, ti_dd=3, ti_h=1, ti_m=20, ti_s=10, &
+! res_str='02001-001-003_001:020:010', testname='printTI_NN1', expect_error=.TRUE. )
+! CALL test_print( ti_yy=2001, ti_mm=12, ti_dd=3, ti_h=1, ti_m=20, ti_s=10, &
+! res_str='02002-000-003_001:020:010', testname='printTI_NN2', expect_error=.TRUE. )
+! CALL test_print( ti_yy=2002, ti_mm=5, ti_dd=500, ti_h=0, ti_m=0, ti_s=7270, &
+! res_str='02002-005-500_002:001:010', testname='printTI_NN3', expect_error=.TRUE. )
+
+ ! Addition tests
+ ! ESMF_Time = ESMF_Time + ESMF_TimeInterval
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2001, op1_t_mm=12, op1_t_dd=3, op1_t_h=1, op1_t_m=20, op1_t_s=10, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=3, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2001, res_t_mm=12, res_t_dd=3, res_t_h=4, res_t_m=30, res_t_s=20, &
+ testname='AddT_T_TI1' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2001, op1_t_mm=12, op1_t_dd=31, op1_t_h=22, op1_t_m=30, op1_t_s=00, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2002, res_t_mm= 1, res_t_dd=1, res_t_h=2, res_t_m=40, res_t_s=10, &
+ testname='AddT_T_TI2' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2003, op1_t_mm=12, op1_t_dd=31, op1_t_h=22, op1_t_m=30, op1_t_s=00, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2004, res_t_mm= 1, res_t_dd=1, res_t_h=2, res_t_m=40, res_t_s=10, &
+ testname='AddT_T_TI3' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2004, op1_t_mm=12, op1_t_dd=31, op1_t_h=22, op1_t_m=30, op1_t_s=00, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2005, res_t_mm= 1, res_t_dd=1, res_t_h=2, res_t_m=40, res_t_s=10, &
+ testname='AddT_T_TI4' )
+ ! this case hung after the CCSM contribution
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2004, op1_t_mm=12, op1_t_dd=30, op1_t_h=22, op1_t_m=30, op1_t_s=00, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2004, res_t_mm=12, res_t_dd=31, res_t_h=2, res_t_m=40, res_t_s=10, &
+ testname='AddT_T_TI5' )
+! NOTE: CCSM folks need to decide what it means to add "1 month" to Feb. 29. And all the
+! other very similar cases. Then, write this unit test!
+! CALL test_arithmetic( add_op=.TRUE., &
+! op1_t_yy=2004, op1_t_mm=12, op1_t_dd=31, op1_t_h=22, op1_t_m=30, op1_t_s=00, &
+! op2_ti_yy= 2, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+! res_t_yy=2007, res_t_mm= 1, res_t_dd=1, res_t_h=2, res_t_m=40, res_t_s=10, &
+! testname='AddT_T_TI6' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2004, op1_t_mm=12, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=365, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2005, res_t_mm=12, res_t_dd=30, res_t_h=8, res_t_m=40, res_t_s=10, &
+ testname='AddT_T_TI7' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2004, op1_t_mm=12, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=367, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2006, res_t_mm=01, res_t_dd=01, res_t_h=8, res_t_m=40, res_t_s=10, &
+ testname='AddT_T_TI8' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2003, op1_t_mm=12, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=365, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2004, res_t_mm=12, res_t_dd=29, res_t_h=8, res_t_m=40, res_t_s=10, &
+ testname='AddT_T_TI9' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2003, op1_t_mm=12, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=366, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2004, res_t_mm=12, res_t_dd=30, res_t_h=8, res_t_m=40, res_t_s=10, &
+ testname='AddT_T_TI10' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2003, op1_t_mm=12, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=367, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2004, res_t_mm=12, res_t_dd=31, res_t_h=8, res_t_m=40, res_t_s=10, &
+ testname='AddT_T_TI11' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2003, op1_t_mm=12, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=368, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2005, res_t_mm=01, res_t_dd=01, res_t_h=8, res_t_m=40, res_t_s=10, &
+ testname='AddT_T_TI12' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2004, op1_t_mm=03, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=365, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2005, res_t_mm=03, res_t_dd=30, res_t_h=8, res_t_m=40, res_t_s=10, &
+ testname='AddT_T_TI13' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2004, op1_t_mm=03, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=365, op2_ti_h=22, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2005, res_t_mm=03, res_t_dd=31, res_t_h=2, res_t_m=40, res_t_s=10, &
+ testname='AddT_T_TI14' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2004, op1_t_mm=03, op1_t_dd=30, op1_t_h=4, op1_t_m=30, op1_t_s=00, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=366, op2_ti_h=22, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2005, res_t_mm=04, res_t_dd=01, res_t_h=2, res_t_m=40, res_t_s=10, &
+ testname='AddT_T_TI15' )
+ ! ESMF_Time = ESMF_Time + ESMF_TimeInterval with fractions
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_t_yy=2004, op1_t_mm=12, op1_t_dd=31, op1_t_h=22, op1_t_m=30, op1_t_s=00, &
+ op1_t_sn=01, op1_t_sd=03, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+ op2_ti_sn=01, op2_ti_sd=03, &
+ res_t_yy=2005, res_t_mm= 1, res_t_dd=1, res_t_h=2, res_t_m=40, res_t_s=10, &
+ res_t_sn=02, res_t_sd=03, &
+ testname='AddT_T_TI_F1' )
+ ! this should fail (and does)
+! CALL test_arithmetic( add_op=.TRUE., &
+! op1_t_yy=2004, op1_t_mm=12, op1_t_dd=31, op1_t_h=22, op1_t_m=30, op1_t_s=00, &
+! op1_t_sn=01, op1_t_sd=03, &
+! op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+! op2_ti_sn=01, op2_ti_sd=03, &
+! res_t_yy=2005, res_t_mm= 1, res_t_dd=1, res_t_h=2, res_t_m=40, res_t_s=10, &
+! res_t_sn=01, res_t_sd=03, &
+! testname='AddT_T_TI_F2' )
+ ! ESMF_Time = ESMF_TimeInterval + ESMF_Time
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_ti_yy= 0, op1_ti_mm= 0, op1_ti_dd=0, op1_ti_h=3, op1_ti_m=10, op1_ti_s=10, &
+ op2_t_yy=2001, op2_t_mm=12, op2_t_dd=3, op2_t_h=1, op2_t_m=20, op2_t_s=10, &
+ res_t_yy=2001, res_t_mm=12, res_t_dd=3, res_t_h=4, res_t_m=30, res_t_s=20, &
+ testname='AddT_TI_T1' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_ti_yy= 0, op1_ti_mm= 0, op1_ti_dd=0, op1_ti_h=4, op1_ti_m=10, op1_ti_s=10, &
+ op2_t_yy=2001, op2_t_mm=12, op2_t_dd=31, op2_t_h=22, op2_t_m=30, op2_t_s=00, &
+ res_t_yy=2002, res_t_mm= 1, res_t_dd=1, res_t_h=2, res_t_m=40, res_t_s=10, &
+ testname='AddT_TI_T2' )
+ ! ESMF_TimeInterval = ESMF_TimeInterval + ESMF_TimeInterval
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=3, op1_ti_h=1, op1_ti_m=20, op1_ti_s=10, &
+ op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=1, op2_ti_h=1, op2_ti_m=10, op2_ti_s=10, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=4, res_ti_h=2, res_ti_m=30, res_ti_s=20, &
+ testname='AddTI_TI_TI1' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=-3, op1_ti_h=-1, op1_ti_m=-20, op1_ti_s=-10, &
+ op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=1, op2_ti_h=1, op2_ti_m=10, op2_ti_s=10, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=-2, res_ti_h=0, res_ti_m=-10, res_ti_s=00, &
+ testname='AddTI_TI_TI2' )
+ CALL test_arithmetic( add_op=.TRUE., &
+ op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=-3, op1_ti_h=-1, op1_ti_m=-20, op1_ti_s=-10, &
+ op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=-1, op2_ti_h=-1, op2_ti_m=-10, op2_ti_s=-10, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=-4, res_ti_h=-2, res_ti_m=-30, res_ti_s=-20, &
+ testname='AddTI_TI_TI3' )
+
+ ! Subtraction tests
+ ! ESMF_Time = ESMF_Time - ESMF_TimeInterval
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2001, op1_t_mm=12, op1_t_dd=3, op1_t_h=1, op1_t_m=20, op1_t_s=10, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=3, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2001, res_t_mm=12, res_t_dd=2, res_t_h=22, res_t_m=10, res_t_s=0, &
+ testname='SubtractT_T_TI1' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2005, op1_t_mm=1, op1_t_dd=1, op1_t_h=0, op1_t_m=00, op1_t_s=0, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=0, op2_ti_m=00, op2_ti_s=10, &
+ res_t_yy=2004, res_t_mm=12, res_t_dd=31, res_t_h=23, res_t_m=59, res_t_s=50, &
+ testname='SubtractT_T_TI2' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2004, op1_t_mm=1, op1_t_dd=1, op1_t_h=0, op1_t_m=00, op1_t_s=0, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=0, op2_ti_m=00, op2_ti_s=10, &
+ res_t_yy=2003, res_t_mm=12, res_t_dd=31, res_t_h=23, res_t_m=59, res_t_s=50, &
+ testname='SubtractT_T_TI3' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2003, op1_t_mm=1, op1_t_dd=1, op1_t_h=0, op1_t_m=00, op1_t_s=0, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=0, op2_ti_m=00, op2_ti_s=10, &
+ res_t_yy=2002, res_t_mm=12, res_t_dd=31, res_t_h=23, res_t_m=59, res_t_s=50, &
+ testname='SubtractT_T_TI4' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2005, op1_t_mm=04, op1_t_dd=01, op1_t_h=2, op1_t_m=40, op1_t_s=10, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=366, op2_ti_h=22, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2004, res_t_mm=03, res_t_dd=30, res_t_h=4, res_t_m=30, res_t_s=00, &
+ testname='SubtractT_T_TI5' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2006, op1_t_mm=01, op1_t_dd=01, op1_t_h=8, op1_t_m=40, op1_t_s=10, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=367, op2_ti_h=4, op2_ti_m=10, op2_ti_s=10, &
+ res_t_yy=2004, res_t_mm=12, res_t_dd=30, res_t_h=4, res_t_m=30, res_t_s=00, &
+ testname='SubtractT_T_TI6' )
+ ! ESMF_Time = ESMF_Time - ESMF_TimeInterval with fractions
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2005, op1_t_mm=01, op1_t_dd=01, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
+ op1_t_sn=00, op1_t_sd=00, &
+ op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=0, op2_ti_m=00, op2_ti_s=01, &
+ op2_ti_sn=01, op2_ti_sd=03, &
+ res_t_yy=2004, res_t_mm=12, res_t_dd=31, res_t_h=23, res_t_m=59, res_t_s=58, &
+ res_t_sn=02, res_t_sd=03, &
+ testname='SubtractT_T_TI_F1' )
+ ! ESMF_TimeInterval = ESMF_Time - ESMF_Time
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2001, op1_t_mm=12, op1_t_dd=3, op1_t_h=1, op1_t_m=20, op1_t_s=10, &
+ op2_t_yy=2001, op2_t_mm=12, op2_t_dd=1, op2_t_h=1, op2_t_m=10, op2_t_s=10, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=2, res_ti_h=0, res_ti_m=10, res_ti_s=0, &
+ testname='SubtractTI_T_T1' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2002, op1_t_mm=1, op1_t_dd=1, op1_t_h=0, op1_t_m=00, op1_t_s=00, &
+ op2_t_yy=2001, op2_t_mm=12, op2_t_dd=31, op2_t_h=23, op2_t_m=59, op2_t_s=50, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=0, res_ti_h=0, res_ti_m=00, res_ti_s=10, &
+ testname='SubtractTI_T_T2' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2005, op1_t_mm=1, op1_t_dd=1, op1_t_h=0, op1_t_m=00, op1_t_s=00, &
+ op2_t_yy=2004, op2_t_mm=12, op2_t_dd=31, op2_t_h=23, op2_t_m=59, op2_t_s=50, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=0, res_ti_h=0, res_ti_m=00, res_ti_s=10, &
+ testname='SubtractTI_T_T3' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2003, op1_t_mm=03, op1_t_dd=01, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
+ op2_t_yy=2003, op2_t_mm=02, op2_t_dd=28, op2_t_h=23, op2_t_m=59, op2_t_s=50, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=0, res_ti_h=0, res_ti_m=00, res_ti_s=10, &
+ testname='SubtractTI_T_T4' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2004, op1_t_mm=03, op1_t_dd=01, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
+ op2_t_yy=2004, op2_t_mm=02, op2_t_dd=28, op2_t_h=23, op2_t_m=59, op2_t_s=50, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=1, res_ti_h=0, res_ti_m=00, res_ti_s=10, &
+ testname='SubtractTI_T_T5' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2002, op1_t_mm=02, op1_t_dd=28, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
+ op2_t_yy=2002, op2_t_mm=02, op2_t_dd=28, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=0, res_ti_h=0, res_ti_m=00, res_ti_s=00, &
+ testname='SubtractTI_T_T6' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2003, op1_t_mm=02, op1_t_dd=28, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
+ op2_t_yy=2002, op2_t_mm=02, op2_t_dd=28, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=365, res_ti_h=0, res_ti_m=00, res_ti_s=00, &
+ testname='SubtractTI_T_T7' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2004, op1_t_mm=02, op1_t_dd=28, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
+ op2_t_yy=2003, op2_t_mm=02, op2_t_dd=28, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=365, res_ti_h=0, res_ti_m=00, res_ti_s=00, &
+ testname='SubtractTI_T_T8' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2005, op1_t_mm=02, op1_t_dd=28, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
+ op2_t_yy=2004, op2_t_mm=02, op2_t_dd=28, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=366, res_ti_h=0, res_ti_m=00, res_ti_s=00, &
+ testname='SubtractTI_T_T9' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2003, op1_t_mm=03, op1_t_dd=01, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
+ op2_t_yy=2002, op2_t_mm=02, op2_t_dd=28, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=366, res_ti_h=0, res_ti_m=00, res_ti_s=00, &
+ testname='SubtractTI_T_T10' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2005, op1_t_mm=03, op1_t_dd=01, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
+ op2_t_yy=2004, op2_t_mm=02, op2_t_dd=28, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=367, res_ti_h=0, res_ti_m=00, res_ti_s=00, &
+ testname='SubtractTI_T_T11' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2005, op1_t_mm=03, op1_t_dd=01, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
+ op2_t_yy=2004, op2_t_mm=02, op2_t_dd=28, op2_t_h=23, op2_t_m=59, op2_t_s=50, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=366, res_ti_h=0, res_ti_m=00, res_ti_s=10, &
+ testname='SubtractTI_T_T12' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=2004, op1_t_mm=02, op1_t_dd=28, op1_t_h=23, op1_t_m=59, op1_t_s=50, &
+ op2_t_yy=2005, op2_t_mm=03, op2_t_dd=01, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=-366, res_ti_h=0, res_ti_m=00, res_ti_s=-10, &
+ testname='SubtractTI_T_T13' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_t_yy=-2002, op1_t_mm=02, op1_t_dd=28, op1_t_h=00, op1_t_m=00, op1_t_s=00, &
+ op2_t_yy=-2002, op2_t_mm=02, op2_t_dd=28, op2_t_h=00, op2_t_m=00, op2_t_s=00, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=0, res_ti_h=0, res_ti_m=00, res_ti_s=00, &
+ testname='SubtractTI_T_T14' )
+ ! ESMF_TimeInterval = ESMF_TimeInterval - ESMF_TimeInterval
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=3, op1_ti_h=1, op1_ti_m=20, op1_ti_s=10, &
+ op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=1, op2_ti_h=1, op2_ti_m=10, op2_ti_s=10, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=2, res_ti_h=0, res_ti_m=10, res_ti_s=0, &
+ testname='SubtractTI_TI_TI1' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=3, op1_ti_h=1, op1_ti_m=20, op1_ti_s=10, &
+ op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=-1, op2_ti_h=-1, op2_ti_m=-10, op2_ti_s=-10, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=4, res_ti_h=2, res_ti_m=30, res_ti_s=20, &
+ testname='SubtractTI_TI_TI2' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=-1, op1_ti_h=-1, op1_ti_m=-10, op1_ti_s=-10, &
+ op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=-3, op2_ti_h=-1, op2_ti_m=-20, op2_ti_s=-10, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=2, res_ti_h=0, res_ti_m=10, res_ti_s=00, &
+ testname='SubtractTI_TI_TI3' )
+ ! Negative result ESMF_TimeInterval = ESMF_TimeInterval - ESMF_TimeInterval
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=1, op1_ti_h=1, op1_ti_m=10, op1_ti_s=10, &
+ op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=3, op2_ti_h=1, op2_ti_m=20, op2_ti_s=10, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=-2, res_ti_h=0, res_ti_m=-10, res_ti_s=0, &
+ testname='SubtractTI_TI_TIN1' )
+ CALL test_arithmetic( add_op=.FALSE., &
+ op1_ti_yy=0000, op1_ti_mm=00, op1_ti_dd=-1, op1_ti_h=-1, op1_ti_m=-10, op1_ti_s=-10, &
+ op2_ti_yy=0000, op2_ti_mm=00, op2_ti_dd=3, op2_ti_h=1, op2_ti_m=20, op2_ti_s=10, &
+ res_ti_yy=0000, res_ti_mm=00, res_ti_dd=-4, res_ti_h=-2, res_ti_m=-30, res_ti_s=-20, &
+ testname='SubtractTI_TI_TIN2' )
+
+ ! Un-normalized ESMF_TimeInterval = ESMF_TimeInterval - ESMF_TimeInterval
+ ! this is an error
+! CALL test_arithmetic( add_op=.FALSE., &
+! op1_ti_yy=2001, op1_ti_mm=11, op1_ti_dd=3, op1_ti_h=1, op1_ti_m=20, op1_ti_s=10, &
+! op2_ti_yy=2001, op2_ti_mm=11, op2_ti_dd=1, op2_ti_h=1, op2_ti_m=10, op2_ti_s=10, &
+! res_ti_yy=0000, res_ti_mm=00, res_ti_dd=2, res_ti_h=0, res_ti_m=10, res_ti_s=0, &
+! testname='SubtractTI_TI_TIU1', expect_error=.TRUE. )
+
+ ! this one should FAIL, and does
+! CALL test_arithmetic( add_op=.TRUE., &
+! op1_t_yy=2001, op1_t_mm=12, op1_t_dd=3, op1_t_h=1, op1_t_m=20, op1_t_s=10, &
+! op2_ti_yy= 0, op2_ti_mm= 0, op2_ti_dd=0, op2_ti_h=3, op2_ti_m=10, op2_ti_s=10, &
+! res_t_yy=2002, res_t_mm=12, res_t_dd=3, res_t_h=4, res_t_m=30, res_t_s=20, &
+! testname='AddTT1' )
+
+ ! Multiplication tests
+ ! ESMF_TimeInterval = ESMF_TimeInterval * INTEGER
+ CALL test_arithmetic( multiply_op=.TRUE., &
+ op1_ti_dd=3, op1_ti_h=12, op1_ti_m=18, op1_ti_s=33, &
+ op2_int=2, &
+ res_ti_dd=6, res_ti_h=24, res_ti_m=37, res_ti_s=06, &
+ testname='MultiplyTI_TI_INT1' )
+ CALL test_arithmetic( multiply_op=.TRUE., &
+ op1_ti_dd=350, op1_ti_h=23, op1_ti_m=50, op1_ti_s=50, &
+ op2_int=2, &
+ res_ti_dd=701, res_ti_h=23, res_ti_m=41, res_ti_s=40,&
+ testname='MultiplyTI_TI_INT2' )
+ CALL test_arithmetic( multiply_op=.TRUE., &
+ op1_ti_s=01, op1_ti_sn=03, op1_ti_sd=04, &
+ op2_int=8, &
+ res_ti_s=14, &
+ testname='MultiplyTI_TI_INT3' )
+
+ ! Division tests
+ ! ESMF_TimeInterval = ESMF_TimeInterval / INTEGER
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_dd=3, op1_ti_h=12, op1_ti_m=18, op1_ti_s=33, &
+ op2_int=3, &
+ res_ti_dd=1, res_ti_h=04, res_ti_m=06, res_ti_s=11, &
+ testname='DivideTI_TI_INT1' )
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_dd=3, op1_ti_h=12, op1_ti_m=18, op1_ti_s=33, &
+ op2_int=4, &
+ res_ti_dd=0, res_ti_h=21, res_ti_m=04, res_ti_s=38, &
+ res_ti_sn=1, res_ti_sd=4, &
+ testname='DivideTI_TI_INT2' )
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_s=01, op1_ti_sn=03, op1_ti_sd=04, &
+ op2_int=5, &
+ res_ti_s=0, res_ti_sn=7, res_ti_sd=20, &
+ testname='DivideTI_TI_INT3' )
+ ! INTEGER = ESMF_TimeInterval / ESMF_TimeInterval
+ ! this operator truncates to whole integers
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_dd=3, op1_ti_h=12, op1_ti_m=18, op1_ti_s=33, &
+ op2_ti_dd=3, op2_ti_h=12, op2_ti_m=18, op2_ti_s=33, &
+ res_int=1, &
+ testname='DivideINT_TI_TI1' )
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_dd=6, op1_ti_h=24, op1_ti_m=36, op1_ti_s=66, &
+ op2_ti_dd=3, op2_ti_h=12, op2_ti_m=18, op2_ti_s=33, &
+ res_int=2, &
+ testname='DivideINT_TI_TI2' )
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_dd=0, op1_ti_h=00, op1_ti_m=00, op1_ti_s=00, &
+ op2_ti_dd=3, op2_ti_h=12, op2_ti_m=18, op2_ti_s=33, &
+ res_int=0, &
+ testname='DivideINT_TI_TI3' )
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_dd=1, op1_ti_h=00, op1_ti_m=00, op1_ti_s=00, &
+ op2_ti_dd=0, op2_ti_h=01, op2_ti_m=00, op2_ti_s=00, &
+ res_int=24, &
+ testname='DivideINT_TI_TI4' )
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_dd=1, op1_ti_h=00, op1_ti_m=00, op1_ti_s=00, &
+ op2_ti_dd=0, op2_ti_h=00, op2_ti_m=01, op2_ti_s=00, &
+ res_int=1440, &
+ testname='DivideINT_TI_TI5' )
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_dd=1, op1_ti_h=00, op1_ti_m=00, op1_ti_s=00, &
+ op2_ti_dd=0, op2_ti_h=00, op2_ti_m=00, op2_ti_s=01, &
+ res_int=86400, &
+ testname='DivideINT_TI_TI6' )
+ ! rounding
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_dd=0, op1_ti_h=00, op1_ti_m=00, op1_ti_s=03, &
+ op2_ti_dd=0, op2_ti_h=00, op2_ti_m=00, op2_ti_s=02, &
+ res_int=1, &
+ testname='DivideINT_TI_TIR1' )
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_dd=1, op1_ti_h=00, op1_ti_m=00, op1_ti_s=02, &
+ op2_ti_dd=1, op2_ti_h=00, op2_ti_m=00, op2_ti_s=03, &
+ res_int=0, &
+ testname='DivideINT_TI_TIR2' )
+ ! fractional operands
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_m=00, op1_ti_s=00, op1_ti_sn=03, op1_ti_sd=04, &
+ op2_ti_m=00, op2_ti_s=00, op2_ti_sn=03, op2_ti_sd=04, &
+ res_int=1, &
+ testname='DivideINT_TI_TIF1' )
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_m=00, op1_ti_s=00, op1_ti_sn=06, op1_ti_sd=08, &
+ op2_ti_m=00, op2_ti_s=00, op2_ti_sn=03, op2_ti_sd=04, &
+ res_int=1, &
+ testname='DivideINT_TI_TIF2' )
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_m=00, op1_ti_s=00, op1_ti_sn=03, op1_ti_sd=04, &
+ op2_ti_m=00, op2_ti_s=00, op2_ti_sn=04, op2_ti_sd=03, &
+ res_int=0, &
+ testname='DivideINT_TI_TIF3' )
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_m=00, op1_ti_s=02, op1_ti_sn=03, op1_ti_sd=04, &
+ op2_ti_m=00, op2_ti_s=01, op2_ti_sn=01, op2_ti_sd=03, &
+ res_int=2, &
+ testname='DivideINT_TI_TIF4' )
+ ! negative operands
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_dd=-6, op1_ti_h=-24, op1_ti_m=-36, op1_ti_s=-66, &
+ op2_ti_dd=3, op2_ti_h=12, op2_ti_m=18, op2_ti_s=33, &
+ res_int=-2, &
+ testname='DivideINT_TI_TIN1' )
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_dd=6, op1_ti_h=24, op1_ti_m=36, op1_ti_s=66, &
+ op2_ti_dd=-3, op2_ti_h=-12, op2_ti_m=-18, op2_ti_s=-33, &
+ res_int=-2, &
+ testname='DivideINT_TI_TIN2' )
+ CALL test_arithmetic( multiply_op=.FALSE., &
+ op1_ti_dd=-6, op1_ti_h=-24, op1_ti_m=-36, op1_ti_s=-66, &
+ op2_ti_dd=-3, op2_ti_h=-12, op2_ti_m=-18, op2_ti_s=-33, &
+ res_int=2, &
+ testname='DivideINT_TI_TIN3' )
+
+!$$$here... modify these to add self-test PASS/FAIL output
+ CALL test_clock_advance( &
+ start_yy=2002, start_mm=12, start_dd=27, start_h=3, start_m=0, start_s=0, &
+ stop_yy=2002, stop_mm=12, stop_dd=28, stop_h=8, stop_m=0, stop_s=0, &
+ timestep_d=0, timestep_h=0, timestep_m=0, timestep_s=600, &
+ testname="SimpleClockAdvance" )
+
+ CALL test_clock_advance( &
+ start_yy=2003, start_mm=12, start_dd=29, start_h=9, start_m=0, start_s=0, &
+ stop_yy=2004, stop_mm=1, stop_dd=2, stop_h=9, stop_m=0, stop_s=0, &
+ timestep_d=0, timestep_h=0, timestep_m=0, timestep_s=3600, &
+ testname="StdYearClockAdvance", increment_S=10 )
+
+ CALL test_clock_advance( &
+ start_yy=2004, start_mm=12, start_dd=29, start_h=9, start_m=0, start_s=0, &
+ stop_yy=2005, stop_mm=1, stop_dd=2, stop_h=9, stop_m=0, stop_s=0, &
+ timestep_d=0, timestep_h=0, timestep_m=0, timestep_s=3600, &
+ testname="LeapYearClockAdvance", increment_S=10 )
+
+ ! NRCM domain 3 case: 120 seconds / 9
+ ! 18 timesteps through end of leap year
+ CALL test_clock_advance( &
+ start_yy=2004, start_mm=12, start_dd=31, start_h=23, start_m=58, start_s=0,&
+ stop_yy=2005, stop_mm=1, stop_dd=1, stop_h=0, stop_m=2, stop_s=0, &
+ timestep_d=0, timestep_h=0, timestep_m=0, timestep_s=13, &
+ timestep_sn=1, timestep_sd=3, &
+ testname="LeapYearFractionClockAdvance", &
+ increment_S=1, increment_Sn=1, increment_Sd=3 )
+
+ CALL ESMF_Finalize( rc=rc )
+ CALL test_check_error( ESMF_SUCCESS, rc, &
+ 'ESMF_Finalize() ', &
+ __FILE__ , &
+ __LINE__ )
+
+ PRINT *,'END TEST SUITE'
+
+END PROGRAM time_manager_test
+
Deleted: branches/atmos_physics/src/external/esmf_time_f90/Test1.out.correct
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/Test1.out.correct        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/Test1.out.correct        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,1275 +0,0 @@
- BEGIN TEST SUITE
-PASS: printT_1
-PASS: printT_2
-PASS: printT_3
-PASS: printT_4
-PASS: printT_5
-PASS: printT_6
-PASS: printT_D1
-PASS: printT_D2
-PASS: printT_F1
-PASS: printT_F2
-PASS: printT_F3
-PASS: printT_F4
-PASS: printTI_1
-PASS: printTI_2
-PASS: printTI_D1
-PASS: printTI_D2
-PASS: printTI_N1
-PASS: printTI_M1
-PASS: printTI_F1
-PASS: printTI_F2
-PASS: printTI_F3
-PASS: printTI_F4
-PASS: AddT_T_TI1
-PASS: AddT_T_TI2
-PASS: AddT_T_TI3
-PASS: AddT_T_TI4
-PASS: AddT_T_TI5
-PASS: AddT_T_TI7
-PASS: AddT_T_TI8
-PASS: AddT_T_TI9
-PASS: AddT_T_TI10
-PASS: AddT_T_TI11
-PASS: AddT_T_TI12
-PASS: AddT_T_TI13
-PASS: AddT_T_TI14
-PASS: AddT_T_TI15
-PASS: AddT_T_TI_F1
-PASS: AddT_TI_T1
-PASS: AddT_TI_T2
-PASS: AddTI_TI_TI1
-PASS: AddTI_TI_TI2
-PASS: AddTI_TI_TI3
-PASS: SubtractT_T_TI1
-PASS: SubtractT_T_TI2
-PASS: SubtractT_T_TI3
-PASS: SubtractT_T_TI4
-PASS: SubtractT_T_TI5
-PASS: SubtractT_T_TI6
-PASS: SubtractT_T_TI_F1
-PASS: SubtractTI_T_T1
-PASS: SubtractTI_T_T2
-PASS: SubtractTI_T_T3
-PASS: SubtractTI_T_T4
-PASS: SubtractTI_T_T5
-PASS: SubtractTI_T_T6
-PASS: SubtractTI_T_T7
-PASS: SubtractTI_T_T8
-PASS: SubtractTI_T_T9
-PASS: SubtractTI_T_T10
-PASS: SubtractTI_T_T11
-PASS: SubtractTI_T_T12
-PASS: SubtractTI_T_T13
-PASS: SubtractTI_T_T14
-PASS: SubtractTI_TI_TI1
-PASS: SubtractTI_TI_TI2
-PASS: SubtractTI_TI_TI3
-PASS: SubtractTI_TI_TIN1
-PASS: SubtractTI_TI_TIN2
-PASS: MultiplyTI_TI_INT1
-PASS: MultiplyTI_TI_INT2
-PASS: MultiplyTI_TI_INT3
-PASS: DivideTI_TI_INT1
-PASS: DivideTI_TI_INT2
-PASS: DivideTI_TI_INT3
-PASS: DivideINT_TI_TI1
-PASS: DivideINT_TI_TI2
-PASS: DivideINT_TI_TI3
-PASS: DivideINT_TI_TI4
-PASS: DivideINT_TI_TI5
-PASS: DivideINT_TI_TI6
-PASS: DivideINT_TI_TIR1
-PASS: DivideINT_TI_TIR2
-PASS: DivideINT_TI_TIF1
-PASS: DivideINT_TI_TIF2
-PASS: DivideINT_TI_TIF3
-PASS: DivideINT_TI_TIF4
-PASS: DivideINT_TI_TIN1
-PASS: DivideINT_TI_TIN2
-PASS: DivideINT_TI_TIN3
-SimpleClockAdvance_SETUP: start_time = <2002-12-27_03:00:00>
-SimpleClockAdvance_SETUP: stop_time = <2002-12-28_08:00:00>
-SimpleClockAdvance_SETUP: timestep = <0000000000_000:010:000>
-SimpleClockAdvance_SETUP: increment = <0000000000_000:000:000>
-SimpleClockAdvance_SETUP: clock current_time = <2002-12-27_03:00:00>
-SimpleClockAdvance_SETUP: current_time dayOfYear_r8 = < 361.125000 >
-SimpleClockAdvance_SETUP: current_time-increment = <2002-12-27_03:00:00>
-SimpleClockAdvance_SETUP: current_time+increment = <2002-12-27_03:00:00>
-SimpleClockAdvance_ADVANCE: count = 000001 current_time = <2002-12-27_03:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_03:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_03:10:00>
-SimpleClockAdvance_ADVANCE: count = 000002 current_time = <2002-12-27_03:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_03:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_03:20:00>
-SimpleClockAdvance_ADVANCE: count = 000003 current_time = <2002-12-27_03:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_03:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_03:30:00>
-SimpleClockAdvance_ADVANCE: count = 000004 current_time = <2002-12-27_03:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_03:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_03:40:00>
-SimpleClockAdvance_ADVANCE: count = 000005 current_time = <2002-12-27_03:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_03:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_03:50:00>
-SimpleClockAdvance_ADVANCE: count = 000006 current_time = <2002-12-27_04:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_04:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_04:00:00>
-SimpleClockAdvance_ADVANCE: count = 000007 current_time = <2002-12-27_04:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_04:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_04:10:00>
-SimpleClockAdvance_ADVANCE: count = 000008 current_time = <2002-12-27_04:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_04:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_04:20:00>
-SimpleClockAdvance_ADVANCE: count = 000009 current_time = <2002-12-27_04:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_04:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_04:30:00>
-SimpleClockAdvance_ADVANCE: count = 000010 current_time = <2002-12-27_04:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_04:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_04:40:00>
-SimpleClockAdvance_ADVANCE: count = 000011 current_time = <2002-12-27_04:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_04:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_04:50:00>
-SimpleClockAdvance_ADVANCE: count = 000012 current_time = <2002-12-27_05:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_05:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_05:00:00>
-SimpleClockAdvance_ADVANCE: count = 000013 current_time = <2002-12-27_05:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_05:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_05:10:00>
-SimpleClockAdvance_ADVANCE: count = 000014 current_time = <2002-12-27_05:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_05:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_05:20:00>
-SimpleClockAdvance_ADVANCE: count = 000015 current_time = <2002-12-27_05:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_05:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_05:30:00>
-SimpleClockAdvance_ADVANCE: count = 000016 current_time = <2002-12-27_05:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_05:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_05:40:00>
-SimpleClockAdvance_ADVANCE: count = 000017 current_time = <2002-12-27_05:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_05:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_05:50:00>
-SimpleClockAdvance_ADVANCE: count = 000018 current_time = <2002-12-27_06:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_06:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_06:00:00>
-SimpleClockAdvance_ADVANCE: count = 000019 current_time = <2002-12-27_06:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_06:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_06:10:00>
-SimpleClockAdvance_ADVANCE: count = 000020 current_time = <2002-12-27_06:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_06:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_06:20:00>
-SimpleClockAdvance_ADVANCE: count = 000021 current_time = <2002-12-27_06:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_06:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_06:30:00>
-SimpleClockAdvance_ADVANCE: count = 000022 current_time = <2002-12-27_06:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_06:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_06:40:00>
-SimpleClockAdvance_ADVANCE: count = 000023 current_time = <2002-12-27_06:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_06:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_06:50:00>
-SimpleClockAdvance_ADVANCE: count = 000024 current_time = <2002-12-27_07:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_07:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_07:00:00>
-SimpleClockAdvance_ADVANCE: count = 000025 current_time = <2002-12-27_07:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_07:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_07:10:00>
-SimpleClockAdvance_ADVANCE: count = 000026 current_time = <2002-12-27_07:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_07:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_07:20:00>
-SimpleClockAdvance_ADVANCE: count = 000027 current_time = <2002-12-27_07:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_07:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_07:30:00>
-SimpleClockAdvance_ADVANCE: count = 000028 current_time = <2002-12-27_07:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_07:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_07:40:00>
-SimpleClockAdvance_ADVANCE: count = 000029 current_time = <2002-12-27_07:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_07:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_07:50:00>
-SimpleClockAdvance_ADVANCE: count = 000030 current_time = <2002-12-27_08:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_08:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_08:00:00>
-SimpleClockAdvance_ADVANCE: count = 000031 current_time = <2002-12-27_08:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_08:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_08:10:00>
-SimpleClockAdvance_ADVANCE: count = 000032 current_time = <2002-12-27_08:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_08:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_08:20:00>
-SimpleClockAdvance_ADVANCE: count = 000033 current_time = <2002-12-27_08:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_08:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_08:30:00>
-SimpleClockAdvance_ADVANCE: count = 000034 current_time = <2002-12-27_08:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_08:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_08:40:00>
-SimpleClockAdvance_ADVANCE: count = 000035 current_time = <2002-12-27_08:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_08:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_08:50:00>
-SimpleClockAdvance_ADVANCE: count = 000036 current_time = <2002-12-27_09:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_09:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_09:00:00>
-SimpleClockAdvance_ADVANCE: count = 000037 current_time = <2002-12-27_09:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_09:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_09:10:00>
-SimpleClockAdvance_ADVANCE: count = 000038 current_time = <2002-12-27_09:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_09:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_09:20:00>
-SimpleClockAdvance_ADVANCE: count = 000039 current_time = <2002-12-27_09:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_09:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_09:30:00>
-SimpleClockAdvance_ADVANCE: count = 000040 current_time = <2002-12-27_09:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_09:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_09:40:00>
-SimpleClockAdvance_ADVANCE: count = 000041 current_time = <2002-12-27_09:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_09:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_09:50:00>
-SimpleClockAdvance_ADVANCE: count = 000042 current_time = <2002-12-27_10:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_10:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_10:00:00>
-SimpleClockAdvance_ADVANCE: count = 000043 current_time = <2002-12-27_10:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_10:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_10:10:00>
-SimpleClockAdvance_ADVANCE: count = 000044 current_time = <2002-12-27_10:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_10:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_10:20:00>
-SimpleClockAdvance_ADVANCE: count = 000045 current_time = <2002-12-27_10:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_10:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_10:30:00>
-SimpleClockAdvance_ADVANCE: count = 000046 current_time = <2002-12-27_10:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_10:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_10:40:00>
-SimpleClockAdvance_ADVANCE: count = 000047 current_time = <2002-12-27_10:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_10:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_10:50:00>
-SimpleClockAdvance_ADVANCE: count = 000048 current_time = <2002-12-27_11:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_11:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_11:00:00>
-SimpleClockAdvance_ADVANCE: count = 000049 current_time = <2002-12-27_11:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_11:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_11:10:00>
-SimpleClockAdvance_ADVANCE: count = 000050 current_time = <2002-12-27_11:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_11:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_11:20:00>
-SimpleClockAdvance_ADVANCE: count = 000051 current_time = <2002-12-27_11:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_11:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_11:30:00>
-SimpleClockAdvance_ADVANCE: count = 000052 current_time = <2002-12-27_11:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_11:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_11:40:00>
-SimpleClockAdvance_ADVANCE: count = 000053 current_time = <2002-12-27_11:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_11:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_11:50:00>
-SimpleClockAdvance_ADVANCE: count = 000054 current_time = <2002-12-27_12:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_12:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_12:00:00>
-SimpleClockAdvance_ADVANCE: count = 000055 current_time = <2002-12-27_12:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_12:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_12:10:00>
-SimpleClockAdvance_ADVANCE: count = 000056 current_time = <2002-12-27_12:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_12:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_12:20:00>
-SimpleClockAdvance_ADVANCE: count = 000057 current_time = <2002-12-27_12:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_12:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_12:30:00>
-SimpleClockAdvance_ADVANCE: count = 000058 current_time = <2002-12-27_12:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_12:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_12:40:00>
-SimpleClockAdvance_ADVANCE: count = 000059 current_time = <2002-12-27_12:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_12:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_12:50:00>
-SimpleClockAdvance_ADVANCE: count = 000060 current_time = <2002-12-27_13:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_13:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_13:00:00>
-SimpleClockAdvance_ADVANCE: count = 000061 current_time = <2002-12-27_13:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_13:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_13:10:00>
-SimpleClockAdvance_ADVANCE: count = 000062 current_time = <2002-12-27_13:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_13:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_13:20:00>
-SimpleClockAdvance_ADVANCE: count = 000063 current_time = <2002-12-27_13:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_13:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_13:30:00>
-SimpleClockAdvance_ADVANCE: count = 000064 current_time = <2002-12-27_13:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_13:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_13:40:00>
-SimpleClockAdvance_ADVANCE: count = 000065 current_time = <2002-12-27_13:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_13:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_13:50:00>
-SimpleClockAdvance_ADVANCE: count = 000066 current_time = <2002-12-27_14:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_14:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_14:00:00>
-SimpleClockAdvance_ADVANCE: count = 000067 current_time = <2002-12-27_14:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_14:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_14:10:00>
-SimpleClockAdvance_ADVANCE: count = 000068 current_time = <2002-12-27_14:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_14:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_14:20:00>
-SimpleClockAdvance_ADVANCE: count = 000069 current_time = <2002-12-27_14:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_14:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_14:30:00>
-SimpleClockAdvance_ADVANCE: count = 000070 current_time = <2002-12-27_14:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_14:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_14:40:00>
-SimpleClockAdvance_ADVANCE: count = 000071 current_time = <2002-12-27_14:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_14:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_14:50:00>
-SimpleClockAdvance_ADVANCE: count = 000072 current_time = <2002-12-27_15:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_15:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_15:00:00>
-SimpleClockAdvance_ADVANCE: count = 000073 current_time = <2002-12-27_15:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_15:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_15:10:00>
-SimpleClockAdvance_ADVANCE: count = 000074 current_time = <2002-12-27_15:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_15:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_15:20:00>
-SimpleClockAdvance_ADVANCE: count = 000075 current_time = <2002-12-27_15:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_15:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_15:30:00>
-SimpleClockAdvance_ADVANCE: count = 000076 current_time = <2002-12-27_15:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_15:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_15:40:00>
-SimpleClockAdvance_ADVANCE: count = 000077 current_time = <2002-12-27_15:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_15:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_15:50:00>
-SimpleClockAdvance_ADVANCE: count = 000078 current_time = <2002-12-27_16:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_16:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_16:00:00>
-SimpleClockAdvance_ADVANCE: count = 000079 current_time = <2002-12-27_16:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_16:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_16:10:00>
-SimpleClockAdvance_ADVANCE: count = 000080 current_time = <2002-12-27_16:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_16:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_16:20:00>
-SimpleClockAdvance_ADVANCE: count = 000081 current_time = <2002-12-27_16:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_16:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_16:30:00>
-SimpleClockAdvance_ADVANCE: count = 000082 current_time = <2002-12-27_16:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_16:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_16:40:00>
-SimpleClockAdvance_ADVANCE: count = 000083 current_time = <2002-12-27_16:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_16:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_16:50:00>
-SimpleClockAdvance_ADVANCE: count = 000084 current_time = <2002-12-27_17:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_17:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_17:00:00>
-SimpleClockAdvance_ADVANCE: count = 000085 current_time = <2002-12-27_17:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_17:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_17:10:00>
-SimpleClockAdvance_ADVANCE: count = 000086 current_time = <2002-12-27_17:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_17:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_17:20:00>
-SimpleClockAdvance_ADVANCE: count = 000087 current_time = <2002-12-27_17:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_17:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_17:30:00>
-SimpleClockAdvance_ADVANCE: count = 000088 current_time = <2002-12-27_17:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_17:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_17:40:00>
-SimpleClockAdvance_ADVANCE: count = 000089 current_time = <2002-12-27_17:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_17:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_17:50:00>
-SimpleClockAdvance_ADVANCE: count = 000090 current_time = <2002-12-27_18:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_18:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_18:00:00>
-SimpleClockAdvance_ADVANCE: count = 000091 current_time = <2002-12-27_18:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_18:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_18:10:00>
-SimpleClockAdvance_ADVANCE: count = 000092 current_time = <2002-12-27_18:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_18:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_18:20:00>
-SimpleClockAdvance_ADVANCE: count = 000093 current_time = <2002-12-27_18:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_18:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_18:30:00>
-SimpleClockAdvance_ADVANCE: count = 000094 current_time = <2002-12-27_18:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_18:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_18:40:00>
-SimpleClockAdvance_ADVANCE: count = 000095 current_time = <2002-12-27_18:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_18:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_18:50:00>
-SimpleClockAdvance_ADVANCE: count = 000096 current_time = <2002-12-27_19:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_19:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_19:00:00>
-SimpleClockAdvance_ADVANCE: count = 000097 current_time = <2002-12-27_19:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_19:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_19:10:00>
-SimpleClockAdvance_ADVANCE: count = 000098 current_time = <2002-12-27_19:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_19:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_19:20:00>
-SimpleClockAdvance_ADVANCE: count = 000099 current_time = <2002-12-27_19:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_19:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_19:30:00>
-SimpleClockAdvance_ADVANCE: count = 000100 current_time = <2002-12-27_19:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_19:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_19:40:00>
-SimpleClockAdvance_ADVANCE: count = 000101 current_time = <2002-12-27_19:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_19:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_19:50:00>
-SimpleClockAdvance_ADVANCE: count = 000102 current_time = <2002-12-27_20:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_20:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_20:00:00>
-SimpleClockAdvance_ADVANCE: count = 000103 current_time = <2002-12-27_20:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_20:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_20:10:00>
-SimpleClockAdvance_ADVANCE: count = 000104 current_time = <2002-12-27_20:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_20:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_20:20:00>
-SimpleClockAdvance_ADVANCE: count = 000105 current_time = <2002-12-27_20:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_20:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_20:30:00>
-SimpleClockAdvance_ADVANCE: count = 000106 current_time = <2002-12-27_20:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_20:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_20:40:00>
-SimpleClockAdvance_ADVANCE: count = 000107 current_time = <2002-12-27_20:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_20:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_20:50:00>
-SimpleClockAdvance_ADVANCE: count = 000108 current_time = <2002-12-27_21:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_21:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_21:00:00>
-SimpleClockAdvance_ADVANCE: count = 000109 current_time = <2002-12-27_21:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_21:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_21:10:00>
-SimpleClockAdvance_ADVANCE: count = 000110 current_time = <2002-12-27_21:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_21:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_21:20:00>
-SimpleClockAdvance_ADVANCE: count = 000111 current_time = <2002-12-27_21:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_21:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_21:30:00>
-SimpleClockAdvance_ADVANCE: count = 000112 current_time = <2002-12-27_21:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_21:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_21:40:00>
-SimpleClockAdvance_ADVANCE: count = 000113 current_time = <2002-12-27_21:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_21:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_21:50:00>
-SimpleClockAdvance_ADVANCE: count = 000114 current_time = <2002-12-27_22:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_22:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_22:00:00>
-SimpleClockAdvance_ADVANCE: count = 000115 current_time = <2002-12-27_22:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_22:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_22:10:00>
-SimpleClockAdvance_ADVANCE: count = 000116 current_time = <2002-12-27_22:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_22:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_22:20:00>
-SimpleClockAdvance_ADVANCE: count = 000117 current_time = <2002-12-27_22:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_22:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_22:30:00>
-SimpleClockAdvance_ADVANCE: count = 000118 current_time = <2002-12-27_22:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_22:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_22:40:00>
-SimpleClockAdvance_ADVANCE: count = 000119 current_time = <2002-12-27_22:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_22:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_22:50:00>
-SimpleClockAdvance_ADVANCE: count = 000120 current_time = <2002-12-27_23:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_23:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_23:00:00>
-SimpleClockAdvance_ADVANCE: count = 000121 current_time = <2002-12-27_23:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_23:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_23:10:00>
-SimpleClockAdvance_ADVANCE: count = 000122 current_time = <2002-12-27_23:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_23:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_23:20:00>
-SimpleClockAdvance_ADVANCE: count = 000123 current_time = <2002-12-27_23:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_23:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_23:30:00>
-SimpleClockAdvance_ADVANCE: count = 000124 current_time = <2002-12-27_23:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_23:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_23:40:00>
-SimpleClockAdvance_ADVANCE: count = 000125 current_time = <2002-12-27_23:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_23:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_23:50:00>
-SimpleClockAdvance_ADVANCE: count = 000126 current_time = <2002-12-28_00:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_00:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_00:00:00>
-SimpleClockAdvance_ADVANCE: count = 000127 current_time = <2002-12-28_00:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_00:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_00:10:00>
-SimpleClockAdvance_ADVANCE: count = 000128 current_time = <2002-12-28_00:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_00:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_00:20:00>
-SimpleClockAdvance_ADVANCE: count = 000129 current_time = <2002-12-28_00:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_00:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_00:30:00>
-SimpleClockAdvance_ADVANCE: count = 000130 current_time = <2002-12-28_00:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_00:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_00:40:00>
-SimpleClockAdvance_ADVANCE: count = 000131 current_time = <2002-12-28_00:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_00:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_00:50:00>
-SimpleClockAdvance_ADVANCE: count = 000132 current_time = <2002-12-28_01:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_01:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_01:00:00>
-SimpleClockAdvance_ADVANCE: count = 000133 current_time = <2002-12-28_01:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_01:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_01:10:00>
-SimpleClockAdvance_ADVANCE: count = 000134 current_time = <2002-12-28_01:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_01:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_01:20:00>
-SimpleClockAdvance_ADVANCE: count = 000135 current_time = <2002-12-28_01:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_01:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_01:30:00>
-SimpleClockAdvance_ADVANCE: count = 000136 current_time = <2002-12-28_01:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_01:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_01:40:00>
-SimpleClockAdvance_ADVANCE: count = 000137 current_time = <2002-12-28_01:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_01:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_01:50:00>
-SimpleClockAdvance_ADVANCE: count = 000138 current_time = <2002-12-28_02:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_02:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_02:00:00>
-SimpleClockAdvance_ADVANCE: count = 000139 current_time = <2002-12-28_02:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_02:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_02:10:00>
-SimpleClockAdvance_ADVANCE: count = 000140 current_time = <2002-12-28_02:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_02:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_02:20:00>
-SimpleClockAdvance_ADVANCE: count = 000141 current_time = <2002-12-28_02:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_02:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_02:30:00>
-SimpleClockAdvance_ADVANCE: count = 000142 current_time = <2002-12-28_02:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_02:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_02:40:00>
-SimpleClockAdvance_ADVANCE: count = 000143 current_time = <2002-12-28_02:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_02:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_02:50:00>
-SimpleClockAdvance_ADVANCE: count = 000144 current_time = <2002-12-28_03:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_03:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_03:00:00>
-SimpleClockAdvance_ADVANCE: count = 000145 current_time = <2002-12-28_03:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_03:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_03:10:00>
-SimpleClockAdvance_ADVANCE: count = 000146 current_time = <2002-12-28_03:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_03:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_03:20:00>
-SimpleClockAdvance_ADVANCE: count = 000147 current_time = <2002-12-28_03:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_03:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_03:30:00>
-SimpleClockAdvance_ADVANCE: count = 000148 current_time = <2002-12-28_03:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_03:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_03:40:00>
-SimpleClockAdvance_ADVANCE: count = 000149 current_time = <2002-12-28_03:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_03:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_03:50:00>
-SimpleClockAdvance_ADVANCE: count = 000150 current_time = <2002-12-28_04:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_04:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_04:00:00>
-SimpleClockAdvance_ADVANCE: count = 000151 current_time = <2002-12-28_04:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_04:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_04:10:00>
-SimpleClockAdvance_ADVANCE: count = 000152 current_time = <2002-12-28_04:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_04:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_04:20:00>
-SimpleClockAdvance_ADVANCE: count = 000153 current_time = <2002-12-28_04:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_04:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_04:30:00>
-SimpleClockAdvance_ADVANCE: count = 000154 current_time = <2002-12-28_04:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_04:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_04:40:00>
-SimpleClockAdvance_ADVANCE: count = 000155 current_time = <2002-12-28_04:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_04:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_04:50:00>
-SimpleClockAdvance_ADVANCE: count = 000156 current_time = <2002-12-28_05:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_05:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_05:00:00>
-SimpleClockAdvance_ADVANCE: count = 000157 current_time = <2002-12-28_05:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_05:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_05:10:00>
-SimpleClockAdvance_ADVANCE: count = 000158 current_time = <2002-12-28_05:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_05:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_05:20:00>
-SimpleClockAdvance_ADVANCE: count = 000159 current_time = <2002-12-28_05:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_05:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_05:30:00>
-SimpleClockAdvance_ADVANCE: count = 000160 current_time = <2002-12-28_05:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_05:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_05:40:00>
-SimpleClockAdvance_ADVANCE: count = 000161 current_time = <2002-12-28_05:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_05:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_05:50:00>
-SimpleClockAdvance_ADVANCE: count = 000162 current_time = <2002-12-28_06:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_06:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_06:00:00>
-SimpleClockAdvance_ADVANCE: count = 000163 current_time = <2002-12-28_06:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_06:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_06:10:00>
-SimpleClockAdvance_ADVANCE: count = 000164 current_time = <2002-12-28_06:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_06:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_06:20:00>
-SimpleClockAdvance_ADVANCE: count = 000165 current_time = <2002-12-28_06:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_06:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_06:30:00>
-SimpleClockAdvance_ADVANCE: count = 000166 current_time = <2002-12-28_06:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_06:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_06:40:00>
-SimpleClockAdvance_ADVANCE: count = 000167 current_time = <2002-12-28_06:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_06:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_06:50:00>
-SimpleClockAdvance_ADVANCE: count = 000168 current_time = <2002-12-28_07:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_07:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_07:00:00>
-SimpleClockAdvance_ADVANCE: count = 000169 current_time = <2002-12-28_07:10:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_07:10:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_07:10:00>
-SimpleClockAdvance_ADVANCE: count = 000170 current_time = <2002-12-28_07:20:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_07:20:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_07:20:00>
-SimpleClockAdvance_ADVANCE: count = 000171 current_time = <2002-12-28_07:30:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_07:30:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_07:30:00>
-SimpleClockAdvance_ADVANCE: count = 000172 current_time = <2002-12-28_07:40:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_07:40:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_07:40:00>
-SimpleClockAdvance_ADVANCE: count = 000173 current_time = <2002-12-28_07:50:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_07:50:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_07:50:00>
-SimpleClockAdvance_ADVANCE: count = 000174 current_time = <2002-12-28_08:00:00>
-SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_08:00:00>
-SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_08:00:00>
-StdYearClockAdvance_SETUP: start_time = <2003-12-29_09:00:00>
-StdYearClockAdvance_SETUP: stop_time = <2004-01-02_09:00:00>
-StdYearClockAdvance_SETUP: timestep = <0000000000_001:000:000>
-StdYearClockAdvance_SETUP: increment = <0000000000_000:000:010>
-StdYearClockAdvance_SETUP: clock current_time = <2003-12-29_09:00:00>
-StdYearClockAdvance_SETUP: current_time dayOfYear_r8 = < 363.375000 >
-StdYearClockAdvance_SETUP: current_time-increment = <2003-12-29_08:59:50>
-StdYearClockAdvance_SETUP: current_time+increment = <2003-12-29_09:00:10>
-StdYearClockAdvance_ADVANCE: count = 000001 current_time = <2003-12-29_10:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_09:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_10:00:10>
-StdYearClockAdvance_ADVANCE: count = 000002 current_time = <2003-12-29_11:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_10:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_11:00:10>
-StdYearClockAdvance_ADVANCE: count = 000003 current_time = <2003-12-29_12:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_11:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_12:00:10>
-StdYearClockAdvance_ADVANCE: count = 000004 current_time = <2003-12-29_13:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_12:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_13:00:10>
-StdYearClockAdvance_ADVANCE: count = 000005 current_time = <2003-12-29_14:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_13:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_14:00:10>
-StdYearClockAdvance_ADVANCE: count = 000006 current_time = <2003-12-29_15:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_14:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_15:00:10>
-StdYearClockAdvance_ADVANCE: count = 000007 current_time = <2003-12-29_16:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_15:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_16:00:10>
-StdYearClockAdvance_ADVANCE: count = 000008 current_time = <2003-12-29_17:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_16:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_17:00:10>
-StdYearClockAdvance_ADVANCE: count = 000009 current_time = <2003-12-29_18:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_17:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_18:00:10>
-StdYearClockAdvance_ADVANCE: count = 000010 current_time = <2003-12-29_19:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_18:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_19:00:10>
-StdYearClockAdvance_ADVANCE: count = 000011 current_time = <2003-12-29_20:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_19:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_20:00:10>
-StdYearClockAdvance_ADVANCE: count = 000012 current_time = <2003-12-29_21:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_20:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_21:00:10>
-StdYearClockAdvance_ADVANCE: count = 000013 current_time = <2003-12-29_22:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_21:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_22:00:10>
-StdYearClockAdvance_ADVANCE: count = 000014 current_time = <2003-12-29_23:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_22:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_23:00:10>
-StdYearClockAdvance_ADVANCE: count = 000015 current_time = <2003-12-30_00:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_23:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_00:00:10>
-StdYearClockAdvance_ADVANCE: count = 000016 current_time = <2003-12-30_01:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_00:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_01:00:10>
-StdYearClockAdvance_ADVANCE: count = 000017 current_time = <2003-12-30_02:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_01:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_02:00:10>
-StdYearClockAdvance_ADVANCE: count = 000018 current_time = <2003-12-30_03:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_02:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_03:00:10>
-StdYearClockAdvance_ADVANCE: count = 000019 current_time = <2003-12-30_04:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_03:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_04:00:10>
-StdYearClockAdvance_ADVANCE: count = 000020 current_time = <2003-12-30_05:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_04:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_05:00:10>
-StdYearClockAdvance_ADVANCE: count = 000021 current_time = <2003-12-30_06:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_05:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_06:00:10>
-StdYearClockAdvance_ADVANCE: count = 000022 current_time = <2003-12-30_07:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_06:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_07:00:10>
-StdYearClockAdvance_ADVANCE: count = 000023 current_time = <2003-12-30_08:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_07:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_08:00:10>
-StdYearClockAdvance_ADVANCE: count = 000024 current_time = <2003-12-30_09:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_08:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_09:00:10>
-StdYearClockAdvance_ADVANCE: count = 000025 current_time = <2003-12-30_10:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_09:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_10:00:10>
-StdYearClockAdvance_ADVANCE: count = 000026 current_time = <2003-12-30_11:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_10:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_11:00:10>
-StdYearClockAdvance_ADVANCE: count = 000027 current_time = <2003-12-30_12:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_11:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_12:00:10>
-StdYearClockAdvance_ADVANCE: count = 000028 current_time = <2003-12-30_13:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_12:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_13:00:10>
-StdYearClockAdvance_ADVANCE: count = 000029 current_time = <2003-12-30_14:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_13:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_14:00:10>
-StdYearClockAdvance_ADVANCE: count = 000030 current_time = <2003-12-30_15:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_14:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_15:00:10>
-StdYearClockAdvance_ADVANCE: count = 000031 current_time = <2003-12-30_16:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_15:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_16:00:10>
-StdYearClockAdvance_ADVANCE: count = 000032 current_time = <2003-12-30_17:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_16:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_17:00:10>
-StdYearClockAdvance_ADVANCE: count = 000033 current_time = <2003-12-30_18:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_17:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_18:00:10>
-StdYearClockAdvance_ADVANCE: count = 000034 current_time = <2003-12-30_19:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_18:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_19:00:10>
-StdYearClockAdvance_ADVANCE: count = 000035 current_time = <2003-12-30_20:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_19:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_20:00:10>
-StdYearClockAdvance_ADVANCE: count = 000036 current_time = <2003-12-30_21:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_20:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_21:00:10>
-StdYearClockAdvance_ADVANCE: count = 000037 current_time = <2003-12-30_22:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_21:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_22:00:10>
-StdYearClockAdvance_ADVANCE: count = 000038 current_time = <2003-12-30_23:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_22:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_23:00:10>
-StdYearClockAdvance_ADVANCE: count = 000039 current_time = <2003-12-31_00:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_23:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_00:00:10>
-StdYearClockAdvance_ADVANCE: count = 000040 current_time = <2003-12-31_01:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_00:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_01:00:10>
-StdYearClockAdvance_ADVANCE: count = 000041 current_time = <2003-12-31_02:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_01:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_02:00:10>
-StdYearClockAdvance_ADVANCE: count = 000042 current_time = <2003-12-31_03:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_02:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_03:00:10>
-StdYearClockAdvance_ADVANCE: count = 000043 current_time = <2003-12-31_04:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_03:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_04:00:10>
-StdYearClockAdvance_ADVANCE: count = 000044 current_time = <2003-12-31_05:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_04:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_05:00:10>
-StdYearClockAdvance_ADVANCE: count = 000045 current_time = <2003-12-31_06:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_05:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_06:00:10>
-StdYearClockAdvance_ADVANCE: count = 000046 current_time = <2003-12-31_07:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_06:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_07:00:10>
-StdYearClockAdvance_ADVANCE: count = 000047 current_time = <2003-12-31_08:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_07:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_08:00:10>
-StdYearClockAdvance_ADVANCE: count = 000048 current_time = <2003-12-31_09:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_08:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_09:00:10>
-StdYearClockAdvance_ADVANCE: count = 000049 current_time = <2003-12-31_10:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_09:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_10:00:10>
-StdYearClockAdvance_ADVANCE: count = 000050 current_time = <2003-12-31_11:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_10:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_11:00:10>
-StdYearClockAdvance_ADVANCE: count = 000051 current_time = <2003-12-31_12:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_11:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_12:00:10>
-StdYearClockAdvance_ADVANCE: count = 000052 current_time = <2003-12-31_13:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_12:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_13:00:10>
-StdYearClockAdvance_ADVANCE: count = 000053 current_time = <2003-12-31_14:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_13:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_14:00:10>
-StdYearClockAdvance_ADVANCE: count = 000054 current_time = <2003-12-31_15:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_14:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_15:00:10>
-StdYearClockAdvance_ADVANCE: count = 000055 current_time = <2003-12-31_16:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_15:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_16:00:10>
-StdYearClockAdvance_ADVANCE: count = 000056 current_time = <2003-12-31_17:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_16:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_17:00:10>
-StdYearClockAdvance_ADVANCE: count = 000057 current_time = <2003-12-31_18:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_17:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_18:00:10>
-StdYearClockAdvance_ADVANCE: count = 000058 current_time = <2003-12-31_19:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_18:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_19:00:10>
-StdYearClockAdvance_ADVANCE: count = 000059 current_time = <2003-12-31_20:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_19:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_20:00:10>
-StdYearClockAdvance_ADVANCE: count = 000060 current_time = <2003-12-31_21:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_20:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_21:00:10>
-StdYearClockAdvance_ADVANCE: count = 000061 current_time = <2003-12-31_22:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_21:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_22:00:10>
-StdYearClockAdvance_ADVANCE: count = 000062 current_time = <2003-12-31_23:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_22:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_23:00:10>
-StdYearClockAdvance_ADVANCE: count = 000063 current_time = <2004-01-01_00:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_23:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_00:00:10>
-StdYearClockAdvance_ADVANCE: count = 000064 current_time = <2004-01-01_01:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_00:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_01:00:10>
-StdYearClockAdvance_ADVANCE: count = 000065 current_time = <2004-01-01_02:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_01:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_02:00:10>
-StdYearClockAdvance_ADVANCE: count = 000066 current_time = <2004-01-01_03:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_02:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_03:00:10>
-StdYearClockAdvance_ADVANCE: count = 000067 current_time = <2004-01-01_04:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_03:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_04:00:10>
-StdYearClockAdvance_ADVANCE: count = 000068 current_time = <2004-01-01_05:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_04:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_05:00:10>
-StdYearClockAdvance_ADVANCE: count = 000069 current_time = <2004-01-01_06:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_05:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_06:00:10>
-StdYearClockAdvance_ADVANCE: count = 000070 current_time = <2004-01-01_07:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_06:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_07:00:10>
-StdYearClockAdvance_ADVANCE: count = 000071 current_time = <2004-01-01_08:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_07:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_08:00:10>
-StdYearClockAdvance_ADVANCE: count = 000072 current_time = <2004-01-01_09:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_08:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_09:00:10>
-StdYearClockAdvance_ADVANCE: count = 000073 current_time = <2004-01-01_10:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_09:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_10:00:10>
-StdYearClockAdvance_ADVANCE: count = 000074 current_time = <2004-01-01_11:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_10:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_11:00:10>
-StdYearClockAdvance_ADVANCE: count = 000075 current_time = <2004-01-01_12:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_11:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_12:00:10>
-StdYearClockAdvance_ADVANCE: count = 000076 current_time = <2004-01-01_13:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_12:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_13:00:10>
-StdYearClockAdvance_ADVANCE: count = 000077 current_time = <2004-01-01_14:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_13:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_14:00:10>
-StdYearClockAdvance_ADVANCE: count = 000078 current_time = <2004-01-01_15:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_14:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_15:00:10>
-StdYearClockAdvance_ADVANCE: count = 000079 current_time = <2004-01-01_16:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_15:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_16:00:10>
-StdYearClockAdvance_ADVANCE: count = 000080 current_time = <2004-01-01_17:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_16:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_17:00:10>
-StdYearClockAdvance_ADVANCE: count = 000081 current_time = <2004-01-01_18:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_17:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_18:00:10>
-StdYearClockAdvance_ADVANCE: count = 000082 current_time = <2004-01-01_19:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_18:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_19:00:10>
-StdYearClockAdvance_ADVANCE: count = 000083 current_time = <2004-01-01_20:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_19:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_20:00:10>
-StdYearClockAdvance_ADVANCE: count = 000084 current_time = <2004-01-01_21:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_20:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_21:00:10>
-StdYearClockAdvance_ADVANCE: count = 000085 current_time = <2004-01-01_22:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_21:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_22:00:10>
-StdYearClockAdvance_ADVANCE: count = 000086 current_time = <2004-01-01_23:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_22:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_23:00:10>
-StdYearClockAdvance_ADVANCE: count = 000087 current_time = <2004-01-02_00:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_23:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_00:00:10>
-StdYearClockAdvance_ADVANCE: count = 000088 current_time = <2004-01-02_01:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_00:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_01:00:10>
-StdYearClockAdvance_ADVANCE: count = 000089 current_time = <2004-01-02_02:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_01:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_02:00:10>
-StdYearClockAdvance_ADVANCE: count = 000090 current_time = <2004-01-02_03:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_02:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_03:00:10>
-StdYearClockAdvance_ADVANCE: count = 000091 current_time = <2004-01-02_04:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_03:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_04:00:10>
-StdYearClockAdvance_ADVANCE: count = 000092 current_time = <2004-01-02_05:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_04:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_05:00:10>
-StdYearClockAdvance_ADVANCE: count = 000093 current_time = <2004-01-02_06:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_05:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_06:00:10>
-StdYearClockAdvance_ADVANCE: count = 000094 current_time = <2004-01-02_07:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_06:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_07:00:10>
-StdYearClockAdvance_ADVANCE: count = 000095 current_time = <2004-01-02_08:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_07:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_08:00:10>
-StdYearClockAdvance_ADVANCE: count = 000096 current_time = <2004-01-02_09:00:00>
-StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_08:59:50>
-StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_09:00:10>
-LeapYearClockAdvance_SETUP: start_time = <2004-12-29_09:00:00>
-LeapYearClockAdvance_SETUP: stop_time = <2005-01-02_09:00:00>
-LeapYearClockAdvance_SETUP: timestep = <0000000000_001:000:000>
-LeapYearClockAdvance_SETUP: increment = <0000000000_000:000:010>
-LeapYearClockAdvance_SETUP: clock current_time = <2004-12-29_09:00:00>
-LeapYearClockAdvance_SETUP: current_time dayOfYear_r8 = < 364.375000 >
-LeapYearClockAdvance_SETUP: current_time-increment = <2004-12-29_08:59:50>
-LeapYearClockAdvance_SETUP: current_time+increment = <2004-12-29_09:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000001 current_time = <2004-12-29_10:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_09:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_10:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000002 current_time = <2004-12-29_11:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_10:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_11:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000003 current_time = <2004-12-29_12:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_11:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_12:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000004 current_time = <2004-12-29_13:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_12:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_13:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000005 current_time = <2004-12-29_14:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_13:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_14:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000006 current_time = <2004-12-29_15:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_14:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_15:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000007 current_time = <2004-12-29_16:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_15:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_16:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000008 current_time = <2004-12-29_17:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_16:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_17:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000009 current_time = <2004-12-29_18:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_17:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_18:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000010 current_time = <2004-12-29_19:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_18:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_19:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000011 current_time = <2004-12-29_20:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_19:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_20:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000012 current_time = <2004-12-29_21:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_20:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_21:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000013 current_time = <2004-12-29_22:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_21:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_22:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000014 current_time = <2004-12-29_23:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_22:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_23:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000015 current_time = <2004-12-30_00:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_23:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_00:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000016 current_time = <2004-12-30_01:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_00:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_01:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000017 current_time = <2004-12-30_02:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_01:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_02:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000018 current_time = <2004-12-30_03:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_02:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_03:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000019 current_time = <2004-12-30_04:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_03:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_04:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000020 current_time = <2004-12-30_05:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_04:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_05:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000021 current_time = <2004-12-30_06:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_05:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_06:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000022 current_time = <2004-12-30_07:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_06:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_07:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000023 current_time = <2004-12-30_08:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_07:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_08:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000024 current_time = <2004-12-30_09:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_08:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_09:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000025 current_time = <2004-12-30_10:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_09:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_10:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000026 current_time = <2004-12-30_11:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_10:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_11:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000027 current_time = <2004-12-30_12:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_11:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_12:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000028 current_time = <2004-12-30_13:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_12:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_13:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000029 current_time = <2004-12-30_14:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_13:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_14:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000030 current_time = <2004-12-30_15:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_14:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_15:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000031 current_time = <2004-12-30_16:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_15:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_16:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000032 current_time = <2004-12-30_17:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_16:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_17:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000033 current_time = <2004-12-30_18:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_17:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_18:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000034 current_time = <2004-12-30_19:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_18:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_19:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000035 current_time = <2004-12-30_20:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_19:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_20:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000036 current_time = <2004-12-30_21:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_20:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_21:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000037 current_time = <2004-12-30_22:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_21:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_22:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000038 current_time = <2004-12-30_23:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_22:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_23:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000039 current_time = <2004-12-31_00:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_23:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_00:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000040 current_time = <2004-12-31_01:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_00:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_01:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000041 current_time = <2004-12-31_02:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_01:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_02:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000042 current_time = <2004-12-31_03:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_02:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_03:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000043 current_time = <2004-12-31_04:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_03:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_04:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000044 current_time = <2004-12-31_05:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_04:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_05:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000045 current_time = <2004-12-31_06:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_05:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_06:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000046 current_time = <2004-12-31_07:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_06:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_07:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000047 current_time = <2004-12-31_08:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_07:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_08:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000048 current_time = <2004-12-31_09:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_08:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_09:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000049 current_time = <2004-12-31_10:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_09:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_10:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000050 current_time = <2004-12-31_11:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_10:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_11:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000051 current_time = <2004-12-31_12:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_11:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_12:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000052 current_time = <2004-12-31_13:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_12:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_13:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000053 current_time = <2004-12-31_14:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_13:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_14:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000054 current_time = <2004-12-31_15:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_14:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_15:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000055 current_time = <2004-12-31_16:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_15:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_16:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000056 current_time = <2004-12-31_17:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_16:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_17:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000057 current_time = <2004-12-31_18:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_17:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_18:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000058 current_time = <2004-12-31_19:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_18:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_19:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000059 current_time = <2004-12-31_20:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_19:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_20:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000060 current_time = <2004-12-31_21:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_20:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_21:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000061 current_time = <2004-12-31_22:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_21:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_22:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000062 current_time = <2004-12-31_23:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_22:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000063 current_time = <2005-01-01_00:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000064 current_time = <2005-01-01_01:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_01:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000065 current_time = <2005-01-01_02:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_01:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_02:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000066 current_time = <2005-01-01_03:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_02:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_03:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000067 current_time = <2005-01-01_04:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_03:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_04:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000068 current_time = <2005-01-01_05:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_04:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_05:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000069 current_time = <2005-01-01_06:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_05:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_06:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000070 current_time = <2005-01-01_07:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_06:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_07:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000071 current_time = <2005-01-01_08:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_07:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_08:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000072 current_time = <2005-01-01_09:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_08:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_09:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000073 current_time = <2005-01-01_10:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_09:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_10:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000074 current_time = <2005-01-01_11:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_10:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_11:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000075 current_time = <2005-01-01_12:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_11:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_12:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000076 current_time = <2005-01-01_13:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_12:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_13:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000077 current_time = <2005-01-01_14:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_13:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_14:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000078 current_time = <2005-01-01_15:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_14:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_15:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000079 current_time = <2005-01-01_16:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_15:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_16:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000080 current_time = <2005-01-01_17:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_16:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_17:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000081 current_time = <2005-01-01_18:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_17:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_18:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000082 current_time = <2005-01-01_19:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_18:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_19:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000083 current_time = <2005-01-01_20:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_19:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_20:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000084 current_time = <2005-01-01_21:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_20:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_21:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000085 current_time = <2005-01-01_22:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_21:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_22:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000086 current_time = <2005-01-01_23:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_22:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_23:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000087 current_time = <2005-01-02_00:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_23:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_00:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000088 current_time = <2005-01-02_01:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_00:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_01:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000089 current_time = <2005-01-02_02:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_01:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_02:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000090 current_time = <2005-01-02_03:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_02:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_03:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000091 current_time = <2005-01-02_04:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_03:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_04:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000092 current_time = <2005-01-02_05:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_04:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_05:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000093 current_time = <2005-01-02_06:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_05:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_06:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000094 current_time = <2005-01-02_07:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_06:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_07:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000095 current_time = <2005-01-02_08:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_07:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_08:00:10>
-LeapYearClockAdvance_ADVANCE: count = 000096 current_time = <2005-01-02_09:00:00>
-LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_08:59:50>
-LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_09:00:10>
-LeapYearFractionClockAdvance_SETUP: start_time = <2004-12-31_23:58:00>
-LeapYearFractionClockAdvance_SETUP: stop_time = <2005-01-01_00:02:00>
-LeapYearFractionClockAdvance_SETUP: timestep = <0000000000_000:000:013+01/03>
-LeapYearFractionClockAdvance_SETUP: increment = <0000000000_000:000:001+01/03>
-LeapYearFractionClockAdvance_SETUP: clock current_time = <2004-12-31_23:58:00>
-LeapYearFractionClockAdvance_SETUP: current_time dayOfYear_r8 = < 366.998611 >
-LeapYearFractionClockAdvance_SETUP: current_time-increment = <2004-12-31_23:57:58+02/03>
-LeapYearFractionClockAdvance_SETUP: current_time+increment = <2004-12-31_23:58:01+01/03>
-LeapYearFractionClockAdvance_ADVANCE: count = 000001 current_time = <2004-12-31_23:58:13+01/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:58:12>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:58:14+02/03>
-LeapYearFractionClockAdvance_ADVANCE: count = 000002 current_time = <2004-12-31_23:58:26+02/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:58:25+01/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:58:28>
-LeapYearFractionClockAdvance_ADVANCE: count = 000003 current_time = <2004-12-31_23:58:40>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:58:38+02/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:58:41+01/03>
-LeapYearFractionClockAdvance_ADVANCE: count = 000004 current_time = <2004-12-31_23:58:53+01/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:58:52>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:58:54+02/03>
-LeapYearFractionClockAdvance_ADVANCE: count = 000005 current_time = <2004-12-31_23:59:06+02/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:59:05+01/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:59:08>
-LeapYearFractionClockAdvance_ADVANCE: count = 000006 current_time = <2004-12-31_23:59:20>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:59:18+02/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:59:21+01/03>
-LeapYearFractionClockAdvance_ADVANCE: count = 000007 current_time = <2004-12-31_23:59:33+01/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:59:32>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:59:34+02/03>
-LeapYearFractionClockAdvance_ADVANCE: count = 000008 current_time = <2004-12-31_23:59:46+02/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:59:45+01/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:59:48>
-LeapYearFractionClockAdvance_ADVANCE: count = 000009 current_time = <2005-01-01_00:00:00>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:59:58+02/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:00:01+01/03>
-LeapYearFractionClockAdvance_ADVANCE: count = 000010 current_time = <2005-01-01_00:00:13+01/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:00:12>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:00:14+02/03>
-LeapYearFractionClockAdvance_ADVANCE: count = 000011 current_time = <2005-01-01_00:00:26+02/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:00:25+01/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:00:28>
-LeapYearFractionClockAdvance_ADVANCE: count = 000012 current_time = <2005-01-01_00:00:40>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:00:38+02/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:00:41+01/03>
-LeapYearFractionClockAdvance_ADVANCE: count = 000013 current_time = <2005-01-01_00:00:53+01/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:00:52>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:00:54+02/03>
-LeapYearFractionClockAdvance_ADVANCE: count = 000014 current_time = <2005-01-01_00:01:06+02/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:01:05+01/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:01:08>
-LeapYearFractionClockAdvance_ADVANCE: count = 000015 current_time = <2005-01-01_00:01:20>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:01:18+02/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:01:21+01/03>
-LeapYearFractionClockAdvance_ADVANCE: count = 000016 current_time = <2005-01-01_00:01:33+01/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:01:32>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:01:34+02/03>
-LeapYearFractionClockAdvance_ADVANCE: count = 000017 current_time = <2005-01-01_00:01:46+02/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:01:45+01/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:01:48>
-LeapYearFractionClockAdvance_ADVANCE: count = 000018 current_time = <2005-01-01_00:02:00>
-LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:01:58+02/03>
-LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:02:01+01/03>
- END TEST SUITE
Copied: branches/atmos_physics/src/external/esmf_time_f90/Test1.out.correct (from rev 968, trunk/mpas/src/external/esmf_time_f90/Test1.out.correct)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/Test1.out.correct         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/Test1.out.correct        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,1275 @@
+ BEGIN TEST SUITE
+PASS: printT_1
+PASS: printT_2
+PASS: printT_3
+PASS: printT_4
+PASS: printT_5
+PASS: printT_6
+PASS: printT_D1
+PASS: printT_D2
+PASS: printT_F1
+PASS: printT_F2
+PASS: printT_F3
+PASS: printT_F4
+PASS: printTI_1
+PASS: printTI_2
+PASS: printTI_D1
+PASS: printTI_D2
+PASS: printTI_N1
+PASS: printTI_M1
+PASS: printTI_F1
+PASS: printTI_F2
+PASS: printTI_F3
+PASS: printTI_F4
+PASS: AddT_T_TI1
+PASS: AddT_T_TI2
+PASS: AddT_T_TI3
+PASS: AddT_T_TI4
+PASS: AddT_T_TI5
+PASS: AddT_T_TI7
+PASS: AddT_T_TI8
+PASS: AddT_T_TI9
+PASS: AddT_T_TI10
+PASS: AddT_T_TI11
+PASS: AddT_T_TI12
+PASS: AddT_T_TI13
+PASS: AddT_T_TI14
+PASS: AddT_T_TI15
+PASS: AddT_T_TI_F1
+PASS: AddT_TI_T1
+PASS: AddT_TI_T2
+PASS: AddTI_TI_TI1
+PASS: AddTI_TI_TI2
+PASS: AddTI_TI_TI3
+PASS: SubtractT_T_TI1
+PASS: SubtractT_T_TI2
+PASS: SubtractT_T_TI3
+PASS: SubtractT_T_TI4
+PASS: SubtractT_T_TI5
+PASS: SubtractT_T_TI6
+PASS: SubtractT_T_TI_F1
+PASS: SubtractTI_T_T1
+PASS: SubtractTI_T_T2
+PASS: SubtractTI_T_T3
+PASS: SubtractTI_T_T4
+PASS: SubtractTI_T_T5
+PASS: SubtractTI_T_T6
+PASS: SubtractTI_T_T7
+PASS: SubtractTI_T_T8
+PASS: SubtractTI_T_T9
+PASS: SubtractTI_T_T10
+PASS: SubtractTI_T_T11
+PASS: SubtractTI_T_T12
+PASS: SubtractTI_T_T13
+PASS: SubtractTI_T_T14
+PASS: SubtractTI_TI_TI1
+PASS: SubtractTI_TI_TI2
+PASS: SubtractTI_TI_TI3
+PASS: SubtractTI_TI_TIN1
+PASS: SubtractTI_TI_TIN2
+PASS: MultiplyTI_TI_INT1
+PASS: MultiplyTI_TI_INT2
+PASS: MultiplyTI_TI_INT3
+PASS: DivideTI_TI_INT1
+PASS: DivideTI_TI_INT2
+PASS: DivideTI_TI_INT3
+PASS: DivideINT_TI_TI1
+PASS: DivideINT_TI_TI2
+PASS: DivideINT_TI_TI3
+PASS: DivideINT_TI_TI4
+PASS: DivideINT_TI_TI5
+PASS: DivideINT_TI_TI6
+PASS: DivideINT_TI_TIR1
+PASS: DivideINT_TI_TIR2
+PASS: DivideINT_TI_TIF1
+PASS: DivideINT_TI_TIF2
+PASS: DivideINT_TI_TIF3
+PASS: DivideINT_TI_TIF4
+PASS: DivideINT_TI_TIN1
+PASS: DivideINT_TI_TIN2
+PASS: DivideINT_TI_TIN3
+SimpleClockAdvance_SETUP: start_time = <2002-12-27_03:00:00>
+SimpleClockAdvance_SETUP: stop_time = <2002-12-28_08:00:00>
+SimpleClockAdvance_SETUP: timestep = <0000000000_000:010:000>
+SimpleClockAdvance_SETUP: increment = <0000000000_000:000:000>
+SimpleClockAdvance_SETUP: clock current_time = <2002-12-27_03:00:00>
+SimpleClockAdvance_SETUP: current_time dayOfYear_r8 = < 361.125000 >
+SimpleClockAdvance_SETUP: current_time-increment = <2002-12-27_03:00:00>
+SimpleClockAdvance_SETUP: current_time+increment = <2002-12-27_03:00:00>
+SimpleClockAdvance_ADVANCE: count = 000001 current_time = <2002-12-27_03:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_03:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_03:10:00>
+SimpleClockAdvance_ADVANCE: count = 000002 current_time = <2002-12-27_03:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_03:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_03:20:00>
+SimpleClockAdvance_ADVANCE: count = 000003 current_time = <2002-12-27_03:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_03:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_03:30:00>
+SimpleClockAdvance_ADVANCE: count = 000004 current_time = <2002-12-27_03:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_03:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_03:40:00>
+SimpleClockAdvance_ADVANCE: count = 000005 current_time = <2002-12-27_03:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_03:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_03:50:00>
+SimpleClockAdvance_ADVANCE: count = 000006 current_time = <2002-12-27_04:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_04:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_04:00:00>
+SimpleClockAdvance_ADVANCE: count = 000007 current_time = <2002-12-27_04:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_04:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_04:10:00>
+SimpleClockAdvance_ADVANCE: count = 000008 current_time = <2002-12-27_04:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_04:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_04:20:00>
+SimpleClockAdvance_ADVANCE: count = 000009 current_time = <2002-12-27_04:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_04:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_04:30:00>
+SimpleClockAdvance_ADVANCE: count = 000010 current_time = <2002-12-27_04:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_04:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_04:40:00>
+SimpleClockAdvance_ADVANCE: count = 000011 current_time = <2002-12-27_04:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_04:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_04:50:00>
+SimpleClockAdvance_ADVANCE: count = 000012 current_time = <2002-12-27_05:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_05:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_05:00:00>
+SimpleClockAdvance_ADVANCE: count = 000013 current_time = <2002-12-27_05:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_05:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_05:10:00>
+SimpleClockAdvance_ADVANCE: count = 000014 current_time = <2002-12-27_05:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_05:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_05:20:00>
+SimpleClockAdvance_ADVANCE: count = 000015 current_time = <2002-12-27_05:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_05:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_05:30:00>
+SimpleClockAdvance_ADVANCE: count = 000016 current_time = <2002-12-27_05:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_05:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_05:40:00>
+SimpleClockAdvance_ADVANCE: count = 000017 current_time = <2002-12-27_05:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_05:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_05:50:00>
+SimpleClockAdvance_ADVANCE: count = 000018 current_time = <2002-12-27_06:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_06:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_06:00:00>
+SimpleClockAdvance_ADVANCE: count = 000019 current_time = <2002-12-27_06:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_06:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_06:10:00>
+SimpleClockAdvance_ADVANCE: count = 000020 current_time = <2002-12-27_06:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_06:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_06:20:00>
+SimpleClockAdvance_ADVANCE: count = 000021 current_time = <2002-12-27_06:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_06:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_06:30:00>
+SimpleClockAdvance_ADVANCE: count = 000022 current_time = <2002-12-27_06:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_06:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_06:40:00>
+SimpleClockAdvance_ADVANCE: count = 000023 current_time = <2002-12-27_06:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_06:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_06:50:00>
+SimpleClockAdvance_ADVANCE: count = 000024 current_time = <2002-12-27_07:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_07:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_07:00:00>
+SimpleClockAdvance_ADVANCE: count = 000025 current_time = <2002-12-27_07:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_07:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_07:10:00>
+SimpleClockAdvance_ADVANCE: count = 000026 current_time = <2002-12-27_07:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_07:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_07:20:00>
+SimpleClockAdvance_ADVANCE: count = 000027 current_time = <2002-12-27_07:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_07:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_07:30:00>
+SimpleClockAdvance_ADVANCE: count = 000028 current_time = <2002-12-27_07:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_07:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_07:40:00>
+SimpleClockAdvance_ADVANCE: count = 000029 current_time = <2002-12-27_07:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_07:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_07:50:00>
+SimpleClockAdvance_ADVANCE: count = 000030 current_time = <2002-12-27_08:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_08:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_08:00:00>
+SimpleClockAdvance_ADVANCE: count = 000031 current_time = <2002-12-27_08:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_08:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_08:10:00>
+SimpleClockAdvance_ADVANCE: count = 000032 current_time = <2002-12-27_08:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_08:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_08:20:00>
+SimpleClockAdvance_ADVANCE: count = 000033 current_time = <2002-12-27_08:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_08:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_08:30:00>
+SimpleClockAdvance_ADVANCE: count = 000034 current_time = <2002-12-27_08:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_08:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_08:40:00>
+SimpleClockAdvance_ADVANCE: count = 000035 current_time = <2002-12-27_08:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_08:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_08:50:00>
+SimpleClockAdvance_ADVANCE: count = 000036 current_time = <2002-12-27_09:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_09:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_09:00:00>
+SimpleClockAdvance_ADVANCE: count = 000037 current_time = <2002-12-27_09:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_09:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_09:10:00>
+SimpleClockAdvance_ADVANCE: count = 000038 current_time = <2002-12-27_09:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_09:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_09:20:00>
+SimpleClockAdvance_ADVANCE: count = 000039 current_time = <2002-12-27_09:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_09:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_09:30:00>
+SimpleClockAdvance_ADVANCE: count = 000040 current_time = <2002-12-27_09:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_09:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_09:40:00>
+SimpleClockAdvance_ADVANCE: count = 000041 current_time = <2002-12-27_09:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_09:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_09:50:00>
+SimpleClockAdvance_ADVANCE: count = 000042 current_time = <2002-12-27_10:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_10:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_10:00:00>
+SimpleClockAdvance_ADVANCE: count = 000043 current_time = <2002-12-27_10:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_10:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_10:10:00>
+SimpleClockAdvance_ADVANCE: count = 000044 current_time = <2002-12-27_10:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_10:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_10:20:00>
+SimpleClockAdvance_ADVANCE: count = 000045 current_time = <2002-12-27_10:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_10:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_10:30:00>
+SimpleClockAdvance_ADVANCE: count = 000046 current_time = <2002-12-27_10:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_10:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_10:40:00>
+SimpleClockAdvance_ADVANCE: count = 000047 current_time = <2002-12-27_10:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_10:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_10:50:00>
+SimpleClockAdvance_ADVANCE: count = 000048 current_time = <2002-12-27_11:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_11:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_11:00:00>
+SimpleClockAdvance_ADVANCE: count = 000049 current_time = <2002-12-27_11:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_11:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_11:10:00>
+SimpleClockAdvance_ADVANCE: count = 000050 current_time = <2002-12-27_11:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_11:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_11:20:00>
+SimpleClockAdvance_ADVANCE: count = 000051 current_time = <2002-12-27_11:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_11:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_11:30:00>
+SimpleClockAdvance_ADVANCE: count = 000052 current_time = <2002-12-27_11:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_11:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_11:40:00>
+SimpleClockAdvance_ADVANCE: count = 000053 current_time = <2002-12-27_11:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_11:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_11:50:00>
+SimpleClockAdvance_ADVANCE: count = 000054 current_time = <2002-12-27_12:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_12:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_12:00:00>
+SimpleClockAdvance_ADVANCE: count = 000055 current_time = <2002-12-27_12:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_12:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_12:10:00>
+SimpleClockAdvance_ADVANCE: count = 000056 current_time = <2002-12-27_12:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_12:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_12:20:00>
+SimpleClockAdvance_ADVANCE: count = 000057 current_time = <2002-12-27_12:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_12:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_12:30:00>
+SimpleClockAdvance_ADVANCE: count = 000058 current_time = <2002-12-27_12:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_12:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_12:40:00>
+SimpleClockAdvance_ADVANCE: count = 000059 current_time = <2002-12-27_12:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_12:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_12:50:00>
+SimpleClockAdvance_ADVANCE: count = 000060 current_time = <2002-12-27_13:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_13:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_13:00:00>
+SimpleClockAdvance_ADVANCE: count = 000061 current_time = <2002-12-27_13:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_13:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_13:10:00>
+SimpleClockAdvance_ADVANCE: count = 000062 current_time = <2002-12-27_13:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_13:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_13:20:00>
+SimpleClockAdvance_ADVANCE: count = 000063 current_time = <2002-12-27_13:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_13:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_13:30:00>
+SimpleClockAdvance_ADVANCE: count = 000064 current_time = <2002-12-27_13:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_13:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_13:40:00>
+SimpleClockAdvance_ADVANCE: count = 000065 current_time = <2002-12-27_13:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_13:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_13:50:00>
+SimpleClockAdvance_ADVANCE: count = 000066 current_time = <2002-12-27_14:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_14:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_14:00:00>
+SimpleClockAdvance_ADVANCE: count = 000067 current_time = <2002-12-27_14:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_14:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_14:10:00>
+SimpleClockAdvance_ADVANCE: count = 000068 current_time = <2002-12-27_14:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_14:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_14:20:00>
+SimpleClockAdvance_ADVANCE: count = 000069 current_time = <2002-12-27_14:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_14:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_14:30:00>
+SimpleClockAdvance_ADVANCE: count = 000070 current_time = <2002-12-27_14:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_14:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_14:40:00>
+SimpleClockAdvance_ADVANCE: count = 000071 current_time = <2002-12-27_14:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_14:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_14:50:00>
+SimpleClockAdvance_ADVANCE: count = 000072 current_time = <2002-12-27_15:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_15:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_15:00:00>
+SimpleClockAdvance_ADVANCE: count = 000073 current_time = <2002-12-27_15:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_15:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_15:10:00>
+SimpleClockAdvance_ADVANCE: count = 000074 current_time = <2002-12-27_15:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_15:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_15:20:00>
+SimpleClockAdvance_ADVANCE: count = 000075 current_time = <2002-12-27_15:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_15:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_15:30:00>
+SimpleClockAdvance_ADVANCE: count = 000076 current_time = <2002-12-27_15:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_15:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_15:40:00>
+SimpleClockAdvance_ADVANCE: count = 000077 current_time = <2002-12-27_15:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_15:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_15:50:00>
+SimpleClockAdvance_ADVANCE: count = 000078 current_time = <2002-12-27_16:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_16:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_16:00:00>
+SimpleClockAdvance_ADVANCE: count = 000079 current_time = <2002-12-27_16:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_16:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_16:10:00>
+SimpleClockAdvance_ADVANCE: count = 000080 current_time = <2002-12-27_16:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_16:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_16:20:00>
+SimpleClockAdvance_ADVANCE: count = 000081 current_time = <2002-12-27_16:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_16:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_16:30:00>
+SimpleClockAdvance_ADVANCE: count = 000082 current_time = <2002-12-27_16:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_16:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_16:40:00>
+SimpleClockAdvance_ADVANCE: count = 000083 current_time = <2002-12-27_16:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_16:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_16:50:00>
+SimpleClockAdvance_ADVANCE: count = 000084 current_time = <2002-12-27_17:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_17:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_17:00:00>
+SimpleClockAdvance_ADVANCE: count = 000085 current_time = <2002-12-27_17:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_17:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_17:10:00>
+SimpleClockAdvance_ADVANCE: count = 000086 current_time = <2002-12-27_17:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_17:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_17:20:00>
+SimpleClockAdvance_ADVANCE: count = 000087 current_time = <2002-12-27_17:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_17:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_17:30:00>
+SimpleClockAdvance_ADVANCE: count = 000088 current_time = <2002-12-27_17:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_17:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_17:40:00>
+SimpleClockAdvance_ADVANCE: count = 000089 current_time = <2002-12-27_17:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_17:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_17:50:00>
+SimpleClockAdvance_ADVANCE: count = 000090 current_time = <2002-12-27_18:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_18:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_18:00:00>
+SimpleClockAdvance_ADVANCE: count = 000091 current_time = <2002-12-27_18:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_18:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_18:10:00>
+SimpleClockAdvance_ADVANCE: count = 000092 current_time = <2002-12-27_18:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_18:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_18:20:00>
+SimpleClockAdvance_ADVANCE: count = 000093 current_time = <2002-12-27_18:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_18:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_18:30:00>
+SimpleClockAdvance_ADVANCE: count = 000094 current_time = <2002-12-27_18:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_18:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_18:40:00>
+SimpleClockAdvance_ADVANCE: count = 000095 current_time = <2002-12-27_18:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_18:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_18:50:00>
+SimpleClockAdvance_ADVANCE: count = 000096 current_time = <2002-12-27_19:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_19:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_19:00:00>
+SimpleClockAdvance_ADVANCE: count = 000097 current_time = <2002-12-27_19:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_19:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_19:10:00>
+SimpleClockAdvance_ADVANCE: count = 000098 current_time = <2002-12-27_19:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_19:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_19:20:00>
+SimpleClockAdvance_ADVANCE: count = 000099 current_time = <2002-12-27_19:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_19:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_19:30:00>
+SimpleClockAdvance_ADVANCE: count = 000100 current_time = <2002-12-27_19:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_19:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_19:40:00>
+SimpleClockAdvance_ADVANCE: count = 000101 current_time = <2002-12-27_19:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_19:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_19:50:00>
+SimpleClockAdvance_ADVANCE: count = 000102 current_time = <2002-12-27_20:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_20:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_20:00:00>
+SimpleClockAdvance_ADVANCE: count = 000103 current_time = <2002-12-27_20:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_20:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_20:10:00>
+SimpleClockAdvance_ADVANCE: count = 000104 current_time = <2002-12-27_20:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_20:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_20:20:00>
+SimpleClockAdvance_ADVANCE: count = 000105 current_time = <2002-12-27_20:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_20:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_20:30:00>
+SimpleClockAdvance_ADVANCE: count = 000106 current_time = <2002-12-27_20:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_20:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_20:40:00>
+SimpleClockAdvance_ADVANCE: count = 000107 current_time = <2002-12-27_20:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_20:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_20:50:00>
+SimpleClockAdvance_ADVANCE: count = 000108 current_time = <2002-12-27_21:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_21:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_21:00:00>
+SimpleClockAdvance_ADVANCE: count = 000109 current_time = <2002-12-27_21:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_21:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_21:10:00>
+SimpleClockAdvance_ADVANCE: count = 000110 current_time = <2002-12-27_21:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_21:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_21:20:00>
+SimpleClockAdvance_ADVANCE: count = 000111 current_time = <2002-12-27_21:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_21:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_21:30:00>
+SimpleClockAdvance_ADVANCE: count = 000112 current_time = <2002-12-27_21:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_21:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_21:40:00>
+SimpleClockAdvance_ADVANCE: count = 000113 current_time = <2002-12-27_21:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_21:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_21:50:00>
+SimpleClockAdvance_ADVANCE: count = 000114 current_time = <2002-12-27_22:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_22:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_22:00:00>
+SimpleClockAdvance_ADVANCE: count = 000115 current_time = <2002-12-27_22:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_22:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_22:10:00>
+SimpleClockAdvance_ADVANCE: count = 000116 current_time = <2002-12-27_22:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_22:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_22:20:00>
+SimpleClockAdvance_ADVANCE: count = 000117 current_time = <2002-12-27_22:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_22:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_22:30:00>
+SimpleClockAdvance_ADVANCE: count = 000118 current_time = <2002-12-27_22:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_22:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_22:40:00>
+SimpleClockAdvance_ADVANCE: count = 000119 current_time = <2002-12-27_22:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_22:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_22:50:00>
+SimpleClockAdvance_ADVANCE: count = 000120 current_time = <2002-12-27_23:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_23:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_23:00:00>
+SimpleClockAdvance_ADVANCE: count = 000121 current_time = <2002-12-27_23:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_23:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_23:10:00>
+SimpleClockAdvance_ADVANCE: count = 000122 current_time = <2002-12-27_23:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_23:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_23:20:00>
+SimpleClockAdvance_ADVANCE: count = 000123 current_time = <2002-12-27_23:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_23:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_23:30:00>
+SimpleClockAdvance_ADVANCE: count = 000124 current_time = <2002-12-27_23:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_23:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_23:40:00>
+SimpleClockAdvance_ADVANCE: count = 000125 current_time = <2002-12-27_23:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-27_23:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-27_23:50:00>
+SimpleClockAdvance_ADVANCE: count = 000126 current_time = <2002-12-28_00:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_00:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_00:00:00>
+SimpleClockAdvance_ADVANCE: count = 000127 current_time = <2002-12-28_00:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_00:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_00:10:00>
+SimpleClockAdvance_ADVANCE: count = 000128 current_time = <2002-12-28_00:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_00:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_00:20:00>
+SimpleClockAdvance_ADVANCE: count = 000129 current_time = <2002-12-28_00:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_00:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_00:30:00>
+SimpleClockAdvance_ADVANCE: count = 000130 current_time = <2002-12-28_00:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_00:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_00:40:00>
+SimpleClockAdvance_ADVANCE: count = 000131 current_time = <2002-12-28_00:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_00:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_00:50:00>
+SimpleClockAdvance_ADVANCE: count = 000132 current_time = <2002-12-28_01:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_01:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_01:00:00>
+SimpleClockAdvance_ADVANCE: count = 000133 current_time = <2002-12-28_01:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_01:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_01:10:00>
+SimpleClockAdvance_ADVANCE: count = 000134 current_time = <2002-12-28_01:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_01:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_01:20:00>
+SimpleClockAdvance_ADVANCE: count = 000135 current_time = <2002-12-28_01:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_01:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_01:30:00>
+SimpleClockAdvance_ADVANCE: count = 000136 current_time = <2002-12-28_01:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_01:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_01:40:00>
+SimpleClockAdvance_ADVANCE: count = 000137 current_time = <2002-12-28_01:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_01:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_01:50:00>
+SimpleClockAdvance_ADVANCE: count = 000138 current_time = <2002-12-28_02:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_02:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_02:00:00>
+SimpleClockAdvance_ADVANCE: count = 000139 current_time = <2002-12-28_02:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_02:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_02:10:00>
+SimpleClockAdvance_ADVANCE: count = 000140 current_time = <2002-12-28_02:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_02:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_02:20:00>
+SimpleClockAdvance_ADVANCE: count = 000141 current_time = <2002-12-28_02:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_02:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_02:30:00>
+SimpleClockAdvance_ADVANCE: count = 000142 current_time = <2002-12-28_02:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_02:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_02:40:00>
+SimpleClockAdvance_ADVANCE: count = 000143 current_time = <2002-12-28_02:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_02:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_02:50:00>
+SimpleClockAdvance_ADVANCE: count = 000144 current_time = <2002-12-28_03:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_03:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_03:00:00>
+SimpleClockAdvance_ADVANCE: count = 000145 current_time = <2002-12-28_03:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_03:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_03:10:00>
+SimpleClockAdvance_ADVANCE: count = 000146 current_time = <2002-12-28_03:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_03:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_03:20:00>
+SimpleClockAdvance_ADVANCE: count = 000147 current_time = <2002-12-28_03:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_03:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_03:30:00>
+SimpleClockAdvance_ADVANCE: count = 000148 current_time = <2002-12-28_03:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_03:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_03:40:00>
+SimpleClockAdvance_ADVANCE: count = 000149 current_time = <2002-12-28_03:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_03:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_03:50:00>
+SimpleClockAdvance_ADVANCE: count = 000150 current_time = <2002-12-28_04:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_04:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_04:00:00>
+SimpleClockAdvance_ADVANCE: count = 000151 current_time = <2002-12-28_04:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_04:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_04:10:00>
+SimpleClockAdvance_ADVANCE: count = 000152 current_time = <2002-12-28_04:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_04:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_04:20:00>
+SimpleClockAdvance_ADVANCE: count = 000153 current_time = <2002-12-28_04:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_04:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_04:30:00>
+SimpleClockAdvance_ADVANCE: count = 000154 current_time = <2002-12-28_04:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_04:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_04:40:00>
+SimpleClockAdvance_ADVANCE: count = 000155 current_time = <2002-12-28_04:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_04:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_04:50:00>
+SimpleClockAdvance_ADVANCE: count = 000156 current_time = <2002-12-28_05:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_05:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_05:00:00>
+SimpleClockAdvance_ADVANCE: count = 000157 current_time = <2002-12-28_05:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_05:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_05:10:00>
+SimpleClockAdvance_ADVANCE: count = 000158 current_time = <2002-12-28_05:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_05:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_05:20:00>
+SimpleClockAdvance_ADVANCE: count = 000159 current_time = <2002-12-28_05:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_05:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_05:30:00>
+SimpleClockAdvance_ADVANCE: count = 000160 current_time = <2002-12-28_05:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_05:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_05:40:00>
+SimpleClockAdvance_ADVANCE: count = 000161 current_time = <2002-12-28_05:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_05:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_05:50:00>
+SimpleClockAdvance_ADVANCE: count = 000162 current_time = <2002-12-28_06:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_06:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_06:00:00>
+SimpleClockAdvance_ADVANCE: count = 000163 current_time = <2002-12-28_06:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_06:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_06:10:00>
+SimpleClockAdvance_ADVANCE: count = 000164 current_time = <2002-12-28_06:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_06:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_06:20:00>
+SimpleClockAdvance_ADVANCE: count = 000165 current_time = <2002-12-28_06:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_06:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_06:30:00>
+SimpleClockAdvance_ADVANCE: count = 000166 current_time = <2002-12-28_06:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_06:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_06:40:00>
+SimpleClockAdvance_ADVANCE: count = 000167 current_time = <2002-12-28_06:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_06:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_06:50:00>
+SimpleClockAdvance_ADVANCE: count = 000168 current_time = <2002-12-28_07:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_07:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_07:00:00>
+SimpleClockAdvance_ADVANCE: count = 000169 current_time = <2002-12-28_07:10:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_07:10:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_07:10:00>
+SimpleClockAdvance_ADVANCE: count = 000170 current_time = <2002-12-28_07:20:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_07:20:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_07:20:00>
+SimpleClockAdvance_ADVANCE: count = 000171 current_time = <2002-12-28_07:30:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_07:30:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_07:30:00>
+SimpleClockAdvance_ADVANCE: count = 000172 current_time = <2002-12-28_07:40:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_07:40:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_07:40:00>
+SimpleClockAdvance_ADVANCE: count = 000173 current_time = <2002-12-28_07:50:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_07:50:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_07:50:00>
+SimpleClockAdvance_ADVANCE: count = 000174 current_time = <2002-12-28_08:00:00>
+SimpleClockAdvance_ADVANCE: current_time-increment = <2002-12-28_08:00:00>
+SimpleClockAdvance_ADVANCE: current_time+increment = <2002-12-28_08:00:00>
+StdYearClockAdvance_SETUP: start_time = <2003-12-29_09:00:00>
+StdYearClockAdvance_SETUP: stop_time = <2004-01-02_09:00:00>
+StdYearClockAdvance_SETUP: timestep = <0000000000_001:000:000>
+StdYearClockAdvance_SETUP: increment = <0000000000_000:000:010>
+StdYearClockAdvance_SETUP: clock current_time = <2003-12-29_09:00:00>
+StdYearClockAdvance_SETUP: current_time dayOfYear_r8 = < 363.375000 >
+StdYearClockAdvance_SETUP: current_time-increment = <2003-12-29_08:59:50>
+StdYearClockAdvance_SETUP: current_time+increment = <2003-12-29_09:00:10>
+StdYearClockAdvance_ADVANCE: count = 000001 current_time = <2003-12-29_10:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_09:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_10:00:10>
+StdYearClockAdvance_ADVANCE: count = 000002 current_time = <2003-12-29_11:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_10:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_11:00:10>
+StdYearClockAdvance_ADVANCE: count = 000003 current_time = <2003-12-29_12:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_11:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_12:00:10>
+StdYearClockAdvance_ADVANCE: count = 000004 current_time = <2003-12-29_13:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_12:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_13:00:10>
+StdYearClockAdvance_ADVANCE: count = 000005 current_time = <2003-12-29_14:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_13:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_14:00:10>
+StdYearClockAdvance_ADVANCE: count = 000006 current_time = <2003-12-29_15:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_14:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_15:00:10>
+StdYearClockAdvance_ADVANCE: count = 000007 current_time = <2003-12-29_16:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_15:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_16:00:10>
+StdYearClockAdvance_ADVANCE: count = 000008 current_time = <2003-12-29_17:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_16:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_17:00:10>
+StdYearClockAdvance_ADVANCE: count = 000009 current_time = <2003-12-29_18:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_17:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_18:00:10>
+StdYearClockAdvance_ADVANCE: count = 000010 current_time = <2003-12-29_19:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_18:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_19:00:10>
+StdYearClockAdvance_ADVANCE: count = 000011 current_time = <2003-12-29_20:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_19:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_20:00:10>
+StdYearClockAdvance_ADVANCE: count = 000012 current_time = <2003-12-29_21:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_20:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_21:00:10>
+StdYearClockAdvance_ADVANCE: count = 000013 current_time = <2003-12-29_22:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_21:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_22:00:10>
+StdYearClockAdvance_ADVANCE: count = 000014 current_time = <2003-12-29_23:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_22:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-29_23:00:10>
+StdYearClockAdvance_ADVANCE: count = 000015 current_time = <2003-12-30_00:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-29_23:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_00:00:10>
+StdYearClockAdvance_ADVANCE: count = 000016 current_time = <2003-12-30_01:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_00:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_01:00:10>
+StdYearClockAdvance_ADVANCE: count = 000017 current_time = <2003-12-30_02:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_01:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_02:00:10>
+StdYearClockAdvance_ADVANCE: count = 000018 current_time = <2003-12-30_03:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_02:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_03:00:10>
+StdYearClockAdvance_ADVANCE: count = 000019 current_time = <2003-12-30_04:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_03:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_04:00:10>
+StdYearClockAdvance_ADVANCE: count = 000020 current_time = <2003-12-30_05:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_04:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_05:00:10>
+StdYearClockAdvance_ADVANCE: count = 000021 current_time = <2003-12-30_06:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_05:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_06:00:10>
+StdYearClockAdvance_ADVANCE: count = 000022 current_time = <2003-12-30_07:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_06:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_07:00:10>
+StdYearClockAdvance_ADVANCE: count = 000023 current_time = <2003-12-30_08:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_07:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_08:00:10>
+StdYearClockAdvance_ADVANCE: count = 000024 current_time = <2003-12-30_09:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_08:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_09:00:10>
+StdYearClockAdvance_ADVANCE: count = 000025 current_time = <2003-12-30_10:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_09:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_10:00:10>
+StdYearClockAdvance_ADVANCE: count = 000026 current_time = <2003-12-30_11:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_10:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_11:00:10>
+StdYearClockAdvance_ADVANCE: count = 000027 current_time = <2003-12-30_12:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_11:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_12:00:10>
+StdYearClockAdvance_ADVANCE: count = 000028 current_time = <2003-12-30_13:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_12:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_13:00:10>
+StdYearClockAdvance_ADVANCE: count = 000029 current_time = <2003-12-30_14:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_13:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_14:00:10>
+StdYearClockAdvance_ADVANCE: count = 000030 current_time = <2003-12-30_15:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_14:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_15:00:10>
+StdYearClockAdvance_ADVANCE: count = 000031 current_time = <2003-12-30_16:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_15:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_16:00:10>
+StdYearClockAdvance_ADVANCE: count = 000032 current_time = <2003-12-30_17:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_16:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_17:00:10>
+StdYearClockAdvance_ADVANCE: count = 000033 current_time = <2003-12-30_18:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_17:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_18:00:10>
+StdYearClockAdvance_ADVANCE: count = 000034 current_time = <2003-12-30_19:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_18:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_19:00:10>
+StdYearClockAdvance_ADVANCE: count = 000035 current_time = <2003-12-30_20:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_19:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_20:00:10>
+StdYearClockAdvance_ADVANCE: count = 000036 current_time = <2003-12-30_21:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_20:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_21:00:10>
+StdYearClockAdvance_ADVANCE: count = 000037 current_time = <2003-12-30_22:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_21:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_22:00:10>
+StdYearClockAdvance_ADVANCE: count = 000038 current_time = <2003-12-30_23:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_22:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-30_23:00:10>
+StdYearClockAdvance_ADVANCE: count = 000039 current_time = <2003-12-31_00:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-30_23:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_00:00:10>
+StdYearClockAdvance_ADVANCE: count = 000040 current_time = <2003-12-31_01:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_00:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_01:00:10>
+StdYearClockAdvance_ADVANCE: count = 000041 current_time = <2003-12-31_02:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_01:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_02:00:10>
+StdYearClockAdvance_ADVANCE: count = 000042 current_time = <2003-12-31_03:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_02:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_03:00:10>
+StdYearClockAdvance_ADVANCE: count = 000043 current_time = <2003-12-31_04:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_03:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_04:00:10>
+StdYearClockAdvance_ADVANCE: count = 000044 current_time = <2003-12-31_05:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_04:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_05:00:10>
+StdYearClockAdvance_ADVANCE: count = 000045 current_time = <2003-12-31_06:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_05:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_06:00:10>
+StdYearClockAdvance_ADVANCE: count = 000046 current_time = <2003-12-31_07:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_06:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_07:00:10>
+StdYearClockAdvance_ADVANCE: count = 000047 current_time = <2003-12-31_08:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_07:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_08:00:10>
+StdYearClockAdvance_ADVANCE: count = 000048 current_time = <2003-12-31_09:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_08:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_09:00:10>
+StdYearClockAdvance_ADVANCE: count = 000049 current_time = <2003-12-31_10:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_09:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_10:00:10>
+StdYearClockAdvance_ADVANCE: count = 000050 current_time = <2003-12-31_11:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_10:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_11:00:10>
+StdYearClockAdvance_ADVANCE: count = 000051 current_time = <2003-12-31_12:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_11:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_12:00:10>
+StdYearClockAdvance_ADVANCE: count = 000052 current_time = <2003-12-31_13:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_12:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_13:00:10>
+StdYearClockAdvance_ADVANCE: count = 000053 current_time = <2003-12-31_14:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_13:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_14:00:10>
+StdYearClockAdvance_ADVANCE: count = 000054 current_time = <2003-12-31_15:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_14:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_15:00:10>
+StdYearClockAdvance_ADVANCE: count = 000055 current_time = <2003-12-31_16:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_15:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_16:00:10>
+StdYearClockAdvance_ADVANCE: count = 000056 current_time = <2003-12-31_17:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_16:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_17:00:10>
+StdYearClockAdvance_ADVANCE: count = 000057 current_time = <2003-12-31_18:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_17:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_18:00:10>
+StdYearClockAdvance_ADVANCE: count = 000058 current_time = <2003-12-31_19:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_18:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_19:00:10>
+StdYearClockAdvance_ADVANCE: count = 000059 current_time = <2003-12-31_20:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_19:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_20:00:10>
+StdYearClockAdvance_ADVANCE: count = 000060 current_time = <2003-12-31_21:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_20:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_21:00:10>
+StdYearClockAdvance_ADVANCE: count = 000061 current_time = <2003-12-31_22:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_21:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_22:00:10>
+StdYearClockAdvance_ADVANCE: count = 000062 current_time = <2003-12-31_23:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_22:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2003-12-31_23:00:10>
+StdYearClockAdvance_ADVANCE: count = 000063 current_time = <2004-01-01_00:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2003-12-31_23:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_00:00:10>
+StdYearClockAdvance_ADVANCE: count = 000064 current_time = <2004-01-01_01:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_00:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_01:00:10>
+StdYearClockAdvance_ADVANCE: count = 000065 current_time = <2004-01-01_02:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_01:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_02:00:10>
+StdYearClockAdvance_ADVANCE: count = 000066 current_time = <2004-01-01_03:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_02:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_03:00:10>
+StdYearClockAdvance_ADVANCE: count = 000067 current_time = <2004-01-01_04:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_03:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_04:00:10>
+StdYearClockAdvance_ADVANCE: count = 000068 current_time = <2004-01-01_05:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_04:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_05:00:10>
+StdYearClockAdvance_ADVANCE: count = 000069 current_time = <2004-01-01_06:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_05:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_06:00:10>
+StdYearClockAdvance_ADVANCE: count = 000070 current_time = <2004-01-01_07:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_06:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_07:00:10>
+StdYearClockAdvance_ADVANCE: count = 000071 current_time = <2004-01-01_08:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_07:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_08:00:10>
+StdYearClockAdvance_ADVANCE: count = 000072 current_time = <2004-01-01_09:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_08:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_09:00:10>
+StdYearClockAdvance_ADVANCE: count = 000073 current_time = <2004-01-01_10:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_09:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_10:00:10>
+StdYearClockAdvance_ADVANCE: count = 000074 current_time = <2004-01-01_11:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_10:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_11:00:10>
+StdYearClockAdvance_ADVANCE: count = 000075 current_time = <2004-01-01_12:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_11:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_12:00:10>
+StdYearClockAdvance_ADVANCE: count = 000076 current_time = <2004-01-01_13:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_12:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_13:00:10>
+StdYearClockAdvance_ADVANCE: count = 000077 current_time = <2004-01-01_14:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_13:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_14:00:10>
+StdYearClockAdvance_ADVANCE: count = 000078 current_time = <2004-01-01_15:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_14:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_15:00:10>
+StdYearClockAdvance_ADVANCE: count = 000079 current_time = <2004-01-01_16:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_15:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_16:00:10>
+StdYearClockAdvance_ADVANCE: count = 000080 current_time = <2004-01-01_17:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_16:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_17:00:10>
+StdYearClockAdvance_ADVANCE: count = 000081 current_time = <2004-01-01_18:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_17:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_18:00:10>
+StdYearClockAdvance_ADVANCE: count = 000082 current_time = <2004-01-01_19:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_18:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_19:00:10>
+StdYearClockAdvance_ADVANCE: count = 000083 current_time = <2004-01-01_20:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_19:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_20:00:10>
+StdYearClockAdvance_ADVANCE: count = 000084 current_time = <2004-01-01_21:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_20:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_21:00:10>
+StdYearClockAdvance_ADVANCE: count = 000085 current_time = <2004-01-01_22:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_21:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_22:00:10>
+StdYearClockAdvance_ADVANCE: count = 000086 current_time = <2004-01-01_23:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_22:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-01_23:00:10>
+StdYearClockAdvance_ADVANCE: count = 000087 current_time = <2004-01-02_00:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-01_23:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_00:00:10>
+StdYearClockAdvance_ADVANCE: count = 000088 current_time = <2004-01-02_01:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_00:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_01:00:10>
+StdYearClockAdvance_ADVANCE: count = 000089 current_time = <2004-01-02_02:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_01:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_02:00:10>
+StdYearClockAdvance_ADVANCE: count = 000090 current_time = <2004-01-02_03:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_02:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_03:00:10>
+StdYearClockAdvance_ADVANCE: count = 000091 current_time = <2004-01-02_04:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_03:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_04:00:10>
+StdYearClockAdvance_ADVANCE: count = 000092 current_time = <2004-01-02_05:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_04:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_05:00:10>
+StdYearClockAdvance_ADVANCE: count = 000093 current_time = <2004-01-02_06:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_05:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_06:00:10>
+StdYearClockAdvance_ADVANCE: count = 000094 current_time = <2004-01-02_07:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_06:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_07:00:10>
+StdYearClockAdvance_ADVANCE: count = 000095 current_time = <2004-01-02_08:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_07:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_08:00:10>
+StdYearClockAdvance_ADVANCE: count = 000096 current_time = <2004-01-02_09:00:00>
+StdYearClockAdvance_ADVANCE: current_time-increment = <2004-01-02_08:59:50>
+StdYearClockAdvance_ADVANCE: current_time+increment = <2004-01-02_09:00:10>
+LeapYearClockAdvance_SETUP: start_time = <2004-12-29_09:00:00>
+LeapYearClockAdvance_SETUP: stop_time = <2005-01-02_09:00:00>
+LeapYearClockAdvance_SETUP: timestep = <0000000000_001:000:000>
+LeapYearClockAdvance_SETUP: increment = <0000000000_000:000:010>
+LeapYearClockAdvance_SETUP: clock current_time = <2004-12-29_09:00:00>
+LeapYearClockAdvance_SETUP: current_time dayOfYear_r8 = < 364.375000 >
+LeapYearClockAdvance_SETUP: current_time-increment = <2004-12-29_08:59:50>
+LeapYearClockAdvance_SETUP: current_time+increment = <2004-12-29_09:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000001 current_time = <2004-12-29_10:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_09:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_10:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000002 current_time = <2004-12-29_11:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_10:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_11:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000003 current_time = <2004-12-29_12:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_11:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_12:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000004 current_time = <2004-12-29_13:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_12:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_13:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000005 current_time = <2004-12-29_14:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_13:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_14:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000006 current_time = <2004-12-29_15:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_14:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_15:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000007 current_time = <2004-12-29_16:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_15:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_16:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000008 current_time = <2004-12-29_17:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_16:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_17:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000009 current_time = <2004-12-29_18:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_17:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_18:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000010 current_time = <2004-12-29_19:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_18:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_19:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000011 current_time = <2004-12-29_20:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_19:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_20:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000012 current_time = <2004-12-29_21:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_20:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_21:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000013 current_time = <2004-12-29_22:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_21:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_22:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000014 current_time = <2004-12-29_23:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_22:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-29_23:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000015 current_time = <2004-12-30_00:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-29_23:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_00:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000016 current_time = <2004-12-30_01:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_00:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_01:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000017 current_time = <2004-12-30_02:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_01:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_02:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000018 current_time = <2004-12-30_03:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_02:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_03:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000019 current_time = <2004-12-30_04:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_03:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_04:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000020 current_time = <2004-12-30_05:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_04:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_05:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000021 current_time = <2004-12-30_06:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_05:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_06:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000022 current_time = <2004-12-30_07:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_06:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_07:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000023 current_time = <2004-12-30_08:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_07:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_08:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000024 current_time = <2004-12-30_09:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_08:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_09:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000025 current_time = <2004-12-30_10:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_09:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_10:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000026 current_time = <2004-12-30_11:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_10:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_11:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000027 current_time = <2004-12-30_12:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_11:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_12:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000028 current_time = <2004-12-30_13:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_12:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_13:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000029 current_time = <2004-12-30_14:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_13:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_14:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000030 current_time = <2004-12-30_15:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_14:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_15:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000031 current_time = <2004-12-30_16:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_15:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_16:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000032 current_time = <2004-12-30_17:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_16:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_17:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000033 current_time = <2004-12-30_18:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_17:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_18:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000034 current_time = <2004-12-30_19:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_18:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_19:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000035 current_time = <2004-12-30_20:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_19:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_20:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000036 current_time = <2004-12-30_21:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_20:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_21:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000037 current_time = <2004-12-30_22:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_21:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_22:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000038 current_time = <2004-12-30_23:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_22:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-30_23:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000039 current_time = <2004-12-31_00:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-30_23:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_00:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000040 current_time = <2004-12-31_01:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_00:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_01:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000041 current_time = <2004-12-31_02:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_01:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_02:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000042 current_time = <2004-12-31_03:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_02:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_03:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000043 current_time = <2004-12-31_04:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_03:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_04:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000044 current_time = <2004-12-31_05:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_04:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_05:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000045 current_time = <2004-12-31_06:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_05:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_06:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000046 current_time = <2004-12-31_07:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_06:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_07:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000047 current_time = <2004-12-31_08:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_07:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_08:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000048 current_time = <2004-12-31_09:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_08:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_09:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000049 current_time = <2004-12-31_10:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_09:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_10:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000050 current_time = <2004-12-31_11:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_10:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_11:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000051 current_time = <2004-12-31_12:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_11:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_12:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000052 current_time = <2004-12-31_13:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_12:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_13:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000053 current_time = <2004-12-31_14:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_13:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_14:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000054 current_time = <2004-12-31_15:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_14:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_15:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000055 current_time = <2004-12-31_16:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_15:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_16:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000056 current_time = <2004-12-31_17:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_16:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_17:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000057 current_time = <2004-12-31_18:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_17:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_18:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000058 current_time = <2004-12-31_19:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_18:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_19:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000059 current_time = <2004-12-31_20:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_19:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_20:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000060 current_time = <2004-12-31_21:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_20:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_21:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000061 current_time = <2004-12-31_22:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_21:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_22:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000062 current_time = <2004-12-31_23:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_22:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000063 current_time = <2005-01-01_00:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000064 current_time = <2005-01-01_01:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_01:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000065 current_time = <2005-01-01_02:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_01:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_02:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000066 current_time = <2005-01-01_03:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_02:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_03:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000067 current_time = <2005-01-01_04:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_03:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_04:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000068 current_time = <2005-01-01_05:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_04:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_05:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000069 current_time = <2005-01-01_06:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_05:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_06:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000070 current_time = <2005-01-01_07:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_06:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_07:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000071 current_time = <2005-01-01_08:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_07:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_08:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000072 current_time = <2005-01-01_09:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_08:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_09:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000073 current_time = <2005-01-01_10:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_09:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_10:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000074 current_time = <2005-01-01_11:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_10:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_11:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000075 current_time = <2005-01-01_12:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_11:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_12:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000076 current_time = <2005-01-01_13:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_12:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_13:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000077 current_time = <2005-01-01_14:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_13:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_14:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000078 current_time = <2005-01-01_15:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_14:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_15:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000079 current_time = <2005-01-01_16:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_15:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_16:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000080 current_time = <2005-01-01_17:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_16:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_17:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000081 current_time = <2005-01-01_18:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_17:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_18:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000082 current_time = <2005-01-01_19:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_18:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_19:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000083 current_time = <2005-01-01_20:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_19:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_20:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000084 current_time = <2005-01-01_21:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_20:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_21:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000085 current_time = <2005-01-01_22:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_21:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_22:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000086 current_time = <2005-01-01_23:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_22:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-01_23:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000087 current_time = <2005-01-02_00:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-01_23:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_00:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000088 current_time = <2005-01-02_01:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_00:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_01:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000089 current_time = <2005-01-02_02:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_01:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_02:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000090 current_time = <2005-01-02_03:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_02:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_03:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000091 current_time = <2005-01-02_04:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_03:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_04:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000092 current_time = <2005-01-02_05:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_04:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_05:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000093 current_time = <2005-01-02_06:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_05:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_06:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000094 current_time = <2005-01-02_07:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_06:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_07:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000095 current_time = <2005-01-02_08:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_07:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_08:00:10>
+LeapYearClockAdvance_ADVANCE: count = 000096 current_time = <2005-01-02_09:00:00>
+LeapYearClockAdvance_ADVANCE: current_time-increment = <2005-01-02_08:59:50>
+LeapYearClockAdvance_ADVANCE: current_time+increment = <2005-01-02_09:00:10>
+LeapYearFractionClockAdvance_SETUP: start_time = <2004-12-31_23:58:00>
+LeapYearFractionClockAdvance_SETUP: stop_time = <2005-01-01_00:02:00>
+LeapYearFractionClockAdvance_SETUP: timestep = <0000000000_000:000:013+01/03>
+LeapYearFractionClockAdvance_SETUP: increment = <0000000000_000:000:001+01/03>
+LeapYearFractionClockAdvance_SETUP: clock current_time = <2004-12-31_23:58:00>
+LeapYearFractionClockAdvance_SETUP: current_time dayOfYear_r8 = < 366.998611 >
+LeapYearFractionClockAdvance_SETUP: current_time-increment = <2004-12-31_23:57:58+02/03>
+LeapYearFractionClockAdvance_SETUP: current_time+increment = <2004-12-31_23:58:01+01/03>
+LeapYearFractionClockAdvance_ADVANCE: count = 000001 current_time = <2004-12-31_23:58:13+01/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:58:12>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:58:14+02/03>
+LeapYearFractionClockAdvance_ADVANCE: count = 000002 current_time = <2004-12-31_23:58:26+02/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:58:25+01/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:58:28>
+LeapYearFractionClockAdvance_ADVANCE: count = 000003 current_time = <2004-12-31_23:58:40>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:58:38+02/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:58:41+01/03>
+LeapYearFractionClockAdvance_ADVANCE: count = 000004 current_time = <2004-12-31_23:58:53+01/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:58:52>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:58:54+02/03>
+LeapYearFractionClockAdvance_ADVANCE: count = 000005 current_time = <2004-12-31_23:59:06+02/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:59:05+01/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:59:08>
+LeapYearFractionClockAdvance_ADVANCE: count = 000006 current_time = <2004-12-31_23:59:20>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:59:18+02/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:59:21+01/03>
+LeapYearFractionClockAdvance_ADVANCE: count = 000007 current_time = <2004-12-31_23:59:33+01/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:59:32>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:59:34+02/03>
+LeapYearFractionClockAdvance_ADVANCE: count = 000008 current_time = <2004-12-31_23:59:46+02/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:59:45+01/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2004-12-31_23:59:48>
+LeapYearFractionClockAdvance_ADVANCE: count = 000009 current_time = <2005-01-01_00:00:00>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2004-12-31_23:59:58+02/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:00:01+01/03>
+LeapYearFractionClockAdvance_ADVANCE: count = 000010 current_time = <2005-01-01_00:00:13+01/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:00:12>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:00:14+02/03>
+LeapYearFractionClockAdvance_ADVANCE: count = 000011 current_time = <2005-01-01_00:00:26+02/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:00:25+01/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:00:28>
+LeapYearFractionClockAdvance_ADVANCE: count = 000012 current_time = <2005-01-01_00:00:40>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:00:38+02/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:00:41+01/03>
+LeapYearFractionClockAdvance_ADVANCE: count = 000013 current_time = <2005-01-01_00:00:53+01/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:00:52>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:00:54+02/03>
+LeapYearFractionClockAdvance_ADVANCE: count = 000014 current_time = <2005-01-01_00:01:06+02/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:01:05+01/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:01:08>
+LeapYearFractionClockAdvance_ADVANCE: count = 000015 current_time = <2005-01-01_00:01:20>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:01:18+02/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:01:21+01/03>
+LeapYearFractionClockAdvance_ADVANCE: count = 000016 current_time = <2005-01-01_00:01:33+01/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:01:32>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:01:34+02/03>
+LeapYearFractionClockAdvance_ADVANCE: count = 000017 current_time = <2005-01-01_00:01:46+02/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:01:45+01/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:01:48>
+LeapYearFractionClockAdvance_ADVANCE: count = 000018 current_time = <2005-01-01_00:02:00>
+LeapYearFractionClockAdvance_ADVANCE: current_time-increment = <2005-01-01_00:01:58+02/03>
+LeapYearFractionClockAdvance_ADVANCE: current_time+increment = <2005-01-01_00:02:01+01/03>
+ END TEST SUITE
Deleted: branches/atmos_physics/src/external/esmf_time_f90/module_symbols_util.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/module_symbols_util.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/module_symbols_util.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,126 +0,0 @@
-!
-! NOTE: This file will be removed once encapsulation of bare ESMF
-! calls is complete within WRF non-external source code.
-!
-! NOTE: This file was automatically generated by the findsymbol script
-! based on WRFV2_20050512_1410. Recipe follows:
-!
-! 1) Run the findsymbol script on a machine that has Ruby installed to
-! generate this file. Type "findsymbol -h" for help using findsymbol.
-! For example:
-! >> hender IN loquat:/loquat2/hender/Ruby/FortranTools/ >> findsymbol -d /users/hender/Tasks/WRF_ESMF/WRFV2_20050512_1410_WORK/WRFV2/external/esmf_time_f90 -S ESMF_ -p -g WRFU_ -o ESMF_Mod -n module_symbols_util > & ! module_symbols_util.F90
-!
-! 2) Added this comment block by hand.
-!
- MODULE module_symbols_util
-
- USE ESMF_Mod, WRFU_ALARM => ESMF_ALARM
- USE ESMF_Mod, WRFU_ALARMCREATE => ESMF_ALARMCREATE
- USE ESMF_Mod, WRFU_ALARMDESTROY => ESMF_ALARMDESTROY
- USE ESMF_Mod, WRFU_ALARMDISABLE => ESMF_ALARMDISABLE
- USE ESMF_Mod, WRFU_ALARMENABLE => ESMF_ALARMENABLE
- USE ESMF_Mod, WRFU_ALARMGET => ESMF_ALARMGET
- USE ESMF_Mod, WRFU_ALARMISRINGING => ESMF_ALARMISRINGING
- USE ESMF_Mod, WRFU_ALARMPRINT => ESMF_ALARMPRINT
- USE ESMF_Mod, WRFU_ALARMRINGEROFF => ESMF_ALARMRINGEROFF
- USE ESMF_Mod, WRFU_ALARMRINGERON => ESMF_ALARMRINGERON
- USE ESMF_Mod, WRFU_ALARMSET => ESMF_ALARMSET
- USE ESMF_Mod, WRFU_ALARMVALIDATE => ESMF_ALARMVALIDATE
- USE ESMF_Mod, WRFU_ATTRIBUTE => ESMF_ATTRIBUTE
- USE ESMF_Mod, WRFU_ATTRIBUTECOPY => ESMF_ATTRIBUTECOPY
- USE ESMF_Mod, WRFU_ATTRIBUTECOPYALL => ESMF_ATTRIBUTECOPYALL
- USE ESMF_Mod, WRFU_ATTRIBUTEGET => ESMF_ATTRIBUTEGET
- USE ESMF_Mod, WRFU_ATTRIBUTEGETBYNUMBER => ESMF_ATTRIBUTEGETBYNUMBER
- USE ESMF_Mod, WRFU_ATTRIBUTEGETCOUNT => ESMF_ATTRIBUTEGETCOUNT
- USE ESMF_Mod, WRFU_ATTRIBUTEGETLIST => ESMF_ATTRIBUTEGETLIST
- USE ESMF_Mod, WRFU_ATTRIBUTEGETNAMELIST => ESMF_ATTRIBUTEGETNAMELIST
- USE ESMF_Mod, WRFU_ATTRIBUTEGETOBJECTLIST => ESMF_ATTRIBUTEGETOBJECTLIST
- USE ESMF_Mod, WRFU_ATTRIBUTESET => ESMF_ATTRIBUTESET
- USE ESMF_Mod, WRFU_ATTRIBUTESETLIST => ESMF_ATTRIBUTESETLIST
- USE ESMF_Mod, WRFU_ATTRIBUTESETOBJECTLIST => ESMF_ATTRIBUTESETOBJECTLIST
- USE ESMF_Mod, WRFU_AXISINDEX => ESMF_AXISINDEX
- USE ESMF_Mod, WRFU_AXISINDEXGET => ESMF_AXISINDEXGET
- USE ESMF_Mod, WRFU_BAD_POINTER => ESMF_BAD_POINTER
- USE ESMF_Mod, WRFU_BASE => ESMF_BASE
- USE ESMF_Mod, WRFU_BASETIME => ESMF_BASETIME
- USE ESMF_Mod, WRFU_CALENDAR => ESMF_CALENDAR
- USE ESMF_Mod, WRFU_CALENDARTYPE => ESMF_CALENDARTYPE
- USE ESMF_Mod, WRFU_CAL_360DAY => ESMF_CAL_360DAY
- USE ESMF_Mod, WRFU_CAL_GREGORIAN => ESMF_CAL_GREGORIAN
- USE ESMF_Mod, WRFU_CAL_NOCALENDAR => ESMF_CAL_NOCALENDAR
- USE ESMF_Mod, WRFU_CAL_NOLEAP => ESMF_CAL_NOLEAP
- USE ESMF_Mod, WRFU_CLOCK => ESMF_CLOCK
- USE ESMF_Mod, WRFU_CLOCKADDALARM => ESMF_CLOCKADDALARM
- USE ESMF_Mod, WRFU_CLOCKADVANCE => ESMF_CLOCKADVANCE
- USE ESMF_Mod, WRFU_CLOCKCREATE => ESMF_CLOCKCREATE
- USE ESMF_Mod, WRFU_CLOCKDESTROY => ESMF_CLOCKDESTROY
- USE ESMF_Mod, WRFU_CLOCKGET => ESMF_CLOCKGET
- USE ESMF_Mod, WRFU_CLOCKGETALARMLIST => ESMF_CLOCKGETALARMLIST
- USE ESMF_Mod, WRFU_CLOCKISSTOPTIME => ESMF_CLOCKISSTOPTIME
- USE ESMF_Mod, WRFU_CLOCKPRINT => ESMF_CLOCKPRINT
- USE ESMF_Mod, WRFU_CLOCKSET => ESMF_CLOCKSET
- USE ESMF_Mod, WRFU_CLOCKSTOPTIMEDISABLE => ESMF_CLOCKSTOPTIMEDISABLE
- USE ESMF_Mod, WRFU_CLOCKVALIDATE => ESMF_CLOCKVALIDATE
- USE ESMF_Mod, WRFU_DATATYPE => ESMF_DATATYPE
- USE ESMF_Mod, WRFU_DATATYPESTRING => ESMF_DATATYPESTRING
- USE ESMF_Mod, WRFU_DATAVALUE => ESMF_DATAVALUE
- USE ESMF_Mod, WRFU_DATA_CHARACTER => ESMF_DATA_CHARACTER
- USE ESMF_Mod, WRFU_DATA_INTEGER => ESMF_DATA_INTEGER
- USE ESMF_Mod, WRFU_DATA_LOGICAL => ESMF_DATA_LOGICAL
- USE ESMF_Mod, WRFU_DATA_REAL => ESMF_DATA_REAL
- USE ESMF_Mod, WRFU_FAILURE => ESMF_FAILURE
- USE ESMF_Mod, WRFU_FINALIZE => ESMF_FINALIZE
- USE ESMF_Mod, WRFU_FRACTION => ESMF_FRACTION
- USE ESMF_Mod, WRFU_GETNAME => ESMF_GETNAME
- USE ESMF_Mod, WRFU_GETPOINTER => ESMF_GETPOINTER
- USE ESMF_Mod, WRFU_GRID => ESMF_GRID
- USE ESMF_Mod, WRFU_GRIDCOMP => ESMF_GRIDCOMP
- USE ESMF_Mod, WRFU_INITIALIZE => ESMF_INITIALIZE
- USE ESMF_Mod, WRFU_ISINITIALIZED => ESMF_ISINITIALIZED
- USE ESMF_Mod, WRFU_KIND_C16 => ESMF_KIND_C16
- USE ESMF_Mod, WRFU_KIND_C8 => ESMF_KIND_C8
- USE ESMF_Mod, WRFU_KIND_I1 => ESMF_KIND_I1
- USE ESMF_Mod, WRFU_KIND_I2 => ESMF_KIND_I2
- USE ESMF_Mod, WRFU_KIND_I4 => ESMF_KIND_I4
- USE ESMF_Mod, WRFU_KIND_I8 => ESMF_KIND_I8
- USE ESMF_Mod, WRFU_KIND_R4 => ESMF_KIND_R4
- USE ESMF_Mod, WRFU_KIND_R8 => ESMF_KIND_R8
- USE ESMF_Mod, WRFU_LOG => ESMF_LOG
- USE ESMF_Mod, WRFU_LOGICAL => ESMF_LOGICAL
- USE ESMF_Mod, WRFU_LOGWRITE => ESMF_LOGWRITE
- USE ESMF_Mod, WRFU_LOG_ERROR => ESMF_LOG_ERROR
- USE ESMF_Mod, WRFU_LOG_INFO => ESMF_LOG_INFO
- USE ESMF_Mod, WRFU_LOG_WARNING => ESMF_LOG_WARNING
- USE ESMF_Mod, WRFU_MAJOR_VERSION => ESMF_MAJOR_VERSION
- USE ESMF_Mod, WRFU_MAXDECOMPDIM => ESMF_MAXDECOMPDIM
- USE ESMF_Mod, WRFU_MAXDIM => ESMF_MAXDIM
- USE ESMF_Mod, WRFU_MAXGRIDDIM => ESMF_MAXGRIDDIM
- USE ESMF_Mod, WRFU_MAXSTR => ESMF_MAXSTR
- USE ESMF_Mod, WRFU_MINOR_VERSION => ESMF_MINOR_VERSION
- USE ESMF_Mod, WRFU_MSGTYPE => ESMF_MSGTYPE
- USE ESMF_Mod, WRFU_NULL_POINTER => ESMF_NULL_POINTER
- USE ESMF_Mod, WRFU_POINTER => ESMF_POINTER
- USE ESMF_Mod, WRFU_REVISION => ESMF_REVISION
- USE ESMF_Mod, WRFU_SETNAME => ESMF_SETNAME
- USE ESMF_Mod, WRFU_SETNULLPOINTER => ESMF_SETNULLPOINTER
- USE ESMF_Mod, WRFU_SETPOINTER => ESMF_SETPOINTER
- USE ESMF_Mod, WRFU_STATE => ESMF_STATE
- USE ESMF_Mod, WRFU_STATE_INVALID => ESMF_STATE_INVALID
- USE ESMF_Mod, WRFU_STATUS => ESMF_STATUS
- USE ESMF_Mod, WRFU_STATUSSTRING => ESMF_STATUSSTRING
- USE ESMF_Mod, WRFU_SUCCESS => ESMF_SUCCESS
- USE ESMF_Mod, WRFU_TIME => ESMF_TIME
- USE ESMF_Mod, WRFU_TIMEEQ => ESMF_TIMEEQ
- USE ESMF_Mod, WRFU_TIMEGET => ESMF_TIMEGET
- USE ESMF_Mod, WRFU_TIMEINTERVAL => ESMF_TIMEINTERVAL
- USE ESMF_Mod, WRFU_TIMEINTERVALABSVALUE => ESMF_TIMEINTERVALABSVALUE
- USE ESMF_Mod, WRFU_TIMEINTERVALDIVQUOT => ESMF_TIMEINTERVALDIVQUOT
- USE ESMF_Mod, WRFU_TIMEINTERVALGET => ESMF_TIMEINTERVALGET
- USE ESMF_Mod, WRFU_TIMEINTERVALNEGABSVALUE => ESMF_TIMEINTERVALNEGABSVALUE
- USE ESMF_Mod, WRFU_TIMEINTERVALSET => ESMF_TIMEINTERVALSET
- USE ESMF_Mod, WRFU_TIMESET => ESMF_TIMESET
- USE ESMF_Mod, WRFU_VERSION_STRING => ESMF_VERSION_STRING
- USE ESMF_Mod, WRFU_VM => ESMF_VM
-
- END MODULE module_symbols_util
-
Copied: branches/atmos_physics/src/external/esmf_time_f90/module_symbols_util.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/module_symbols_util.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/module_symbols_util.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/module_symbols_util.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,126 @@
+!
+! NOTE: This file will be removed once encapsulation of bare ESMF
+! calls is complete within WRF non-external source code.
+!
+! NOTE: This file was automatically generated by the findsymbol script
+! based on WRFV2_20050512_1410. Recipe follows:
+!
+! 1) Run the findsymbol script on a machine that has Ruby installed to
+! generate this file. Type "findsymbol -h" for help using findsymbol.
+! For example:
+! >> hender IN loquat:/loquat2/hender/Ruby/FortranTools/ >> findsymbol -d /users/hender/Tasks/WRF_ESMF/WRFV2_20050512_1410_WORK/WRFV2/external/esmf_time_f90 -S ESMF_ -p -g WRFU_ -o ESMF_Mod -n module_symbols_util > & ! module_symbols_util.F90
+!
+! 2) Added this comment block by hand.
+!
+ MODULE module_symbols_util
+
+ USE ESMF_Mod, WRFU_ALARM => ESMF_ALARM
+ USE ESMF_Mod, WRFU_ALARMCREATE => ESMF_ALARMCREATE
+ USE ESMF_Mod, WRFU_ALARMDESTROY => ESMF_ALARMDESTROY
+ USE ESMF_Mod, WRFU_ALARMDISABLE => ESMF_ALARMDISABLE
+ USE ESMF_Mod, WRFU_ALARMENABLE => ESMF_ALARMENABLE
+ USE ESMF_Mod, WRFU_ALARMGET => ESMF_ALARMGET
+ USE ESMF_Mod, WRFU_ALARMISRINGING => ESMF_ALARMISRINGING
+ USE ESMF_Mod, WRFU_ALARMPRINT => ESMF_ALARMPRINT
+ USE ESMF_Mod, WRFU_ALARMRINGEROFF => ESMF_ALARMRINGEROFF
+ USE ESMF_Mod, WRFU_ALARMRINGERON => ESMF_ALARMRINGERON
+ USE ESMF_Mod, WRFU_ALARMSET => ESMF_ALARMSET
+ USE ESMF_Mod, WRFU_ALARMVALIDATE => ESMF_ALARMVALIDATE
+ USE ESMF_Mod, WRFU_ATTRIBUTE => ESMF_ATTRIBUTE
+ USE ESMF_Mod, WRFU_ATTRIBUTECOPY => ESMF_ATTRIBUTECOPY
+ USE ESMF_Mod, WRFU_ATTRIBUTECOPYALL => ESMF_ATTRIBUTECOPYALL
+ USE ESMF_Mod, WRFU_ATTRIBUTEGET => ESMF_ATTRIBUTEGET
+ USE ESMF_Mod, WRFU_ATTRIBUTEGETBYNUMBER => ESMF_ATTRIBUTEGETBYNUMBER
+ USE ESMF_Mod, WRFU_ATTRIBUTEGETCOUNT => ESMF_ATTRIBUTEGETCOUNT
+ USE ESMF_Mod, WRFU_ATTRIBUTEGETLIST => ESMF_ATTRIBUTEGETLIST
+ USE ESMF_Mod, WRFU_ATTRIBUTEGETNAMELIST => ESMF_ATTRIBUTEGETNAMELIST
+ USE ESMF_Mod, WRFU_ATTRIBUTEGETOBJECTLIST => ESMF_ATTRIBUTEGETOBJECTLIST
+ USE ESMF_Mod, WRFU_ATTRIBUTESET => ESMF_ATTRIBUTESET
+ USE ESMF_Mod, WRFU_ATTRIBUTESETLIST => ESMF_ATTRIBUTESETLIST
+ USE ESMF_Mod, WRFU_ATTRIBUTESETOBJECTLIST => ESMF_ATTRIBUTESETOBJECTLIST
+ USE ESMF_Mod, WRFU_AXISINDEX => ESMF_AXISINDEX
+ USE ESMF_Mod, WRFU_AXISINDEXGET => ESMF_AXISINDEXGET
+ USE ESMF_Mod, WRFU_BAD_POINTER => ESMF_BAD_POINTER
+ USE ESMF_Mod, WRFU_BASE => ESMF_BASE
+ USE ESMF_Mod, WRFU_BASETIME => ESMF_BASETIME
+ USE ESMF_Mod, WRFU_CALENDAR => ESMF_CALENDAR
+ USE ESMF_Mod, WRFU_CALENDARTYPE => ESMF_CALENDARTYPE
+ USE ESMF_Mod, WRFU_CAL_360DAY => ESMF_CAL_360DAY
+ USE ESMF_Mod, WRFU_CAL_GREGORIAN => ESMF_CAL_GREGORIAN
+ USE ESMF_Mod, WRFU_CAL_NOCALENDAR => ESMF_CAL_NOCALENDAR
+ USE ESMF_Mod, WRFU_CAL_NOLEAP => ESMF_CAL_NOLEAP
+ USE ESMF_Mod, WRFU_CLOCK => ESMF_CLOCK
+ USE ESMF_Mod, WRFU_CLOCKADDALARM => ESMF_CLOCKADDALARM
+ USE ESMF_Mod, WRFU_CLOCKADVANCE => ESMF_CLOCKADVANCE
+ USE ESMF_Mod, WRFU_CLOCKCREATE => ESMF_CLOCKCREATE
+ USE ESMF_Mod, WRFU_CLOCKDESTROY => ESMF_CLOCKDESTROY
+ USE ESMF_Mod, WRFU_CLOCKGET => ESMF_CLOCKGET
+ USE ESMF_Mod, WRFU_CLOCKGETALARMLIST => ESMF_CLOCKGETALARMLIST
+ USE ESMF_Mod, WRFU_CLOCKISSTOPTIME => ESMF_CLOCKISSTOPTIME
+ USE ESMF_Mod, WRFU_CLOCKPRINT => ESMF_CLOCKPRINT
+ USE ESMF_Mod, WRFU_CLOCKSET => ESMF_CLOCKSET
+ USE ESMF_Mod, WRFU_CLOCKSTOPTIMEDISABLE => ESMF_CLOCKSTOPTIMEDISABLE
+ USE ESMF_Mod, WRFU_CLOCKVALIDATE => ESMF_CLOCKVALIDATE
+ USE ESMF_Mod, WRFU_DATATYPE => ESMF_DATATYPE
+ USE ESMF_Mod, WRFU_DATATYPESTRING => ESMF_DATATYPESTRING
+ USE ESMF_Mod, WRFU_DATAVALUE => ESMF_DATAVALUE
+ USE ESMF_Mod, WRFU_DATA_CHARACTER => ESMF_DATA_CHARACTER
+ USE ESMF_Mod, WRFU_DATA_INTEGER => ESMF_DATA_INTEGER
+ USE ESMF_Mod, WRFU_DATA_LOGICAL => ESMF_DATA_LOGICAL
+ USE ESMF_Mod, WRFU_DATA_REAL => ESMF_DATA_REAL
+ USE ESMF_Mod, WRFU_FAILURE => ESMF_FAILURE
+ USE ESMF_Mod, WRFU_FINALIZE => ESMF_FINALIZE
+ USE ESMF_Mod, WRFU_FRACTION => ESMF_FRACTION
+ USE ESMF_Mod, WRFU_GETNAME => ESMF_GETNAME
+ USE ESMF_Mod, WRFU_GETPOINTER => ESMF_GETPOINTER
+ USE ESMF_Mod, WRFU_GRID => ESMF_GRID
+ USE ESMF_Mod, WRFU_GRIDCOMP => ESMF_GRIDCOMP
+ USE ESMF_Mod, WRFU_INITIALIZE => ESMF_INITIALIZE
+ USE ESMF_Mod, WRFU_ISINITIALIZED => ESMF_ISINITIALIZED
+ USE ESMF_Mod, WRFU_KIND_C16 => ESMF_KIND_C16
+ USE ESMF_Mod, WRFU_KIND_C8 => ESMF_KIND_C8
+ USE ESMF_Mod, WRFU_KIND_I1 => ESMF_KIND_I1
+ USE ESMF_Mod, WRFU_KIND_I2 => ESMF_KIND_I2
+ USE ESMF_Mod, WRFU_KIND_I4 => ESMF_KIND_I4
+ USE ESMF_Mod, WRFU_KIND_I8 => ESMF_KIND_I8
+ USE ESMF_Mod, WRFU_KIND_R4 => ESMF_KIND_R4
+ USE ESMF_Mod, WRFU_KIND_R8 => ESMF_KIND_R8
+ USE ESMF_Mod, WRFU_LOG => ESMF_LOG
+ USE ESMF_Mod, WRFU_LOGICAL => ESMF_LOGICAL
+ USE ESMF_Mod, WRFU_LOGWRITE => ESMF_LOGWRITE
+ USE ESMF_Mod, WRFU_LOG_ERROR => ESMF_LOG_ERROR
+ USE ESMF_Mod, WRFU_LOG_INFO => ESMF_LOG_INFO
+ USE ESMF_Mod, WRFU_LOG_WARNING => ESMF_LOG_WARNING
+ USE ESMF_Mod, WRFU_MAJOR_VERSION => ESMF_MAJOR_VERSION
+ USE ESMF_Mod, WRFU_MAXDECOMPDIM => ESMF_MAXDECOMPDIM
+ USE ESMF_Mod, WRFU_MAXDIM => ESMF_MAXDIM
+ USE ESMF_Mod, WRFU_MAXGRIDDIM => ESMF_MAXGRIDDIM
+ USE ESMF_Mod, WRFU_MAXSTR => ESMF_MAXSTR
+ USE ESMF_Mod, WRFU_MINOR_VERSION => ESMF_MINOR_VERSION
+ USE ESMF_Mod, WRFU_MSGTYPE => ESMF_MSGTYPE
+ USE ESMF_Mod, WRFU_NULL_POINTER => ESMF_NULL_POINTER
+ USE ESMF_Mod, WRFU_POINTER => ESMF_POINTER
+ USE ESMF_Mod, WRFU_REVISION => ESMF_REVISION
+ USE ESMF_Mod, WRFU_SETNAME => ESMF_SETNAME
+ USE ESMF_Mod, WRFU_SETNULLPOINTER => ESMF_SETNULLPOINTER
+ USE ESMF_Mod, WRFU_SETPOINTER => ESMF_SETPOINTER
+ USE ESMF_Mod, WRFU_STATE => ESMF_STATE
+ USE ESMF_Mod, WRFU_STATE_INVALID => ESMF_STATE_INVALID
+ USE ESMF_Mod, WRFU_STATUS => ESMF_STATUS
+ USE ESMF_Mod, WRFU_STATUSSTRING => ESMF_STATUSSTRING
+ USE ESMF_Mod, WRFU_SUCCESS => ESMF_SUCCESS
+ USE ESMF_Mod, WRFU_TIME => ESMF_TIME
+ USE ESMF_Mod, WRFU_TIMEEQ => ESMF_TIMEEQ
+ USE ESMF_Mod, WRFU_TIMEGET => ESMF_TIMEGET
+ USE ESMF_Mod, WRFU_TIMEINTERVAL => ESMF_TIMEINTERVAL
+ USE ESMF_Mod, WRFU_TIMEINTERVALABSVALUE => ESMF_TIMEINTERVALABSVALUE
+ USE ESMF_Mod, WRFU_TIMEINTERVALDIVQUOT => ESMF_TIMEINTERVALDIVQUOT
+ USE ESMF_Mod, WRFU_TIMEINTERVALGET => ESMF_TIMEINTERVALGET
+ USE ESMF_Mod, WRFU_TIMEINTERVALNEGABSVALUE => ESMF_TIMEINTERVALNEGABSVALUE
+ USE ESMF_Mod, WRFU_TIMEINTERVALSET => ESMF_TIMEINTERVALSET
+ USE ESMF_Mod, WRFU_TIMESET => ESMF_TIMESET
+ USE ESMF_Mod, WRFU_VERSION_STRING => ESMF_VERSION_STRING
+ USE ESMF_Mod, WRFU_VM => ESMF_VM
+
+ END MODULE module_symbols_util
+
Deleted: branches/atmos_physics/src/external/esmf_time_f90/module_utility.F90
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/module_utility.F90        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/module_utility.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,7 +0,0 @@
-
- MODULE module_utility
-
- USE module_symbols_util
-
- END MODULE module_utility
-
Copied: branches/atmos_physics/src/external/esmf_time_f90/module_utility.F90 (from rev 968, trunk/mpas/src/external/esmf_time_f90/module_utility.F90)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/module_utility.F90         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/module_utility.F90        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,7 @@
+
+ MODULE module_utility
+
+ USE module_symbols_util
+
+ END MODULE module_utility
+
Deleted: branches/atmos_physics/src/external/esmf_time_f90/testall.csh
===================================================================
--- trunk/mpas/src/external/esmf_time_f90/testall.csh        2011-08-30 22:18:11 UTC (rev 968)
+++ branches/atmos_physics/src/external/esmf_time_f90/testall.csh        2011-09-07 00:23:57 UTC (rev 979)
@@ -1,46 +0,0 @@
-#!/bin/csh
-#
-# Build and run Test1.exe and compare results with known-good output
-#
-set selflong = $0
-set self = $selflong:t
-
-if ( ! -f ../../configure.wrf ) then
- echo "ERROR: must run ../../configure before building esmf_time_f90 unit tests"
- exit -1
-endif
-
-# build
-set allpass = "true"
-make superclean >& /dev/null
-cd ../.. ; make esmf_time_f90_only >&! external/esmf_time_f90/make_tests.out ; cd external/esmf_time_f90
-# run tests for both ESMF_ and WRFU_ interfaces...
-set testoutok = "Test1.out.correct"
-foreach tst ( "ESMF" "WRFU" )
- set testname = "Test1_${tst}"
- ./${testname}.exe >&! ${testname}.out || echo "ERROR ${testname}: failed to execute ./${testname}.exe, see make_tests.out" && exit 20
- # evaluate test results
- diff ${testoutok} ${testname}.out >& /dev/null
- set ok = $status
- if ( $ok == 0 ) then
- echo "PASS ${testname}"
- else
- set allpass = "false"
- echo
- echo "FAIL ${testname}"
- echo
- which xxdiff >& /dev/null
- set ok = $status
- if ( $ok == 0 ) then
- xxdiff ${testoutok} ${testname}.out
- else
- diff ${testoutok} ${testname}.out
- endif
- endif
-end
-# clean up if all tests passed
-if ( $allpass == "true" ) then
-# make testclean >& /dev/null
- make superclean >& /dev/null
-endif
-
Copied: branches/atmos_physics/src/external/esmf_time_f90/testall.csh (from rev 968, trunk/mpas/src/external/esmf_time_f90/testall.csh)
===================================================================
--- branches/atmos_physics/src/external/esmf_time_f90/testall.csh         (rev 0)
+++ branches/atmos_physics/src/external/esmf_time_f90/testall.csh        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,46 @@
+#!/bin/csh
+#
+# Build and run Test1.exe and compare results with known-good output
+#
+set selflong = $0
+set self = $selflong:t
+
+if ( ! -f ../../configure.wrf ) then
+ echo "ERROR: must run ../../configure before building esmf_time_f90 unit tests"
+ exit -1
+endif
+
+# build
+set allpass = "true"
+make superclean >& /dev/null
+cd ../.. ; make esmf_time_f90_only >&! external/esmf_time_f90/make_tests.out ; cd external/esmf_time_f90
+# run tests for both ESMF_ and WRFU_ interfaces...
+set testoutok = "Test1.out.correct"
+foreach tst ( "ESMF" "WRFU" )
+ set testname = "Test1_${tst}"
+ ./${testname}.exe >&! ${testname}.out || echo "ERROR ${testname}: failed to execute ./${testname}.exe, see make_tests.out" && exit 20
+ # evaluate test results
+ diff ${testoutok} ${testname}.out >& /dev/null
+ set ok = $status
+ if ( $ok == 0 ) then
+ echo "PASS ${testname}"
+ else
+ set allpass = "false"
+ echo
+ echo "FAIL ${testname}"
+ echo
+ which xxdiff >& /dev/null
+ set ok = $status
+ if ( $ok == 0 ) then
+ xxdiff ${testoutok} ${testname}.out
+ else
+ diff ${testoutok} ${testname}.out
+ endif
+ endif
+end
+# clean up if all tests passed
+if ( $allpass == "true" ) then
+# make testclean >& /dev/null
+ make superclean >& /dev/null
+endif
+
Modified: branches/atmos_physics/src/framework/Makefile
===================================================================
--- branches/atmos_physics/src/framework/Makefile        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/framework/Makefile        2011-09-07 00:23:57 UTC (rev 979)
@@ -6,6 +6,7 @@
OBJS = module_mpas_framework.o \
module_timer.o \
+ module_mpas_timekeeping.o \
module_configure.o \
module_constants.o \
module_grid_types.o \
@@ -33,7 +34,7 @@
module_block_decomp.o: module_grid_types.o module_hash.o module_configure.o
-module_io_input.o: module_grid_types.o module_dmpar.o module_block_decomp.o module_sort.o module_configure.o $(ZOLTANOBJ)
+module_io_input.o: module_grid_types.o module_dmpar.o module_block_decomp.o module_sort.o module_configure.o module_mpas_timekeeping.o $(ZOLTANOBJ)
module_io_output.o: module_grid_types.o module_dmpar.o module_sort.o module_configure.o
@@ -43,7 +44,7 @@
.F.o:
        $(RM) $@ $*.mod
        $(CPP) $(CPPFLAGS) $(CPPINCLUDES) $< > $*.f90
-        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES)
+        $(FC) $(FFLAGS) -c $*.f90 $(FCINCLUDES) -I../external/esmf_time_f90
.c.o:
        $(CC) $(CFLAGS) $(CPPFLAGS) $(CPPINCLUDES) -c $<
Modified: branches/atmos_physics/src/framework/module_grid_types.F
===================================================================
--- branches/atmos_physics/src/framework/module_grid_types.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/framework/module_grid_types.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -65,6 +65,22 @@
end type field1DInteger
+ ! Derived type for storing fields
+ type field1DChar
+ type (block_type), pointer :: block
+ character (len=64), dimension(:), pointer :: array
+ type (io_info), pointer :: ioinfo
+ end type field1DChar
+
+
+ ! Derived type for storing fields
+ type field0DChar
+ type (block_type), pointer :: block
+ character (len=64) :: scalar
+ type (io_info), pointer :: ioinfo
+ end type field0DChar
+
+
! Derived type for storing grid meta-data
type mesh_type
Modified: branches/atmos_physics/src/framework/module_io_input.F
===================================================================
--- branches/atmos_physics/src/framework/module_io_input.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/framework/module_io_input.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -5,7 +5,9 @@
use block_decomp
use sort
use configure
+ use mpas_timekeeping
+
#ifdef HAVE_ZOLTAN
use zoltan_interface
#endif
@@ -30,6 +32,8 @@
module procedure io_input_field3dReal
module procedure io_input_field1dInteger
module procedure io_input_field2dInteger
+ module procedure io_input_field0dChar
+ module procedure io_input_field1dChar
end interface io_input_field
interface io_input_field_time
@@ -38,6 +42,8 @@
module procedure io_input_field2dReal_time
module procedure io_input_field3dReal_time
module procedure io_input_field1dInteger_time
+ module procedure io_input_field0dChar_time
+ module procedure io_input_field1dChar_time
end interface io_input_field_time
type (exchange_list), pointer :: sendCellList, recvCellList
@@ -85,7 +91,7 @@
#endif
#endif
- type (field1dReal) :: xtime
+ type (field1DChar) :: xtime
integer, dimension(:), pointer :: indexToCellID_0Halo
integer, dimension(:), pointer :: nEdgesOnCell_0Halo
@@ -117,8 +123,11 @@
type (graph) :: block_graph_0Halo, block_graph_1Halo, block_graph_2Halo
integer :: ghostEdgeStart, ghostVertexStart
- real (kind=RKIND) :: tdiff
- integer :: idxTdiff
+ type (MPAS_Time_type) :: startTime
+ type (MPAS_Time_type) :: sliceTime
+ type (MPAS_TimeInterval_type) :: timeDiff
+ type (MPAS_TimeInterval_type) :: minTimeDiff
+ character(len=32) :: timeStamp
if (config_do_restart) then
input_obj % filename = trim(config_restart_name)
@@ -751,25 +760,29 @@
xtime % ioinfo % fieldName = 'xtime'
call io_input_field(input_obj, xtime)
- tdiff = 1.E20
+ call MPAS_setTimeInterval(interval=minTimeDiff, DD=10000)
+ call MPAS_setTime(curr_time=startTime, dateTimeString=config_start_time)
+
do i=1,input_obj % rdLocalTime
- if (abs(xtime % array(i) - config_restart_time) < tdiff) then
+ call MPAS_setTime(curr_time=sliceTime, dateTimeString=xtime % array(i))
+ timeDiff = abs(sliceTime - startTime)
+ if (timeDiff < minTimeDiff) then
+ minTimeDiff = timeDiff
input_obj % time = i
- tdiff = abs(xtime % array(i) - config_restart_time)
end if
end do
- tdiff = xtime % array(input_obj % time)
+ timeStamp = xtime % array(input_obj % time)
deallocate(xtime % ioinfo)
deallocate(xtime % array)
end if
call dmpar_bcast_int(domain % dminfo, input_obj % time)
- call dmpar_bcast_real(domain % dminfo, tdiff)
+ call dmpar_bcast_char(domain % dminfo, timeStamp)
- write(0,*) 'Restarting model from time ', tdiff
-
+ write(0,*) 'Restarting model from time ', timeStamp
+
end if
@@ -1019,6 +1032,8 @@
type (field1dReal) :: real1d
type (field2dReal) :: real2d
type (field3dReal) :: real3d
+ type (field0dChar) :: char0d
+ type (field1dChar) :: char1d
integer :: i1, i2, i3, i4
@@ -1028,6 +1043,8 @@
real (kind=RKIND), dimension(:), pointer :: super_real1d
real (kind=RKIND), dimension(:,:), pointer :: super_real2d
real (kind=RKIND), dimension(:,:,:), pointer :: super_real3d
+ character (len=64) :: super_char0d
+ character (len=64), dimension(:), pointer :: super_char1d
integer :: i, k
@@ -1039,6 +1056,8 @@
allocate(real1d % ioinfo)
allocate(real2d % ioinfo)
allocate(real3d % ioinfo)
+ allocate(char0d % ioinfo)
+ allocate(char1d % ioinfo)
#include "io_input_fields.inc"
@@ -1467,6 +1486,116 @@
end subroutine io_input_field1dInteger_time
+ subroutine io_input_field0dChar_time(input_obj, field)
+
+ implicit none
+
+ type (io_input_object), intent(in) :: input_obj
+ type (field0dChar), intent(inout) :: field
+
+ include 'netcdf.inc'
+
+ integer :: nferr
+ integer :: varID
+ integer, dimension(2) :: start1, count1
+
+ start1(1) = 1
+ count1(1) = 64
+ start1(2) = input_obj % time
+ count1(2) = 1
+
+#include "input_field0dchar_time.inc"
+
+ nferr = nf_get_vara_text(input_obj % rd_ncid, varID, start1, count1, field % scalar)
+
+ end subroutine io_input_field0dChar_time
+
+
+ subroutine io_input_field1dChar_time(input_obj, field)
+
+ implicit none
+
+ type (io_input_object), intent(in) :: input_obj
+ type (field1dChar), intent(inout) :: field
+
+ include 'netcdf.inc'
+
+ integer :: nferr
+ integer :: varID
+ integer, dimension(3) :: start2, count2
+
+ start2(1) = 1
+ start2(2) = field % ioinfo % start(1)
+ start2(3) = input_obj % time
+ count2(1) = 64
+ count2(2) = field % ioinfo % count(1)
+ count2(3) = 1
+
+#include "input_field1dchar_time.inc"
+
+ nferr = nf_get_vara_text(input_obj % rd_ncid, varID, start2, count2, field % array)
+
+ end subroutine io_input_field1dChar_time
+
+
+ subroutine io_input_field0dChar(input_obj, field)
+
+ implicit none
+
+ type (io_input_object), intent(in) :: input_obj
+ type (field0dChar), intent(inout) :: field
+
+ include 'netcdf.inc'
+
+ integer :: nferr
+ integer :: varID
+ integer, dimension(2) :: start1, count1
+
+ start1(1) = 1
+ count1(1) = 64
+ start1(2) = 1
+ count1(2) = 1
+
+#include "input_field0dchar.inc"
+
+ nferr = nf_get_vara_text(input_obj % rd_ncid, varID, start1, count1, field % scalar)
+
+ end subroutine io_input_field0dChar
+
+
+ subroutine io_input_field1dChar(input_obj, field)
+
+ implicit none
+
+ type (io_input_object), intent(in) :: input_obj
+ type (field1dChar), intent(inout) :: field
+
+ include 'netcdf.inc'
+
+ integer :: nferr
+ integer :: varID
+ integer, dimension(2) :: start1, count1
+
+ start1(1) = 1
+ count1(1) = 64
+ start1(2) = field % ioinfo % start(1)
+ count1(2) = field % ioinfo % count(1)
+
+ !
+ ! Special case: we may want to read the xtime variable across the
+ ! time dimension as a 1d array.
+ !
+ if (trim(field % ioinfo % fieldName) == 'xtime') then
+ varID = input_obj % rdVarIDxtime
+ end if
+
+#include "input_field1dchar.inc"
+
+ nferr = nf_get_vara_text(input_obj % rd_ncid, varID, start1, count1, field % array)
+
+ end subroutine io_input_field1dChar
+
+
subroutine io_input_finalize(input_obj, dminfo)
implicit none
Modified: branches/atmos_physics/src/framework/module_io_output.F
===================================================================
--- branches/atmos_physics/src/framework/module_io_output.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/framework/module_io_output.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -17,6 +17,7 @@
integer :: stream
+ integer :: wrDimIDStrLen
#include "io_output_obj_decls.inc"
logical :: validExchangeLists
@@ -34,6 +35,8 @@
module procedure io_output_field3dReal
module procedure io_output_field1dInteger
module procedure io_output_field2dInteger
+ module procedure io_output_field0dChar
+ module procedure io_output_field1dChar
end interface io_output_field
interface io_output_field_time
@@ -42,20 +45,25 @@
module procedure io_output_field2dReal_time
module procedure io_output_field3dReal_time
module procedure io_output_field1dInteger_time
+ module procedure io_output_field0dChar_time
+ module procedure io_output_field1dChar_time
end interface io_output_field_time
contains
- subroutine output_state_init(output_obj, domain, stream)
+ subroutine output_state_init(output_obj, domain, stream, outputSuffix)
implicit none
type (io_output_object), intent(inout) :: output_obj
type (domain_type), intent(in) :: domain
character (len=*) :: stream
+ character (len=*), optional :: outputSuffix
+ character (len=128) :: tempfilename
+
type (block_type), pointer :: block_ptr
#include "output_dim_actual_decls.inc"
@@ -78,7 +86,12 @@
nVertLevelsGlobal = block_ptr % mesh % nVertLevels
if (trim(stream) == 'OUTPUT') then
- output_obj % filename = trim(config_output_name)
+ if(present(outputSuffix)) then
+ call insert_string_suffix(config_output_name, outputSuffix, tempfilename)
+ else
+ tempfilename = config_output_name
+ end if
+ output_obj % filename = trim(tempfilename)
output_obj % stream = OUTPUT
else if (trim(stream) == 'RESTART') then
output_obj % filename = trim(config_restart_name)
@@ -95,10 +108,32 @@
block_ptr % mesh, &
#include "output_dim_actual_args.inc"
)
-
+
end subroutine output_state_init
+ subroutine insert_string_suffix(stream, suffix, filename)
+
+ implicit none
+
+ character (len=*), intent(in) :: stream
+ character (len=*), intent(in) :: suffix
+ character (len=*), intent(out) :: filename
+ integer :: length, i
+
+ filename = trim(stream) // '.' // trim(suffix)
+
+ length = len_trim(stream)
+ do i=length-1,1,-1
+ if(stream(i:i) == '.') then
+ filename = trim(stream(:i)) // trim(suffix) // trim(stream(i:))
+ exit
+ end if
+ end do
+
+ end subroutine insert_string_suffix
+
+
subroutine output_state_for_domain(output_obj, domain, itime)
implicit none
@@ -127,15 +162,19 @@
type (field1dReal) :: real1d
type (field2dReal) :: real2d
type (field3dReal) :: real3d
+ type (field0dChar) :: char0d
+ type (field1dChar) :: char1d
integer :: i1, i2, i3, i4
integer, dimension(:), pointer :: super_int1d
integer, dimension(:,:), pointer :: super_int2d
- real :: super_real0d
+ real (kind=RKIND) :: super_real0d
real (kind=RKIND), dimension(:), pointer :: super_real1d
real (kind=RKIND), dimension(:,:), pointer :: super_real2d
real (kind=RKIND), dimension(:,:,:), pointer :: super_real3d
+ character (len=64) :: super_char0d
+ character (len=64), dimension(:), pointer :: super_char1d
#include "nondecomp_outputs.inc"
@@ -147,6 +186,8 @@
allocate(real1d % ioinfo)
allocate(real2d % ioinfo)
allocate(real3d % ioinfo)
+ allocate(char0d % ioinfo)
+ allocate(char1d % ioinfo)
call dmpar_sum_int(domain % dminfo, domain % blocklist % mesh % nCellsSolve, nCellsGlobal)
call dmpar_sum_int(domain % dminfo, domain % blocklist % mesh % nEdgesSolve, nEdgesGlobal)
@@ -345,6 +386,7 @@
nferr = nf_create(trim(output_obj % filename), NF_CLOBBER, output_obj % wr_ncid)
#endif
+ nferr = nf_def_dim(output_obj % wr_ncid, 'StrLen', 64, output_obj % wrDimIDStrLen)
#include "netcdf_def_dims_vars.inc"
if (mesh % on_a_sphere) then
@@ -693,6 +735,116 @@
end subroutine io_output_field1dInteger_time
+ subroutine io_output_field0dChar_time(output_obj, field)
+
+ implicit none
+
+ type (io_output_object), intent(in) :: output_obj
+ type (field0dChar), intent(inout) :: field
+
+ include 'netcdf.inc'
+
+ integer :: nferr
+ integer :: varID
+ integer, dimension(2) :: start1, count1
+
+ start1(1) = 1
+ count1(1) = 64
+ start1(2) = output_obj % time
+ count1(2) = 1
+
+#include "output_field0dchar_time.inc"
+
+ nferr = nf_put_vara_text(output_obj % wr_ncid, varID, start1, count1, field % scalar)
+
+ nferr = nf_sync(output_obj % wr_ncid)
+
+ end subroutine io_output_field0dChar_time
+
+
+ subroutine io_output_field1dChar_time(output_obj, field)
+
+ implicit none
+
+ type (io_output_object), intent(in) :: output_obj
+ type (field1dChar), intent(inout) :: field
+
+ include 'netcdf.inc'
+
+ integer :: nferr
+ integer :: varID
+ integer, dimension(3) :: start2, count2
+
+ start2(1) = 1
+ start2(2) = field % ioinfo % start(1)
+ start2(3) = output_obj % time
+ count2(1) = 64
+ count2(2) = field % ioinfo % count(1)
+ count2(3) = 1
+
+#include "output_field1dchar_time.inc"
+
+ nferr = nf_put_vara_text(output_obj % wr_ncid, varID, start2, count2, field % array)
+
+ nferr = nf_sync(output_obj % wr_ncid)
+
+ end subroutine io_output_field1dChar_time
+
+
+ subroutine io_output_field0dChar(output_obj, field)
+
+ implicit none
+
+ type (io_output_object), intent(in) :: output_obj
+ type (field0dChar), intent(inout) :: field
+
+ include 'netcdf.inc'
+
+ integer :: nferr
+ integer :: varID
+ integer, dimension(2) :: start1, count1
+
+ start1(1) = 1
+ count1(1) = 64
+ start1(2) = 1
+ count1(2) = 1
+
+#include "output_field0dchar.inc"
+
+ nferr = nf_put_vara_text(output_obj % wr_ncid, varID, start1, count1, field % scalar)
+
+ nferr = nf_sync(output_obj % wr_ncid)
+
+ end subroutine io_output_field0dChar
+
+
+ subroutine io_output_field1dChar(output_obj, field)
+
+ implicit none
+
+ type (io_output_object), intent(in) :: output_obj
+ type (field1dChar), intent(inout) :: field
+
+ include 'netcdf.inc'
+
+ integer :: nferr
+ integer :: varID
+ integer, dimension(2) :: start1, count1
+
+ start1(1) = 1
+ count1(1) = 64
+ start1(2) = field % ioinfo % start(1)
+ count1(2) = field % ioinfo % count(1)
+
+#include "output_field1dchar.inc"
+
+ nferr = nf_put_vara_text(output_obj % wr_ncid, VarID, start1, count1, field % array)
+
+ nferr = nf_sync(output_obj % wr_ncid)
+
+ end subroutine io_output_field1dChar
+
+
subroutine io_output_finalize(output_obj, dminfo)
implicit none
Modified: branches/atmos_physics/src/framework/module_mpas_framework.F
===================================================================
--- branches/atmos_physics/src/framework/module_mpas_framework.F        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/framework/module_mpas_framework.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -6,6 +6,7 @@
use io_output
use configure
use timer
+ use mpas_timekeeping
contains
@@ -24,6 +25,8 @@
call read_namelist(dminfo)
call allocate_domain(domain, dminfo)
+
+ call mpas_timekeeping_init(config_calendar_type)
end subroutine mpas_framework_init
@@ -39,6 +42,8 @@
call dmpar_finalize(dminfo)
+ call mpas_timekeeping_finalize()
+
end subroutine mpas_framework_finalize
end module mpas_framework
Copied: branches/atmos_physics/src/framework/module_mpas_timekeeping.F (from rev 968, trunk/mpas/src/framework/module_mpas_timekeeping.F)
===================================================================
--- branches/atmos_physics/src/framework/module_mpas_timekeeping.F         (rev 0)
+++ branches/atmos_physics/src/framework/module_mpas_timekeeping.F        2011-09-07 00:23:57 UTC (rev 979)
@@ -0,0 +1,1625 @@
+module mpas_timekeeping
+
+ use ESMF_BaseMod
+ use ESMF_Stubs
+ use ESMF_CalendarMod
+ use ESMF_ClockMod
+ use ESMF_TimeMod
+ use ESMF_TimeIntervalMod
+
+ private :: MPAS_CalibrateAlarms
+ private :: MPAS_inRingingEnvelope
+
+ integer, parameter :: MPAS_MAX_ALARMS = 20
+ integer, parameter :: MPAS_NOW = 0, &
+ MPAS_START_TIME = 1, &
+ MPAS_STOP_TIME = 2
+ integer, parameter :: MPAS_FORWARD = 1, &
+ MPAS_BACKWARD = -1
+ integer, parameter :: MPAS_GREGORIAN = 0, &
+ MPAS_GREGORIAN_NOLEAP = 1, &
+ MPAS_360DAY = 2
+
+ integer :: TheCalendar
+
+ integer, dimension(12), parameter :: daysInMonth = (/31,28,31,30,31,30,31,31,30,31,30,31/)
+ integer, dimension(12), parameter :: daysInMonthLeap = (/31,29,31,30,31,30,31,31,30,31,30,31/)
+
+
+ type MPAS_Time_type
+ type (ESMF_Time) :: t
+ end type
+
+ type MPAS_TimeInterval_type
+ type (ESMF_TimeInterval) :: ti
+ end type
+
+ type MPAS_Alarm_type
+ integer :: alarmID
+ logical :: isRecurring
+ logical :: isSet
+ type (MPAS_Time_type) :: ringTime
+ type (MPAS_Time_type) :: prevRingTime
+ type (MPAS_TimeInterval_type) :: ringTimeInterval
+ type (MPAS_Alarm_type), pointer :: next
+ end type
+
+ type MPAS_Clock_type
+ integer :: direction
+ integer :: nAlarms
+ type (ESMF_Clock) :: c
+ type (MPAS_Alarm_type), pointer :: alarmListHead
+ end type
+
+ interface operator (+)
+ module procedure add_t_ti
+ module procedure add_ti_ti
+ end interface
+
+ interface operator (-)
+ module procedure sub_t_t
+ module procedure sub_t_ti
+ module procedure sub_ti_ti
+ module procedure neg_ti
+ end interface
+
+ interface operator (*)
+ module procedure mul_ti_n
+ end interface
+
+ interface operator (/)
+ module procedure div_ti_n
+ end interface
+
+ interface operator (.EQ.)
+ module procedure eq_t_t
+ module procedure eq_ti_ti
+ end interface
+
+ interface operator (.NE.)
+ module procedure ne_t_t
+ module procedure ne_ti_ti
+ end interface
+
+ interface operator (.LT.)
+ module procedure lt_t_t
+ module procedure lt_ti_ti
+ end interface
+
+ interface operator (.GT.)
+ module procedure gt_t_t
+ module procedure gt_ti_ti
+ end interface
+
+ interface operator (.LE.)
+ module procedure le_t_t
+ module procedure le_ti_ti
+ end interface
+
+ interface operator (.GE.)
+ module procedure ge_t_t
+ module procedure ge_ti_ti
+ end interface
+
+ interface abs
+ module procedure abs_ti
+ end interface
+
+
+ contains
+
+
+ subroutine mpas_timekeeping_init(calendar)
+
+ implicit none
+
+ integer, intent(in) :: calendar
+
+ TheCalendar = calendar
+
+ if (TheCalendar == MPAS_GREGORIAN) then
+ call ESMF_Initialize(defaultCalendar=ESMF_CAL_GREGORIAN)
+ else if (TheCalendar == MPAS_GREGORIAN_NOLEAP) then
+ call ESMF_Initialize(defaultCalendar=ESMF_CAL_NOLEAP)
+ else if (TheCalendar == MPAS_360DAY) then
+ call ESMF_Initialize(defaultCalendar=ESMF_CAL_360DAY)
+ else
+ write(0,*) 'ERROR: mpas_timekeeping_init: Invalid calendar type'
+ end if
+
+ end subroutine mpas_timekeeping_init
+
+
+ subroutine mpas_timekeeping_finalize()
+
+ implicit none
+
+ call ESMF_Finalize()
+
+ end subroutine mpas_timekeeping_finalize
+
+
+ subroutine MPAS_createClock(clock, startTime, timeStep, stopTime, runDuration, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(out) :: clock
+ type (MPAS_Time_type), intent(in) :: startTime
+ type (MPAS_TimeInterval_type), intent(in) :: timeStep
+ type (MPAS_Time_type), intent(in), optional :: stopTime
+ type (MPAS_TimeInterval_type), intent(in), optional :: runDuration
+ integer, intent(out), optional :: ierr
+
+ type (MPAS_Time_type) :: stop_time
+
+ if (present(runDuration)) then
+ stop_time = startTime + runDuration
+ if (present(stopTime)) then
+ if (stopTime /= stop_time) then
+ if (present(ierr)) ierr = 1 ! stopTime and runDuration are inconsistent
+ write(0,*) 'ERROR: MPAS_createClock: stopTime and runDuration are inconsistent'
+ return
+ end if
+ end if
+ else if (present(stopTime)) then
+ stop_time = stopTime
+ else
+ if (present(ierr)) ierr = 1 ! neither stopTime nor runDuration are specified
+ write(0,*) 'ERROR: MPAS_createClock: neither stopTime nor runDuration are specified'
+ return
+ end if
+
+ clock % c = ESMF_ClockCreate(TimeStep=timeStep%ti, StartTime=startTime%t, StopTime=stop_time%t, rc=ierr)
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+ clock % direction = MPAS_FORWARD
+ clock % nAlarms = 0
+ nullify(clock % alarmListHead)
+
+ end subroutine MPAS_createClock
+
+
+ subroutine MPAS_destroyClock(clock, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(inout) :: clock
+ integer, intent(out), optional :: ierr
+
+ type (MPAS_Alarm_type), pointer :: alarmPtr
+
+ alarmPtr => clock % alarmListHead
+ do while (associated(alarmPtr))
+ clock % alarmListHead => alarmPtr % next
+ deallocate(alarmPtr)
+ alarmPtr => clock % alarmListHead
+ end do
+
+ call ESMF_ClockDestroy(clock % c, rc=ierr)
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ end subroutine MPAS_destroyClock
+
+
+ logical function MPAS_isClockStartTime(clock, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(in) :: clock
+ integer, intent(out), optional :: ierr
+
+ type (ESMF_Time) :: currTime, startTime, stopTime
+
+ call ESMF_ClockGet(clock % c, CurrTime=currTime, rc=ierr)
+ call ESMF_ClockGet(clock % c, StartTime=startTime, rc=ierr)
+ call ESMF_ClockGet(clock % c, StopTime=stopTime, rc=ierr)
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ if (startTime <= stopTime) then
+ MPAS_isClockStartTime = (currTime <= startTime)
+ else
+ MPAS_isClockStartTime = (currTime >= startTime)
+ end if
+
+ end function MPAS_isClockStartTime
+
+
+ logical function MPAS_isClockStopTime(clock, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(in) :: clock
+ integer, intent(out), optional :: ierr
+
+ type (ESMF_Time) :: currTime, startTime, stopTime
+
+ call ESMF_ClockGet(clock % c, CurrTime=currTime, rc=ierr)
+ call ESMF_ClockGet(clock % c, StartTime=startTime, rc=ierr)
+ call ESMF_ClockGet(clock % c, StopTime=stopTime, rc=ierr)
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ if (startTime <= stopTime) then
+ MPAS_isClockStopTime = (currTime >= stopTime)
+ else
+ MPAS_isClockStopTime = (currTime <= stopTime)
+ end if
+
+ end function MPAS_isClockStopTime
+
+
+ subroutine MPAS_setClockDirection(clock, direction, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(inout) :: clock
+ integer, intent(in) :: direction
+ integer, intent(out), optional :: ierr
+
+ type (MPAS_TimeInterval_type) :: timeStep
+
+ if (direction == MPAS_FORWARD .and. clock % direction == MPAS_FORWARD) return
+ if (direction == MPAS_BACKWARD .and. clock % direction == MPAS_BACKWARD) return
+
+ clock % direction = direction
+ call ESMF_ClockGet(clock % c, TimeStep=timeStep%ti, rc=ierr)
+ timeStep = neg_ti(timeStep)
+ call ESMF_ClockSet(clock % c, TimeStep=timeStep%ti, rc=ierr)
+
+ ! specify a valid previousRingTime for each alarm
+ call MPAS_CalibrateAlarms(clock, ierr);
+
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ end subroutine MPAS_setClockDirection
+
+
+
+ integer function MPAS_getClockDirection(clock, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(in) :: clock
+ integer, intent(out), optional :: ierr
+
+ if (present(ierr)) ierr = 0
+
+ MPAS_getClockDirection = clock % direction
+
+ end function MPAS_getClockDirection
+
+
+ subroutine MPAS_setClockTimeStep(clock, timeStep, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(inout) :: clock
+ type (MPAS_TimeInterval_type), intent(in) :: timeStep
+ integer, intent(out), optional :: ierr
+
+ call ESMF_ClockSet(clock % c, TimeStep=timeStep%ti, rc=ierr)
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ end subroutine MPAS_setClockTimeStep
+
+
+ type (MPAS_TimeInterval_type) function MPAS_getClockTimeStep(clock, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(in) :: clock
+ integer, intent(out), optional :: ierr
+
+ type (MPAS_TimeInterval_type) :: timeStep
+
+ call ESMF_ClockGet(clock % c, TimeStep=timeStep%ti, rc=ierr)
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ MPAS_getClockTimeStep = timeStep
+
+ end function MPAS_getClockTimeStep
+
+
+ subroutine MPAS_advanceClock(clock, timeStep, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(inout) :: clock
+ type (MPAS_TimeInterval_type), intent(in), optional :: timeStep
+ integer, intent(out), optional :: ierr
+
+ type (ESMF_TimeInterval) :: time_step
+
+ if (present(timeStep)) then
+ call ESMF_ClockGet(clock % c, TimeStep=time_step, rc=ierr)
+ call ESMF_ClockSet(clock % c, TimeStep=timeStep % ti, rc=ierr)
+ call ESMF_ClockAdvance(clock % c, rc=ierr)
+ call ESMF_ClockSet(clock % c, TimeStep=time_step, rc=ierr)
+ else
+ call ESMF_ClockAdvance(clock % c, rc=ierr)
+ end if
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ end subroutine MPAS_advanceClock
+
+
+ subroutine MPAS_setClockTime(clock, clock_time, whichTime, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(inout) :: clock
+ type (MPAS_Time_type), intent(in) :: clock_time
+ integer, intent(in) :: whichTime
+ integer, intent(out), optional :: ierr
+
+ if (whichTime == MPAS_NOW) then
+ call ESMF_ClockSet(clock % c, CurrTime=clock_time%t, rc=ierr)
+ call MPAS_CalibrateAlarms(clock, ierr);
+ else if (whichTime == MPAS_START_TIME) then
+ call ESMF_ClockSet(clock % c, StartTime=clock_time%t, rc=ierr)
+ else if (whichTime == MPAS_STOP_TIME) then
+ call ESMF_ClockSet(clock % c, StopTime=clock_time%t, rc=ierr)
+ else if (present(ierr)) then
+ ierr = 1
+ end if
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ end subroutine MPAS_setClockTime
+
+
+ type (MPAS_Time_type) function MPAS_getClockTime(clock, whichTime, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(in) :: clock
+ integer, intent(in) :: whichTime
+ integer, intent(out), optional :: ierr
+
+ type (MPAS_Time_type) :: clock_time
+
+ if (whichTime == MPAS_NOW) then
+ call ESMF_ClockGet(clock % c, CurrTime=clock_time%t, rc=ierr)
+ else if (whichTime == MPAS_START_TIME) then
+ call ESMF_ClockGet(clock % c, StartTime=clock_time%t, rc=ierr)
+ else if (whichTime == MPAS_STOP_TIME) then
+ call ESMF_ClockGet(clock % c, StopTime=clock_time%t, rc=ierr)
+ else if (present(ierr)) then
+ ierr = 1
+ end if
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ MPAS_getClockTime = clock_time
+
+ end function MPAS_getClockTime
+
+
+ subroutine MPAS_addClockAlarm(clock, alarmID, alarmTime, alarmTimeInterval, ierr)
+! TODO: possibly add a stop time for recurring alarms
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(inout) :: clock
+ integer, intent(in) :: alarmID
+ type (MPAS_Time_type), intent(in) :: alarmTime
+ type (MPAS_TimeInterval_type), intent(in), optional :: alarmTimeInterval
+ integer, intent(out), optional :: ierr
+
+ type (MPAS_Alarm_type), pointer :: alarmPtr
+
+ ! Add a new entry to the linked list of alarms for this clock
+ if (.not. associated(clock % alarmListHead)) then
+ allocate(clock % alarmListHead)
+ nullify(clock % alarmListHead % next)
+ alarmPtr => clock % alarmListHead
+ else
+ alarmPtr => clock % alarmListHead
+ do while (associated(alarmPtr % next))
+ if (alarmPtr % alarmID == alarmID) then
+ write(0,*) 'OOPS -- we have a duplicate alarmID', alarmID
+ if (present(ierr)) ierr = 1
+ return
+ end if
+ alarmPtr => alarmPtr % next
+ end do
+ if (alarmPtr % alarmID == alarmID) then
+ write(0,*) 'OOPS -- we have a duplicate alarmID', alarmID
+ if (present(ierr)) ierr = 1
+ return
+ end if
+ allocate(alarmPtr % next)
+ alarmPtr => alarmPtr % next
+ nullify(alarmPtr % next)
+ end if
+
+ alarmPtr % alarmID = alarmID
+
+ clock % nAlarms = clock % nAlarms + 1
+
+ alarmPtr % isSet = .true.
+ alarmPtr % ringTime = alarmTime
+
+
+ if (present(alarmTimeInterval)) then
+ alarmPtr % isRecurring = .true.
+ alarmPtr % ringTimeInterval = alarmTimeInterval
+ if(clock % direction == MPAS_FORWARD) then
+ alarmPtr % prevRingTime = alarmTime - alarmTimeInterval
+ else
+ alarmPtr % prevRingTime = alarmTime + alarmTimeInterval
+ end if
+ else
+ alarmPtr % isRecurring = .false.
+ alarmPtr % prevRingTime = alarmTime
+ end if
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ end subroutine MPAS_addClockAlarm
+
+
+ subroutine MPAS_removeClockAlarm(clock, alarmID, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(inout) :: clock
+ integer, intent(in) :: alarmID
+ integer, intent(out), optional :: ierr
+
+ type (MPAS_Alarm_type), pointer :: alarmPtr
+ type (MPAS_Alarm_type), pointer :: alarmParentPtr
+
+ if (present(ierr)) ierr = 0
+
+ alarmPtr => clock % alarmListHead
+ alarmParentPtr = alarmPtr
+ do while (associated(alarmPtr))
+ if (alarmPtr % alarmID == alarmID) then
+ alarmParentPtr % next => alarmPtr % next
+ deallocate(alarmPtr)
+ exit
+ end if
+ alarmParentPtr = alarmPtr
+ alarmPtr => alarmPtr % next
+ end do
+
+ end subroutine MPAS_removeClockAlarm
+
+
+
+ subroutine MPAS_printAlarm(clock, alarmID, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(in) :: clock
+ integer, intent(in) :: alarmID
+ integer, intent(out) :: ierr
+
+ type (MPAS_Alarm_type), pointer :: alarmPtr
+
+ type (MPAS_TimeInterval_type) :: alarmTimeInterval
+ type (MPAS_Time_type) :: alarmTime
+ character (len=32) :: printString
+
+ ierr = 0
+
+ alarmPtr => clock % alarmListHead
+ do while (associated(alarmPtr))
+ if (alarmPtr % alarmID == alarmID) then
+ write(0,*) 'ALARM ', alarmID
+
+ write(0,*) 'isRecurring', alarmPtr % isRecurring
+
+ write(0,*) 'isSet', alarmPtr % isSet
+
+ call MPAS_getTime(alarmPtr % ringTime, dateTimeString=printString, ierr=ierr)
+ write(0,*) 'ringTime', printString
+
+ call MPAS_getTime(alarmPtr % prevRingTime, dateTimeString=printString, ierr=ierr)
+ write(0,*) 'prevRingTime', printString
+
+ call MPAS_getTimeInterval(alarmPtr % ringTimeInterval, timeString=printString, ierr=ierr)
+ write(0,*) 'ringTimeInterval', printString
+
+ exit
+ end if
+ alarmPtr => alarmPtr % next
+ end do
+
+ end subroutine MPAS_printAlarm
+
+
+
+ logical function MPAS_isAlarmRinging(clock, alarmID, interval, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(in) :: clock
+ integer, intent(in) :: alarmID
+ type (MPAS_TimeInterval_type), intent(in), optional :: interval
+ integer, intent(out), optional :: ierr
+
+ type (MPAS_Alarm_type), pointer :: alarmPtr
+
+ if (present(ierr)) ierr = 0
+
+ MPAS_isAlarmRinging = .false.
+
+ alarmPtr => clock % alarmListHead
+ do while (associated(alarmPtr))
+ if (alarmPtr % alarmID == alarmID) then
+ if (alarmPtr % isSet) then
+ if (MPAS_inRingingEnvelope(clock, alarmPtr, interval, ierr)) then
+ MPAS_isAlarmRinging = .true.
+ end if
+ end if
+ exit
+ end if
+ alarmPtr => alarmPtr % next
+ end do
+
+ end function MPAS_isAlarmRinging
+
+
+
+ subroutine MPAS_getClockRingingAlarms(clock, nAlarms, alarmList, interval, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(in) :: clock
+ integer, intent(out) :: nAlarms
+ integer, dimension(MPAS_MAX_ALARMS), intent(out) :: alarmList
+ type (MPAS_TimeInterval_type), intent(in), optional :: interval
+ integer, intent(out), optional :: ierr
+
+ type (MPAS_Alarm_type), pointer :: alarmPtr
+
+ if (present(ierr)) ierr = 0
+
+ nAlarms = 0
+
+ alarmPtr => clock % alarmListHead
+ do while (associated(alarmPtr))
+ if (alarmPtr % isSet) then
+ if (MPAS_inRingingEnvelope(clock, alarmPtr, interval, ierr)) then
+ nAlarms = nAlarms + 1
+ alarmList(nAlarms) = alarmPtr % alarmID
+ end if
+ end if
+ alarmPtr => alarmPtr % next
+ end do
+
+ end subroutine MPAS_getClockRingingAlarms
+
+
+ logical function MPAS_inRingingEnvelope(clock, alarmPtr, interval, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(in) :: clock
+ type (MPAS_Alarm_type), pointer, intent(in) :: alarmPtr
+ type (MPAS_TimeInterval_type), intent(in), optional :: interval
+ integer, intent(out), optional :: ierr
+
+ type (MPAS_Time_type) :: alarmNow
+ type (MPAS_Time_type) :: alarmThreshold
+
+ alarmNow = MPAS_getClockTime(clock, MPAS_NOW, ierr)
+ alarmThreshold = alarmPtr % ringTime
+
+ MPAS_inRingingEnvelope = .false.
+
+ if(clock % direction == MPAS_FORWARD) then
+
+ if (present(interval)) then
+ alarmNow = alarmNow + interval;
+ end if
+
+ if (alarmPtr % isRecurring) then
+ alarmThreshold = alarmPtr % prevRingTime + alarmPtr % ringTimeInterval
+ end if
+
+ if (alarmThreshold <= alarmNow) then
+ MPAS_inRingingEnvelope = .true.
+ end if
+ else
+
+ if (present(interval)) then
+ alarmNow = alarmNow - interval;
+ end if
+
+ if (alarmPtr % isRecurring) then
+ alarmThreshold = alarmPtr % prevRingTime - alarmPtr % ringTimeInterval
+ end if
+
+ if (alarmThreshold >= alarmNow) then
+ MPAS_inRingingEnvelope = .true.
+ end if
+ end if
+
+ end function MPAS_inRingingEnvelope
+
+
+
+ subroutine MPAS_resetClockAlarm(clock, alarmID, interval, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(inout) :: clock
+ integer, intent(in) :: alarmID
+ type (MPAS_TimeInterval_type), intent(in), optional :: interval
+ integer, intent(out), optional :: ierr
+
+ type (MPAS_Time_type) :: alarmNow
+ type (MPAS_Alarm_type), pointer :: alarmPtr
+
+ if (present(ierr)) ierr = 0
+
+ alarmPtr => clock % alarmListHead
+ do while (associated(alarmPtr))
+
+ if (alarmPtr % alarmID == alarmID) then
+
+ if (MPAS_inRingingEnvelope(clock, alarmPtr, interval, ierr)) then
+
+ if (.not. alarmPtr % isRecurring) then
+ alarmPtr % isSet = .false.
+ else
+ alarmNow = MPAS_getClockTime(clock, MPAS_NOW, ierr)
+
+ if(clock % direction == MPAS_FORWARD) then
+ if (present(interval)) then
+ alarmNow = alarmNow + interval
+ end if
+
+ do while(alarmPtr % prevRingTime <= alarmNow)
+ alarmPtr % prevRingTime = alarmPtr % prevRingTime + alarmPtr % ringTimeInterval
+ end do
+ alarmPtr % prevRingTime = alarmPtr % prevRingTime - alarmPtr % ringTimeInterval
+ else
+ if (present(interval)) then
+ alarmNow = alarmNow - interval
+ end if
+
+ do while(alarmPtr % prevRingTime >= alarmNow)
+ alarmPtr % prevRingTime = alarmPtr % prevRingTime - alarmPtr % ringTimeInterval
+ end do
+ alarmPtr % prevRingTime = alarmPtr % prevRingTime + alarmPtr % ringTimeInterval
+ end if
+ end if
+ end if
+ exit
+ end if
+ alarmPtr => alarmPtr % next
+ end do
+
+ end subroutine MPAS_resetClockAlarm
+
+
+
+ ! specify a valid previousRingTime for each alarm
+ subroutine MPAS_CalibrateAlarms(clock, ierr)
+
+ implicit none
+
+ type (MPAS_Clock_type), intent(in) :: clock
+ integer, intent(out), optional :: ierr
+
+ type (MPAS_Time_type) :: now
+ type (MPAS_Time_type) :: previousRingTime
+ type (MPAS_Time_type) :: negativeNeighborRingTime
+ type (MPAS_Time_type) :: positiveNeighborRingTime
+ type (MPAS_TimeInterval_type) :: ringTimeInterval
+ type (MPAS_Alarm_type), pointer :: alarmPtr
+
+ now = MPAS_getClockTime(clock, MPAS_NOW, ierr)
+
+ alarmPtr => clock % alarmListHead
+ do while (associated(alarmPtr))
+
+ if (.not. alarmPtr % isRecurring) then
+ alarmPtr % isSet = .true.
+ else
+
+ previousRingTime = alarmPtr % prevRingTime
+
+ if (previousRingTime <= now) then
+
+ do while(previousRingTime <= now)
+ previousRingTime = previousRingTime + alarmPtr % ringTimeInterval
+ end do
+ positiveNeighborRingTime = previousRingTime
+
+ do while(previousRingTime >= now)
+ previousRingTime = previousRingTime - alarmPtr % ringTimeInterval
+ end do
+ negativeNeighborRingTime = previousRingTime
+
+ else
+
+ do while(previousRingTime >= now)
+ previousRingTime = previousRingTime - alarmPtr % ringTimeInterval
+ end do
+ negativeNeighborRingTime = previousRingTime
+
+ do while(previousRingTime <= now)
+ previousRingTime = previousRingTime + alarmPtr % ringTimeInterval
+ end do
+ positiveNeighborRingTime = previousRingTime
+
+ end if
+
+ if (clock % direction == MPAS_FORWARD) then
+ alarmPtr % prevRingTime = negativeNeighborRingTime
+ else
+ alarmPtr % prevRingTime = positiveNeighborRingTime
+ end if
+
+ end if
+
+ alarmPtr => alarmPtr % next
+
+ end do
+
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ end subroutine MPAS_CalibrateAlarms
+
+
+ subroutine MPAS_setTime(curr_time, YYYY, MM, DD, DoY, H, M, S, S_n, S_d, dateTimeString, ierr)
+
+ implicit none
+
+ type (MPAS_Time_type), intent(out) :: curr_time
+ integer, intent(in), optional :: YYYY
+ integer, intent(in), optional :: MM
+ integer, intent(in), optional :: DD
+ integer, intent(in), optional :: DoY
+ integer, intent(in), optional :: H
+ integer, intent(in), optional :: M
+ integer, intent(in), optional :: S
+ integer, intent(in), optional :: S_n
+ integer, intent(in), optional :: S_d
+ character (len=*), intent(in), optional :: dateTimeString
+ integer, intent(out), optional :: ierr
+
+ integer, parameter :: integerMaxDigits = 8
+ integer :: year, month, day, hour, min, sec
+ integer :: numerator, denominator, denominatorPower
+
+ character (len=50) :: dateTimeString_
+ character (len=50) :: dateSubString
+ character (len=50) :: timeSubString
+ character (len=50) :: secDecSubString
+ character(len=50), pointer, dimension(:) :: subStrings
+
+ if (present(dateTimeString)) then
+
+ dateTimeString_ = dateTimeString
+ numerator = 0
+ denominator = 1
+
+ call SplitString(dateTimeString_, ".", subStrings)
+ if (size(subStrings) == 2) then ! contains second decimals
+ dateTimeString_ = subStrings(1)
+ secDecSubString = subStrings(2)(:integerMaxDigits)
+ deallocate(subStrings)
+ denominatorPower = len_trim(secDecSubString)
+ if(denominatorPower > 0) then
+ read(secDecSubString,*) numerator
+ if(numerator > 0) then
+ denominator = 10**denominatorPower
+ end if
+ end if
+ else if (size(subStrings) /= 1) then
+ deallocate(subStrings)
+ if (present(ierr)) ierr = 1
+ write(0,*) 'ERROR: Invalid DateTime string', dateTimeString
+ return
+ end if
+
+ call SplitString(dateTimeString_, "_", subStrings)
+
+ if(size(subStrings) == 2) then ! contains a date and time
+ dateSubString = subStrings(1)
+ timeSubString = subStrings(2)
+ deallocate(subStrings)
+
+ call SplitString(timeSubString, ":", subStrings)
+
+ if (size(subStrings) == 3) then
+ read(subStrings(1),*) hour
+ read(subStrings(2),*) min
+ read(subStrings(3),*) sec
+ deallocate(subStrings)
+ else
+ deallocate(subStrings)
+ if (present(ierr)) ierr = 1
+ write(0,*) 'ERROR: Invalid DateTime string (invalid time substring)', dateTimeString
+ return
+ end if
+
+ else if(size(subStrings) == 1) then ! contains only a date- assume all time values are 0
+ dateSubString = subStrings(1)
+ deallocate(subStrings)
+
+ hour = 0
+ min = 0
+ sec = 0
+
+ else
+ deallocate(subStrings)
+ if (present(ierr)) ierr = 1
+ write(0,*) 'ERROR: Invalid DateTime string', dateTimeString
+ return
+ end if
+
+ call SplitString(dateSubString, "-", subStrings)
+
+ if (size(subStrings) == 3) then
+ read(subStrings(1),*) year
+ read(subStrings(2),*) month
+ read(subStrings(3),*) day
+ deallocate(subStrings)
+ else
+ deallocate(subStrings)
+ if (present(ierr)) ierr = 1
+ write(0,*) 'ERROR: Invalid DateTime string (invalid date substring)', dateTimeString
+ return
+ end if
+
+ call ESMF_TimeSet(curr_time % t, YY=year, MM=month, DD=day, H=hour, M=min, S=sec, Sn=numerator, Sd=denominator, rc=ierr)
+
+ else
+
+ if (present(DoY)) then
+ call getMonthDay(YYYY, DoY, month, day)
+
+ ! consistency check
+ if (present(MM)) then
+ if (MM /= month) then
+ if (present(ierr)) ierr = 1
+ write(0,*) 'ERROR: MPAS_setTime : DoY and MM are inconsistent - using DoY'
+ end if
+ end if
+ if (present(DD)) then
+ if (DD /= day) then
+ if (present(ierr)) ierr = 1
+ write(0,*) 'ERROR: MPAS_setTime : DoY and DD are inconsistent - using DoY'
+ end if
+ end if
+ else
+ if (present(MM)) then
+ month = MM
+ else
+ if (present(ierr)) ierr = 1
+ write(0,*) 'ERROR: MPAS_setTime : Neither DoY nor MM are specified'
+ return
+ end if
+
+ if (present(DD)) then
+ day = DD
+ else
+ if (present(ierr)) ierr = 1
+ write(0,*) 'ERROR: MPAS_setTime : Neither DoY nor DD are specified'
+ return
+ end if
+ end if
+
+ if (.not. isValidDate(YYYY,month,day)) then
+ write(0,*) 'ERROR: MPAS_setTime : Invalid date'
+ return
+ end if
+
+ call ESMF_TimeSet(curr_time % t, YY=YYYY, MM=month, DD=day, H=H, M=M, S=S, Sn=S_n, Sd=S_d, rc=ierr)
+
+ end if
+
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ end subroutine MPAS_setTime
+
+
+ subroutine MPAS_getTime(curr_time, YYYY, MM, DD, DoY, H, M, S, S_n, S_d, dateTimeString, ierr)
+
+ implicit none
+
+ type (MPAS_Time_type), intent(in) :: curr_time
+ integer, intent(out), optional :: YYYY
+ integer, intent(out), optional :: MM
+ integer, intent(out), optional :: DD
+ integer, intent(out), optional :: DoY
+ integer, intent(out), optional :: H
+ integer, intent(out), optional :: M
+ integer, intent(out), optional :: S
+ integer, intent(out), optional :: S_n
+ integer, intent(out), optional :: S_d
+ character (len=32), intent(out), optional :: dateTimeString
+ integer, intent(out), optional :: ierr
+
+ call ESMF_TimeGet(curr_time % t, YY=YYYY, MM=MM, DD=DD, H=H, M=M, S=S, Sn=S_n, Sd=S_d, rc=ierr)
+ call ESMF_TimeGet(curr_time % t, dayOfYear=DoY, rc=ierr)
+ call ESMF_TimeGet(curr_time % t, timeString=dateTimeString, rc=ierr)
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ end subroutine MPAS_getTime
+
+
+ subroutine MPAS_setTimeInterval(interval, DD, H, M, S, S_n, S_d, timeString, dt, ierr)
+
+ implicit none
+
+ type (MPAS_TimeInterval_type), intent(out) :: interval
+ integer, intent(in), optional :: DD
+ integer, intent(in), optional :: H
+ integer, intent(in), optional :: M
+ integer, intent(in), optional :: S
+ integer, intent(in), optional :: S_n
+ integer, intent(in), optional :: S_d
+ character (len=*), intent(in), optional :: timeString
+ real (kind=RKIND), intent(in), optional :: dt
+ integer, intent(out), optional :: ierr
+
+ integer, parameter :: integerMaxDigits = 8
+ integer :: days, hours, minutes, seconds
+ integer :: numerator, denominator, denominatorPower
+ type (MPAS_TimeInterval_type) :: zeroInterval
+
+ integer :: day, hour, min, sec
+ character (len=50) :: timeString_
+ character (len=50) :: daySubString
+ character (len=50) :: timeSubString
+ character (len=50) :: secDecSubString
+ character(len=50), pointer, dimension(:) :: subStrings
+
+! if (present(DD)) then
+! days = DD
+! else
+! days = 0
+! end if
+
+! if (present(H)) then
+! hours = H
+! else
+! hours = 0
+! end if
+
+! if (present(M)) then
+! minutes = M
+! else
+! minutes = 0
+! end if
+
+! if (present(S)) then
+! seconds = S
+! else
+! seconds = 0
+! end if
+
+
+ !
+ ! Reduce minute count to something less than one hour
+ !
+! do while (minutes > 1440)
+! days = days + 1
+! minutes = minutes - 1440
+! end do
+! do while (minutes > 60)
+! hours = hours + 1
+! minutes = minutes - 60
+! end do
+! do while (minutes < -1440)
+! days = days - 1
+! minutes = minutes + 1440
+! end do
+! do while (minutes < -60)
+! hours = hours - 1
+! minutes = minutes + 60
+! end do
+
+ !
+ ! Reduce hour count to something less than one day
+ !
+! do while (hours > 24)
+! days = days + 1
+! hours = hours - 24
+! end do
+! do while (hours < -24)
+! days = days - 1
+! hours = hours + 24
+! end do
+
+ !
+ ! Any leftover minutes and hours are given to the second count
+ !
+! seconds = seconds + hours*3600 + minutes*60
+
+! call ESMF_TimeIntervalSet(interval % ti, D=days, S=seconds, Sn=S_n, Sd=S_d, rc=ierr)
+
+
+ if (present(timeString) .or. present(dt)) then
+
+
+ if(present(dt)) then
+ write (timeString_,*) "00:00:", dt
+ else
+ timeString_ = timeString
+ end if
+
+ numerator = 0
+ denominator = 1
+
+ call SplitString(timeString_, ".", subStrings)
+
+ if (size(subStrings) == 2) then ! contains second decimals
+ timeString_ = subStrings(1)
+ secDecSubString = subStrings(2)(:integerMaxDigits)
+ deallocate(subStrings)
+
+ denominatorPower = len_trim(secDecSubString)
+ if(denominatorPower > 0) then
+ read(secDecSubString,*) numerator
+ if(numerator > 0) then
+ denominator = 10**denominatorPower
+ end if
+ end if
+ else if (size(subStrings) /= 1) then
+ deallocate(subStrings)
+ if (present(ierr)) ierr = 1
+ write(0,*) 'ERROR: Invalid TimeInterval string', timeString
+ return
+ end if
+
+ call SplitString(timeString_, "_", subStrings)
+
+ if(size(subStrings) == 2) then ! contains a day and time
+ daySubString = subStrings(1)
+ timeSubString = subStrings(2)
+ deallocate(subStrings)
+ read(daySubString,*) day
+ else if(size(subStrings) == 1) then ! contains only a time- assume day is 0
+ timeSubString = subStrings(1)
+ deallocate(subStrings)
+ day = 0
+ else
+ deallocate(subStrings)
+ if (present(ierr)) ierr = 1
+ write(0,*) 'ERROR: Invalid TimeInterval string', timeString
+ return
+ end if
+
+ call SplitString(timeSubString, ":", subStrings)
+
+ if (size(subStrings) == 3) then
+ read(subStrings(1),*) hour
+ read(subStrings(2),*) min
+ read(subStrings(3),*) sec
+ deallocate(subStrings)
+ else
+ deallocate(subStrings)
+ if (present(ierr)) ierr = 1
+ write(0,*) 'ERROR: Invalid TimeInterval string (invalid time substring)', timeString
+ return
+ end if
+
+ call ESMF_TimeIntervalSet(interval % ti, D=day, H=hour, M=min, S=sec, Sn=numerator, Sd=denominator, rc=ierr)
+
+ else
+
+ call ESMF_TimeIntervalSet(interval % ti, D=DD, H=H, M=M, S=S, Sn=S_n, Sd=S_d, rc=ierr)
+
+ end if
+
+ ! verify that time interval is positive
+ call ESMF_TimeIntervalSet(zeroInterval % ti, D=0, H=0, M=0, S=0, rc=ierr)
+
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ if (interval <= zeroInterval) then
+ if (present(ierr)) ierr = 1
+ write(0,*) 'ERROR: TimeInterval must be greater than 0', timeString !'ERROR: TimeInterval cannot be negative'
+ end if
+
+
+
+ end subroutine MPAS_setTimeInterval
+
+
+ subroutine MPAS_getTimeInterval(interval, DD, H, M, S, S_n, S_d, timeString, dt, ierr)
+! TODO: add double-precision seconds
+
+ implicit none
+
+ type (MPAS_TimeInterval_type), intent(in) :: interval
+ integer, intent(out), optional :: DD
+ integer, intent(out), optional :: H
+ integer, intent(out), optional :: M
+ integer, intent(out), optional :: S
+ integer, intent(out), optional :: S_n
+ integer, intent(out), optional :: S_d
+ character (len=32), intent(out), optional :: timeString
+ real (kind=RKIND), intent(out), optional :: dt
+ integer, intent(out), optional :: ierr
+
+ integer :: days, seconds, sn, sd
+
+ call ESMF_TimeIntervalGet(interval % ti, D=days, S=seconds, Sn=sn, Sd=sd, rc=ierr)
+
+ if (present(dt)) then
+ dt = (days * 24 * 60 * 60) + seconds + (sn / sd)
+ end if
+
+ if (present(DD)) then
+ DD = days
+ days = 0
+ end if
+
+ if (present(H)) then
+ H = (seconds - mod(seconds,3600)) / 3600
+ seconds = seconds - H*3600
+ H = H + days * 24
+ days = 0
+ end if
+
+ if (present(M)) then
+ M = (seconds - mod(seconds,60)) / 60
+ seconds = seconds - M*60
+ M = M + days * 1440
+ days = 0
+ end if
+
+ if (present(S)) then
+ S = seconds
+ end if
+
+ if (present(S_n)) then
+ S_n = sn
+ end if
+
+ if (present(S_d)) then
+ S_d = sd
+ end if
+
+ if (present(timeString)) then
+ call ESMF_TimeIntervalGet(interval % ti, timeString=timeString, rc=ierr)
+ end if
+
+ if (present(ierr)) then
+ if (ierr == ESMF_SUCCESS) ierr = 0
+ end if
+
+ end subroutine MPAS_getTimeInterval
+
+
+ type (MPAS_Time_type) function add_t_ti(t, ti)
+
+ implicit none
+
+ type (MPAS_Time_type), intent(in) :: t
+ type (MPAS_TimeInterval_type), intent(in) :: ti
+
+ add_t_ti % t = t % t + ti % ti
+
+ end function add_t_ti
+
+
+ type (MPAS_TimeInterval_type) function add_ti_ti(ti1, ti2)
+
+ implicit none
+
+ type (MPAS_TimeInterval_type), intent(in) :: ti1, ti2
+
+ add_ti_ti % ti = ti1 % ti + ti2 % ti
+
+ end function add_ti_ti
+
+
+ type (MPAS_TimeInterval_type) function sub_t_t(t1, t2)
+
+ implicit none
+
+ type (MPAS_Time_type), intent(in) :: t1, t2
+
+ sub_t_t % ti = t1 % t - t2 % t
+
+ end function sub_t_t
+
+
+ type (MPAS_Time_type) function sub_t_ti(t, ti)
+
+ implicit none
+
+ type (MPAS_Time_type), intent(in) :: t
+ type (MPAS_TimeInterval_type), intent(in) :: ti
+
+ sub_t_ti % t = t % t - ti % ti
+
+ end function sub_t_ti
+
+
+ type (MPAS_TimeInterval_type) function sub_ti_ti(ti1, ti2)
+
+ implicit none
+
+ type (MPAS_TimeInterval_type), intent(in) :: ti1, ti2
+
+ sub_ti_ti % ti = ti1 % ti - ti2 % ti
+
+ end function sub_ti_ti
+
+
+ type (MPAS_TimeInterval_type) function mul_ti_n(ti, n)
+
+ implicit none
+
+ type (MPAS_TimeInterval_type), intent(in) :: ti
+ integer, intent(in) :: n
+
+ mul_ti_n % ti = ti % ti * n
+
+ end function mul_ti_n
+
+
+ type (MPAS_TimeInterval_type) function div_ti_n(ti, n)
+
+ implicit none
+
+ type (MPAS_TimeInterval_type), intent(in) :: ti
+ integer, intent(in) :: n
+
+ div_ti_n % ti = ti % ti / n
+
+ end function div_ti_n
+
+
+ logical function eq_t_t(t1, t2)
+
+ implicit none
+
+ type (MPAS_Time_type), intent(in) :: t1, t2
+
+ eq_t_t = (t1 % t == t2 % t)
+
+ end function eq_t_t
+
+
+ logical function ne_t_t(t1, t2)
+
+ implicit none
+
+ type (MPAS_Time_type), intent(in) :: t1, t2
+
+ ne_t_t = (t1 % t /= t2 % t)
+
+ end function ne_t_t
+
+
+ logical function lt_t_t(t1, t2)
+
+ implicit none
+
+ type (MPAS_Time_type), intent(in) :: t1, t2
+
+ lt_t_t = (t1 % t < t2 % t)
+
+ end function lt_t_t
+
+
+ logical function gt_t_t(t1, t2)
+
+ implicit none
+
+ type (MPAS_Time_type), intent(in) :: t1, t2
+
+ gt_t_t = (t1 % t > t2 % t)
+
+ end function gt_t_t
+
+
+ logical function le_t_t(t1, t2)
+
+ implicit none
+
+ type (MPAS_Time_type), intent(in) :: t1, t2
+
+ le_t_t = (t1 % t <= t2 % t)
+
+ end function le_t_t
+
+
+ logical function ge_t_t(t1, t2)
+
+ implicit none
+
+ type (MPAS_Time_type), intent(in) :: t1, t2
+
+ ge_t_t = (t1 % t >= t2 % t)
+
+ end function ge_t_t
+
+
+ logical function eq_ti_ti(ti1, ti2)
+
+ implicit none
+
+ type (MPAS_TimeInterval_type), intent(in) :: ti1, ti2
+
+ eq_ti_ti = (ti1 % ti == ti2 % ti)
+
+ end function eq_ti_ti
+
+
+ logical function ne_ti_ti(ti1, ti2)
+
+ implicit none
+
+ type (MPAS_TimeInterval_type), intent(in) :: ti1, ti2
+
+ ne_ti_ti = (ti1 % ti /= ti2 % ti)
+
+ end function ne_ti_ti
+
+
+ logical function lt_ti_ti(ti1, ti2)
+
+ implicit none
+
+ type (MPAS_TimeInterval_type), intent(in) :: ti1, ti2
+
+ lt_ti_ti = (ti1 % ti < ti2 % ti)
+
+ end function lt_ti_ti
+
+
+ logical function gt_ti_ti(ti1, ti2)
+
+ implicit none
+
+ type (MPAS_TimeInterval_type), intent(in) :: ti1, ti2
+
+ gt_ti_ti = (ti1 % ti > ti2 % ti)
+
+ end function gt_ti_ti
+
+
+ logical function le_ti_ti(ti1, ti2)
+
+ implicit none
+
+ type (MPAS_TimeInterval_type), intent(in) :: ti1, ti2
+
+ le_ti_ti = (ti1 % ti <= ti2 % ti)
+
+ end function le_ti_ti
+
+
+ logical function ge_ti_ti(ti1, ti2)
+
+ implicit none
+
+ type (MPAS_TimeInterval_type), intent(in) :: ti1, ti2
+
+ ge_ti_ti = (ti1 % ti >= ti2 % ti)
+
+ end function ge_ti_ti
+
+
+ type (MPAS_TimeInterval_type) function neg_ti(ti)
+
+ implicit none
+
+ type (MPAS_TimeInterval_type), intent(in) :: ti
+
+ integer :: rc
+ integer :: D, S, Sn, Sd
+
+ call ESMF_TimeIntervalGet(ti % ti, D=D, S=S, Sn=Sn, Sd=Sd, rc=rc)
+ D = -D
+ S = -S
+ Sn = -Sn
+ call ESMF_TimeIntervalSet(neg_ti % ti, D=D, S=S, Sn=Sn, Sd=Sd, rc=rc)
+
+ end function neg_ti
+
+
+ type (MPAS_TimeInterval_type) function abs_ti(ti)
+
+ implicit none
+
+ type (MPAS_TimeInterval_type), intent(in) :: ti
+
+ type (MPAS_TimeInterval_type) :: zeroInterval
+ integer :: rc
+ integer :: D, S, Sn, Sd
+
+ call ESMF_TimeIntervalSet(zeroInterval % ti, D=0, H=0, M=0, S=0, rc=rc)
+
+ if(ti < zeroInterval) then
+ call ESMF_TimeIntervalGet(ti % ti, D=D, S=S, Sn=Sn, Sd=Sd, rc=rc)
+ D = -D
+ S = -S
+ Sn = -Sn
+ call ESMF_TimeIntervalSet(abs_ti % ti, D=D, S=S, Sn=Sn, Sd=Sd, rc=rc)
+ else
+ abs_ti = ti
+ end if
+
+ end function abs_ti
+
+
+! TODO: Implement this function
+! type (MPAS_TimeInterval_type) function mod(ti1, ti2)
+!
+! implicit none
+!
+! type (MPAS_TimeInterval_type), intent(in) :: ti1, ti2
+!
+! mod % ti = mod(ti1 % ti, ti2 % ti)
+!
+! end function mod
+
+
+ subroutine SplitString(string, delimiter, subStrings)
+
+ implicit none
+
+ character(len=*), intent(in) :: string
+ character, intent(in) :: delimiter
+ character(len=*), pointer, dimension(:) :: subStrings
+
+ integer :: i, start, index
+
+ index = 1
+ do i = 1, len(string)
+ if(string(i:i) == delimiter) then
+ index = index + 1
+ end if
+ end do
+
+ allocate(subStrings(1:index))
+
+ start = 1
+ index = 1
+ do i = 1, len(string)
+ if(string(i:i) == delimiter) then
+ subStrings(index) = string(start:i-1)
+ index = index + 1
+ start = i + 1
+ end if
+ end do
+ subStrings(index) = string(start:len(string))
+
+ end subroutine SplitString
+
+
+ subroutine getMonthDay(YYYY, DoY, month, day)
+
+ implicit none
+
+ integer, intent(in) :: YYYY, DoY
+ integer, intent(out) :: month, day
+
+ integer, dimension(12) :: dpm
+
+ if (isLeapYear(YYYY)) then
+ dpm(:) = daysInMonthLeap
+ else
+ dpm(:) = daysInMonth
+ end if
+
+ month = 1
+ day = DoY
+ do while (day > dpm(month))
+ day = day - dpm(month)
+ month = month + 1
+ end do
+
+ end subroutine getMonthDay
+
+
+ logical function isValidDate(YYYY, MM, DD)
+
+ integer, intent(in) :: YYYY, MM, DD
+ integer :: daysInMM
+
+ isValidDate = .true.
+
+ ! TODO: ???? Gregorian calendar has no year zero, but perhaps 0 = 1 BC ???
+ !if (YYYY == 0) then
+ ! isValidDate = .false.
+ ! return
+ !end if
+
+ if (MM < 1 .or. MM > 12) then
+ isValidDate = .false.
+ return
+ end if
+
+ if (DD < 1) then
+ isValidDate = .false.
+ return
+ end if
+
+ if(TheCalendar == MPAS_360DAY) then
+ daysInMM = 30
+ else
+ if (TheCalendar == MPAS_GREGORIAN .and. isLeapYear(YYYY)) then
+ daysInMM = daysInMonthLeap(MM)
+ else
+ daysInMM = daysInMonth(MM)
+ end if
+ end if
+
+ if (DD > daysInMM) then
+ isValidDate = .false.
+ return
+ end if
+
+ end function
+
+
+ logical function isLeapYear(year)
+
+ implicit none
+
+ integer, intent(in) :: year
+
+ isLeapYear = .false.
+
+ if (mod(year,4) == 0) then
+ if (mod(year,100) == 0) then
+ if (mod(year,400) == 0) then
+ isLeapYear = .true.
+ end if
+ else
+ isLeapYear = .true.
+ end if
+ end if
+
+ end function isLeapYear
+
+
+
+
+
+end module mpas_timekeeping
+
+
+
+subroutine wrf_error_fatal(msg)
+
+ implicit none
+
+ character (len=*) :: msg
+
+ write(0,*) 'MPAS_TIMEKEEPING: '//trim(msg)
+
+ stop
+
+end subroutine wrf_error_fatal
Modified: branches/atmos_physics/src/registry/gen_inc.c
===================================================================
--- branches/atmos_physics/src/registry/gen_inc.c        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/registry/gen_inc.c        2011-09-07 00:23:57 UTC (rev 979)
@@ -322,12 +322,14 @@
while (var_list_ptr) {
var_ptr = var_list_ptr->var;
if (!strncmp(var_ptr->super_array, "-", 1024)) {
- if (var_ptr->vtype == INTEGER) fortprintf(fd, " type (field%idInteger), pointer :: %s</font>
<font color="red">", var_ptr->ndims, var_ptr->name_in_code);
- if (var_ptr->vtype == REAL) fortprintf(fd, " type (field%idReal), pointer :: %s</font>
<font color="blue">", var_ptr->ndims, var_ptr->name_in_code);
+ if (var_ptr->vtype == INTEGER) fortprintf(fd, " type (field%idInteger), pointer :: %s</font>
<font color="blue">", var_ptr->ndims, var_ptr->name_in_code);
+ if (var_ptr->vtype == REAL) fortprintf(fd, " type (field%idReal), pointer :: %s</font>
<font color="blue">", var_ptr->ndims, var_ptr->name_in_code);
+ if (var_ptr->vtype == CHARACTER) fortprintf(fd, " type (field%idChar), pointer :: %s</font>
<font color="red">", var_ptr->ndims, var_ptr->name_in_code);
}
else {
- if (var_ptr->vtype == INTEGER) fortprintf(fd, " type (field%idInteger), pointer :: %s</font>
<font color="red">", var_ptr->ndims+1, var_ptr->super_array);
- if (var_ptr->vtype == REAL) fortprintf(fd, " type (field%idReal), pointer :: %s</font>
<font color="blue">", var_ptr->ndims+1, var_ptr->super_array);
+ if (var_ptr->vtype == INTEGER) fortprintf(fd, " type (field%idInteger), pointer :: %s</font>
<font color="blue">", var_ptr->ndims+1, var_ptr->super_array);
+ if (var_ptr->vtype == REAL) fortprintf(fd, " type (field%idReal), pointer :: %s</font>
<font color="blue">", var_ptr->ndims+1, var_ptr->super_array);
+ if (var_ptr->vtype == CHARACTER) fortprintf(fd, " type (field%idChar), pointer :: %s</font>
<font color="gray">", var_ptr->ndims+1, var_ptr->super_array);
while (var_list_ptr->next && !strncmp(var_list_ptr->next->var->super_array, var_list_ptr->var->super_array, 1024)) var_list_ptr = var_list_ptr->next;
}
var_list_ptr = var_list_ptr->next;
@@ -413,12 +415,14 @@
while (var_list_ptr) {
var_ptr = var_list_ptr->var;
if (!strncmp(var_ptr->super_array, "-", 1024)) {
- if (var_ptr->vtype == INTEGER) fortprintf(fd, " type (field%idInteger), pointer :: %s</font>
<font color="red">", var_ptr->ndims, var_ptr->name_in_code);
- if (var_ptr->vtype == REAL) fortprintf(fd, " type (field%idReal), pointer :: %s</font>
<font color="blue">", var_ptr->ndims, var_ptr->name_in_code);
+ if (var_ptr->vtype == INTEGER) fortprintf(fd, " type (field%idInteger), pointer :: %s</font>
<font color="blue">", var_ptr->ndims, var_ptr->name_in_code);
+ if (var_ptr->vtype == REAL) fortprintf(fd, " type (field%idReal), pointer :: %s</font>
<font color="blue">", var_ptr->ndims, var_ptr->name_in_code);
+ if (var_ptr->vtype == CHARACTER) fortprintf(fd, " type (field%idChar), pointer :: %s</font>
<font color="red">", var_ptr->ndims, var_ptr->name_in_code);
}
else {
- if (var_ptr->vtype == INTEGER) fortprintf(fd, " type (field%idInteger), pointer :: %s</font>
<font color="red">", var_ptr->ndims+1, var_ptr->super_array);
- if (var_ptr->vtype == REAL) fortprintf(fd, " type (field%idReal), pointer :: %s</font>
<font color="blue">", var_ptr->ndims+1, var_ptr->super_array);
+ if (var_ptr->vtype == INTEGER) fortprintf(fd, " type (field%idInteger), pointer :: %s</font>
<font color="blue">", var_ptr->ndims+1, var_ptr->super_array);
+ if (var_ptr->vtype == REAL) fortprintf(fd, " type (field%idReal), pointer :: %s</font>
<font color="blue">", var_ptr->ndims+1, var_ptr->super_array);
+ if (var_ptr->vtype == CHARACTER) fortprintf(fd, " type (field%idChar), pointer :: %s</font>
<font color="gray">", var_ptr->ndims+1, var_ptr->super_array);
while (var_list_ptr->next && !strncmp(var_list_ptr->next->var->super_array, var_list_ptr->var->super_array, 1024)) var_list_ptr = var_list_ptr->next;
}
var_list_ptr = var_list_ptr->next;
@@ -567,7 +571,12 @@
dimlist_ptr = dimlist_ptr->next;
}
fortprintf(fd, "))</font>
<font color="red">");
- fortprintf(fd, " %s %% %s %% array = 0</font>
<font color="blue">", group_ptr->name, var_ptr2->super_array ); /* initialize field to zero */
+ if (var_ptr->vtype == INTEGER)
+ fortprintf(fd, " %s %% %s %% array = 0</font>
<font color="blue">", group_ptr->name, var_ptr2->super_array ); /* initialize field to zero */
+ else if (var_ptr->vtype == REAL)
+ fortprintf(fd, " %s %% %s %% array = 0.0</font>
<font color="blue">", group_ptr->name, var_ptr2->super_array ); /* initialize field to zero */
+ else if (var_ptr->vtype == CHARACTER)
+ fortprintf(fd, " %s %% %s %% array = \'\'</font>
<font color="black">", group_ptr->name, var_ptr2->super_array ); /* initialize field to zero */
if (var_ptr2->iostreams & INPUT0)
fortprintf(fd, " %s %% %s %% ioinfo %% input = .true.</font>
<font color="gray">", group_ptr->name, var_ptr2->super_array);
@@ -617,7 +626,12 @@
dimlist_ptr = dimlist_ptr->next;
}
fortprintf(fd, "))</font>
<font color="red">");
- fortprintf(fd, " %s %% %s %% array = 0</font>
<font color="blue">", group_ptr->name, var_ptr->name_in_code ); /* initialize field to zero */
+ if (var_ptr->vtype == INTEGER)
+ fortprintf(fd, " %s %% %s %% array = 0</font>
<font color="blue">", group_ptr->name, var_ptr->name_in_code ); /* initialize field to zero */
+ else if (var_ptr->vtype == REAL)
+ fortprintf(fd, " %s %% %s %% array = 0.0</font>
<font color="blue">", group_ptr->name, var_ptr->name_in_code ); /* initialize field to zero */
+ else if (var_ptr->vtype == CHARACTER)
+ fortprintf(fd, " %s %% %s %% array = \'\'</font>
<font color="gray">", group_ptr->name, var_ptr->name_in_code ); /* initialize field to zero */
}
if (var_ptr->iostreams & INPUT0)
@@ -1225,6 +1239,7 @@
dimlist_ptr = var_ptr->dimlist;
if (var_ptr->vtype == INTEGER) sprintf(vtype, "int");
else if (var_ptr->vtype == REAL) sprintf(vtype, "real");
+ else if (var_ptr->vtype == CHARACTER) sprintf(vtype, "char");
if (strncmp(var_ptr->super_array, "-", 1024) != 0) {
fortprintf(fd, " if ((%s %% %s %% ioinfo %% input .and. input_obj %% stream == STREAM_INPUT) .or. &</font>
<font color="gray">", struct_deref, var_ptr->super_array);
@@ -1535,16 +1550,20 @@
/*
* Generate code to read 0d, 1d, 2d, 3d time-invariant fields
*/
- for(j=0; j<2; j++) {
+ for(j=0; j<3; j++) {
for(i=0; i<=3; i++) {
if (j == 0) {
sprintf(fname, "input_field%idinteger.inc", i);
ivtype = INTEGER;
}
- else {
+ else if (j == 1) {
sprintf(fname, "input_field%idreal.inc", i);
ivtype = REAL;
}
+ else if (j == 2) {
+ sprintf(fname, "input_field%idchar.inc", i);
+ ivtype = CHARACTER;
+ }
fd = fopen(fname, "w");
var_ptr = vars;
@@ -1595,12 +1614,40 @@
fortprintf(fd, " varID = input_obj %% rdVarID%s</font>
<font color="blue">", var_ptr->name_in_file);
}
var_ptr = var_ptr->next;
+
+         }
+         fortprintf(fd, " end if</font>
<font color="blue">");
+         }
+
+         fclose(fd);
+ }
+ }
+
+
+ /*
+ * Generate code to read 0d and 1d time-varying character fields
+ */
+ for(i=0; i<=1; i++) {
+ sprintf(fname, "input_field%idchar_time.inc", i);
+ fd = fopen(fname, "w");
+
+ var_ptr = vars;
+ while (var_ptr && (var_ptr->ndims != i || var_ptr->vtype != CHARACTER || !var_ptr->timedim)) var_ptr = var_ptr->next;
+ if (var_ptr) {
+ fortprintf(fd, " if (trim(field %% ioinfo %% fieldName) == \'%s\') then</font>
<font color="blue">", var_ptr->name_in_file);
+ fortprintf(fd, " varID = input_obj %% rdVarID%s</font>
<font color="blue">", var_ptr->name_in_file);
+ var_ptr = var_ptr->next;
+ while (var_ptr) {
+ if (var_ptr->ndims == i && var_ptr->vtype == CHARACTER && var_ptr->timedim) {
+ fortprintf(fd, " else if (trim(field %% ioinfo %% fieldName) == \'%s\') then</font>
<font color="blue">", var_ptr->name_in_file);
+ fortprintf(fd, " varID = input_obj %% rdVarID%s</font>
<font color="red">", var_ptr->name_in_file);
}
- fortprintf(fd, " end if</font>
<font color="red">");
+ var_ptr = var_ptr->next;
}
-
- fclose(fd);
- }
+ fortprintf(fd, " end if</font>
<font color="gray">");
+ }
+
+ fclose(fd);
}
}
@@ -1720,6 +1767,8 @@
fortprintf(fd, " ) then</font>
<font color="blue">");
dimlist_ptr = var_ptr->dimlist;
i = 1;
+ if (var_ptr->vtype == CHARACTER)
+ fortprintf(fd, " dimlist(%i) = output_obj %% wrDimIDStrLen</font>
<font color="black">", i++);
while(dimlist_ptr) {
fortprintf(fd, " dimlist(%i) = output_obj %% wrDimID%s</font>
<font color="gray">", i++, dimlist_ptr->dim->name_in_file);
dimlist_ptr = dimlist_ptr->next;
@@ -1729,6 +1778,8 @@
fortprintf(fd, " nferr = nf_def_var(output_obj %% wr_ncid, \'%s\', NF_INT, %i, dimlist, output_obj %% wrVarID%s)</font>
<font color="black">", var_ptr->name_in_file, var_ptr->ndims + var_ptr->timedim, var_ptr->name_in_file);
else if (var_ptr->vtype == REAL)
fortprintf(fd, " nferr = nf_def_var(output_obj %% wr_ncid, \'%s\', NF_DOUBLE, %i, dimlist, output_obj %% wrVarID%s)</font>
<font color="blue">", var_ptr->name_in_file, var_ptr->ndims + var_ptr->timedim, var_ptr->name_in_file);
+ else if (var_ptr->vtype == CHARACTER)
+ fortprintf(fd, " nferr = nf_def_var(output_obj %% wr_ncid, \'%s\', NF_CHAR, %i, dimlist, output_obj %% wrVarID%s)</font>
<font color="black">", var_ptr->name_in_file, var_ptr->ndims + var_ptr->timedim + 1, var_ptr->name_in_file);
fortprintf(fd, " end if</font>
<font color="black"></font>
<font color="gray">");
@@ -1781,6 +1832,7 @@
dimlist_ptr = var_ptr->dimlist;
if (var_ptr->vtype == INTEGER) sprintf(vtype, "int");
else if (var_ptr->vtype == REAL) sprintf(vtype, "real");
+ else if (var_ptr->vtype == CHARACTER) sprintf(vtype, "char");
if (strncmp(var_ptr->super_array, "-", 1024) != 0) {
fortprintf(fd, " if ((%s %% %s %% ioinfo %% output .and. output_obj %% stream == OUTPUT) .or. &</font>
<font color="gray">", struct_deref, var_ptr->super_array);
@@ -2036,16 +2088,20 @@
/*
* Generate code to write 0d, 1d, 2d, 3d time-invariant fields
*/
- for(j=0; j<2; j++) {
+ for(j=0; j<3; j++) {
for(i=0; i<=3; i++) {
if (j == 0) {
sprintf(fname, "output_field%idinteger.inc", i);
ivtype = INTEGER;
}
- else {
+ else if (j == 1) {
sprintf(fname, "output_field%idreal.inc", i);
ivtype = REAL;
}
+ else if (j == 2) {
+ sprintf(fname, "output_field%idchar.inc", i);
+ ivtype = CHARACTER;
+ }
fd = fopen(fname, "w");
var_ptr = vars;
@@ -2100,8 +2156,35 @@
fortprintf(fd, " end if</font>
<font color="red">");
}
- fclose(fd);
+         fclose(fd);
}
}
+
+ /*
+ * Generate code to write 0d and 1d character time-varying fields
+ */
+ for(i=0; i<=1; i++) {
+ sprintf(fname, "output_field%idchar_time.inc", i);
+ fd = fopen(fname, "w");
+
+ var_ptr = vars;
+ while (var_ptr && (var_ptr->ndims != i || var_ptr->vtype != CHARACTER || !var_ptr->timedim)) var_ptr = var_ptr->next;
+ if (var_ptr) {
+ fortprintf(fd, " if (trim(field %% ioinfo %% fieldName) == \'%s\') then</font>
<font color="blue">", var_ptr->name_in_file);
+ fortprintf(fd, " varID = output_obj %% wrVarID%s</font>
<font color="blue">", var_ptr->name_in_file);
+ var_ptr = var_ptr->next;
+ while (var_ptr) {
+ if (var_ptr->ndims == i && var_ptr->vtype == CHARACTER && var_ptr->timedim) {
+ fortprintf(fd, " else if (trim(field %% ioinfo %% fieldName) == \'%s\') then</font>
<font color="blue">", var_ptr->name_in_file);
+ fortprintf(fd, " varID = output_obj %% wrVarID%s</font>
<font color="blue">", var_ptr->name_in_file);
+ }
+ var_ptr = var_ptr->next;
+ }
+ fortprintf(fd, " end if</font>
<font color="gray">");
+ }
+
+ fclose(fd);
+ }
+
}
Modified: branches/atmos_physics/src/registry/parse.c
===================================================================
--- branches/atmos_physics/src/registry/parse.c        2011-09-06 16:27:58 UTC (rev 978)
+++ branches/atmos_physics/src/registry/parse.c        2011-09-07 00:23:57 UTC (rev 979)
@@ -153,6 +153,8 @@
var_ptr->vtype = INTEGER;
else if (strncmp(word, "logical", 1024) == 0)
var_ptr->vtype = LOGICAL;
+ else if (strncmp(word, "text", 1024) == 0)
+ var_ptr->vtype = CHARACTER;
getword(regfile, var_ptr->name_in_file);
</font>
</pre>