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