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