[1682] | 1 | !> @file data_output_spectra.f90 |
---|
[1036] | 2 | !--------------------------------------------------------------------------------! |
---|
| 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
| 5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 7 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 8 | ! |
---|
| 9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 12 | ! |
---|
| 13 | ! You should have received a copy of the GNU General Public License along with |
---|
| 14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 15 | ! |
---|
[1310] | 16 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 17 | !--------------------------------------------------------------------------------! |
---|
| 18 | ! |
---|
[254] | 19 | ! Current revisions: |
---|
[1327] | 20 | ! ------------------ |
---|
[1329] | 21 | ! |
---|
[1784] | 22 | ! |
---|
[1321] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: data_output_spectra.f90 1784 2016-03-06 19:14:40Z raasch $ |
---|
| 26 | ! |
---|
[1784] | 27 | ! 1783 2016-03-06 18:36:17Z raasch |
---|
| 28 | ! name change of netcdf routines and module + related changes |
---|
| 29 | ! |
---|
[1683] | 30 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 31 | ! Code annotations made doxygen readable |
---|
| 32 | ! |
---|
[1354] | 33 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 34 | ! REAL constants provided with KIND-attribute |
---|
| 35 | ! |
---|
[1329] | 36 | ! 1327 2014-03-21 11:00:16Z raasch |
---|
| 37 | ! -netcdf output queries |
---|
| 38 | ! |
---|
[1325] | 39 | ! 1324 2014-03-21 09:13:16Z suehring |
---|
| 40 | ! Bugfix: module statistics and module spectrum added, missing variables in ONLY |
---|
| 41 | ! arguments added |
---|
| 42 | ! |
---|
[1323] | 43 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 44 | ! REAL functions provided with KIND-attribute |
---|
| 45 | ! |
---|
[1321] | 46 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 47 | ! ONLY-attribute added to USE-statements, |
---|
| 48 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 49 | ! kinds are defined in new module kinds, |
---|
| 50 | ! revision history before 2012 removed, |
---|
| 51 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 52 | ! all variable declaration statements |
---|
[1] | 53 | ! |
---|
[1319] | 54 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
| 55 | ! module interfaces removed |
---|
| 56 | ! |
---|
[1037] | 57 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 58 | ! code put under GPL (PALM 3.9) |
---|
| 59 | ! |
---|
[965] | 60 | ! 964 2012-07-26 09:14:24Z raasch |
---|
| 61 | ! code for profil-output removed |
---|
| 62 | ! |
---|
[1] | 63 | ! Revision 1.1 2001/01/05 15:14:20 raasch |
---|
| 64 | ! Initial revision |
---|
| 65 | ! |
---|
| 66 | ! |
---|
| 67 | ! Description: |
---|
| 68 | ! ------------ |
---|
[1682] | 69 | !> Writing spectra data on file, using a special format which allows |
---|
| 70 | !> plotting of these data with PROFIL-graphic-software |
---|
[1] | 71 | !------------------------------------------------------------------------------! |
---|
[1682] | 72 | SUBROUTINE data_output_spectra |
---|
| 73 | |
---|
[1783] | 74 | #if defined( __netcdf ) |
---|
[1] | 75 | #if defined( __spectra ) |
---|
| 76 | |
---|
[1320] | 77 | USE control_parameters, & |
---|
[1324] | 78 | ONLY: average_count_sp, averaging_interval_sp, dosp_time_count, & |
---|
[1327] | 79 | message_string, run_description_header, & |
---|
[1324] | 80 | time_since_reference_point |
---|
[1320] | 81 | |
---|
| 82 | USE cpulog, & |
---|
| 83 | ONLY: cpu_log, log_point |
---|
| 84 | |
---|
| 85 | USE kinds |
---|
| 86 | |
---|
[1783] | 87 | USE NETCDF |
---|
[1320] | 88 | |
---|
[1783] | 89 | USE netcdf_interface, & |
---|
| 90 | ONLY: id_set_sp, id_var_time_sp, nc_stat, netcdf_handle_error |
---|
| 91 | |
---|
[1] | 92 | USE pegrid |
---|
| 93 | |
---|
[1320] | 94 | USE spectrum, & |
---|
[1324] | 95 | ONLY: data_output_sp, spectra_direction |
---|
[1] | 96 | |
---|
[1320] | 97 | USE statistics, & |
---|
| 98 | ONLY: spectrum_x, spectrum_y |
---|
| 99 | |
---|
| 100 | |
---|
[1] | 101 | IMPLICIT NONE |
---|
| 102 | |
---|
[1682] | 103 | INTEGER(iwp) :: cranz_x !< |
---|
| 104 | INTEGER(iwp) :: cranz_y !< |
---|
| 105 | INTEGER(iwp) :: m !< |
---|
| 106 | INTEGER(iwp) :: pr !< |
---|
[1320] | 107 | |
---|
[1682] | 108 | LOGICAL :: frame_x !< |
---|
| 109 | LOGICAL :: frame_y !< |
---|
[1] | 110 | |
---|
| 111 | CALL cpu_log( log_point(31), 'data_output_spectra', 'start' ) |
---|
| 112 | |
---|
| 113 | ! |
---|
| 114 | !-- Output is only performed on PE0 |
---|
| 115 | IF ( myid == 0 ) THEN |
---|
| 116 | |
---|
| 117 | ! |
---|
| 118 | !-- Open file for spectra output in NetCDF format |
---|
[1327] | 119 | CALL check_open( 107 ) |
---|
[1] | 120 | |
---|
| 121 | ! |
---|
| 122 | !-- Increment the counter for number of output times |
---|
| 123 | dosp_time_count = dosp_time_count + 1 |
---|
| 124 | |
---|
| 125 | ! |
---|
| 126 | !-- Update the spectra time axis |
---|
[291] | 127 | nc_stat = NF90_PUT_VAR( id_set_sp, id_var_time_sp, & |
---|
| 128 | (/ time_since_reference_point /), & |
---|
[1] | 129 | start = (/ dosp_time_count /), count = (/ 1 /) ) |
---|
[1783] | 130 | CALL netcdf_handle_error( 'data_output_spectra', 47 ) |
---|
[1] | 131 | |
---|
| 132 | ! |
---|
| 133 | !-- If necessary, calculate time average and reset average counter |
---|
| 134 | IF ( average_count_sp == 0 ) THEN |
---|
[254] | 135 | message_string = 'no spectra data available' |
---|
| 136 | CALL message( 'data_output_spectra', 'PA0186', 0, 0, 0, 6, 0 ) |
---|
[1] | 137 | ENDIF |
---|
| 138 | IF ( average_count_sp /= 1 ) THEN |
---|
[1322] | 139 | spectrum_x = spectrum_x / REAL( average_count_sp, KIND=wp ) |
---|
| 140 | spectrum_y = spectrum_y / REAL( average_count_sp, KIND=wp ) |
---|
[1] | 141 | average_count_sp = 0 |
---|
| 142 | ENDIF |
---|
| 143 | |
---|
| 144 | ! |
---|
| 145 | !-- Loop over all spectra defined by the user |
---|
| 146 | m = 1 |
---|
| 147 | DO WHILE ( data_output_sp(m) /= ' ' .AND. m <= 10 ) |
---|
| 148 | |
---|
| 149 | SELECT CASE ( TRIM( data_output_sp(m) ) ) |
---|
| 150 | |
---|
| 151 | CASE ( 'u' ) |
---|
| 152 | pr = 1 |
---|
| 153 | |
---|
| 154 | CASE ( 'v' ) |
---|
| 155 | pr = 2 |
---|
| 156 | |
---|
| 157 | CASE ( 'w' ) |
---|
| 158 | pr = 3 |
---|
| 159 | |
---|
| 160 | CASE ( 'pt' ) |
---|
| 161 | pr = 4 |
---|
| 162 | |
---|
| 163 | CASE ( 'q' ) |
---|
| 164 | pr = 5 |
---|
| 165 | |
---|
| 166 | CASE DEFAULT |
---|
[144] | 167 | ! |
---|
| 168 | !-- The DEFAULT case is reached either if the parameter |
---|
| 169 | !-- data_output_sp(m) contains a wrong character string or if the |
---|
| 170 | !-- user has coded a special case in the user interface. There, the |
---|
| 171 | !-- subroutine user_spectra checks which of these two conditions |
---|
| 172 | !-- applies. |
---|
| 173 | CALL user_spectra( 'data_output', m, pr ) |
---|
[1] | 174 | |
---|
| 175 | END SELECT |
---|
| 176 | |
---|
| 177 | ! |
---|
| 178 | !-- Output of spectra in NetCDF format |
---|
[1327] | 179 | !-- Output of x-spectra |
---|
| 180 | IF ( INDEX( spectra_direction(m), 'x' ) /= 0 ) THEN |
---|
| 181 | CALL output_spectra_netcdf( m, 'x' ) |
---|
| 182 | ENDIF |
---|
[1] | 183 | ! |
---|
[1327] | 184 | !-- Output of y-spectra |
---|
| 185 | IF ( INDEX( spectra_direction(m), 'y' ) /= 0 ) THEN |
---|
| 186 | CALL output_spectra_netcdf( m, 'y' ) |
---|
[1] | 187 | ENDIF |
---|
| 188 | |
---|
| 189 | ! |
---|
| 190 | !-- Increase counter for next spectrum |
---|
| 191 | m = m + 1 |
---|
| 192 | |
---|
| 193 | ENDDO |
---|
| 194 | |
---|
| 195 | ! |
---|
| 196 | !-- Reset spectra values |
---|
[1353] | 197 | spectrum_x = 0.0_wp; spectrum_y = 0.0_wp |
---|
[1] | 198 | |
---|
| 199 | ENDIF |
---|
| 200 | |
---|
| 201 | CALL cpu_log( log_point(31), 'data_output_spectra', 'stop' ) |
---|
| 202 | |
---|
| 203 | #if defined( __parallel ) |
---|
| 204 | ! CALL MPI_BARRIER( comm2d, ierr ) ! really necessary |
---|
| 205 | #endif |
---|
| 206 | |
---|
| 207 | #endif |
---|
[1783] | 208 | #endif |
---|
[1] | 209 | END SUBROUTINE data_output_spectra |
---|
| 210 | |
---|
| 211 | |
---|
[1682] | 212 | !------------------------------------------------------------------------------! |
---|
| 213 | ! Description: |
---|
| 214 | ! ------------ |
---|
| 215 | !> @todo Missing subroutine description. |
---|
| 216 | !------------------------------------------------------------------------------! |
---|
[1] | 217 | SUBROUTINE output_spectra_netcdf( nsp, direction ) |
---|
| 218 | #if defined( __netcdf ) |
---|
| 219 | |
---|
[1320] | 220 | USE constants, & |
---|
| 221 | ONLY: pi |
---|
| 222 | |
---|
| 223 | USE control_parameters, & |
---|
| 224 | ONLY: dosp_time_count |
---|
| 225 | |
---|
| 226 | USE grid_variables, & |
---|
| 227 | ONLY: dx, dy |
---|
| 228 | |
---|
| 229 | USE indices, & |
---|
| 230 | ONLY: nx, ny |
---|
| 231 | |
---|
| 232 | USE kinds |
---|
| 233 | |
---|
[1783] | 234 | USE NETCDF |
---|
[1] | 235 | |
---|
[1783] | 236 | USE netcdf_interface, & |
---|
| 237 | ONLY: id_set_sp, id_var_dospx, id_var_dospy, nc_stat, & |
---|
| 238 | netcdf_handle_error |
---|
| 239 | |
---|
[1320] | 240 | USE spectrum, & |
---|
| 241 | ONLY: n_sp_x, n_sp_y |
---|
| 242 | |
---|
| 243 | USE statistics, & |
---|
| 244 | ONLY: spectrum_x, spectrum_y |
---|
| 245 | |
---|
[1] | 246 | IMPLICIT NONE |
---|
| 247 | |
---|
[1682] | 248 | CHARACTER (LEN=1), INTENT(IN) :: direction !< |
---|
[1] | 249 | |
---|
[1682] | 250 | INTEGER(iwp), INTENT(IN) :: nsp !< |
---|
[1] | 251 | |
---|
[1682] | 252 | INTEGER(iwp) :: i !< |
---|
| 253 | INTEGER(iwp) :: k !< |
---|
[1] | 254 | |
---|
[1682] | 255 | REAL(wp) :: frequency !< |
---|
[1] | 256 | |
---|
[1682] | 257 | REAL(wp), DIMENSION(nx/2) :: netcdf_data_x !< |
---|
| 258 | REAL(wp), DIMENSION(ny/2) :: netcdf_data_y !< |
---|
[1] | 259 | |
---|
| 260 | |
---|
| 261 | IF ( direction == 'x' ) THEN |
---|
| 262 | |
---|
| 263 | DO k = 1, n_sp_x |
---|
| 264 | |
---|
| 265 | DO i = 1, nx/2 |
---|
[1353] | 266 | frequency = 2.0_wp * pi * i / ( dx * ( nx + 1 ) ) |
---|
[1] | 267 | netcdf_data_x(i) = frequency * spectrum_x(i,k,nsp) |
---|
| 268 | ENDDO |
---|
| 269 | |
---|
| 270 | nc_stat = NF90_PUT_VAR( id_set_sp, id_var_dospx(nsp), netcdf_data_x, & |
---|
| 271 | start = (/ 1, k, dosp_time_count /), & |
---|
| 272 | count = (/ nx/2, 1, 1 /) ) |
---|
[1783] | 273 | CALL netcdf_handle_error( 'data_output_spectra', 348 ) |
---|
[1] | 274 | |
---|
| 275 | ENDDO |
---|
| 276 | |
---|
| 277 | ENDIF |
---|
| 278 | |
---|
| 279 | IF ( direction == 'y' ) THEN |
---|
| 280 | |
---|
| 281 | DO k = 1, n_sp_y |
---|
| 282 | |
---|
| 283 | DO i = 1, ny/2 |
---|
[1353] | 284 | frequency = 2.0_wp * pi * i / ( dy * ( ny + 1 ) ) |
---|
[1] | 285 | netcdf_data_y(i) = frequency * spectrum_y(i,k,nsp) |
---|
| 286 | ENDDO |
---|
| 287 | |
---|
| 288 | nc_stat = NF90_PUT_VAR( id_set_sp, id_var_dospy(nsp), netcdf_data_y, & |
---|
| 289 | start = (/ 1, k, dosp_time_count /), & |
---|
| 290 | count = (/ ny/2, 1, 1 /) ) |
---|
[1783] | 291 | CALL netcdf_handle_error( 'data_output_spectra', 349 ) |
---|
[1] | 292 | |
---|
| 293 | ENDDO |
---|
| 294 | |
---|
| 295 | ENDIF |
---|
| 296 | |
---|
| 297 | #endif |
---|
| 298 | END SUBROUTINE output_spectra_netcdf |
---|
| 299 | |
---|
| 300 | |
---|
| 301 | #if defined( __spectra ) |
---|
[1682] | 302 | !------------------------------------------------------------------------------! |
---|
| 303 | ! Description: |
---|
| 304 | ! ------------ |
---|
| 305 | !> @todo Missing subroutine description. |
---|
| 306 | !------------------------------------------------------------------------------! |
---|
[1] | 307 | SUBROUTINE data_output_spectra_x( m, cranz, pr, frame_written ) |
---|
| 308 | |
---|
[1324] | 309 | USE arrays_3d, & |
---|
| 310 | ONLY: zu, zw |
---|
[1320] | 311 | USE constants, & |
---|
| 312 | ONLY: pi |
---|
| 313 | |
---|
| 314 | USE control_parameters, & |
---|
[1324] | 315 | ONLY: averaging_interval_sp, run_description_header, simulated_time_chr |
---|
[1320] | 316 | |
---|
| 317 | USE grid_variables, & |
---|
| 318 | ONLY: dx |
---|
| 319 | |
---|
| 320 | USE indices, & |
---|
| 321 | ONLY: nx |
---|
| 322 | |
---|
| 323 | USE kinds |
---|
| 324 | |
---|
[1] | 325 | USE pegrid |
---|
| 326 | |
---|
[1324] | 327 | USE statistics, & |
---|
| 328 | ONLY: spectrum_x |
---|
| 329 | |
---|
[1320] | 330 | USE spectrum, & |
---|
[1324] | 331 | ONLY: comp_spectra_level, header_char, lstyles, klist_x, n_sp_x, & |
---|
| 332 | plot_spectra_level, utext_char, ytext_char |
---|
[1320] | 333 | |
---|
[1] | 334 | IMPLICIT NONE |
---|
| 335 | |
---|
[1682] | 336 | CHARACTER (LEN=30) :: atext !< |
---|
[1320] | 337 | |
---|
[1682] | 338 | INTEGER(iwp) :: i !< |
---|
| 339 | INTEGER(iwp) :: j !< |
---|
| 340 | INTEGER(iwp) :: k !< |
---|
| 341 | INTEGER(iwp) :: m !< |
---|
| 342 | INTEGER(iwp) :: pr !< |
---|
[1320] | 343 | |
---|
[1682] | 344 | LOGICAL :: frame_written !< |
---|
[1320] | 345 | |
---|
[1682] | 346 | REAL(wp) :: frequency = 0.0_wp !< |
---|
[1] | 347 | ! |
---|
| 348 | !-- Variables needed for PROFIL-namelist |
---|
[1682] | 349 | CHARACTER (LEN=80) :: rtext !< |
---|
| 350 | CHARACTER (LEN=80) :: utext !< |
---|
| 351 | CHARACTER (LEN=80) :: xtext = 'k in m>->1' !< |
---|
| 352 | CHARACTER (LEN=80) :: ytext !< |
---|
[1] | 353 | |
---|
[1682] | 354 | INTEGER(iwp) :: cranz !< |
---|
| 355 | INTEGER(iwp) :: labforx = 3 !< |
---|
| 356 | INTEGER(iwp) :: labfory = 3 !< |
---|
| 357 | INTEGER(iwp) :: legpos = 3 !< |
---|
| 358 | INTEGER(iwp) :: timodex = 1 !< |
---|
[1320] | 359 | |
---|
[1682] | 360 | INTEGER(iwp), DIMENSION(1:100) :: cucol = 1 !< |
---|
| 361 | INTEGER(iwp), DIMENSION(1:100) :: klist = 999999 !< |
---|
| 362 | INTEGER(iwp), DIMENSION(1:100) :: lstyle = 0 !< |
---|
[1320] | 363 | |
---|
[1682] | 364 | LOGICAL :: datleg = .TRUE. !< |
---|
| 365 | LOGICAL :: grid = .TRUE. !< |
---|
| 366 | LOGICAL :: lclose = .TRUE. !< |
---|
| 367 | LOGICAL :: rand = .TRUE. !< |
---|
| 368 | LOGICAL :: swap = .TRUE. !< |
---|
| 369 | LOGICAL :: twoxa = .TRUE. !< |
---|
| 370 | LOGICAL :: xlog = .TRUE. !< |
---|
| 371 | LOGICAL :: ylog = .TRUE. !< |
---|
[1320] | 372 | |
---|
[1682] | 373 | REAL(wp) :: gwid = 0.1_wp !< |
---|
| 374 | REAL(wp) :: rlegfak = 0.7_wp !< |
---|
| 375 | REAL(wp) :: uxmin !< |
---|
| 376 | REAL(wp) :: uxmax !< |
---|
| 377 | REAL(wp) :: uymin !< |
---|
| 378 | REAL(wp) :: uymax !< |
---|
[1320] | 379 | |
---|
[1682] | 380 | REAL(wp), DIMENSION(1:100) :: lwid = 0.6_wp !< |
---|
| 381 | REAL(wp), DIMENSION(100) :: uyma !< |
---|
| 382 | REAL(wp), DIMENSION(100) :: uymi !< |
---|
[1320] | 383 | |
---|
[1] | 384 | NAMELIST /RAHMEN/ cranz, datleg, rtext, swap |
---|
| 385 | NAMELIST /CROSS/ rand, cucol, grid, gwid, klist, labforx, labfory, & |
---|
| 386 | legpos, lclose, lstyle, lwid, rlegfak, timodex, utext, & |
---|
| 387 | uxmin, uxmax, uymin, uymax, twoxa, xlog, xtext, ylog, & |
---|
| 388 | ytext |
---|
| 389 | |
---|
| 390 | |
---|
| 391 | rtext = '\0.5 ' // run_description_header |
---|
| 392 | |
---|
| 393 | ! |
---|
| 394 | !-- Open parameter- and data-file |
---|
| 395 | CALL check_open( 81 ) |
---|
| 396 | CALL check_open( 82 ) |
---|
| 397 | |
---|
| 398 | ! |
---|
| 399 | !-- Write file header, |
---|
| 400 | !-- write RAHMEN-parameters (pr=3: w-array is on zw, other arrys on zu, |
---|
| 401 | !-- pr serves as an index for output of strings (axis-labels) of the |
---|
| 402 | !-- different quantities u, v, w, pt and q) |
---|
| 403 | DO k = 1, n_sp_x |
---|
[189] | 404 | IF ( k < 100 ) THEN |
---|
[1] | 405 | IF ( pr == 3 ) THEN |
---|
| 406 | WRITE ( 82, 100 ) '#', k, header_char( pr ), & |
---|
| 407 | INT( zw(comp_spectra_level(k)) ), & |
---|
| 408 | simulated_time_chr |
---|
| 409 | ELSE |
---|
| 410 | WRITE ( 82, 100 ) '#', k, header_char( pr ), & |
---|
| 411 | INT( zu(comp_spectra_level(k)) ), & |
---|
| 412 | simulated_time_chr |
---|
| 413 | ENDIF |
---|
| 414 | ELSE |
---|
| 415 | IF ( pr == 3 ) THEN |
---|
| 416 | WRITE ( 82, 101 ) '#', k, header_char( pr ), & |
---|
| 417 | INT( zw(comp_spectra_level(k)) ), & |
---|
| 418 | simulated_time_chr |
---|
| 419 | ELSE |
---|
| 420 | WRITE ( 82, 101 ) '#', k, header_char( pr ), & |
---|
| 421 | INT( zu(comp_spectra_level(k)) ), & |
---|
| 422 | simulated_time_chr |
---|
| 423 | ENDIF |
---|
| 424 | ENDIF |
---|
| 425 | ENDDO |
---|
| 426 | |
---|
| 427 | IF ( .NOT. frame_written ) THEN |
---|
| 428 | WRITE ( 81, RAHMEN ) |
---|
| 429 | frame_written = .TRUE. |
---|
| 430 | ENDIF |
---|
| 431 | |
---|
| 432 | ! |
---|
| 433 | !-- Write all data and calculate uymi and uyma. They serve to calculate |
---|
| 434 | !-- the CROSS-parameters uymin and uymax |
---|
[1353] | 435 | uymi = 999.999_wp; uyma = -999.999_wp |
---|
[1] | 436 | DO i = 1, nx/2 |
---|
[1353] | 437 | frequency = 2.0_wp * pi * i / ( dx * ( nx + 1 ) ) |
---|
[1] | 438 | WRITE ( 82, 102 ) frequency, ( frequency * spectrum_x(i,k,m), k = 1, & |
---|
| 439 | n_sp_x ) |
---|
| 440 | DO k = 1, n_sp_x |
---|
| 441 | uymi(k) = MIN( uymi(k), frequency * spectrum_x(i,k,m) ) |
---|
| 442 | uyma(k) = MAX( uyma(k), frequency * spectrum_x(i,k,m) ) |
---|
| 443 | ENDDO |
---|
| 444 | ENDDO |
---|
| 445 | |
---|
| 446 | ! |
---|
| 447 | !-- Determine CROSS-parameters |
---|
| 448 | cucol(1:n_sp_x) = (/ ( k, k = 1, n_sp_x ) /) |
---|
| 449 | lstyle(1:n_sp_x) = (/ ( lstyles(k), k = 1, n_sp_x ) /) |
---|
| 450 | |
---|
| 451 | ! |
---|
| 452 | !-- Calculate klist-values from the available comp_spectra_level values |
---|
| 453 | i = 1; k = 1 |
---|
[189] | 454 | DO WHILE ( i <= 100 .AND. plot_spectra_level(i) /= 999999 ) |
---|
[1] | 455 | DO WHILE ( k <= n_sp_x .AND. & |
---|
| 456 | plot_spectra_level(i) >= comp_spectra_level(k) ) |
---|
| 457 | IF ( plot_spectra_level(i) == comp_spectra_level(k) ) THEN |
---|
| 458 | klist(i) = k + klist_x |
---|
| 459 | ELSE |
---|
[1353] | 460 | uymi(k) = 999.999_wp |
---|
| 461 | uyma(k) = -999.999_wp |
---|
[1] | 462 | ENDIF |
---|
| 463 | k = k + 1 |
---|
| 464 | ENDDO |
---|
| 465 | i = i + 1 |
---|
| 466 | ENDDO |
---|
[1353] | 467 | uymi(k:n_sp_x) = 999.999_wp |
---|
| 468 | uyma(k:n_sp_x) = -999.999_wp |
---|
[1] | 469 | utext = 'x'//utext_char( pr ) |
---|
[1353] | 470 | IF ( averaging_interval_sp /= 0.0_wp ) THEN |
---|
[1] | 471 | WRITE ( atext, 104 ) averaging_interval_sp |
---|
| 472 | utext = TRIM(utext) // ', ' // TRIM( atext ) |
---|
| 473 | ENDIF |
---|
[1353] | 474 | uxmin = 0.8_wp * 2.0_wp * pi / ( dx * ( nx + 1 ) ) |
---|
| 475 | uxmax = 1.2_wp * 2.0_wp * pi * nx/2 / ( dx * ( nx + 1 ) ) |
---|
| 476 | uymin = 0.8_wp * MIN ( 999.999_wp, MINVAL ( uymi ) ) |
---|
| 477 | uymax = 1.2_wp * MAX ( -999.999_wp, MAXVAL ( uyma ) ) |
---|
[1] | 478 | ytext = ytext_char( pr ) |
---|
| 479 | |
---|
| 480 | ! |
---|
| 481 | !-- Output of CROSS-parameters |
---|
| 482 | WRITE ( 81, CROSS ) |
---|
| 483 | |
---|
| 484 | ! |
---|
| 485 | !-- Increase counter by the number of profiles written in the actual block |
---|
| 486 | klist_x = klist_x + n_sp_x |
---|
| 487 | |
---|
| 488 | ! |
---|
| 489 | !-- Write end-mark |
---|
| 490 | WRITE ( 82, 103 ) |
---|
| 491 | |
---|
| 492 | ! |
---|
| 493 | !-- Close parameter- and data-file |
---|
| 494 | CALL close_file( 81 ) |
---|
| 495 | CALL close_file( 82 ) |
---|
| 496 | |
---|
| 497 | ! |
---|
| 498 | !-- Formats |
---|
| 499 | 100 FORMAT (A,I1,1X,A,1X,I4,'m ',A) |
---|
| 500 | 101 FORMAT (A,I2,1X,A,1X,I4,'m ',A) |
---|
[189] | 501 | 102 FORMAT (E15.7,100(1X,E15.7)) |
---|
[1] | 502 | 103 FORMAT ('NEXT') |
---|
| 503 | 104 FORMAT ('time averaged over',F7.1,' s') |
---|
| 504 | |
---|
| 505 | END SUBROUTINE data_output_spectra_x |
---|
| 506 | |
---|
| 507 | |
---|
[1682] | 508 | !------------------------------------------------------------------------------! |
---|
| 509 | ! Description: |
---|
| 510 | ! ------------ |
---|
| 511 | !> @todo Missing subroutine description. |
---|
| 512 | !------------------------------------------------------------------------------! |
---|
[1] | 513 | SUBROUTINE data_output_spectra_y( m, cranz, pr, frame_written ) |
---|
| 514 | |
---|
[1324] | 515 | USE arrays_3d, & |
---|
| 516 | ONLY: zu, zw |
---|
| 517 | |
---|
[1320] | 518 | USE constants, & |
---|
| 519 | ONLY: pi |
---|
| 520 | |
---|
| 521 | USE control_parameters, & |
---|
[1324] | 522 | ONLY: averaging_interval_sp, run_description_header, simulated_time_chr |
---|
[1320] | 523 | |
---|
| 524 | USE grid_variables, & |
---|
| 525 | ONLY: dy |
---|
| 526 | |
---|
| 527 | USE indices, & |
---|
| 528 | ONLY: ny |
---|
| 529 | |
---|
| 530 | USE kinds |
---|
| 531 | |
---|
[1] | 532 | USE pegrid |
---|
[1324] | 533 | |
---|
| 534 | USE statistics, & |
---|
| 535 | ONLY: spectrum_y |
---|
[1] | 536 | |
---|
[1324] | 537 | USE spectrum, & |
---|
| 538 | ONLY: comp_spectra_level, header_char, klist_y, lstyles, n_sp_y, & |
---|
| 539 | plot_spectra_level, utext_char, ytext_char |
---|
[1320] | 540 | |
---|
[1] | 541 | IMPLICIT NONE |
---|
| 542 | |
---|
[1320] | 543 | |
---|
[1682] | 544 | CHARACTER (LEN=30) :: atext !< |
---|
[1320] | 545 | |
---|
[1682] | 546 | INTEGER(iwp) :: i !< |
---|
| 547 | INTEGER(iwp) :: j !< |
---|
| 548 | INTEGER(iwp) :: k !< |
---|
| 549 | INTEGER(iwp) :: m !< |
---|
| 550 | INTEGER(iwp) :: pr !< |
---|
[1320] | 551 | |
---|
[1682] | 552 | LOGICAL :: frame_written !< |
---|
[1320] | 553 | |
---|
[1682] | 554 | REAL(wp) :: frequency = 0.0_wp !< |
---|
[1] | 555 | |
---|
| 556 | ! |
---|
| 557 | !-- Variables needed for PROFIL-namelist |
---|
[1682] | 558 | CHARACTER (LEN=80) :: rtext !< |
---|
| 559 | CHARACTER (LEN=80) :: utext !< |
---|
| 560 | CHARACTER (LEN=80) :: xtext = 'k in m>->1' !< |
---|
| 561 | CHARACTER (LEN=80) :: ytext !< |
---|
[1] | 562 | |
---|
[1682] | 563 | INTEGER(iwp) :: cranz !< |
---|
| 564 | INTEGER(iwp) :: labforx = 3 !< |
---|
| 565 | INTEGER(iwp) :: labfory = 3 !< |
---|
| 566 | INTEGER(iwp) :: legpos = 3 !< |
---|
| 567 | INTEGER(iwp) :: timodex = 1 !< |
---|
[1320] | 568 | |
---|
[1682] | 569 | INTEGER(iwp), DIMENSION(1:100) :: cucol = 1 !< |
---|
| 570 | INTEGER(iwp), DIMENSION(1:100) :: klist = 999999 !< |
---|
| 571 | INTEGER(iwp), DIMENSION(1:100) :: lstyle = 0 !< |
---|
[1320] | 572 | |
---|
[1682] | 573 | LOGICAL :: datleg = .TRUE. !< |
---|
| 574 | LOGICAL :: grid = .TRUE. !< |
---|
| 575 | LOGICAL :: lclose = .TRUE. !< |
---|
| 576 | LOGICAL :: rand = .TRUE. !< |
---|
| 577 | LOGICAL :: swap = .TRUE. !< |
---|
| 578 | LOGICAL :: twoxa = .TRUE. !< |
---|
| 579 | LOGICAL :: xlog = .TRUE. !< |
---|
| 580 | LOGICAL :: ylog = .TRUE. !< |
---|
[1320] | 581 | |
---|
[1682] | 582 | REAL(wp) :: gwid = 0.1_wp !< |
---|
| 583 | REAL(wp) :: rlegfak = 0.7_wp !< |
---|
| 584 | REAL(wp) :: uxmin !< |
---|
| 585 | REAL(wp) :: uxmax !< |
---|
| 586 | REAL(wp) :: uymin !< |
---|
| 587 | REAL(wp) :: uymax !< |
---|
[1320] | 588 | |
---|
[1682] | 589 | REAL(wp), DIMENSION(1:100) :: lwid = 0.6_wp !< |
---|
[1320] | 590 | |
---|
[1682] | 591 | REAL(wp), DIMENSION(100) :: uyma !< |
---|
| 592 | REAL(wp), DIMENSION(100) :: uymi !< |
---|
[1320] | 593 | |
---|
[1] | 594 | NAMELIST /RAHMEN/ cranz, datleg, rtext, swap |
---|
| 595 | NAMELIST /CROSS/ rand, cucol, grid, gwid, klist, labforx, labfory, & |
---|
| 596 | legpos, lclose, lstyle, lwid, rlegfak, timodex, utext, & |
---|
| 597 | uxmin, uxmax, uymin, uymax, twoxa, xlog, xtext, ylog, & |
---|
| 598 | ytext |
---|
| 599 | |
---|
| 600 | |
---|
| 601 | rtext = '\0.5 ' // run_description_header |
---|
| 602 | |
---|
| 603 | ! |
---|
| 604 | !-- Open parameter- and data-file |
---|
| 605 | CALL check_open( 83 ) |
---|
| 606 | CALL check_open( 84 ) |
---|
| 607 | |
---|
| 608 | ! |
---|
| 609 | !-- Write file header, |
---|
| 610 | !-- write RAHMEN-parameters (pr=3: w-array is on zw, other arrys on zu, |
---|
| 611 | !-- pr serves as an index for output of strings (axis-labels) of the |
---|
| 612 | !-- different quantities u, v, w, pt and q) |
---|
| 613 | DO k = 1, n_sp_y |
---|
[189] | 614 | IF ( k < 100 ) THEN |
---|
[1] | 615 | IF ( pr == 3 ) THEN |
---|
| 616 | WRITE ( 84, 100 ) '#', k, header_char( pr ), & |
---|
| 617 | INT( zw(comp_spectra_level(k)) ), & |
---|
| 618 | simulated_time_chr |
---|
| 619 | ELSE |
---|
| 620 | WRITE ( 84, 100 ) '#', k, header_char( pr ), & |
---|
| 621 | INT( zu(comp_spectra_level(k)) ), & |
---|
| 622 | simulated_time_chr |
---|
| 623 | ENDIF |
---|
| 624 | ELSE |
---|
| 625 | IF ( pr == 3 ) THEN |
---|
| 626 | WRITE ( 84, 101 ) '#', k, header_char( pr ), & |
---|
| 627 | INT( zw(comp_spectra_level(k)) ), & |
---|
| 628 | simulated_time_chr |
---|
| 629 | ELSE |
---|
| 630 | WRITE ( 84, 101 ) '#', k, header_char( pr ), & |
---|
| 631 | INT( zu(comp_spectra_level(k)) ), & |
---|
| 632 | simulated_time_chr |
---|
| 633 | ENDIF |
---|
| 634 | ENDIF |
---|
| 635 | ENDDO |
---|
| 636 | |
---|
| 637 | IF ( .NOT. frame_written ) THEN |
---|
| 638 | WRITE ( 83, RAHMEN ) |
---|
| 639 | frame_written = .TRUE. |
---|
| 640 | ENDIF |
---|
| 641 | |
---|
| 642 | ! |
---|
| 643 | !-- Write all data and calculate uymi and uyma. They serve to calculate |
---|
| 644 | !-- the CROSS-parameters uymin and uymax |
---|
[1353] | 645 | uymi = 999.999_wp; uyma = -999.999_wp |
---|
[1] | 646 | DO j = 1, ny/2 |
---|
[1353] | 647 | frequency = 2.0_wp * pi * j / ( dy * ( ny + 1 ) ) |
---|
[1] | 648 | WRITE ( 84, 102 ) frequency, ( frequency * spectrum_y(j,k,m), & |
---|
| 649 | k = 1, n_sp_y ) |
---|
| 650 | DO k = 1, n_sp_y |
---|
| 651 | uymi(k) = MIN( uymi(k), frequency * spectrum_y(j,k,m) ) |
---|
| 652 | uyma(k) = MAX( uyma(k), frequency * spectrum_y(j,k,m) ) |
---|
| 653 | ENDDO |
---|
| 654 | ENDDO |
---|
| 655 | |
---|
| 656 | ! |
---|
| 657 | !-- Determine CROSS-parameters |
---|
| 658 | cucol(1:n_sp_y) = (/ ( k, k = 1, n_sp_y ) /) |
---|
| 659 | lstyle(1:n_sp_y) = (/ ( lstyles(k), k = 1, n_sp_y ) /) |
---|
| 660 | |
---|
| 661 | ! |
---|
| 662 | !-- Calculate klist-values from the available comp_spectra_level values |
---|
| 663 | j = 1; k = 1 |
---|
[189] | 664 | DO WHILE ( j <= 100 .AND. plot_spectra_level(j) /= 999999 ) |
---|
[1] | 665 | DO WHILE ( k <= n_sp_y .AND. & |
---|
| 666 | plot_spectra_level(j) >= comp_spectra_level(k) ) |
---|
| 667 | IF ( plot_spectra_level(j) == comp_spectra_level(k) ) THEN |
---|
| 668 | klist(j) = k + klist_y |
---|
| 669 | ELSE |
---|
[1353] | 670 | uymi(k) = 999.999_wp |
---|
| 671 | uyma(k) = -999.999_wp |
---|
[1] | 672 | ENDIF |
---|
| 673 | k = k + 1 |
---|
| 674 | ENDDO |
---|
| 675 | j = j + 1 |
---|
| 676 | ENDDO |
---|
[1353] | 677 | uymi(k:n_sp_y) = 999.999_wp |
---|
| 678 | uyma(k:n_sp_y) = -999.999_wp |
---|
[1] | 679 | utext = 'y'//utext_char( pr ) |
---|
[1353] | 680 | IF ( averaging_interval_sp /= 0.0_wp ) THEN |
---|
[1] | 681 | WRITE ( atext, 104 ) averaging_interval_sp |
---|
| 682 | utext = TRIM(utext) // ', ' // TRIM( atext ) |
---|
| 683 | ENDIF |
---|
[1353] | 684 | uxmin = 0.8_wp * 2.0_wp * pi / ( dy * ( ny + 1 ) ) |
---|
| 685 | uxmax = 1.2_wp * 2.0_wp * pi * ny/2 / ( dy * ( ny + 1 ) ) |
---|
| 686 | uymin = 0.8_wp * MIN ( 999.999_wp, MINVAL ( uymi ) ) |
---|
| 687 | uymax = 1.2_wp * MAX ( -999.999_wp, MAXVAL ( uyma ) ) |
---|
[1] | 688 | ytext = ytext_char( pr ) |
---|
| 689 | |
---|
| 690 | ! |
---|
| 691 | !-- Output CROSS-parameters |
---|
| 692 | WRITE ( 83, CROSS ) |
---|
| 693 | |
---|
| 694 | ! |
---|
| 695 | !-- Increase counter by the number of profiles written in the actual block |
---|
| 696 | klist_y = klist_y + n_sp_y |
---|
| 697 | |
---|
| 698 | ! |
---|
| 699 | !-- Write end-mark |
---|
| 700 | WRITE ( 84, 103 ) |
---|
| 701 | |
---|
| 702 | ! |
---|
| 703 | !-- Close parameter- and data-file |
---|
| 704 | CALL close_file( 83 ) |
---|
| 705 | CALL close_file( 84 ) |
---|
| 706 | |
---|
| 707 | ! |
---|
| 708 | !-- Formats |
---|
| 709 | 100 FORMAT (A,I1,1X,A,1X,I4,'m ',A) |
---|
| 710 | 101 FORMAT (A,I2,1X,A,1X,I4,'m ',A) |
---|
[189] | 711 | 102 FORMAT (E15.7,100(1X,E15.7)) |
---|
[1] | 712 | 103 FORMAT ('NEXT') |
---|
| 713 | 104 FORMAT ('time averaged over',F7.1,' s') |
---|
| 714 | |
---|
| 715 | END SUBROUTINE data_output_spectra_y |
---|
| 716 | #endif |
---|