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