Changeset 345 for palm/trunk/SOURCE/data_output_profiles.f90
 Timestamp:
 Jul 1, 2009 2:37:56 PM (13 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

palm/trunk/SOURCE/data_output_profiles.f90
r291 r345 4 4 ! Current revisions: 5 5 !  6 ! In case of restart runs without extension, initial profiles are not written 7 ! to NetCDFfile anymore. 6 8 ! simulated_time in NetCDF output replaced by time_since_reference_point. 7 9 ! Output of NetCDF messages with aid of message handling routine. … … 48 50 49 51 INTEGER :: i, id, ilc, ils, j, k, sr 50 LOGICAL :: output_for_t051 52 REAL :: uxma, uxmi 52 53 … … 107 108 ! Output of initial profiles 108 109 IF ( dopr_time_count == 1 ) THEN 109 110 IF ( netcdf_output ) THEN 111 #if defined( __netcdf ) 112 ! 113 ! Store initial time (t=0) to time axis, but only if an output 114 ! is required for at least one of the profiles 115 output_for_t0 = .FALSE. 116 DO i = 1, dopr_n 110 111 IF ( .NOT. output_for_t0 ) THEN 112 113 IF ( netcdf_output ) THEN 114 #if defined( __netcdf ) 115 ! 116 ! Store initial time (t=0) to time axis, but only if an output 117 ! is required for at least one of the profiles 118 DO i = 1, dopr_n 117 119 IF ( dopr_initial_index(i) /= 0 ) THEN 118 120 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_time_pr, & 119 (/ 0.0 /), start = (/ 1 /), & 120 count = (/ 1 /) ) 121 CALL handle_netcdf_error( 'data_output_profiles', 329 ) 122 output_for_t0 = .TRUE. 123 EXIT 124 ENDIF 125 ENDDO 126 127 ! 128 ! Store normalization factors 129 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(1), & ! wpt0 130 (/ hom_sum(nzb,18,normalizing_region) /), & 121 (/ 0.0 /), start = (/ 1 /), & 122 count = (/ 1 /) ) 123 CALL handle_netcdf_error( 'data_output_profiles', 329 ) 124 output_for_t0 = .TRUE. 125 EXIT 126 ENDIF 127 ENDDO 128 129 ! 130 ! Store normalization factors 131 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(1), & ! wpt0 132 (/ hom_sum(nzb,18,normalizing_region) /), & 133 start = (/ 1 /), count = (/ 1 /) ) 134 CALL handle_netcdf_error( 'data_output_profiles', 330 ) 135 136 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(2), & ! ws2 137 (/ hom_sum(nzb+8,pr_palm,normalizing_region)**2 /), & 138 start = (/ 1 /), count = (/ 1 /) ) 139 CALL handle_netcdf_error( 'data_output_profiles', 331 ) 140 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(3), & ! tsw2 141 (/ hom_sum(nzb+3,pr_palm,normalizing_region)**2 /), & 131 142 start = (/ 1 /), count = (/ 1 /) ) 132 CALL handle_netcdf_error( 'data_output_profiles', 330 ) 133 134 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(2), & ! ws2 135 (/ hom_sum(nzb+8,pr_palm,normalizing_region)**2 /), & 136 start = (/ 1 /), count = (/ 1 /) ) 137 CALL handle_netcdf_error( 'data_output_profiles', 331 ) 138 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(3), & ! tsw2 139 (/ hom_sum(nzb+3,pr_palm,normalizing_region)**2 /), & 140 start = (/ 1 /), count = (/ 1 /) ) 141 CALL handle_netcdf_error( 'data_output_profiles', 332 ) 142 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(4), & ! ws3 143 (/ hom_sum(nzb+8,pr_palm,normalizing_region)**3 /), & 144 start = (/ 1 /), count = (/ 1 /) ) 145 CALL handle_netcdf_error( 'data_output_profiles', 333 ) 146 147 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(5), & ! ws2tsw 148 (/ hom_sum(nzb+8,pr_palm,normalizing_region)**3 * & 149 hom_sum(nzb+3,pr_palm,normalizing_region) /), & 150 start = (/ 1 /), count = (/ 1 /) ) 151 CALL handle_netcdf_error( 'data_output_profiles', 334 ) 152 153 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(6), & ! wstsw2 154 (/ hom_sum(nzb+8,pr_palm,normalizing_region) * & 155 hom_sum(nzb+3,pr_palm,normalizing_region)**2 /), & 156 start = (/ 1 /), count = (/ 1 /) ) 157 CALL handle_netcdf_error( 'data_output_profiles', 335 ) 158 159 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(7), & ! z_i 160 (/ hom_sum(nzb+6,pr_palm,normalizing_region) /), & 161 start = (/ 1 /), count = (/ 1 /) ) 162 CALL handle_netcdf_error( 'data_output_profiles', 336 ) 143 CALL handle_netcdf_error( 'data_output_profiles', 332 ) 144 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(4), & ! ws3 145 (/ hom_sum(nzb+8,pr_palm,normalizing_region)**3 /), & 146 start = (/ 1 /), count = (/ 1 /) ) 147 CALL handle_netcdf_error( 'data_output_profiles', 333 ) 148 149 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(5), &!ws2tsw 150 (/ hom_sum(nzb+8,pr_palm,normalizing_region)**3 * & 151 hom_sum(nzb+3,pr_palm,normalizing_region) /), & 152 start = (/ 1 /), count = (/ 1 /) ) 153 CALL handle_netcdf_error( 'data_output_profiles', 334 ) 154 155 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(6), &!wstsw2 156 (/ hom_sum(nzb+8,pr_palm,normalizing_region) * & 157 hom_sum(nzb+3,pr_palm,normalizing_region)**2 /), & 158 start = (/ 1 /), count = (/ 1 /) ) 159 CALL handle_netcdf_error( 'data_output_profiles', 335 ) 160 161 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_norm_dopr(7), & ! z_i 162 (/ hom_sum(nzb+6,pr_palm,normalizing_region) /), & 163 start = (/ 1 /), count = (/ 1 /) ) 164 CALL handle_netcdf_error( 'data_output_profiles', 336 ) 165 163 166 #endif 164 ENDIF 165 ! 166 ! Loop over all 1D variables 167 DO i = 1, dopr_n 168 169 IF ( dopr_initial_index(i) /= 0 ) THEN 170 171 ! 172 ! Output for the individual (sub)regions 173 DO sr = 0, statistic_regions 167 ENDIF 168 ! 169 ! Loop over all 1D variables 170 DO i = 1, dopr_n 171 172 IF ( dopr_initial_index(i) /= 0 ) THEN 173 174 ! 175 ! Output for the individual (sub)regions 176 DO sr = 0, statistic_regions 177 178 IF ( profil_output ) THEN 179 id = 40 + sr 180 ! 181 ! Write LabelHeader 182 WRITE ( id, 100 ) TRIM( data_output_pr(i) ), '(t=0)' 183 ! 184 ! Write total profile 185 DO k = nzb, nzt+1 186 WRITE ( id, 101 ) hom(k,2,dopr_initial_index(i),sr), & 187 hom(k,1,dopr_initial_index(i),sr) 188 ENDDO 189 ! 190 ! Write separation label 191 WRITE ( id, 102 ) 192 ENDIF 193 194 IF ( netcdf_output ) THEN 195 #if defined( __netcdf ) 196 ! 197 ! Write data to netcdf file 198 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_dopr(i,sr), & 199 hom(nzb:nzt+1,1,dopr_initial_index(i),sr), & 200 start = (/ 1, 1 /), & 201 count = (/ nztnzb+2, 1 /) ) 202 CALL handle_netcdf_error( 'data_output_profiles', 337 ) 203 #endif 204 ENDIF 205 206 ENDDO 174 207 175 208 IF ( profil_output ) THEN 176 id = 40 + sr 177 ! 178 ! Write LabelHeader 179 WRITE ( id, 100 ) TRIM( data_output_pr(i) ), '(t=0)' 180 ! 181 ! Write total profile 182 DO k = nzb, nzt+1 183 WRITE ( id, 101 ) hom(k,2,dopr_initial_index(i),sr), & 184 hom(k,1,dopr_initial_index(i),sr) 185 ENDDO 186 ! 187 ! Write separation label 188 WRITE ( id, 102 ) 189 ENDIF 190 191 IF ( netcdf_output ) THEN 192 #if defined( __netcdf ) 193 ! 194 ! Write data to netcdf file 195 nc_stat = NF90_PUT_VAR( id_set_pr, id_var_dopr(i,sr), & 196 hom(nzb:nzt+1,1,dopr_initial_index(i),sr), & 197 start = (/ 1, 1 /), & 198 count = (/ nztnzb+2, 1 /) ) 199 CALL handle_netcdf_error( 'data_output_profiles', 337 ) 200 #endif 201 ENDIF 202 203 ENDDO 204 205 IF ( profil_output ) THEN 206 ! 207 ! Determine indices for later NAMELISToutput (s. below) 208 profile_number = profile_number + 1 209 j = dopr_crossindex(i) 210 IF ( j /= 0 ) THEN 211 cross_profile_number_count(j) = & 212 cross_profile_number_count(j) + 1 213 k = cross_profile_number_count(j) 214 cross_profile_numbers(k,j) = profile_number 215 ! 216 ! Initial profiles are always drawn as solid lines in 217 ! antibackground colour. 218 cross_linecolors(k,j) = 1 219 cross_linestyles(k,j) = 0 220 ! 221 ! If required, extend xvalue range of the respective 222 ! cross, provided it has not been specified in & 223 ! check_parameters. Determination over all (sub)regions. 224 IF ( cross_uxmin(j) == 0.0 .AND. & 225 cross_uxmax(j) == 0.0 ) THEN 226 227 DO sr = 0, statistic_regions 228 229 uxmi = & 230 MINVAL( hom(:nz_do1d,1,dopr_initial_index(i),sr) ) 231 232 uxma = & 233 MAXVAL( hom(:nz_do1d,1,dopr_initial_index(i),sr) ) 234 ! 235 ! When the value range of the first line in the 236 ! corresponding cross is determined, its value range 237 ! is simply adopted. 238 IF ( cross_uxmin_computed(j) > & 239 cross_uxmax_computed(j) ) THEN 240 cross_uxmin_computed(j) = uxmi 241 cross_uxmax_computed(j) = uxma 242 ELSE 243 cross_uxmin_computed(j) = & 244 MIN( cross_uxmin_computed(j), uxmi ) 245 cross_uxmax_computed(j) = & 246 MAX( cross_uxmax_computed(j), uxma ) 247 ENDIF 248 249 ENDDO 250 251 ENDIF 252 ! 253 ! If required, determine and note normalizing factors 254 SELECT CASE ( cross_normalized_x(j) ) 255 256 CASE ( 'ts2' ) 257 cross_normx_factor(k,j) = & 258 ( hom_sum(nzb+3,pr_palm,normalizing_region) )**2 259 CASE ( 'wpt0' ) 260 cross_normx_factor(k,j) = & 261 hom_sum(nzb,18,normalizing_region) 262 CASE ( 'wsts2' ) 263 cross_normx_factor(k,j) = & 264 hom_sum(nzb+8,pr_palm,normalizing_region) & 265 * ( hom_sum(nzb+3,pr_palm,normalizing_region) )**2 266 CASE ( 'ws2' ) 267 cross_normx_factor(k,j) = & 268 ( hom_sum(nzb+8,pr_palm,normalizing_region) )**2 269 CASE ( 'ws2ts' ) 270 cross_normx_factor(k,j) = & 271 ( hom_sum(nzb+8,pr_palm,normalizing_region) )**2 & 272 * hom_sum(nzb+3,pr_palm,normalizing_region) 273 CASE ( 'ws3' ) 274 cross_normx_factor(k,j) = & 275 ( hom_sum(nzb+8,pr_palm,normalizing_region) )**3 276 277 END SELECT 278 279 SELECT CASE ( cross_normalized_y(j) ) 280 281 CASE ( 'z_i' ) 282 cross_normy_factor(k,j) = & 283 hom_sum(nzb+6,pr_palm,normalizing_region) 284 285 END SELECT 286 287 ! 288 ! Check the normalizing factors for zeros and deactivate 289 ! the normalization, if required. 290 IF ( cross_normx_factor(k,j) == 0.0 .OR. & 291 cross_normy_factor(k,j) == 0.0 ) THEN 292 WRITE( message_string, * ) 'data_output_profiles: ', & 293 'normalizing cross ',j, ' is not possible ', & 294 'since one of the & normalizing factors ', & 295 'is zero! & cross_normx_factor(',k,',',j,') = ', & 296 cross_normx_factor(k,j), & 297 ' & cross_normy_factor(',k,',',j,') = ', & 298 cross_normy_factor(k,j) 299 CALL message( 'data_output_profiles', 'PA0185',& 300 0, 1, 0, 6, 0 ) 301 cross_normx_factor(k,j) = 1.0 302 cross_normy_factor(k,j) = 1.0 303 cross_normalized_x(j) = ' ' 304 cross_normalized_y(j) = ' ' 305 ENDIF 306 307 ! 308 ! If required, extend normalized xvalue range of the 309 ! respective cross, provided it has not been specified in 310 ! check_parameters. Determination over all (sub)regions. 311 IF ( cross_uxmin_normalized(j) == 0.0 .AND. & 312 cross_uxmax_normalized(j) == 0.0 ) THEN 313 314 DO sr = 0, statistic_regions 315 316 uxmi = MINVAL( hom(:nz_do1d,1, & 317 dopr_initial_index(i),sr) ) / & 318 cross_normx_factor(k,j) 319 uxma = MAXVAL( hom(:nz_do1d,1, & 320 dopr_initial_index(i),sr) ) / & 321 cross_normx_factor(k,j) 322 ! 323 ! When the value range of the first line in the 324 ! corresponding cross is determined, its value range 325 ! is simply adopted. 326 IF ( cross_uxmin_normalized_computed(j) > & 327 cross_uxmax_normalized_computed(j) ) THEN 328 cross_uxmin_normalized_computed(j) = uxmi 329 cross_uxmax_normalized_computed(j) = uxma 330 ELSE 331 cross_uxmin_normalized_computed(j) = & 332 MIN( cross_uxmin_normalized_computed(j), uxmi ) 333 cross_uxmax_normalized_computed(j) = & 334 MAX( cross_uxmax_normalized_computed(j), uxma ) 335 ENDIF 336 337 ENDDO 338 339 ENDIF 340 341 ENDIF ! Index determination 342 343 ENDIF ! profil output 344 345 ENDIF ! Initial profile available 346 347 ENDDO ! Loop over dopr_n for initial profiles 348 349 IF ( netcdf_output .AND. output_for_t0 ) THEN 350 dopr_time_count = dopr_time_count + 1 351 ENDIF 352 209 ! 210 ! Determine indices for later NAMELISToutput (s. below) 211 profile_number = profile_number + 1 212 j = dopr_crossindex(i) 213 IF ( j /= 0 ) THEN 214 cross_profile_number_count(j) = & 215 cross_profile_number_count(j) + 1 216 k = cross_profile_number_count(j) 217 cross_profile_numbers(k,j) = profile_number 218 ! 219 ! Initial profiles are always drawn as solid lines in 220 ! antibackground colour. 221 cross_linecolors(k,j) = 1 222 cross_linestyles(k,j) = 0 223 ! 224 ! If required, extend xvalue range of the respective 225 ! cross, provided it has not been specified in & 226 ! check_parameters. Determination over all (sub)regions. 227 IF ( cross_uxmin(j) == 0.0 .AND. & 228 cross_uxmax(j) == 0.0 ) THEN 229 230 DO sr = 0, statistic_regions 231 232 uxmi = & 233 MINVAL( hom(:nz_do1d,1,dopr_initial_index(i),sr) ) 234 235 uxma = & 236 MAXVAL( hom(:nz_do1d,1,dopr_initial_index(i),sr) ) 237 ! 238 ! When the value range of the first line in the 239 ! corresponding cross is determined, its value range 240 ! is simply adopted. 241 IF ( cross_uxmin_computed(j) > & 242 cross_uxmax_computed(j) ) THEN 243 cross_uxmin_computed(j) = uxmi 244 cross_uxmax_computed(j) = uxma 245 ELSE 246 cross_uxmin_computed(j) = & 247 MIN( cross_uxmin_computed(j), uxmi ) 248 cross_uxmax_computed(j) = & 249 MAX( cross_uxmax_computed(j), uxma ) 250 ENDIF 251 252 ENDDO 253 254 ENDIF 255 ! 256 ! If required, determine and note normalizing factors 257 SELECT CASE ( cross_normalized_x(j) ) 258 259 CASE ( 'ts2' ) 260 cross_normx_factor(k,j) = & 261 ( hom_sum(nzb+3,pr_palm,normalizing_region) )**2 262 CASE ( 'wpt0' ) 263 cross_normx_factor(k,j) = & 264 hom_sum(nzb,18,normalizing_region) 265 CASE ( 'wsts2' ) 266 cross_normx_factor(k,j) = & 267 hom_sum(nzb+8,pr_palm,normalizing_region) & 268 * ( hom_sum(nzb+3,pr_palm,normalizing_region) )**2 269 CASE ( 'ws2' ) 270 cross_normx_factor(k,j) = & 271 ( hom_sum(nzb+8,pr_palm,normalizing_region) )**2 272 CASE ( 'ws2ts' ) 273 cross_normx_factor(k,j) = & 274 ( hom_sum(nzb+8,pr_palm,normalizing_region) )**2 & 275 * hom_sum(nzb+3,pr_palm,normalizing_region) 276 CASE ( 'ws3' ) 277 cross_normx_factor(k,j) = & 278 ( hom_sum(nzb+8,pr_palm,normalizing_region) )**3 279 280 END SELECT 281 282 SELECT CASE ( cross_normalized_y(j) ) 283 284 CASE ( 'z_i' ) 285 cross_normy_factor(k,j) = & 286 hom_sum(nzb+6,pr_palm,normalizing_region) 287 288 END SELECT 289 290 ! 291 ! Check the normalizing factors for zeros and deactivate 292 ! the normalization, if required. 293 IF ( cross_normx_factor(k,j) == 0.0 .OR. & 294 cross_normy_factor(k,j) == 0.0 ) THEN 295 WRITE( message_string, * ) 'data_output_profiles: ', & 296 'normalizing cross ',j, ' is not possible ', & 297 'since one of the & normalizing factors ', & 298 'is zero! & cross_normx_factor(',k,',',j,') = ', & 299 cross_normx_factor(k,j), & 300 ' & cross_normy_factor(',k,',',j,') = ', & 301 cross_normy_factor(k,j) 302 CALL message( 'data_output_profiles', 'PA0185',& 303 0, 1, 0, 6, 0 ) 304 cross_normx_factor(k,j) = 1.0 305 cross_normy_factor(k,j) = 1.0 306 cross_normalized_x(j) = ' ' 307 cross_normalized_y(j) = ' ' 308 ENDIF 309 310 ! 311 ! If required, extend normalized xvalue range of the 312 ! respective cross, provided it has not been specified in 313 ! check_parameters. Determination over all (sub)regions. 314 IF ( cross_uxmin_normalized(j) == 0.0 .AND. & 315 cross_uxmax_normalized(j) == 0.0 ) THEN 316 317 DO sr = 0, statistic_regions 318 319 uxmi = MINVAL( hom(:nz_do1d,1, & 320 dopr_initial_index(i),sr) ) / & 321 cross_normx_factor(k,j) 322 uxma = MAXVAL( hom(:nz_do1d,1, & 323 dopr_initial_index(i),sr) ) / & 324 cross_normx_factor(k,j) 325 ! 326 ! When the value range of the first line in the 327 ! corresponding cross is determined, its value range 328 ! is simply adopted. 329 IF ( cross_uxmin_normalized_computed(j) > & 330 cross_uxmax_normalized_computed(j) ) THEN 331 cross_uxmin_normalized_computed(j) = uxmi 332 cross_uxmax_normalized_computed(j) = uxma 333 ELSE 334 cross_uxmin_normalized_computed(j) = & 335 MIN( cross_uxmin_normalized_computed(j), uxmi ) 336 cross_uxmax_normalized_computed(j) = & 337 MAX( cross_uxmax_normalized_computed(j), uxma ) 338 ENDIF 339 340 ENDDO 341 342 ENDIF 343 344 ENDIF ! Index determination 345 346 ENDIF ! profil output 347 348 ENDIF ! Initial profile available 349 350 ENDDO ! Loop over dopr_n for initial profiles 351 352 IF ( netcdf_output .AND. output_for_t0 ) THEN 353 dopr_time_count = dopr_time_count + 1 354 ENDIF 355 356 END IF 353 357 ENDIF ! Initial profiles 354 358 355 359 IF ( netcdf_output ) THEN 356 360 #if defined( __netcdf ) 361 357 362 ! 358 363 ! Store time to time axis
Note: See TracChangeset
for help on using the changeset viewer.