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

Last change on this file since 3241 was 3241, checked in by raasch, 6 years ago

various changes to avoid compiler warnings (mainly removal of unused variables)

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