1 !***********************************************************************
2 !* GNU Lesser General Public License
4 !* This file is part of the GFDL Flexible Modeling System (FMS).
6 !* FMS is free software: you can redistribute it and/or modify it under
7 !* the terms of the GNU Lesser General Public License as published by
8 !* the Free Software Foundation, either version 3 of the License, or (at
9 !* your option) any later version.
11 !* FMS is distributed in the hope that it will be useful, but WITHOUT
12 !* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 !* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 !* You should have received a copy of the GNU Lesser General Public
17 !* License along with FMS. If not, see <http://www.gnu.org/licenses/>.
18 !***********************************************************************
20 !> @brief This programs tests the flexible timing capability in the modern diag_manager
21 program test_flexible_time
22 use fms_mod, only: fms_init, fms_end
23 use time_manager_mod, only: set_date, time_type, increment_date, set_calendar_type, &
24 JULIAN, set_time, operator(+)
25 use diag_manager_mod, only: diag_manager_init, diag_axis_init, register_diag_field, &
26 diag_manager_set_time_end, diag_send_complete, diag_manager_end, &
28 use mpp_mod, only: FATAL, mpp_error
29 use platform_mod, only: r8_kind
33 real(kind=r8_kind) :: var_data(2) !< Dummy data
34 logical :: used !< .True. if send_data was sucessful
35 type(time_type) :: Time !< Time of the simulation
36 type(time_type) :: Time_step !< Start time of the simulation
37 type(time_type) :: End_Time !< End Time of the simulation
39 integer :: id_z, id_var
42 call set_calendar_type(JULIAN)
43 call diag_manager_init
45 !< Starting time of the simulation
46 Time = set_date(2,1,1,3,0,0) !02/01/01 hour 3
48 !< Set up a dummy variable
49 id_z = diag_axis_init('z', (/1. ,2. /), 'point_Z', 'z', long_name='point_Z')
50 id_var = register_diag_field ('atm_mod', 'var1', (/id_z/), Time, 'Var not domain decomposed', 'mullions')
52 !< Set up the end of the simulation (i.e 2 days long)
53 End_Time = set_date(2,1,3,3,0,0)
54 call diag_manager_set_time_end(End_Time)
56 !< Set up the simulation
57 Time_step = set_time (3600,0) !< 1 hour
59 var_data = real(i, kind=r8_kind)
60 Time = Time + Time_step
61 used = send_data(id_var, var_data, Time)
62 call diag_send_complete(set_time(3600,0))
65 call diag_manager_end(End_Time)
69 end program test_flexible_time