1 | !> @file data_output_tseries.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
6 | ! terms of the GNU General Public License as published by the Free Software |
---|
7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
8 | ! 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-2020 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: data_output_tseries.f90 4360 2020-01-07 11:25:50Z monakurppa $ |
---|
27 | ! Corrected "Former revisions" section |
---|
28 | ! |
---|
29 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
30 | ! unused format removed |
---|
31 | ! |
---|
32 | ! Revision 1.1 1998/03/03 08:00:13 raasch |
---|
33 | ! Initial revision |
---|
34 | ! |
---|
35 | ! |
---|
36 | ! Description: |
---|
37 | ! ------------ |
---|
38 | !> Time series output for PROFIL. Always all time series are stored. A selection |
---|
39 | !> can be applied via the PROFIL-parameters in close_file. |
---|
40 | !------------------------------------------------------------------------------! |
---|
41 | SUBROUTINE data_output_tseries |
---|
42 | |
---|
43 | |
---|
44 | USE control_parameters, & |
---|
45 | ONLY: dots_time_count, time_since_reference_point |
---|
46 | |
---|
47 | USE cpulog, & |
---|
48 | ONLY: cpu_log, log_point |
---|
49 | |
---|
50 | USE kinds |
---|
51 | |
---|
52 | #if defined( __netcdf ) |
---|
53 | USE NETCDF |
---|
54 | #endif |
---|
55 | USE netcdf_interface, & |
---|
56 | ONLY: dots_num, id_set_ts, id_var_dots, id_var_time_ts, nc_stat, & |
---|
57 | netcdf_handle_error |
---|
58 | |
---|
59 | USE pegrid |
---|
60 | |
---|
61 | USE profil_parameter |
---|
62 | |
---|
63 | USE statistics, & |
---|
64 | ONLY: flow_statistics_called, statistic_regions, ts_value |
---|
65 | |
---|
66 | IMPLICIT NONE |
---|
67 | |
---|
68 | |
---|
69 | INTEGER(iwp) :: i !< |
---|
70 | INTEGER(iwp) :: sr !< |
---|
71 | |
---|
72 | |
---|
73 | ! |
---|
74 | !-- If required, compute statistics. |
---|
75 | IF ( .NOT. flow_statistics_called ) CALL flow_statistics |
---|
76 | |
---|
77 | ! |
---|
78 | !-- Flow_statistics has its own cpu-time measuring. |
---|
79 | CALL cpu_log( log_point(21), 'data_output_tseries', 'start' ) |
---|
80 | |
---|
81 | IF ( myid == 0 ) THEN |
---|
82 | |
---|
83 | ! |
---|
84 | !-- Open file for time series output in NetCDF format |
---|
85 | CALL check_open( 105 ) |
---|
86 | |
---|
87 | !-- Increment the counter for number of output times |
---|
88 | ! CAUTION: The following line has to be after the call of the subroutine |
---|
89 | ! check_open, since check_open resets the counter dots_time_count |
---|
90 | ! to 0, if a new file is opened |
---|
91 | dots_time_count = dots_time_count + 1 |
---|
92 | |
---|
93 | #if defined( __netcdf ) |
---|
94 | ! |
---|
95 | !-- Update the time series time axis |
---|
96 | nc_stat = NF90_PUT_VAR( id_set_ts, id_var_time_ts, & |
---|
97 | (/ time_since_reference_point /), & |
---|
98 | start = (/ dots_time_count /), & |
---|
99 | count = (/ 1 /) ) |
---|
100 | CALL netcdf_handle_error( 'data_output_tseries', 350 ) |
---|
101 | #endif |
---|
102 | |
---|
103 | ! |
---|
104 | !-- Time series output for the total domain (and each subregion, if |
---|
105 | !-- applicable) |
---|
106 | DO sr = 0, statistic_regions |
---|
107 | |
---|
108 | #if defined( __netcdf ) |
---|
109 | DO i = 1, dots_num |
---|
110 | nc_stat = NF90_PUT_VAR( id_set_ts, id_var_dots(i,sr), & |
---|
111 | (/ ts_value(i,sr) /), & |
---|
112 | start = (/ dots_time_count /), & |
---|
113 | count = (/ 1 /) ) |
---|
114 | CALL netcdf_handle_error( 'data_output_tseries', 351 ) |
---|
115 | ENDDO |
---|
116 | #endif |
---|
117 | |
---|
118 | ENDDO |
---|
119 | |
---|
120 | ENDIF |
---|
121 | |
---|
122 | |
---|
123 | CALL cpu_log( log_point(21), 'data_output_tseries', 'stop' ) |
---|
124 | |
---|
125 | END SUBROUTINE data_output_tseries |
---|