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