source: palm/trunk/SOURCE/data_output_profiles.f90 @ 1682

Last change on this file since 1682 was 1682, checked in by knoop, 9 years ago

Code annotations made doxygen readable

  • Property svn:keywords set to Id
File size: 11.9 KB
RevLine 
[1682]1!> @file data_output_profiles.f90
[1036]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!
[1310]16! Copyright 1997-2014 Leibniz Universitaet Hannover
[1036]17!--------------------------------------------------------------------------------!
18!
[254]19! Current revisions:
[1]20! -----------------
[1682]21! Code annotations made doxygen readable
[1329]22!
[1321]23! Former revisions:
24! -----------------
25! $Id: data_output_profiles.f90 1682 2015-10-07 23:56:08Z knoop $
26!
[1354]27! 1353 2014-04-08 15:21:23Z heinze
28! REAL constants provided with KIND-attribute
29!
[1329]30! 1327 2014-03-21 11:00:16Z raasch
31! -netcdf output queries
32!
[1323]33! 1322 2014-03-20 16:38:49Z raasch
34! REAL functions provided with KIND-attribute
35!
[1321]36! 1320 2014-03-20 08:40:49Z raasch
[1320]37! ONLY-attribute added to USE-statements,
38! kind-parameters added to all INTEGER 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
[392]43!
[1319]44! 1318 2014-03-17 13:35:16Z raasch
45! barrier argument removed from cpu_log,
46! module interfaces removed
47!
[1107]48! 1106 2013-03-04 05:31:38Z raasch
49! bugfix: initial time for preruns of coupled runs is output as
50! -coupling_start_time
51!
[1093]52! 1092 2013-02-02 11:24:22Z raasch
53! unused variables removed
54!
[1037]55! 1036 2012-10-22 13:43:42Z raasch
56! code put under GPL (PALM 3.9)
57!
[965]58! 964 2012-07-26 09:14:24Z raasch
59! code for profil-output removed
60!
[1]61! Revision 1.1  1997/09/12 06:28:48  raasch
62! Initial revision
63!
64!
65! Description:
66! ------------
[1682]67!> Plot output of 1D-profiles for PROFIL
[1]68!------------------------------------------------------------------------------!
[1682]69 SUBROUTINE data_output_profiles
70 
[1]71
[1320]72    USE control_parameters,                                                    &
73        ONLY:  average_count_pr, averaging_interval_pr, coupling_start_time,   &
[1327]74               dopr_n, dopr_time_count, normalizing_region,                    &
[1320]75               time_since_reference_point
76
77    USE cpulog,                                                                &
78        ONLY:  cpu_log, log_point
79
80    USE indices,                                                               &
81        ONLY:  nzb, nzt
82
83    USE kinds
84
[1]85    USE netcdf_control
[1320]86
[1]87    USE pegrid
[1320]88
[1]89    USE profil_parameter
90
[1320]91    USE statistics,                                                            &
92        ONLY:  flow_statistics_called, hom, hom_sum, pr_palm, statistic_regions
93
[1]94    IMPLICIT NONE
95
96
[1682]97    INTEGER(iwp) ::  i  !<
98    INTEGER(iwp) ::  sr !<
[1]99
100!
101!-- If required, compute statistics
102    IF ( .NOT. flow_statistics_called )  CALL flow_statistics
103
104!
105!-- Flow_statistics has its own CPU time measurement
106    CALL cpu_log( log_point(15), 'data_output_profiles', 'start' )
107
108!
109!-- If required, compute temporal average
[1353]110    IF ( averaging_interval_pr == 0.0_wp )  THEN
[1]111       hom_sum(:,:,:) = hom(:,1,:,:)
112    ELSE
113       IF ( average_count_pr > 0 )  THEN
[1322]114          hom_sum = hom_sum / REAL( average_count_pr, KIND=wp )
[1]115       ELSE
116!
117!--       This case may happen if dt_dopr is changed in the d3par-list of
118!--       a restart run
119          RETURN
120       ENDIF
121    ENDIF
122
123   
124    IF ( myid == 0 )  THEN
125
126!
127!--    Plot-output for each (sub-)region
128
129!
130!--    Open file for profile output in NetCDF format
[1327]131       CALL check_open( 104 )
[1]132
133!
134!--    Increment the counter for number of output times
135       dopr_time_count = dopr_time_count + 1
136
137!
138!--    Output of initial profiles
139       IF ( dopr_time_count == 1 )  THEN
[345]140       
141          IF ( .NOT. output_for_t0 ) THEN 
[1]142
[345]143#if defined( __netcdf )         
[1]144!
[1327]145!--          Store initial time to time axis, but only if an output
146!--          is required for at least one of the profiles. The initial time
147!--          is either 0, or, in case of a prerun for coupled atmosphere-ocean
148!--          runs, has a negative value
149             DO  i = 1, dopr_n
150             IF ( dopr_initial_index(i) /= 0 )  THEN
151                nc_stat = NF90_PUT_VAR( id_set_pr, id_var_time_pr,  &
152                                        (/ -coupling_start_time /), &
153                                        start = (/ 1 /), count = (/ 1 /) )
154                   CALL handle_netcdf_error( 'data_output_profiles', 329 )
155                   output_for_t0 = .TRUE.
156                   EXIT
157                ENDIF
158             ENDDO
[1]159
160!
[1327]161!--          Store normalization factors
162             nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(1), & ! wpt0
163                                  (/ hom_sum(nzb,18,normalizing_region) /), &
164                                     start = (/ 1 /), count = (/ 1 /) )
165             CALL handle_netcdf_error( 'data_output_profiles', 330 )
[1]166
[1327]167             nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(2), & ! ws2
168                        (/ hom_sum(nzb+8,pr_palm,normalizing_region)**2 /), &
[1]169                                     start = (/ 1 /), count = (/ 1 /) )
[1327]170             CALL handle_netcdf_error( 'data_output_profiles', 331 )
171             nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(3), & ! tsw2
172                        (/ hom_sum(nzb+3,pr_palm,normalizing_region)**2 /), &
173                                  start = (/ 1 /), count = (/ 1 /) )
174             CALL handle_netcdf_error( 'data_output_profiles', 332 )
175             nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(4), & ! ws3
176                        (/ hom_sum(nzb+8,pr_palm,normalizing_region)**3 /), &
177                                     start = (/ 1 /), count = (/ 1 /) )
178             CALL handle_netcdf_error( 'data_output_profiles', 333 )
[1]179
[1327]180             nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(5), &!ws2tsw
181                        (/ hom_sum(nzb+8,pr_palm,normalizing_region)**3 *   &
182                           hom_sum(nzb+3,pr_palm,normalizing_region)    /), &
183                                     start = (/ 1 /), count = (/ 1 /) )
184             CALL handle_netcdf_error( 'data_output_profiles', 334 )
[1]185
[1327]186             nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(6), &!wstsw2
187                        (/ hom_sum(nzb+8,pr_palm,normalizing_region) *      &
188                           hom_sum(nzb+3,pr_palm,normalizing_region)**2 /), &
189                                     start = (/ 1 /), count = (/ 1 /) )
190             CALL handle_netcdf_error( 'data_output_profiles', 335 )
[1]191
[1327]192             nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(7), & ! z_i
193                           (/ hom_sum(nzb+6,pr_palm,normalizing_region) /), &
194                                     start = (/ 1 /), count = (/ 1 /) )
195             CALL handle_netcdf_error( 'data_output_profiles', 336 )
[345]196             
[1]197#endif
198!
[345]199!--          Loop over all 1D variables
200             DO  i = 1, dopr_n
[1]201
[345]202                IF ( dopr_initial_index(i) /= 0 )  THEN
[1]203
204!
[345]205!--                Output for the individual (sub-)regions
206                   DO  sr = 0, statistic_regions
[1]207
208#if defined( __netcdf )
209!
[1327]210!--                   Write data to netcdf file
211                      nc_stat = NF90_PUT_VAR( id_set_pr, id_var_dopr(i,sr),    &
212                                    hom(nzb:nzt+1,1,dopr_initial_index(i),sr), &
213                                              start = (/ 1, 1 /),              &
214                                              count = (/ nzt-nzb+2, 1 /) )
215                      CALL handle_netcdf_error( 'data_output_profiles', 337 )
[1]216#endif
217
[345]218                   ENDDO
[1]219
[345]220                ENDIF   ! Initial profile available
[1]221
[345]222             ENDDO   ! Loop over dopr_n for initial profiles
[1]223
[1327]224             IF ( output_for_t0 )  THEN
[345]225                dopr_time_count = dopr_time_count + 1
226             ENDIF
[1]227
[345]228          END IF
[1]229       ENDIF   ! Initial profiles
230
231#if defined( __netcdf )
[345]232
[1]233!
[1327]234!--    Store time to time axis
235       nc_stat = NF90_PUT_VAR( id_set_pr, id_var_time_pr,        &
236                               (/ time_since_reference_point /), &
237                               start = (/ dopr_time_count /),    &
238                               count = (/ 1 /) )
239       CALL handle_netcdf_error( 'data_output_profiles', 338 )
[1]240
241!
[1327]242!--    Store normalization factors
243       nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(1), &  ! wpt0
244                               (/ hom_sum(nzb,18,normalizing_region) /), &
245                               start = (/ dopr_time_count /),               &
246                               count = (/ 1 /) )
247       CALL handle_netcdf_error( 'data_output_profiles', 339 )
[1]248
[1327]249       nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(2), &  ! ws2
250                     (/ hom_sum(nzb+8,pr_palm,normalizing_region)**2 /), &
251                               start = (/ dopr_time_count /),               &
252                               count = (/ 1 /) )
253       CALL handle_netcdf_error( 'data_output_profiles', 340 )
[1]254
[1327]255       nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(3), &  ! tsw2
256                     (/ hom_sum(nzb+3,pr_palm,normalizing_region)**2 /), &
257                               start = (/ dopr_time_count /),               &
258                               count = (/ 1 /) )
259       CALL handle_netcdf_error( 'data_output_profiles', 341 )
[1]260
[1327]261       nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(4), &  ! ws3
262                     (/ hom_sum(nzb+8,pr_palm,normalizing_region)**3 /), &
263                               start = (/ dopr_time_count /),               &
264                               count = (/ 1 /) )
265       CALL handle_netcdf_error( 'data_output_profiles', 342 )
[1]266
[1327]267       nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(5), &  ! ws2tsw
268                     (/ hom_sum(nzb+8,pr_palm,normalizing_region)**3 *   &
269                        hom_sum(nzb+3,pr_palm,normalizing_region)    /), &
270                               start = (/ dopr_time_count /),               &
271                               count = (/ 1 /) )
272       CALL handle_netcdf_error( 'data_output_profiles', 343 )
[1]273
[1327]274       nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(6), &  ! wstsw2
275                     (/ hom_sum(nzb+8,pr_palm,normalizing_region) *      &
276                        hom_sum(nzb+3,pr_palm,normalizing_region)**2 /), &
277                               start = (/ dopr_time_count /),               &
278                               count = (/ 1 /) )
279       CALL handle_netcdf_error( 'data_output_profiles', 344 )
280
281       nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(7), &  ! z_i
282                        (/ hom_sum(nzb+6,pr_palm,normalizing_region) /), &
283                               start = (/ dopr_time_count /),               &
284                               count = (/ 1 /) )
285       CALL handle_netcdf_error( 'data_output_profiles', 345 )
[1]286#endif
287
288!
289!--    Output of the individual (non-initial) profiles
290       DO  i = 1, dopr_n
291
292!
293!--       Output for the individual (sub-)domains
294          DO  sr = 0, statistic_regions
295
296#if defined( __netcdf )
297!
[1327]298!--          Write data to netcdf file
299             nc_stat = NF90_PUT_VAR( id_set_pr, id_var_dopr(i,sr),          &
300                                     hom_sum(nzb:nzt+1,dopr_index(i),sr),&
301                                     start = (/ 1, dopr_time_count /),      &
302                                     count = (/ nzt-nzb+2, 1 /) )
303             CALL handle_netcdf_error( 'data_output_profiles', 346 )
[1]304#endif
305
306          ENDDO
307
[964]308       ENDDO
[1]309
310    ENDIF  ! Output on PE0
311
312!
313!-- If averaging has been done above, the summation counter must be re-set.
[1353]314    IF ( averaging_interval_pr /= 0.0_wp )  THEN
[1]315       average_count_pr = 0
316    ENDIF
317
[1318]318    CALL cpu_log( log_point(15), 'data_output_profiles','stop' )
[1]319
320!
321!-- Formats
322100 FORMAT ('#1 ',A,1X,A)
323101 FORMAT (E15.7,1X,E15.7)
324102 FORMAT ('NEXT')
325
326 END SUBROUTINE data_output_profiles
Note: See TracBrowser for help on using the repository browser.