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