1 | !> @file data_output_tseries.f90 |
---|
2 | !--------------------------------------------------------------------------------! |
---|
3 | ! This file is part of PALM. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
7 | ! either version 3 of the License, or (at your option) any later version. |
---|
8 | ! |
---|
9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
12 | ! |
---|
13 | ! You should have received a copy of the GNU General Public License along with |
---|
14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
15 | ! |
---|
16 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: data_output_tseries.f90 1683 2015-10-07 23:57:51Z knoop $ |
---|
26 | ! |
---|
27 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
28 | ! Code annotations made doxygen readable |
---|
29 | ! |
---|
30 | ! 1524 2015-01-14 13:18:19Z keck |
---|
31 | ! Bugfix: increment dots_time_count after the call of subroutine check_open |
---|
32 | ! |
---|
33 | ! 1327 2014-03-21 11:00:16Z raasch |
---|
34 | ! -netcdf output queries |
---|
35 | ! |
---|
36 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
37 | ! ONLY-attribute added to USE-statements, |
---|
38 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
39 | ! kinds are defined in new module kinds, |
---|
40 | ! revision history before 2012 removed, |
---|
41 | ! comment fields (!:) to be used for variable explanations added to |
---|
42 | ! all variable declaration statements |
---|
43 | ! |
---|
44 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
45 | ! barrier argument removed from cpu_log. |
---|
46 | ! module interfaces removed |
---|
47 | ! |
---|
48 | ! 1092 2013-02-02 11:24:22Z raasch |
---|
49 | ! unused variables removed |
---|
50 | ! |
---|
51 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
52 | ! code put under GPL (PALM 3.9) |
---|
53 | ! |
---|
54 | ! Revision 1.1 1998/03/03 08:00:13 raasch |
---|
55 | ! Initial revision |
---|
56 | ! |
---|
57 | ! |
---|
58 | ! Description: |
---|
59 | ! ------------ |
---|
60 | !> Time series output for PROFIL. Always all time series are stored. A selection |
---|
61 | !> can be applied via the PROFIL-parameters in close_file. |
---|
62 | !------------------------------------------------------------------------------! |
---|
63 | SUBROUTINE data_output_tseries |
---|
64 | |
---|
65 | |
---|
66 | USE control_parameters, & |
---|
67 | ONLY: dots_time_count, time_since_reference_point |
---|
68 | |
---|
69 | USE cpulog, & |
---|
70 | ONLY: cpu_log, log_point |
---|
71 | |
---|
72 | USE kinds |
---|
73 | |
---|
74 | USE netcdf_control |
---|
75 | |
---|
76 | USE pegrid |
---|
77 | |
---|
78 | USE profil_parameter |
---|
79 | |
---|
80 | USE statistics, & |
---|
81 | ONLY: flow_statistics_called, statistic_regions, ts_value |
---|
82 | |
---|
83 | IMPLICIT NONE |
---|
84 | |
---|
85 | |
---|
86 | INTEGER(iwp) :: i !< |
---|
87 | INTEGER(iwp) :: sr !< |
---|
88 | |
---|
89 | |
---|
90 | ! |
---|
91 | !-- If required, compute statistics. |
---|
92 | IF ( .NOT. flow_statistics_called ) CALL flow_statistics |
---|
93 | |
---|
94 | ! |
---|
95 | !-- Flow_statistics has its own cpu-time measuring. |
---|
96 | CALL cpu_log( log_point(21), 'data_output_tseries', 'start' ) |
---|
97 | |
---|
98 | IF ( myid == 0 ) THEN |
---|
99 | |
---|
100 | ! |
---|
101 | !-- Open file for time series output in NetCDF format |
---|
102 | CALL check_open( 105 ) |
---|
103 | |
---|
104 | !-- Increment the counter for number of output times |
---|
105 | ! CAUTION: The following line has to be after the call of the subroutine |
---|
106 | ! check_open, since check_open resets the counter dots_time_count |
---|
107 | ! to 0, if a new file is opened |
---|
108 | dots_time_count = dots_time_count + 1 |
---|
109 | |
---|
110 | #if defined( __netcdf ) |
---|
111 | ! |
---|
112 | !-- Update the time series time axis |
---|
113 | nc_stat = NF90_PUT_VAR( id_set_ts, id_var_time_ts, & |
---|
114 | (/ time_since_reference_point /), & |
---|
115 | start = (/ dots_time_count /), & |
---|
116 | count = (/ 1 /) ) |
---|
117 | CALL handle_netcdf_error( 'data_output_tseries', 350 ) |
---|
118 | #endif |
---|
119 | |
---|
120 | ! |
---|
121 | !-- Time series output for the total domain (and each subregion, if |
---|
122 | !-- applicable) |
---|
123 | DO sr = 0, statistic_regions |
---|
124 | |
---|
125 | #if defined( __netcdf ) |
---|
126 | DO i = 1, dots_num |
---|
127 | nc_stat = NF90_PUT_VAR( id_set_ts, id_var_dots(i,sr), & |
---|
128 | (/ ts_value(i,sr) /), & |
---|
129 | start = (/ dots_time_count /), & |
---|
130 | count = (/ 1 /) ) |
---|
131 | CALL handle_netcdf_error( 'data_output_tseries', 351 ) |
---|
132 | ENDDO |
---|
133 | #endif |
---|
134 | |
---|
135 | ENDDO |
---|
136 | |
---|
137 | ENDIF |
---|
138 | |
---|
139 | |
---|
140 | CALL cpu_log( log_point(21), 'data_output_tseries', 'stop' ) |
---|
141 | |
---|
142 | ! |
---|
143 | !-- formats |
---|
144 | 500 FORMAT (23(E15.7,1X)) |
---|
145 | |
---|
146 | END SUBROUTINE data_output_tseries |
---|