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 diag_manager with the following diag_table
23 !! "ocn%4yr%2mo%2dy%2hr", 1, "days", 1, "days", "time", 1, "days", "2 1 1 0 0 0"
24 !! "test_diag_manager_mod", "sst", "sst", "ocn%4yr%2mo%2dy%2hr", "all", .true., "none", 2
26 program test_diag_manager_time
31 use time_manager_mod, only: time_type, set_calendar_type, set_date, NOLEAP, JULIAN, operator(+), set_time, print_time
35 type(time_type) :: Time
36 integer, dimension(2) :: layout = (/1,1/)
37 integer :: nlon, nlat, nz
38 type(domain2d) :: Domain
39 real, dimension(:), allocatable :: x, y, z
41 integer :: is, ie, js, je
42 real, allocatable :: sst(:,:,:), ice(:,:)
43 integer :: id_x, id_y, id_z, id_sst, id_ice
47 call set_calendar_type(JULIAN)
48 call diag_manager_init
54 call mpp_domains_set_stack_size(17280000)
55 call mpp_define_domains( (/1,nlon,1,nlat/), layout, Domain, name='test_diag_manager')
56 call mpp_define_io_domain(Domain, (/1,1/))
57 call mpp_get_compute_domain(Domain, is, ie, js, je)
60 allocate(x(nlon), y(nlat), z(nz))
61 allocate(sst(is:ie,js:je,1:nz), ice(is:ie,js:je))
76 ! Set up the intial time
77 Time = set_date(2,1,1,0,0,0)
80 id_x = diag_axis_init('x', x, 'point_E', 'x', long_name='point_E', Domain2=Domain)
81 id_y = diag_axis_init('y', y, 'point_N', 'y', long_name='point_N', Domain2=Domain)
82 id_z = diag_axis_init('z', z, 'point_Z', 'z', long_name='point_Z')
83 id_sst = register_diag_field ('test_diag_manager_mod', 'sst', (/id_x,id_y,id_z/), Time, 'SST', 'K')
84 id_ice = register_diag_field ('test_diag_manager_mod', 'ice', (/id_x,id_y/), Time, 'ICE', 'm')
86 ! Increase the time and send data
88 Time = set_date(2,1,1,i,0,0)
91 if(id_sst > 0) used = send_data(id_sst, sst, Time)
92 if(id_ice > 0) used = send_data(id_ice, ice, Time)
95 call diag_manager_end(Time)
98 end program test_diag_manager_time