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 terms of the GNU General |
---|
6 | ! Public License as published by the Free Software Foundation, either version 3 of the License, or |
---|
7 | ! (at your option) any later version. |
---|
8 | ! |
---|
9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
---|
10 | ! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
11 | ! Public License for more details. |
---|
12 | ! |
---|
13 | ! You should have received a copy of the GNU General Public License along with PALM. If not, see |
---|
14 | ! <http://www.gnu.org/licenses/>. |
---|
15 | ! |
---|
16 | ! Copyright 1997-2020 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: data_output_tseries.f90 4583 2020-06-29 12:36:47Z suehring $ |
---|
26 | ! file re-formatted to follow the PALM coding standard |
---|
27 | ! |
---|
28 | ! 4360 2020-01-07 11:25:50Z suehring |
---|
29 | ! Corrected "Former revisions" section |
---|
30 | ! |
---|
31 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
32 | ! unused format removed |
---|
33 | ! |
---|
34 | ! Revision 1.1 1998/03/03 08:00:13 raasch |
---|
35 | ! Initial revision |
---|
36 | ! |
---|
37 | ! |
---|
38 | ! Description: |
---|
39 | ! ------------ |
---|
40 | !> Time series output for PROFIL. Always all time series are stored. A selection can be applied via |
---|
41 | !> the PROFIL-parameters in close_file. |
---|
42 | !--------------------------------------------------------------------------------------------------! |
---|
43 | SUBROUTINE data_output_tseries |
---|
44 | |
---|
45 | |
---|
46 | USE control_parameters, & |
---|
47 | ONLY: dots_time_count, time_since_reference_point |
---|
48 | |
---|
49 | USE cpulog, & |
---|
50 | ONLY: cpu_log, log_point |
---|
51 | |
---|
52 | USE kinds |
---|
53 | |
---|
54 | #if defined( __netcdf ) |
---|
55 | USE NETCDF |
---|
56 | #endif |
---|
57 | USE netcdf_interface, & |
---|
58 | ONLY: dots_num, id_set_ts, id_var_dots, id_var_time_ts, nc_stat, netcdf_handle_error |
---|
59 | |
---|
60 | USE pegrid |
---|
61 | |
---|
62 | USE profil_parameter |
---|
63 | |
---|
64 | USE statistics, & |
---|
65 | ONLY: flow_statistics_called, statistic_regions, ts_value |
---|
66 | |
---|
67 | IMPLICIT NONE |
---|
68 | |
---|
69 | |
---|
70 | INTEGER(iwp) :: i !< |
---|
71 | INTEGER(iwp) :: sr !< |
---|
72 | |
---|
73 | |
---|
74 | ! |
---|
75 | !-- If required, compute statistics. |
---|
76 | IF ( .NOT. flow_statistics_called ) CALL flow_statistics |
---|
77 | |
---|
78 | ! |
---|
79 | !-- Flow_statistics has its own cpu-time measuring. |
---|
80 | CALL cpu_log( log_point(21), 'data_output_tseries', 'start' ) |
---|
81 | |
---|
82 | IF ( myid == 0 ) THEN |
---|
83 | |
---|
84 | ! |
---|
85 | !-- Open file for time series output in NetCDF format |
---|
86 | CALL check_open( 105 ) |
---|
87 | |
---|
88 | !-- Increment the counter for number of output times |
---|
89 | !-- CAUTION: The following line has to be after the call of the subroutine check_open, since |
---|
90 | !-- check_open resets the counter dots_time_count 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 |
---|