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

Last change on this file since 2000 was 2000, checked in by knoop, 8 years ago

Forced header and separation lines into 80 columns

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