Changeset 4559
- Timestamp:
- Jun 11, 2020 8:51:48 AM (11 months ago)
- Location:
- palm/trunk/SOURCE
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SOURCE/check_parameters.f90
r4536 r4559 1 1 !> @file check_parameters.f90 2 !------------------------------------------------------------------------------ !2 !--------------------------------------------------------------------------------------------------! 3 3 ! This file is part of the PALM model system. 4 4 ! 5 ! PALM is free software: you can redistribute it and/or modify it under the 6 ! terms of the GNU General Public License as published by the Free Software 7 ! Foundation, either version 3 of the License, or (at your option) any later 8 ! 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/>. 5 ! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General 6 ! Public License as published by the Free Software Foundation, either version 3 of the License, or 7 ! (at your option) any later version. 8 ! 9 ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 10 ! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 11 ! Public License for more details. 12 ! 13 ! You should have received a copy of the GNU General Public License along with PALM. If not, see 14 ! <http://www.gnu.org/licenses/>. 16 15 ! 17 16 ! Copyright 1997-2020 Leibniz Universitaet Hannover 18 !------------------------------------------------------------------------------ !17 !--------------------------------------------------------------------------------------------------! 19 18 ! 20 19 ! Current revisions: … … 25 24 ! ----------------- 26 25 ! $Id$ 26 ! file re-formatted to follow the PALM coding standard 27 ! 28 ! 4536 2020-05-17 17:24:13Z raasch 27 29 ! unneccessary query for restart data format removed 28 ! 30 ! 29 31 ! 4534 2020-05-14 18:35:22Z raasch 30 32 ! adjustments for I/O on reduced number of cores using shared memory MPI 31 ! 33 ! 32 34 ! 4514 2020-04-30 16:29:59Z suehring 33 35 ! Enable output of qsurf and ssurf 34 ! 36 ! 35 37 ! 4513 2020-04-30 13:45:47Z raasch 36 38 ! unused modules removed 37 ! 39 ! 38 40 ! 4511 2020-04-30 12:20:40Z raasch 39 41 ! call of chem_boundary_conds removed (respective settings are now done in the chemistry module) 40 ! 42 ! 41 43 ! 4495 2020-04-13 20:11:20Z raasch 42 44 ! check new restart_data_format parameters 43 ! 45 ! 44 46 ! 4493 2020-04-10 09:49:43Z pavelkrc 45 47 ! Kolmogorov length scale eta added to profile output … … 134 136 ! ------------ 135 137 !> Check control parameters and deduce further quantities. 136 !------------------------------------------------------------------------------ !138 !--------------------------------------------------------------------------------------------------! 137 139 SUBROUTINE check_parameters 138 140 … … 142 144 USE basic_constants_and_equations_mod 143 145 144 USE bulk_cloud_model_mod, &146 USE bulk_cloud_model_mod, & 145 147 ONLY: bulk_cloud_model 146 148 … … 153 155 USE indices 154 156 155 USE model_1d_mod, &157 USE model_1d_mod, & 156 158 ONLY: damp_level_1d, damp_level_ind_1d 157 159 158 USE module_interface, &159 ONLY: module_interface_check_ parameters,&160 module_interface_check_data_output_ ts,&161 module_interface_check_data_output_ pr,&162 module_interface_check_ data_output163 164 USE netcdf_data_input_mod, &165 ONLY: init_model, input_pids_static, netcdf_data_input_check_dynamic, &160 USE module_interface, & 161 ONLY: module_interface_check_data_output, & 162 module_interface_check_data_output_pr, & 163 module_interface_check_data_output_ts, & 164 module_interface_check_parameters 165 166 USE netcdf_data_input_mod, & 167 ONLY: init_model, input_pids_static, netcdf_data_input_check_dynamic, & 166 168 netcdf_data_input_check_static 167 169 168 USE netcdf_interface, & 169 ONLY: dopr_unit, do2d_unit, do3d_unit, netcdf_data_format, & 170 netcdf_data_format_string, dots_unit, heatflux_output_unit, & 171 waterflux_output_unit, momentumflux_output_unit, & 172 dots_max, dots_num, dots_label 173 174 USE particle_attributes, & 170 USE netcdf_interface, & 171 ONLY: do2d_unit, do3d_unit, dopr_unit, dots_label, dots_max, dots_num, dots_unit, & 172 heatflux_output_unit, momentumflux_output_unit, netcdf_data_format, & 173 netcdf_data_format_string, waterflux_output_unit 174 175 USE particle_attributes, & 175 176 ONLY: particle_advection, use_sgs_for_particles 176 177 177 178 USE pegrid 178 179 179 USE pmc_interface, &180 USE pmc_interface, & 180 181 ONLY: cpl_id, nested_run 181 182 … … 189 190 190 191 #if defined( __parallel ) 191 USE vertical_nesting_mod, &192 ONLY: vnested, &192 USE vertical_nesting_mod, & 193 ONLY: vnested, & 193 194 vnest_check_parameters 194 195 #endif … … 228 229 CALL location_message( 'checking parameters', 'start' ) 229 230 ! 230 !-- At first, check static and dynamic input for consistency 231 !-- At first, check static and dynamic input for consistency. 231 232 CALL netcdf_data_input_check_dynamic 232 233 CALL netcdf_data_input_check_static … … 240 241 ! 241 242 !-- Check the coupling mode 242 IF ( coupling_mode /= 'uncoupled' .AND. &243 coupling_mode /= 'precursor_atmos' .AND. &244 coupling_mode /= 'precursor_ocean' .AND. &245 coupling_mode /= 'vnested_crse' .AND. &246 coupling_mode /= 'vnested_fine' .AND. &247 coupling_mode /= 'atmosphere_to_ocean' .AND. &243 IF ( coupling_mode /= 'uncoupled' .AND. & 244 coupling_mode /= 'precursor_atmos' .AND. & 245 coupling_mode /= 'precursor_ocean' .AND. & 246 coupling_mode /= 'vnested_crse' .AND. & 247 coupling_mode /= 'vnested_fine' .AND. & 248 coupling_mode /= 'atmosphere_to_ocean' .AND. & 248 249 coupling_mode /= 'ocean_to_atmosphere' ) THEN 249 250 message_string = 'illegal coupling mode: ' // TRIM( coupling_mode ) … … 252 253 253 254 ! 254 !-- Check if humidity is set to TRUEin case of the atmospheric run (for coupled runs)255 !-- Check if humidity is set to .TRUE. in case of the atmospheric run (for coupled runs) 255 256 IF ( coupling_mode == 'atmosphere_to_ocean' .AND. .NOT. humidity) THEN 256 message_string = ' Humidity has to be set to .T. in the _p3d file ' // &257 message_string = ' Humidity has to be set to .T. in the _p3d file ' // & 257 258 'for coupled runs between ocean and atmosphere.' 258 259 CALL message( 'check_parameters', 'PA0476', 1, 2, 0, 6, 0 ) … … 297 298 ! 298 299 !-- Check dt_coupling, restart_time, dt_restart, end_time, dx, dy, nx and ny 299 IF ( coupling_mode /= 'uncoupled' .AND.&300 coupling_mode(1:8) /= 'vnested_' .AND.&301 coupling_mode /= 'precursor_atmos' .AND.&300 IF ( coupling_mode /= 'uncoupled' .AND. & 301 coupling_mode(1:8) /= 'vnested_' .AND. & 302 coupling_mode /= 'precursor_atmos' .AND. & 302 303 coupling_mode /= 'precursor_ocean' ) THEN 303 304 304 305 IF ( dt_coupling == 9999999.9_wp ) THEN 305 message_string = 'dt_coupling is not set but required for coup ' //&306 'ling mode "' //TRIM( coupling_mode ) // '"'306 message_string = 'dt_coupling is not set but required for coupling mode "' // & 307 TRIM( coupling_mode ) // '"' 307 308 CALL message( 'check_parameters', 'PA0003', 1, 2, 0, 6, 0 ) 308 309 ENDIF … … 312 313 313 314 IF ( myid == 0 ) THEN 314 CALL MPI_SEND( dt_coupling, 1, MPI_REAL, target_id, 11, comm_inter, & 315 ierr ) 316 CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 11, comm_inter, & 317 status, ierr ) 315 CALL MPI_SEND( dt_coupling, 1, MPI_REAL, target_id, 11, comm_inter, ierr ) 316 CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 11, comm_inter, status, ierr ) 318 317 ENDIF 319 318 CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr) 320 319 321 320 IF ( dt_coupling /= remote ) THEN 322 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & 323 '": dt_coupling = ', dt_coupling, '& is not equal to ', & 324 'dt_coupling_remote = ', remote 321 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), '": dt_coupling = ',& 322 dt_coupling, '& is not equal to ', 'dt_coupling_remote = ', remote 325 323 CALL message( 'check_parameters', 'PA0004', 1, 2, 0, 6, 0 ) 326 324 ENDIF … … 329 327 IF ( myid == 0 ) THEN 330 328 CALL MPI_SEND( dt_max, 1, MPI_REAL, target_id, 19, comm_inter, ierr ) 331 CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 19, comm_inter, & 332 status, ierr ) 329 CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 19, comm_inter, status, ierr ) 333 330 ENDIF 334 331 CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr) 335 332 336 333 dt_coupling = MAX( dt_max, remote ) 337 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &338 '": dt_coupling <= 0.0 & is not allowed and is reset to ', 339 'MAX(dt_max(A,O)) = ',dt_coupling334 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & 335 '": dt_coupling <= 0.0 & is not allowed and is reset to ', 'MAX(dt_max(A,O)) = ', & 336 dt_coupling 340 337 CALL message( 'check_parameters', 'PA0005', 0, 1, 0, 6, 0 ) 341 338 ENDIF 342 339 343 340 IF ( myid == 0 ) THEN 344 CALL MPI_SEND( restart_time, 1, MPI_REAL, target_id, 12, comm_inter, & 345 ierr ) 346 CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 12, comm_inter, & 347 status, ierr ) 341 CALL MPI_SEND( restart_time, 1, MPI_REAL, target_id, 12, comm_inter, ierr ) 342 CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 12, comm_inter, status, ierr ) 348 343 ENDIF 349 344 CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr) 350 345 351 346 IF ( restart_time /= remote ) THEN 352 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &353 '": restart_time = ', restart_time, '& is not equal to ', &347 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & 348 '": restart_time = ', restart_time, '& is not equal to ', & 354 349 'restart_time_remote = ', remote 355 350 CALL message( 'check_parameters', 'PA0006', 1, 2, 0, 6, 0 ) … … 357 352 358 353 IF ( myid == 0 ) THEN 359 CALL MPI_SEND( dt_restart, 1, MPI_REAL, target_id, 13, comm_inter, & 360 ierr ) 361 CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 13, comm_inter, & 362 status, ierr ) 354 CALL MPI_SEND( dt_restart, 1, MPI_REAL, target_id, 13, comm_inter, ierr ) 355 CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 13, comm_inter, status, ierr ) 363 356 ENDIF 364 357 CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr) 365 358 366 359 IF ( dt_restart /= remote ) THEN 367 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & 368 '": dt_restart = ', dt_restart, '& is not equal to ', & 369 'dt_restart_remote = ', remote 360 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), '": dt_restart = ', & 361 dt_restart, '& is not equal to ', 'dt_restart_remote = ', remote 370 362 CALL message( 'check_parameters', 'PA0007', 1, 2, 0, 6, 0 ) 371 363 ENDIF … … 373 365 time_to_be_simulated_from_reference_point = end_time-coupling_start_time 374 366 375 IF ( myid == 0 ) THEN 376 CALL MPI_SEND( time_to_be_simulated_from_reference_point, 1, & 377 MPI_REAL, target_id, 14, comm_inter, ierr ) 378 CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 14, comm_inter, & 379 status, ierr ) 367 IF ( myid == 0 ) THEN 368 CALL MPI_SEND( time_to_be_simulated_from_reference_point, 1, MPI_REAL, target_id, 14, & 369 comm_inter, ierr ) 370 CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 14, comm_inter, status, ierr ) 380 371 ENDIF 381 372 CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr) 382 373 383 374 IF ( time_to_be_simulated_from_reference_point /= remote ) THEN 384 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), &385 '": time_to_be_simulated_from_reference_point = ', &386 time_to_be_simulated_from_reference_point, '& is not equal ', &387 'to time_to_be_simulated_from_reference_point_remote = ', &375 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & 376 '": time_to_be_simulated_from_reference_point = ', & 377 time_to_be_simulated_from_reference_point, '& is not equal ', & 378 'to time_to_be_simulated_from_reference_point_remote = ', & 388 379 remote 389 380 CALL message( 'check_parameters', 'PA0008', 1, 2, 0, 6, 0 ) … … 392 383 IF ( myid == 0 ) THEN 393 384 CALL MPI_SEND( dx, 1, MPI_REAL, target_id, 15, comm_inter, ierr ) 394 CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 15, comm_inter, & 395 status, ierr ) 385 CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 15, comm_inter, status, ierr ) 396 386 ENDIF 397 387 CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr) … … 401 391 402 392 IF ( dx < remote ) THEN 403 WRITE( message_string, * ) 'coupling mode "', & 404 TRIM( coupling_mode ), & 405 '": dx in Atmosphere is not equal to or not larger than dx in ocean' 393 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & 394 '": dx in Atmosphere is not equal to or not larger than dx in ocean' 406 395 CALL message( 'check_parameters', 'PA0009', 1, 2, 0, 6, 0 ) 407 396 ENDIF 408 397 409 398 IF ( (nx_a+1)*dx /= (nx_o+1)*remote ) THEN 410 WRITE( message_string, * ) 'coupling mode "', & 411 TRIM( coupling_mode ), & 412 '": Domain size in x-direction is not equal in ocean and atmosphere' 399 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & 400 '": Domain size in x-direction is not equal in ocean and atmosphere' 413 401 CALL message( 'check_parameters', 'PA0010', 1, 2, 0, 6, 0 ) 414 402 ENDIF … … 418 406 IF ( myid == 0) THEN 419 407 CALL MPI_SEND( dy, 1, MPI_REAL, target_id, 16, comm_inter, ierr ) 420 CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 16, comm_inter, & 421 status, ierr ) 408 CALL MPI_RECV( remote, 1, MPI_REAL, target_id, 16, comm_inter, status, ierr ) 422 409 ENDIF 423 410 CALL MPI_BCAST( remote, 1, MPI_REAL, 0, comm2d, ierr) … … 426 413 427 414 IF ( dy < remote ) THEN 428 WRITE( message_string, * ) 'coupling mode "', & 429 TRIM( coupling_mode ), & 430 '": dy in Atmosphere is not equal to or not larger than dy in ocean' 415 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & 416 '": dy in Atmosphere is not equal to or not larger than dy in ocean' 431 417 CALL message( 'check_parameters', 'PA0011', 1, 2, 0, 6, 0 ) 432 418 ENDIF 433 419 434 420 IF ( (ny_a+1)*dy /= (ny_o+1)*remote ) THEN 435 WRITE( message_string, * ) 'coupling mode "', & 436 TRIM( coupling_mode ), & 437 '": Domain size in y-direction is not equal in ocean and atmosphere' 421 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & 422 '": Domain size in y-direction is not equal in ocean and atmosphere' 438 423 CALL message( 'check_parameters', 'PA0012', 1, 2, 0, 6, 0 ) 439 424 ENDIF 440 425 441 IF ( MOD(nx_o+1,nx_a+1) /= 0 ) THEN 442 WRITE( message_string, * ) 'coupling mode "', & 443 TRIM( coupling_mode ), & 444 '": nx+1 in ocean is not divisible by nx+1 in', & 445 ' atmosphere without remainder' 426 IF ( MOD( nx_o+1, nx_a+1 ) /= 0 ) THEN 427 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & 428 '": nx+1 in ocean is not divisible by nx+1 in', ' atmosphere without remainder' 446 429 CALL message( 'check_parameters', 'PA0339', 1, 2, 0, 6, 0 ) 447 430 ENDIF 448 431 449 432 IF ( MOD(ny_o+1,ny_a+1) /= 0 ) THEN 450 WRITE( message_string, * ) 'coupling mode "', & 451 TRIM( coupling_mode ), & 452 '": ny+1 in ocean is not divisible by ny+1 in', & 453 ' atmosphere without remainder' 433 WRITE( message_string, * ) 'coupling mode "', TRIM( coupling_mode ), & 434 '": ny+1 in ocean is not divisible by ny+1 in', ' atmosphere without remainder' 454 435 455 436 CALL message( 'check_parameters', 'PA0340', 1, 2, 0, 6, 0 ) … … 458 439 ENDIF 459 440 #else 460 WRITE( message_string, * ) 'coupling requires PALM to be compiled with', &461 ' cpp-option "-D__parallel"'441 WRITE( message_string, * ) 'coupling requires PALM to be compiled with', & 442 ' cpp-option "-D__parallel"' 462 443 CALL message( 'check_parameters', 'PA0141', 1, 2, 0, 6, 0 ) 463 444 #endif … … 467 448 ! 468 449 !-- Exchange via intercommunicator 469 IF ( coupling_mode == 'atmosphere_to_ocean' .AND. myid == 0 ) THEN 470 CALL MPI_SEND( humidity, 1, MPI_LOGICAL, target_id, 19, comm_inter, & 471 ierr ) 472 ELSEIF ( coupling_mode == 'ocean_to_atmosphere' .AND. myid == 0) THEN 473 CALL MPI_RECV( humidity_remote, 1, MPI_LOGICAL, target_id, 19, & 474 comm_inter, status, ierr ) 450 IF ( coupling_mode == 'atmosphere_to_ocean' .AND. myid == 0 ) THEN 451 CALL MPI_SEND( humidity, 1, MPI_LOGICAL, target_id, 19, comm_inter, ierr ) 452 ELSEIF ( coupling_mode == 'ocean_to_atmosphere' .AND. myid == 0) THEN 453 CALL MPI_RECV( humidity_remote, 1, MPI_LOGICAL, target_id, 19, comm_inter, status, ierr ) 475 454 ENDIF 476 455 CALL MPI_BCAST( humidity_remote, 1, MPI_LOGICAL, 0, comm2d, ierr) … … 479 458 480 459 ! 481 !-- User settings for restart times requires that "restart" has been given as 482 !-- file activation string. Otherwise, binary output would not be saved by 483 !-- palmrun. 484 IF ( ( restart_time /= 9999999.9_wp .OR. dt_restart /= 9999999.9_wp ) & 460 !-- User settings for restart times requires that "restart" has been given as file activation 461 !-- string. Otherwise, binary output would not be saved by palmrun. 462 IF ( ( restart_time /= 9999999.9_wp .OR. dt_restart /= 9999999.9_wp ) & 485 463 .AND. .NOT. write_binary ) THEN 486 WRITE( message_string, * ) 'manual restart settings requires file ', &464 WRITE( message_string, * ) 'manual restart settings requires file ', & 487 465 'activation string "restart"' 488 466 CALL message( 'check_parameters', 'PA0001', 1, 2, 0, 6, 0 ) … … 491 469 492 470 ! 493 !-- Generate the file header which is used as a header for most of PALM's 494 !-- output files 471 !-- Generate the file header which is used as a header for most of PALM's output files 495 472 CALL DATE_AND_TIME( date, time, run_zone ) 496 run_date = date(1:4) //'-'//date(5:6)//'-'//date(7:8)497 run_time = time(1:2) //':'//time(3:4)//':'//time(5:6)473 run_date = date(1:4) // '-' // date(5:6) // '-' // date(7:8) 474 run_time = time(1:2) // ':' // time(3:4) // ':' // time(5:6) 498 475 IF ( coupling_mode == 'uncoupled' ) THEN 499 476 coupling_string = '' … … 518 495 ENDIF 519 496 520 WRITE ( run_description_header, & 521 '(A,2X,A,2X,A,A,A,I2.2,A,A,A,2X,A,A,2X,A,1X,A)' ) & 522 TRIM( version ), TRIM( revision ), 'run: ', & 523 TRIM( run_identifier ), '.', runnr, TRIM( coupling_string ), & 524 TRIM( nest_string ), TRIM( ensemble_string), 'host: ', TRIM( host ), & 525 run_date, run_time 497 WRITE ( run_description_header, '(A,2X,A,2X,A,A,A,I2.2,A,A,A,2X,A,A,2X,A,1X,A)' ) & 498 TRIM( version ), TRIM( revision ), 'run: ', TRIM( run_identifier ), '.', runnr, & 499 TRIM( coupling_string ), TRIM( nest_string ), TRIM( ensemble_string), 'host: ', & 500 TRIM( host ), run_date, run_time 526 501 527 502 ! … … 533 508 534 509 CASE DEFAULT 535 message_string = 'illegal value given for loop_optimization: "' // &510 message_string = 'illegal value given for loop_optimization: "' // & 536 511 TRIM( loop_optimization ) // '"' 537 512 CALL message( 'check_parameters', 'PA0013', 1, 2, 0, 6, 0 ) … … 543 518 IF ( topography /= 'flat' ) THEN 544 519 action = ' ' 545 IF ( scalar_advec /= 'pw-scheme' .AND. scalar_advec /= 'ws-scheme' & 546 ) THEN 520 IF ( scalar_advec /= 'pw-scheme' .AND. scalar_advec /= 'ws-scheme' ) THEN 547 521 WRITE( action, '(A,A)' ) 'scalar_advec = ', scalar_advec 548 522 ENDIF 549 IF ( momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ws-scheme' )& 550 THEN 523 IF ( momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ws-scheme' ) THEN 551 524 WRITE( action, '(A,A)' ) 'momentum_advec = ', momentum_advec 552 525 ENDIF … … 563 536 WRITE( action, '(A)' ) 'cloud_droplets = .TRUE.' 564 537 ENDIF 565 IF ( .NOT. constant_flux_layer .AND. topography /= 'closed_channel' ) & 566 THEN 538 IF ( .NOT. constant_flux_layer .AND. topography /= 'closed_channel' ) THEN 567 539 WRITE( action, '(A)' ) 'constant_flux_layer = .FALSE.' 568 540 ENDIF 569 541 IF ( action /= ' ' ) THEN 570 message_string = 'The specified topography does not allow ' // & 571 TRIM( action ) 542 message_string = 'The specified topography does not allow ' // TRIM( action ) 572 543 CALL message( 'check_parameters', 'PA0014', 1, 2, 0, 6, 0 ) 573 544 ENDIF 574 545 ! 575 546 !-- Check illegal/untested parameter combinations for closed channel 576 If ( topography == 'closed_channel' ) THEN547 If ( topography == 'closed_channel' ) THEN 577 548 symmetry_flag = 1 578 549 message_string = 'Bottom and top boundary are treated equal' 579 550 CALL message( 'check_parameters', 'PA0699', 0, 0, 0, 6, 0 ) 580 551 581 IF ( dz(1) /= dz(COUNT( dz /= -1.0_wp )) .OR. & 582 dz_stretch_level /= -9999999.9_wp) THEN 583 WRITE( message_string, * ) 'dz should be equal close to the ' // & 552 IF ( dz(1) /= dz(COUNT( dz /= -1.0_wp )) .OR. dz_stretch_level /= -9999999.9_wp) THEN 553 WRITE( message_string, * ) 'dz should be equal close to the ' // & 584 554 'boundaries due to symmetrical problem' 585 555 CALL message( 'check_parameters', 'PA0700', 1, 2, 0, 6, 0 ) 586 556 ENDIF 587 557 588 IF ( constant_flux_layer ) THEN 589 WRITE( message_string, * ) 'A constant flux layer is not '// & 590 'allowed if a closed channel '// & 591 'shall be used' 558 IF ( constant_flux_layer ) THEN 559 WRITE( message_string, * ) 'A constant flux layer is not ' // & 560 'allowed if a closed channel shall be used' 592 561 CALL message( 'check_parameters', 'PA0701', 1, 2, 0, 6, 0 ) 593 562 ENDIF 594 563 595 IF ( ocean_mode ) THEN596 WRITE( message_string, * ) 'The ocean mode is not allowed if ' //&564 IF ( ocean_mode ) THEN 565 WRITE( message_string, * ) 'The ocean mode is not allowed if ' // & 597 566 'a closed channel shall be used' 598 567 CALL message( 'check_parameters', 'PA0702', 1, 2, 0, 6, 0 ) 599 568 ENDIF 600 569 601 IF ( momentum_advec /= 'ws-scheme' .OR. & 602 scalar_advec /= 'ws-scheme' ) THEN 603 WRITE( message_string, * ) 'A closed channel require the '// & 604 'upwind scheme of Wicker and ' // & 605 'Skamarock as the advection scheme' 570 IF ( momentum_advec /= 'ws-scheme' .OR. & 571 scalar_advec /= 'ws-scheme' ) THEN 572 WRITE( message_string, * ) 'A closed channel require the upwind scheme of Wicker' // & 573 ' and Skamarock as the advection scheme' 606 574 CALL message( 'check_parameters', 'PA0703', 1, 2, 0, 6, 0 ) 607 575 ENDIF … … 611 579 ! 612 580 !-- Check approximation 613 IF ( TRIM( approximation ) /= 'boussinesq' .AND. & 614 TRIM( approximation ) /= 'anelastic' ) THEN 615 message_string = 'unknown approximation: approximation = "' // & 616 TRIM( approximation ) // '"' 581 IF ( TRIM( approximation ) /= 'boussinesq' .AND. TRIM( approximation ) /= 'anelastic' ) THEN 582 message_string = 'unknown approximation: approximation = "' // TRIM( approximation ) // '"' 617 583 CALL message( 'check_parameters', 'PA0446', 1, 2, 0, 6, 0 ) 618 584 ENDIF … … 620 586 ! 621 587 !-- Check approximation requirements 622 IF ( TRIM( approximation ) == 'anelastic' .AND. & 623 TRIM( momentum_advec ) /= 'ws-scheme' ) THEN 624 message_string = 'Anelastic approximation requires ' // & 625 'momentum_advec = "ws-scheme"' 588 IF ( TRIM( approximation ) == 'anelastic' .AND. TRIM( momentum_advec ) /= 'ws-scheme' ) THEN 589 message_string = 'Anelastic approximation requires momentum_advec = "ws-scheme"' 626 590 CALL message( 'check_parameters', 'PA0447', 1, 2, 0, 6, 0 ) 627 591 ENDIF 628 IF ( TRIM( approximation ) == 'anelastic' .AND. & 629 TRIM( psolver ) == 'multigrid' ) THEN 630 message_string = 'Anelastic approximation currently only supports ' // & 631 'psolver = "poisfft", ' // & 632 'psolver = "sor" and ' // & 633 'psolver = "multigrid_noopt"' 592 IF ( TRIM( approximation ) == 'anelastic' .AND. TRIM( psolver ) == 'multigrid' ) THEN 593 message_string = 'Anelastic approximation currently only supports psolver = "poisfft", ' // & 594 'psolver = "sor" and psolver = "multigrid_noopt"' 634 595 CALL message( 'check_parameters', 'PA0448', 1, 2, 0, 6, 0 ) 635 596 ENDIF 636 IF ( TRIM( approximation ) == 'anelastic' .AND. & 637 conserve_volume_flow ) THEN 638 message_string = 'Anelastic approximation is not allowed with ' // & 597 IF ( TRIM( approximation ) == 'anelastic' .AND. conserve_volume_flow ) THEN 598 message_string = 'Anelastic approximation is not allowed with ' // & 639 599 'conserve_volume_flow = .TRUE.' 640 600 CALL message( 'check_parameters', 'PA0449', 1, 2, 0, 6, 0 ) … … 643 603 ! 644 604 !-- Check flux input mode 645 IF ( TRIM( flux_input_mode ) /= 'dynamic' .AND. & 646 TRIM( flux_input_mode ) /= 'kinematic' .AND. & 647 TRIM( flux_input_mode ) /= 'approximation-specific' ) THEN 648 message_string = 'unknown flux input mode: flux_input_mode = "' // & 605 IF ( TRIM( flux_input_mode ) /= 'dynamic' .AND. TRIM( flux_input_mode ) /= 'kinematic' & 606 .AND. TRIM( flux_input_mode ) /= 'approximation-specific' ) THEN 607 message_string = 'unknown flux input mode: flux_input_mode = "' // & 649 608 TRIM( flux_input_mode ) // '"' 650 609 CALL message( 'check_parameters', 'PA0450', 1, 2, 0, 6, 0 ) … … 662 621 ! 663 622 !-- Check flux output mode 664 IF ( TRIM( flux_output_mode ) /= 'dynamic' .AND. & 665 TRIM( flux_output_mode ) /= 'kinematic' .AND. & 666 TRIM( flux_output_mode ) /= 'approximation-specific' ) THEN 667 message_string = 'unknown flux output mode: flux_output_mode = "' // & 623 IF ( TRIM( flux_output_mode ) /= 'dynamic' .AND. TRIM( flux_output_mode ) /= 'kinematic' & 624 .AND. TRIM( flux_output_mode ) /= 'approximation-specific' ) THEN 625 message_string = 'unknown flux output mode: flux_output_mode = "' // & 668 626 TRIM( flux_output_mode ) // '"' 669 627 CALL message( 'check_parameters', 'PA0451', 1, 2, 0, 6, 0 ) … … 681 639 682 640 ! 683 !-- When the land- or urban-surface model is used, the flux output must be 684 !-- dynamic. 641 !-- When the land- or urban-surface model is used, the flux output must be dynamic. 685 642 IF ( land_surface .OR. urban_surface ) THEN 686 643 flux_output_mode = 'dynamic' … … 689 646 ! 690 647 !-- Set the flux output units according to flux_output_mode 691 IF ( TRIM( flux_output_mode ) == 'kinematic' ) THEN648 IF ( TRIM( flux_output_mode ) == 'kinematic' ) THEN 692 649 heatflux_output_unit = 'K m/s' 693 650 waterflux_output_unit = 'kg/kg m/s' 694 651 momentumflux_output_unit = 'm2/s2' 695 ELSEIF ( TRIM( flux_output_mode ) == 'dynamic' ) THEN652 ELSEIF ( TRIM( flux_output_mode ) == 'dynamic' ) THEN 696 653 heatflux_output_unit = 'W/m2' 697 654 waterflux_output_unit = 'W/m2' … … 712 669 !-- Check if maximum number of allowed timeseries is exceeded 713 670 IF ( dots_num > dots_max ) THEN 714 WRITE( message_string, * ) 'number of time series quantities exceeds', &715 ' its maximum of dots_max = ', dots_max, &671 WRITE( message_string, * ) 'number of time series quantities exceeds', & 672 ' its maximum of dots_max = ', dots_max, & 716 673 '&Please increase dots_max in modules.f90.' 717 674 CALL message( 'init_3d_model', 'PA0194', 1, 2, 0, 6, 0 ) … … 721 678 !-- Check whether there are any illegal values 722 679 !-- Pressure solver: 723 IF ( psolver /= 'poisfft' .AND. psolver /= 'sor' .AND. 724 psolver /= 'multigrid ' .AND. psolver /= 'multigrid_noopt' ) THEN725 message_string = 'unknown solver for perturbation pressure: psolver' // &680 IF ( psolver /= 'poisfft' .AND. psolver /= 'sor' .AND. psolver /= 'multigrid' .AND. & 681 psolver /= 'multigrid_noopt' ) THEN 682 message_string = 'unknown solver for perturbation pressure: psolver' // & 726 683 ' = "' // TRIM( psolver ) // '"' 727 684 CALL message( 'check_parameters', 'PA0016', 1, 2, 0, 6, 0 ) … … 734 691 gamma_mg = 1 735 692 ELSE 736 message_string = 'unknown multigrid cycle: cycle_mg = "' // & 737 TRIM( cycle_mg ) // '"' 693 message_string = 'unknown multigrid cycle: cycle_mg = "' // TRIM( cycle_mg ) // '"' 738 694 CALL message( 'check_parameters', 'PA0020', 1, 2, 0, 6, 0 ) 739 695 ENDIF 740 696 ENDIF 741 697 742 IF ( fft_method /= 'singleton-algorithm' .AND. & 743 fft_method /= 'temperton-algorithm' .AND. & 744 fft_method /= 'fftw' .AND. & 745 fft_method /= 'system-specific' ) THEN 746 message_string = 'unknown fft-algorithm: fft_method = "' // & 747 TRIM( fft_method ) // '"' 698 IF ( fft_method /= 'singleton-algorithm' .AND. fft_method /= 'temperton-algorithm' .AND. & 699 fft_method /= 'fftw' .AND. fft_method /= 'system-specific' ) THEN 700 message_string = 'unknown fft-algorithm: fft_method = "' // TRIM( fft_method ) // '"' 748 701 CALL message( 'check_parameters', 'PA0021', 1, 2, 0, 6, 0 ) 749 702 ENDIF 750 703 751 IF( momentum_advec == 'ws-scheme' .AND. & 752 .NOT. call_psolver_at_all_substeps ) THEN 753 message_string = 'psolver must be called at each RK3 substep when "'// & 754 TRIM(momentum_advec) // ' "is used for momentum_advec' 704 IF( momentum_advec == 'ws-scheme' .AND. .NOT. call_psolver_at_all_substeps ) THEN 705 message_string = 'psolver must be called at each RK3 substep when "'// & 706 TRIM(momentum_advec) // ' "is used for momentum_advec' 755 707 CALL message( 'check_parameters', 'PA0344', 1, 2, 0, 6, 0 ) 756 708 END IF 757 709 ! 758 710 !-- Advection schemes: 759 IF ( momentum_advec /= 'pw-scheme' .AND. & 760 momentum_advec /= 'ws-scheme' .AND. & 761 momentum_advec /= 'up-scheme' ) & 762 THEN 763 message_string = 'unknown advection scheme: momentum_advec = "' // & 711 IF ( momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ws-scheme' .AND. & 712 momentum_advec /= 'up-scheme' ) THEN 713 message_string = 'unknown advection scheme: momentum_advec = "' // & 764 714 TRIM( momentum_advec ) // '"' 765 715 CALL message( 'check_parameters', 'PA0022', 1, 2, 0, 6, 0 ) 766 716 ENDIF 767 IF ( ( momentum_advec == 'ws-scheme' .OR. scalar_advec == 'ws-scheme' ) & 768 .AND. ( timestep_scheme == 'euler' .OR. & 769 timestep_scheme == 'runge-kutta-2' ) ) & 770 THEN 771 message_string = 'momentum_advec or scalar_advec = "' & 772 // TRIM( momentum_advec ) // '" is not allowed with ' // & 773 'timestep_scheme = "' // TRIM( timestep_scheme ) // '"' 717 IF ( ( momentum_advec == 'ws-scheme' .OR. scalar_advec == 'ws-scheme' ) & 718 .AND. ( timestep_scheme == 'euler' .OR. timestep_scheme == 'runge-kutta-2' ) ) THEN 719 message_string = 'momentum_advec or scalar_advec = "' // TRIM( momentum_advec ) // & 720 '" is not allowed with timestep_scheme = "' // & 721 TRIM( timestep_scheme ) // '"' 774 722 CALL message( 'check_parameters', 'PA0023', 1, 2, 0, 6, 0 ) 775 723 ENDIF 776 IF ( scalar_advec /= 'pw-scheme' .AND. scalar_advec /= 'ws-scheme' .AND. & 777 scalar_advec /= 'bc-scheme' .AND. scalar_advec /= 'up-scheme' ) & 778 THEN 779 message_string = 'unknown advection scheme: scalar_advec = "' // & 780 TRIM( scalar_advec ) // '"' 724 IF ( scalar_advec /= 'pw-scheme' .AND. scalar_advec /= 'ws-scheme' .AND. & 725 scalar_advec /= 'bc-scheme' .AND. scalar_advec /= 'up-scheme' ) THEN 726 message_string = 'unknown advection scheme: scalar_advec = "' // TRIM( scalar_advec ) // '"' 781 727 CALL message( 'check_parameters', 'PA0024', 1, 2, 0, 6, 0 ) 782 728 ENDIF 783 IF ( scalar_advec == 'bc-scheme' .AND. loop_optimization == 'cache' ) & 784 THEN 785 message_string = 'advection_scheme scalar_advec = "' & 786 // TRIM( scalar_advec ) // '" not implemented for ' // & 787 'loop_optimization = "' // TRIM( loop_optimization ) // '"' 729 IF ( scalar_advec == 'bc-scheme' .AND. loop_optimization == 'cache' ) THEN 730 message_string = 'advection_scheme scalar_advec = "' // TRIM( scalar_advec ) // & 731 '" not implemented for loop_optimization = "' // & 732 TRIM( loop_optimization ) // '"' 788 733 CALL message( 'check_parameters', 'PA0026', 1, 2, 0, 6, 0 ) 789 734 ENDIF 790 735 791 IF ( use_sgs_for_particles .AND. .NOT. cloud_droplets .AND. & 792 .NOT. use_upstream_for_tke .AND. & 793 scalar_advec /= 'ws-scheme' & 794 ) THEN 736 IF ( use_sgs_for_particles .AND. .NOT. cloud_droplets .AND. .NOT. use_upstream_for_tke & 737 .AND. scalar_advec /= 'ws-scheme' ) THEN 795 738 use_upstream_for_tke = .TRUE. 796 message_string = 'use_upstream_for_tke is set to .TRUE. because ' // & 797 'use_sgs_for_particles = .TRUE. ' // & 798 'and scalar_advec /= ws-scheme' 739 message_string = 'use_upstream_for_tke is set to .TRUE. because ' // & 740 'use_sgs_for_particles = .TRUE. and scalar_advec /= ws-scheme' 799 741 CALL message( 'check_parameters', 'PA0025', 0, 1, 0, 6, 0 ) 800 742 ENDIF … … 820 762 821 763 CASE DEFAULT 822 message_string = 'unknown timestep scheme: timestep_scheme = "' // &764 message_string = 'unknown timestep scheme: timestep_scheme = "' // & 823 765 TRIM( timestep_scheme ) // '"' 824 766 CALL message( 'check_parameters', 'PA0027', 1, 2, 0, 6, 0 ) … … 826 768 END SELECT 827 769 828 IF ( ( momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ws-scheme')&829 .AND. timestep_scheme(1:5) == 'runge' ) THEN830 message_string = 'momentum advection scheme "' // &831 TRIM( momentum_advec ) // '" & does not work with ' //&832 'timestep_scheme "' // TRIM( timestep_scheme )// '"'770 IF ( ( momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ws-scheme' ) & 771 .AND. timestep_scheme(1:5) == 'runge' ) THEN 772 message_string = 'momentum advection scheme "' // TRIM( momentum_advec ) // & 773 '" & does not work with timestep_scheme "' // TRIM( timestep_scheme ) & 774 // '"' 833 775 CALL message( 'check_parameters', 'PA0029', 1, 2, 0, 6, 0 ) 834 776 ENDIF … … 836 778 !-- Check for proper settings for microphysics 837 779 IF ( bulk_cloud_model .AND. cloud_droplets ) THEN 838 message_string = 'bulk_cloud_model = .TRUE. is not allowed with ' // & 839 'cloud_droplets = .TRUE.' 780 message_string = 'bulk_cloud_model = .TRUE. is not allowed with cloud_droplets = .TRUE.' 840 781 CALL message( 'check_parameters', 'PA0442', 1, 2, 0, 6, 0 ) 841 782 ENDIF … … 848 789 ENDIF 849 790 850 IF ( TRIM( initializing_actions ) /= 'read_restart_data' .AND. &791 IF ( TRIM( initializing_actions ) /= 'read_restart_data' .AND. & 851 792 TRIM( initializing_actions ) /= 'cyclic_fill' ) THEN 852 793 ! … … 857 798 SELECT CASE ( action(1:position-1) ) 858 799 859 CASE ( 'set_constant_profiles', 'set_1d-model_profiles', & 860 'by_user', 'initialize_vortex', 'initialize_ptanom', & 861 'initialize_bubble', 'inifor' ) 800 CASE ( 'set_constant_profiles', 'set_1d-model_profiles', 'by_user', & 801 'initialize_vortex', 'initialize_ptanom', 'initialize_bubble', 'inifor' ) 862 802 action = action(position+1:) 863 803 864 804 CASE DEFAULT 865 message_string = 'initializing_action = "' // &805 message_string = 'initializing_action = "' // & 866 806 TRIM( action ) // '" unknown or not allowed' 867 807 CALL message( 'check_parameters', 'PA0030', 1, 2, 0, 6, 0 ) … … 871 811 ENDIF 872 812 873 IF ( TRIM( initializing_actions ) == 'initialize_vortex' .AND. & 874 conserve_volume_flow ) THEN 875 message_string = 'initializing_actions = "initialize_vortex"' // & 876 ' is not allowed with conserve_volume_flow = .T.' 813 IF ( TRIM( initializing_actions ) == 'initialize_vortex' .AND. conserve_volume_flow ) THEN 814 message_string = 'initializing_actions = "initialize_vortex"' // & 815 ' is not allowed with conserve_volume_flow = .T.' 877 816 CALL message( 'check_parameters', 'PA0343', 1, 2, 0, 6, 0 ) 878 817 ENDIF 879 818 880 819 881 IF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0 .AND. &820 IF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0 .AND. & 882 821 INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) THEN 883 message_string = 'initializing_actions = "set_constant_profiles"' // & 884 ' and "set_1d-model_profiles" are not allowed ' // & 885 'simultaneously' 822 message_string = 'initializing_actions = "set_constant_profiles"' // & 823 ' and "set_1d-model_profiles" are not allowed simultaneously' 886 824 CALL message( 'check_parameters', 'PA0031', 1, 2, 0, 6, 0 ) 887 825 ENDIF 888 826 889 IF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0 .AND. &827 IF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0 .AND. & 890 828 INDEX( initializing_actions, 'by_user' ) /= 0 ) THEN 891 message_string = 'initializing_actions = "set_constant_profiles"' // &829 message_string = 'initializing_actions = "set_constant_profiles"' // & 892 830 ' and "by_user" are not allowed simultaneously' 893 831 CALL message( 'check_parameters', 'PA0032', 1, 2, 0, 6, 0 ) 894 832 ENDIF 895 833 896 IF ( INDEX( initializing_actions, 'by_user' ) /= 0 .AND. &834 IF ( INDEX( initializing_actions, 'by_user' ) /= 0 .AND. & 897 835 INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) THEN 898 message_string = 'initializing_actions = "by_user" and ' // &836 message_string = 'initializing_actions = "by_user" and ' // & 899 837 '"set_1d-model_profiles" are not allowed simultaneously' 900 838 CALL message( 'check_parameters', 'PA0033', 1, 2, 0, 6, 0 ) 901 839 ENDIF 902 840 ! 903 !-- In case of spinup and nested run, spinup end time must be identical 904 !-- in order to havesynchronously running simulations.841 !-- In case of spinup and nested run, spinup end time must be identical in order to have 842 !-- synchronously running simulations. 905 843 IF ( nested_run ) THEN 906 844 #if defined( __parallel ) 907 CALL MPI_ALLREDUCE( spinup_time, spinup_time_max, 1, MPI_REAL, & 908 MPI_MAX, MPI_COMM_WORLD, ierr ) 909 CALL MPI_ALLREDUCE( dt_spinup, dt_spinup_max, 1, MPI_REAL, & 910 MPI_MAX, MPI_COMM_WORLD, ierr ) 911 912 IF ( spinup_time /= spinup_time_max .OR. dt_spinup /= dt_spinup_max ) & 913 THEN 914 message_string = 'In case of nesting, spinup_time and ' // & 915 'dt_spinup must be identical in all parent ' // & 916 'and child domains.' 845 CALL MPI_ALLREDUCE( spinup_time, spinup_time_max, 1, MPI_REAL, MPI_MAX, MPI_COMM_WORLD, & 846 ierr ) 847 CALL MPI_ALLREDUCE( dt_spinup, dt_spinup_max, 1, MPI_REAL, MPI_MAX, MPI_COMM_WORLD, & 848 ierr ) 849 850 IF ( spinup_time /= spinup_time_max .OR. dt_spinup /= dt_spinup_max ) THEN 851 message_string = 'In case of nesting, spinup_time and ' // & 852 'dt_spinup must be identical in all parent and child domains.' 917 853 CALL message( 'check_parameters', 'PA0489', 3, 2, 0, 6, 0 ) 918 854 ENDIF … … 920 856 ENDIF 921 857 922 IF ( bulk_cloud_model .AND. .NOT. 923 WRITE( message_string, * ) 'bulk_cloud_model = ', bulk_cloud_model, &858 IF ( bulk_cloud_model .AND. .NOT. humidity ) THEN 859 WRITE( message_string, * ) 'bulk_cloud_model = ', bulk_cloud_model, & 924 860 ' is not allowed with humidity = ', humidity 925 861 CALL message( 'check_parameters', 'PA0034', 1, 2, 0, 6, 0 ) … … 927 863 928 864 IF ( humidity .AND. sloping_surface ) THEN 929 message_string = 'humidity = .TRUE. and sloping_surface = .TRUE. ' // &865 message_string = 'humidity = .TRUE. and sloping_surface = .TRUE. ' // & 930 866 'are not allowed simultaneously' 931 867 CALL message( 'check_parameters', 'PA0036', 1, 2, 0, 6, 0 ) … … 936 872 937 873 ! 938 !-- In case of no restart run, check initialising parameters and calculate 939 !-- further quantities 874 !-- In case of no restart run, check initialising parameters and calculate further quantities 940 875 IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN 941 876 … … 947 882 948 883 !-- 949 !-- If required, compute initial profile of the geostrophic wind 950 !-- (component ug) 884 !-- If required, compute initial profile of the geostrophic wind (component ug) 951 885 i = 1 952 886 gradient = 0.0_wp … … 958 892 DO k = 1, nzt+1 959 893 IF ( i < 11 ) THEN 960 IF ( ug_vertical_gradient_level(i) < zu(k) .AND. &894 IF ( ug_vertical_gradient_level(i) < zu(k) .AND. & 961 895 ug_vertical_gradient_level(i) >= 0.0_wp ) THEN 962 896 gradient = ug_vertical_gradient(i) / 100.0_wp … … 982 916 DO k = nzt, nzb, -1 983 917 IF ( i < 11 ) THEN 984 IF ( ug_vertical_gradient_level(i) > zu(k) .AND. &918 IF ( ug_vertical_gradient_level(i) > zu(k) .AND. & 985 919 ug_vertical_gradient_level(i) <= 0.0_wp ) THEN 986 920 gradient = ug_vertical_gradient(i) / 100.0_wp … … 1011 945 ! 1012 946 !-- 1013 !-- If required, compute initial profile of the geostrophic wind 1014 !-- (component vg) 947 !-- If required, compute initial profile of the geostrophic wind (component vg) 1015 948 i = 1 1016 949 gradient = 0.0_wp … … 1022 955 DO k = 1, nzt+1 1023 956 IF ( i < 11 ) THEN 1024 IF ( vg_vertical_gradient_level(i) < zu(k) .AND. &957 IF ( vg_vertical_gradient_level(i) < zu(k) .AND. & 1025 958 vg_vertical_gradient_level(i) >= 0.0_wp ) THEN 1026 959 gradient = vg_vertical_gradient(i) / 100.0_wp … … 1046 979 DO k = nzt, nzb, -1 1047 980 IF ( i < 11 ) THEN 1048 IF ( vg_vertical_gradient_level(i) > zu(k) .AND. &981 IF ( vg_vertical_gradient_level(i) > zu(k) .AND. & 1049 982 vg_vertical_gradient_level(i) <= 0.0_wp ) THEN 1050 983 gradient = vg_vertical_gradient(i) / 100.0_wp … … 1074 1007 1075 1008 ! 1076 !-- Let the initial wind profiles be the calculated ug/vg profiles or 1077 !-- interpolate them from windprofile data (if given)1009 !-- Let the initial wind profiles be the calculated ug/vg profiles or interpolate them from wind 1010 !-- profile data (if given) 1078 1011 IF ( u_profile(1) == 9999999.9_wp .AND. v_profile(1) == 9999999.9_wp ) THEN 1079 1012 … … 1089 1022 1090 1023 IF ( omega /= 0.0_wp ) THEN 1091 message_string = 'Coriolis force must be switched off (by setting omega=0.0)' // &1024 message_string = 'Coriolis force must be switched off (by setting omega=0.0)' // & 1092 1025 ' when prescribing the forcing by u_profile and v_profile' 1093 1026 CALL message( 'check_parameters', 'PA0347', 1, 2, 0, 6, 0 ) … … 1110 1043 1111 1044 IF ( kk < 200 .AND. uv_heights(kk+1) /= 9999999.9_wp ) THEN 1112 u_init(k) = u_profile(kk) + ( zu(k) - uv_heights(kk) ) / &1113 ( uv_heights(kk+1) - uv_heights(kk) ) *&1114 ( u_profile(kk+1) - u_profile(kk) )1115 v_init(k) = v_profile(kk) + ( zu(k) - uv_heights(kk) ) / &1116 ( uv_heights(kk+1) - uv_heights(kk) ) *&1117 ( v_profile(kk+1) - v_profile(kk) )1045 u_init(k) = u_profile(kk) + ( zu(k) - uv_heights(kk) ) / & 1046 ( uv_heights(kk+1) - uv_heights(kk) ) * & 1047 ( u_profile(kk+1) - u_profile(kk) ) 1048 v_init(k) = v_profile(kk) + ( zu(k) - uv_heights(kk) ) / & 1049 ( uv_heights(kk+1) - uv_heights(kk) ) * & 1050 ( v_profile(kk+1) - v_profile(kk) ) 1118 1051 ELSE 1119 1052 u_init(k) = u_profile(kk) … … 1133 1066 !-- Compute initial temperature profile using the given temperature gradients 1134 1067 IF ( .NOT. neutral ) THEN 1135 CALL init_vertical_profiles( pt_vertical_gradient_level_ind, & 1136 pt_vertical_gradient_level, & 1137 pt_vertical_gradient, pt_init, & 1138 pt_surface, bc_pt_t_val ) 1068 CALL init_vertical_profiles( pt_vertical_gradient_level_ind, pt_vertical_gradient_level, & 1069 pt_vertical_gradient, pt_init, pt_surface, bc_pt_t_val ) 1139 1070 ENDIF 1140 1071 ! 1141 1072 !-- Compute initial humidity profile using the given humidity gradients 1142 1073 IF ( humidity ) THEN 1143 CALL init_vertical_profiles( q_vertical_gradient_level_ind, & 1144 q_vertical_gradient_level, & 1145 q_vertical_gradient, q_init, & 1146 q_surface, bc_q_t_val ) 1074 CALL init_vertical_profiles( q_vertical_gradient_level_ind, q_vertical_gradient_level, & 1075 q_vertical_gradient, q_init, q_surface, bc_q_t_val ) 1147 1076 ENDIF 1148 1077 ! 1149 1078 !-- Compute initial scalar profile using the given scalar gradients 1150 1079 IF ( passive_scalar ) THEN 1151 CALL init_vertical_profiles( s_vertical_gradient_level_ind, & 1152 s_vertical_gradient_level, & 1153 s_vertical_gradient, s_init, & 1154 s_surface, bc_s_t_val ) 1080 CALL init_vertical_profiles( s_vertical_gradient_level_ind, s_vertical_gradient_level, & 1081 s_vertical_gradient, s_init, s_surface, bc_s_t_val ) 1155 1082 ENDIF 1156 1083 ! … … 1164 1091 !-- Check if the control parameter use_subsidence_tendencies is used correctly 1165 1092 IF ( use_subsidence_tendencies .AND. .NOT. large_scale_subsidence ) THEN 1166 message_string = 'The usage of use_subsidence_tendencies ' // &1167 1093 message_string = 'The usage of use_subsidence_tendencies ' // & 1094 'requires large_scale_subsidence = .T..' 1168 1095 CALL message( 'check_parameters', 'PA0396', 1, 2, 0, 6, 0 ) 1169 1096 ELSEIF ( use_subsidence_tendencies .AND. .NOT. large_scale_forcing ) THEN 1170 1097 message_string = 'The usage of use_subsidence_tendencies ' // & 1171 1098 'requires large_scale_forcing = .T..' 1172 1099 CALL message( 'check_parameters', 'PA0397', 1, 2, 0, 6, 0 ) 1173 1100 ENDIF … … 1176 1103 !-- Initialize large scale subsidence if required 1177 1104 If ( large_scale_subsidence ) THEN 1178 IF ( subs_vertical_gradient_level(1) /= -9999999.9_wp .AND. 1179 .NOT. large_scale_forcing )THEN1105 IF ( subs_vertical_gradient_level(1) /= -9999999.9_wp .AND. .NOT. large_scale_forcing ) & 1106 THEN 1180 1107 CALL init_w_subsidence 1181 1108 ENDIF 1182 1109 ! 1183 !-- In case large_scale_forcing is used, profiles for subsidence velocity 1184 !-- are read in from file LSF_DATA 1185 1186 IF ( subs_vertical_gradient_level(1) == -9999999.9_wp .AND. & 1187 .NOT. large_scale_forcing ) THEN 1188 message_string = 'There is no default large scale vertical ' // & 1189 'velocity profile set. Specify the subsidence ' // & 1190 'velocity profile via subs_vertical_gradient ' // & 1191 'and subs_vertical_gradient_level.' 1110 !-- In case large_scale_forcing is used, profiles for subsidence velocity are read in from file 1111 !-- LSF_DATA 1112 1113 IF ( subs_vertical_gradient_level(1) == -9999999.9_wp .AND. .NOT. large_scale_forcing ) & 1114 THEN 1115 message_string = 'There is no default large scale vertical velocity profile set. ' // & 1116 'Specify the subsidence velocity profile via subs_vertical_gradient' // & 1117 ' and subs_vertical_gradient_level.' 1192 1118 CALL message( 'check_parameters', 'PA0380', 1, 2, 0, 6, 0 ) 1193 1119 ENDIF 1194 1120 ELSE 1195 1121 IF ( subs_vertical_gradient_level(1) /= -9999999.9_wp ) THEN 1196 message_string = 'Enable usage of large scale subsidence by ' // &1122 message_string = 'Enable usage of large scale subsidence by ' // & 1197 1123 'setting large_scale_subsidence = .T..' 1198 1124 CALL message( 'check_parameters', 'PA0381', 1, 2, 0, 6, 0 ) … … 1223 1149 vpt_reference = pt_reference * ( 1.0_wp + 0.61_wp * q_surface ) 1224 1150 ELSE 1225 message_string = 'illegal value for reference_state: "' // & 1226 TRIM( reference_state ) // '"' 1151 message_string = 'illegal value for reference_state: "' // TRIM( reference_state ) // '"' 1227 1152 CALL message( 'check_parameters', 'PA0056', 1, 2, 0, 6, 0 ) 1228 1153 ENDIF … … 1232 1157 IF ( alpha_surface /= 0.0_wp ) THEN 1233 1158 IF ( ABS( alpha_surface ) > 90.0_wp ) THEN 1234 WRITE( message_string, * ) 'ABS( alpha_surface = ', alpha_surface, & 1235 ' ) must be < 90.0' 1159 WRITE( message_string, * ) 'ABS( alpha_surface = ', alpha_surface, ' ) must be < 90.0' 1236 1160 CALL message( 'check_parameters', 'PA0043', 1, 2, 0, 6, 0 ) 1237 1161 ENDIF … … 1262 1186 ENDIF 1263 1187 ELSE 1264 WRITE( message_string, * ) 'cfl_factor = ', cfl_factor, &1188 WRITE( message_string, * ) 'cfl_factor = ', cfl_factor, & 1265 1189 ' out of range &0.0 < cfl_factor <= 1.0 is required' 1266 1190 CALL message( 'check_parameters', 'PA0045', 1, 2, 0, 6, 0 ) … … 1273 1197 1274 1198 ! 1275 !-- Store reference time for coupled runs and change the coupling flag, 1276 !-- if ... 1199 !-- Store reference time for coupled runs and change the coupling flag, if ... 1277 1200 IF ( simulated_time == 0.0_wp ) THEN 1278 1201 IF ( coupling_start_time == 0.0_wp ) THEN … … 1286 1209 !-- Set wind speed in the Galilei-transformed system 1287 1210 IF ( galilei_transformation ) THEN 1288 IF ( use_ug_for_galilei_tr .AND. &1289 ug_vertical_gradient_level(1) == 0.0_wp .AND. &1290 ug_vertical_gradient(1) == 0.0_wp .AND.&1291 vg_vertical_gradient_level(1) == 0.0_wp .AND. &1292 vg_vertical_gradient(1) == 0.0_wp ) THEN1211 IF ( use_ug_for_galilei_tr .AND. & 1212 ug_vertical_gradient_level(1) == 0.0_wp .AND. & 1213 ug_vertical_gradient(1) == 0.0_wp .AND. & 1214 vg_vertical_gradient_level(1) == 0.0_wp .AND. & 1215 vg_vertical_gradient(1) == 0.0_wp ) THEN 1293 1216 u_gtrans = ug_surface * 0.6_wp 1294 1217 v_gtrans = vg_surface * 0.6_wp 1295 ELSEIF ( use_ug_for_galilei_tr .AND. & 1296 ( ug_vertical_gradient_level(1) /= 0.0_wp .OR. & 1297 ug_vertical_gradient(1) /= 0.0_wp ) ) THEN 1298 message_string = 'baroclinity (ug) not allowed simultaneously' // & 1218 ELSEIF ( use_ug_for_galilei_tr .AND. ( ug_vertical_gradient_level(1) /= 0.0_wp .OR. & 1219 ug_vertical_gradient(1) /= 0.0_wp ) ) THEN 1220 message_string = 'baroclinity (ug) not allowed simultaneously' // & 1299 1221 ' with galilei transformation' 1300 1222 CALL message( 'check_parameters', 'PA0046', 1, 2, 0, 6, 0 ) 1301 ELSEIF ( use_ug_for_galilei_tr .AND. & 1302 ( vg_vertical_gradient_level(1) /= 0.0_wp .OR. & 1303 vg_vertical_gradient(1) /= 0.0_wp ) ) THEN 1304 message_string = 'baroclinity (vg) not allowed simultaneously' // & 1223 ELSEIF ( use_ug_for_galilei_tr .AND. ( vg_vertical_gradient_level(1) /= 0.0_wp .OR. & 1224 vg_vertical_gradient(1) /= 0.0_wp ) ) THEN 1225 message_string = 'baroclinity (vg) not allowed simultaneously' // & 1305 1226 ' with galilei transformation' 1306 1227 CALL message( 'check_parameters', 'PA0047', 1, 2, 0, 6, 0 ) 1307 1228 ELSE 1308 message_string = 'variable translation speed used for Galilei-' // & 1309 'transformation, which may cause & instabilities in stably ' // & 1310 'stratified regions' 1229 message_string = 'variable translation speed used for Galilei-transformation, which ' // & 1230 'may cause & instabilities in stably stratified regions' 1311 1231 CALL message( 'check_parameters', 'PA0048', 0, 1, 0, 6, 0 ) 1312 1232 ENDIF … … 1314 1234 1315 1235 ! 1316 !-- In case of using a prandtl-layer, calculated (or prescribed) surface 1317 !-- fluxes have to be used inthe diffusion-terms1236 !-- In case of using a prandtl-layer, calculated (or prescribed) surface fluxes have to be used in 1237 !-- the diffusion-terms 1318 1238 IF ( constant_flux_layer ) use_surface_fluxes = .TRUE. 1319 1239 1320 1240 ! 1321 1241 !-- Check boundary conditions and set internal variables: 1322 !-- Attention: the lateral boundary conditions have been already checked in 1323 !-- parin 1324 ! 1325 !-- Non-cyclic lateral boundaries require the multigrid method and Piascek- 1326 !-- Willimas or Wicker - Skamarock advection scheme. Several schemes 1327 !-- and tools do not work with non-cyclic boundary conditions. 1242 !-- Attention: the lateral boundary conditions have been already checked in parin 1243 ! 1244 !-- Non-cyclic lateral boundaries require the multigrid method and Piascek-Willimas or 1245 !-- Wicker - Skamarock advection scheme. Several schemes and tools do not work with non-cyclic 1246 !-- boundary conditions. 1328 1247 IF ( bc_lr /= 'cyclic' .OR. bc_ns /= 'cyclic' ) THEN 1329 1248 IF ( psolver(1:9) /= 'multigrid' ) THEN 1330 message_string = 'non-cyclic lateral boundaries do not allow ' // &1331 'psolver = "' //TRIM( psolver ) // '"'1249 message_string = 'non-cyclic lateral boundaries do not allow ' // 'psolver = "' // & 1250 TRIM( psolver ) // '"' 1332 1251 CALL message( 'check_parameters', 'PA0051', 1, 2, 0, 6, 0 ) 1333 1252 ENDIF 1334 IF ( momentum_advec /= 'pw-scheme' .AND. & 1335 momentum_advec /= 'ws-scheme' ) THEN 1336 1337 message_string = 'non-cyclic lateral boundaries do not allow ' // & 1338 'momentum_advec = "' // TRIM( momentum_advec ) // '"' 1253 IF ( momentum_advec /= 'pw-scheme' .AND. momentum_advec /= 'ws-scheme' ) THEN 1254 1255 message_string = 'non-cyclic lateral boundaries do not allow momentum_advec = "' // & 1256 TRIM( momentum_advec ) // '"' 1339 1257 CALL message( 'check_parameters', 'PA0052', 1, 2, 0, 6, 0 ) 1340 1258 ENDIF 1341 IF ( scalar_advec /= 'pw-scheme' .AND. & 1342 scalar_advec /= 'ws-scheme' ) THEN 1343 message_string = 'non-cyclic lateral boundaries do not allow ' // & 1344 'scalar_advec = "' // TRIM( scalar_advec ) // '"' 1259 IF ( scalar_advec /= 'pw-scheme' .AND. scalar_advec /= 'ws-scheme' ) THEN 1260 message_string = 'non-cyclic lateral boundaries do not allow scalar_advec = "' // & 1261 TRIM( scalar_advec ) // '"' 1345 1262 CALL message( 'check_parameters', 'PA0053', 1, 2, 0, 6, 0 ) 1346 1263 ENDIF 1347 1264 IF ( galilei_transformation ) THEN 1348 message_string = 'non-cyclic lateral boundaries do not allow ' // & 1349 'galilei_transformation = .T.' 1265 message_string = 'non-cyclic lateral boundaries do not allow galilei_transformation = .T.' 1350 1266 CALL message( 'check_parameters', 'PA0054', 1, 2, 0, 6, 0 ) 1351 1267 ENDIF … … 1361 1277 bc_e_b = 'neumann' 1362 1278 ibc_e_b = 1 1363 message_string = 'boundary condition bc_e_b changed to "' // & 1364 TRIM( bc_e_b ) // '"' 1279 message_string = 'boundary condition bc_e_b changed to "' // TRIM( bc_e_b ) // '"' 1365 1280 CALL message( 'check_parameters', 'PA0057', 0, 1, 0, 6, 0 ) 1366 1281 ENDIF 1367 1282 ELSE 1368 message_string = 'unknown boundary condition: bc_e_b = "' // & 1369 TRIM( bc_e_b ) // '"' 1283 message_string = 'unknown boundary condition: bc_e_b = "' // TRIM( bc_e_b ) // '"' 1370 1284 CALL message( 'check_parameters', 'PA0058', 1, 2, 0, 6, 0 ) 1371 1285 ENDIF … … 1378 1292 ibc_p_b = 1 1379 1293 ELSE 1380 message_string = 'unknown boundary condition: bc_p_b = "' // & 1381 TRIM( bc_p_b ) // '"' 1294 message_string = 'unknown boundary condition: bc_p_b = "' // TRIM( bc_p_b ) // '"' 1382 1295 CALL message( 'check_parameters', 'PA0059', 1, 2, 0, 6, 0 ) 1383 1296 ENDIF … … 1389 1302 ibc_p_t = 1 1390 1303 ELSE 1391 message_string = 'unknown boundary condition: bc_p_t = "' // & 1392 TRIM( bc_p_t ) // '"' 1304 message_string = 'unknown boundary condition: bc_p_t = "' // TRIM( bc_p_t ) // '"' 1393 1305 CALL message( 'check_parameters', 'PA0061', 1, 2, 0, 6, 0 ) 1394 1306 ENDIF … … 1404 1316 ibc_pt_b = 1 1405 1317 ELSE 1406 message_string = 'unknown boundary condition: bc_pt_b = "' // & 1407 TRIM( bc_pt_b ) // '"' 1318 message_string = 'unknown boundary condition: bc_pt_b = "' // TRIM( bc_pt_b ) // '"' 1408 1319 CALL message( 'check_parameters', 'PA0062', 1, 2, 0, 6, 0 ) 1409 1320 ENDIF … … 1419 1330 ibc_pt_t = 3 1420 1331 ELSE 1421 message_string = 'unknown boundary condition: bc_pt_t = "' // & 1422 TRIM( bc_pt_t ) // '"' 1332 message_string = 'unknown boundary condition: bc_pt_t = "' // TRIM( bc_pt_t ) // '"' 1423 1333 CALL message( 'check_parameters', 'PA0063', 1, 2, 0, 6, 0 ) 1424 1334 ENDIF 1425 1335 1426 IF ( ANY( wall_heatflux /= 0.0_wp ) .AND. & 1427 surface_heatflux == 9999999.9_wp ) THEN 1428 message_string = 'wall_heatflux additionally requires ' // & 1429 'setting of surface_heatflux' 1336 IF ( ANY( wall_heatflux /= 0.0_wp ) .AND. surface_heatflux == 9999999.9_wp ) THEN 1337 message_string = 'wall_heatflux additionally requires setting of surface_heatflux' 1430 1338 CALL message( 'check_parameters', 'PA0443', 1, 2, 0, 6, 0 ) 1431 1339 ENDIF … … 1451 1359 IF ( neutral ) THEN 1452 1360 1453 IF ( surface_heatflux /= 0.0_wp .AND. & 1454 surface_heatflux /= 9999999.9_wp ) THEN 1361 IF ( surface_heatflux /= 0.0_wp .AND. surface_heatflux /= 9999999.9_wp ) THEN 1455 1362 message_string = 'heatflux must not be set for pure neutral flow' 1456 1363 CALL message( 'check_parameters', 'PA0351', 1, 2, 0, 6, 0 ) 1457 1364 ENDIF 1458 1365 1459 IF ( top_heatflux /= 0.0_wp .AND. top_heatflux /= 9999999.9_wp ) & 1460 THEN 1366 IF ( top_heatflux /= 0.0_wp .AND. top_heatflux /= 9999999.9_wp ) THEN 1461 1367 message_string = 'heatflux must not be set for pure neutral flow' 1462 1368 CALL message( 'check_parameters', 'PA0351', 1, 2, 0, 6, 0 ) … … 1465 1371 ENDIF 1466 1372 1467 IF ( top_momentumflux_u /= 9999999.9_wp .AND. & 1468 top_momentumflux_v /= 9999999.9_wp ) THEN 1373 IF ( top_momentumflux_u /= 9999999.9_wp .AND. top_momentumflux_v /= 9999999.9_wp ) THEN 1469 1374 constant_top_momentumflux = .TRUE. 1470 ELSEIF ( .NOT. ( top_momentumflux_u == 9999999.9_wp .AND.&1375 ELSEIF ( .NOT. ( top_momentumflux_u == 9999999.9_wp .AND. & 1471 1376 top_momentumflux_v == 9999999.9_wp ) ) THEN 1472 message_string = 'both, top_momentumflux_u AND top_momentumflux_v ' // & 1473 'must be set' 1377 message_string = 'both, top_momentumflux_u AND top_momentumflux_v must be set' 1474 1378 CALL message( 'check_parameters', 'PA0064', 1, 2, 0, 6, 0 ) 1475 1379 ENDIF 1476 1380 1477 1381 ! 1478 !-- A given surface temperature implies Dirichlet boundary condition for 1479 !-- temperature. In this case specification of a constant heat flux is 1480 !-- forbidden. 1481 IF ( ibc_pt_b == 0 .AND. constant_heatflux .AND. & 1482 surface_heatflux /= 0.0_wp ) THEN 1483 message_string = 'boundary_condition: bc_pt_b = "' // TRIM( bc_pt_b ) //& 1382 !-- A given surface temperature implies Dirichlet boundary condition for temperature. In this case 1383 !-- specification of a constant heat flux is forbidden. 1384 IF ( ibc_pt_b == 0 .AND. constant_heatflux .AND. surface_heatflux /= 0.0_wp ) THEN 1385 message_string = 'boundary_condition: bc_pt_b = "' // TRIM( bc_pt_b ) // & 1484 1386 '& is not allowed with constant_heatflux = .TRUE.' 1485 1387 CALL message( 'check_parameters', 'PA0065', 1, 2, 0, 6, 0 ) 1486 1388 ENDIF 1487 1389 IF ( constant_heatflux .AND. pt_surface_initial_change /= 0.0_wp ) THEN 1488 WRITE ( message_string, * ) 'constant_heatflux = .TRUE. is not allo', & 1489 'wed with pt_surface_initial_change (/=0) = ', & 1490 pt_surface_initial_change 1390 WRITE ( message_string, * ) 'constant_heatflux = .TRUE. is not allo', & 1391 'wed with pt_surface_initial_change (/=0) = ', pt_surface_initial_change 1491 1392 CALL message( 'check_parameters', 'PA0066', 1, 2, 0, 6, 0 ) 1492 1393 ENDIF 1493 1394 1494 1395 ! 1495 !-- A given temperature at the top implies Dirichlet boundary condition for 1496 !-- temperature. In this case specification of a constant heat flux is 1497 !-- forbidden. 1498 IF ( ibc_pt_t == 0 .AND. constant_top_heatflux .AND. & 1499 top_heatflux /= 0.0_wp ) THEN 1500 message_string = 'boundary_condition: bc_pt_t = "' // TRIM( bc_pt_t ) //& 1396 !-- A given temperature at the top implies Dirichlet boundary condition for temperature. In this 1397 !-- case specification of a constant heat flux is forbidden. 1398 IF ( ibc_pt_t == 0 .AND. constant_top_heatflux .AND. top_heatflux /= 0.0_wp ) THEN 1399 message_string = 'boundary_condition: bc_pt_t = "' // TRIM( bc_pt_t ) // & 1501 1400 '" is not allowed with constant_top_heatflux = .TRUE.' 1502 1401 CALL message( 'check_parameters', 'PA0067', 1, 2, 0, 6, 0 ) … … 1507 1406 IF ( humidity ) THEN 1508 1407 1509 IF ( ANY( wall_humidityflux /= 0.0_wp ) .AND. & 1510 surface_waterflux == 9999999.9_wp ) THEN 1511 message_string = 'wall_humidityflux additionally requires ' // & 1512 'setting of surface_waterflux' 1408 IF ( ANY( wall_humidityflux /= 0.0_wp ) .AND. surface_waterflux == 9999999.9_wp ) THEN 1409 message_string = 'wall_humidityflux additionally requires setting of surface_waterflux' 1513 1410 CALL message( 'check_parameters', 'PA0444', 1, 2, 0, 6, 0 ) 1514 1411 ENDIF 1515 1412 1516 CALL set_bc_scalars( 'q', bc_q_b, bc_q_t, ibc_q_b, ibc_q_t, & 1517 'PA0071', 'PA0072' ) 1413 CALL set_bc_scalars( 'q', bc_q_b, bc_q_t, ibc_q_b, ibc_q_t, 'PA0071', 'PA0072' ) 1518 1414 1519 1415 IF ( surface_waterflux == 9999999.9_wp ) THEN … … 1530 1426 ENDIF 1531 1427 1532 CALL check_bc_scalars( 'q', bc_q_b, ibc_q_b, 'PA0073', 'PA0074', &1533 constant_waterflux,q_surface_initial_change )1428 CALL check_bc_scalars( 'q', bc_q_b, ibc_q_b, 'PA0073', 'PA0074', constant_waterflux, & 1429 q_surface_initial_change ) 1534 1430 1535 1431 ENDIF … … 1537 1433 IF ( passive_scalar ) THEN 1538 1434 1539 IF ( ANY( wall_scalarflux /= 0.0_wp ) .AND. & 1540 surface_scalarflux == 9999999.9_wp ) THEN 1541 message_string = 'wall_scalarflux additionally requires ' // & 1542 'setting of surface_scalarflux' 1435 IF ( ANY( wall_scalarflux /= 0.0_wp ) .AND. surface_scalarflux == 9999999.9_wp ) THEN 1436 message_string = 'wall_scalarflux additionally requires setting of surface_scalarflux' 1543 1437 CALL message( 'check_parameters', 'PA0445', 1, 2, 0, 6, 0 ) 1544 1438 ENDIF … … 1546 1440 IF ( surface_scalarflux == 9999999.9_wp ) constant_scalarflux = .FALSE. 1547 1441 1548 CALL set_bc_scalars( 's', bc_s_b, bc_s_t, ibc_s_b, ibc_s_t, & 1549 'PA0071', 'PA0072' ) 1550 1551 CALL check_bc_scalars( 's', bc_s_b, ibc_s_b, 'PA0073', 'PA0074', & 1552 constant_scalarflux, s_surface_initial_change ) 1442 CALL set_bc_scalars( 's', bc_s_b, bc_s_t, ibc_s_b, ibc_s_t, 'PA0071', 'PA0072' ) 1443 1444 CALL check_bc_scalars( 's', bc_s_b, ibc_s_b, 'PA0073', 'PA0074', constant_scalarflux, & 1445 s_surface_initial_change ) 1553 1446 1554 1447 IF ( top_scalarflux == 9999999.9_wp ) constant_top_scalarflux = .FALSE. 1555 1448 ! 1556 !-- A fixed scalar concentration at the top implies Dirichlet boundary 1557 !-- condition for scalar. Hence, in this case specification of a constant 1558 !-- scalar flux is forbidden. 1559 IF ( ( ibc_s_t == 0 .OR. ibc_s_t == 2 ) .AND. constant_top_scalarflux & 1560 .AND. top_scalarflux /= 0.0_wp ) THEN 1561 message_string = 'boundary condition: bc_s_t = "' // & 1562 TRIM( bc_s_t ) // '" is not allowed with ' // & 1563 'top_scalarflux /= 0.0' 1449 !-- A fixed scalar concentration at the top implies Dirichlet boundary condition for scalar. 1450 !-- Hence, in this case specification of a constant scalar flux is forbidden. 1451 IF ( ( ibc_s_t == 0 .OR. ibc_s_t == 2 ) .AND. constant_top_scalarflux .AND. & 1452 top_scalarflux /= 0.0_wp ) THEN 1453 message_string = 'boundary condition: bc_s_t = "' // TRIM( bc_s_t ) // & 1454 '" is not allowed with top_scalarflux /= 0.0' 1564 1455 CALL message( 'check_parameters', 'PA0441', 1, 2, 0, 6, 0 ) 1565 1456 ENDIF … … 1573 1464 ibc_uv_b = 1 1574 1465 IF ( constant_flux_layer ) THEN 1575 message_string = 'boundary condition: bc_uv_b = "' // & 1576 TRIM( bc_uv_b ) // '" is not allowed with constant_flux_layer' & 1577 // ' = .TRUE.' 1466 message_string = 'boundary condition: bc_uv_b = "' // TRIM( bc_uv_b ) // & 1467 '" is not allowed with constant_flux_layer = .TRUE.' 1578 1468 CALL message( 'check_parameters', 'PA0075', 1, 2, 0, 6, 0 ) 1579 1469 ENDIF 1580 1470 ELSE 1581 message_string = 'unknown boundary condition: bc_uv_b = "' // & 1582 TRIM( bc_uv_b ) // '"' 1471 message_string = 'unknown boundary condition: bc_uv_b = "' // TRIM( bc_uv_b ) // '"' 1583 1472 CALL message( 'check_parameters', 'PA0076', 1, 2, 0, 6, 0 ) 1584 1473 ENDIF 1585 1474 ! 1586 !-- In case of coupled simulations u and v at the ground in atmosphere will be 1587 !-- a ssigned with the u and v values of the ocean surface1475 !-- In case of coupled simulations u and v at the ground in atmosphere will be assigned with the u 1476 !-- and v values of the ocean surface 1588 1477 IF ( coupling_mode == 'atmosphere_to_ocean' ) THEN 1589 1478 ibc_uv_b = 2 … … 1598 1487 IF ( bc_uv_t == 'dirichlet_0' ) THEN 1599 1488 ! 1600 !-- Velocities for the initial u,v-profiles are set zero at the top 1601 !-- in case of dirichlet_0conditions1489 !-- Velocities for the initial u,v-profiles are set zero at the top in case of dirichlet_0 1490 !-- conditions 1602 1491 u_init(nzt+1) = 0.0_wp 1603 1492 v_init(nzt+1) = 0.0_wp … … 1608 1497 ibc_uv_t = 3 1609 1498 ELSE 1610 message_string = 'unknown boundary condition: bc_uv_t = "' // & 1611 TRIM( bc_uv_t ) // '"' 1499 message_string = 'unknown boundary condition: bc_uv_t = "' // TRIM( bc_uv_t ) // '"' 1612 1500 CALL message( 'check_parameters', 'PA0077', 1, 2, 0, 6, 0 ) 1613 1501 ENDIF … … 1619 1507 rayleigh_damping_factor = 0.0_wp 1620 1508 ELSE 1621 IF ( rayleigh_damping_factor < 0.0_wp .OR. & 1622 rayleigh_damping_factor > 1.0_wp ) THEN 1623 WRITE( message_string, * ) 'rayleigh_damping_factor = ', & 1624 rayleigh_damping_factor, ' out of range [0.0,1.0]' 1509 IF ( rayleigh_damping_factor < 0.0_wp .OR. rayleigh_damping_factor > 1.0_wp ) THEN 1510 WRITE( message_string, * ) 'rayleigh_damping_factor = ', rayleigh_damping_factor, & 1511 ' out of range [0.0,1.0]' 1625 1512 CALL message( 'check_parameters', 'PA0078', 1, 2, 0, 6, 0 ) 1626 1513 ENDIF … … 1628 1515 1629 1516 IF ( rayleigh_damping_height == -1.0_wp ) THEN 1630 IF ( .NOT.ocean_mode ) THEN1517 IF ( .NOT. ocean_mode ) THEN 1631 1518 rayleigh_damping_height = 0.66666666666_wp * zu(nzt) 1632 1519 ELSE … … 1634 1521 ENDIF 1635 1522 ELSE 1636 IF ( .NOT. ocean_mode ) THEN 1637 IF ( rayleigh_damping_height < 0.0_wp .OR. & 1638 rayleigh_damping_height > zu(nzt) ) THEN 1639 WRITE( message_string, * ) 'rayleigh_damping_height = ', & 1640 rayleigh_damping_height, ' out of range [0.0,', zu(nzt), ']' 1523 IF ( .NOT. ocean_mode ) THEN 1524 IF ( rayleigh_damping_height < 0.0_wp .OR. rayleigh_damping_height > zu(nzt) ) THEN 1525 WRITE( message_string, * ) 'rayleigh_damping_height = ', rayleigh_damping_height, & 1526 ' out of range [0.0,', zu(nzt), ']' 1641 1527 CALL message( 'check_parameters', 'PA0079', 1, 2, 0, 6, 0 ) 1642 1528 ENDIF 1643 1529 ELSE 1644 IF ( rayleigh_damping_height > 0.0_wp .OR. & 1645 rayleigh_damping_height < zu(nzb) ) THEN 1646 WRITE( message_string, * ) 'rayleigh_damping_height = ', & 1647 rayleigh_damping_height, ' out of range [0.0,', zu(nzb), ']' 1530 IF ( rayleigh_damping_height > 0.0_wp .OR. rayleigh_damping_height < zu(nzb) ) THEN 1531 WRITE( message_string, * ) 'rayleigh_damping_height = ', rayleigh_damping_height, & 1532 ' out of range [0.0,', zu(nzb), ']' 1648 1533 CALL message( 'check_parameters', 'PA0079', 1, 2, 0, 6, 0 ) 1649 1534 ENDIF … … 1654 1539 !-- Check number of chosen statistic regions 1655 1540 IF ( statistic_regions < 0 ) THEN 1656 WRITE ( message_string, * ) 'number of statistic_regions = ', &1657 statistic_regions+1,' is not allowed'1541 WRITE ( message_string, * ) 'number of statistic_regions = ', statistic_regions+1, & 1542 ' is not allowed' 1658 1543 CALL message( 'check_parameters', 'PA0082', 1, 2, 0, 6, 0 ) 1659 1544 ENDIF 1660 IF ( normalizing_region > statistic_regions .OR. & 1661 normalizing_region < 0) THEN 1662 WRITE ( message_string, * ) 'normalizing_region = ', & 1663 normalizing_region, ' must be >= 0 and <= ',statistic_regions, & 1664 ' (value of statistic_regions)' 1545 IF ( normalizing_region > statistic_regions .OR. normalizing_region < 0) THEN 1546 WRITE ( message_string, * ) 'normalizing_region = ', normalizing_region, & 1547 ' must be >= 0 and <= ',statistic_regions, ' (value of statistic_regions)' 1665 1548 CALL message( 'check_parameters', 'PA0083', 1, 2, 0, 6, 0 ) 1666 1549 ENDIF … … 1684 1567 ! 1685 1568 !-- Set the default skip time intervals for data output, if necessary 1686 IF ( skip_time_dopr == 9999999.9_wp ) & 1687 skip_time_dopr = skip_time_data_output 1688 IF ( skip_time_do2d_xy == 9999999.9_wp ) & 1689 skip_time_do2d_xy = skip_time_data_output 1690 IF ( skip_time_do2d_xz == 9999999.9_wp ) & 1691 skip_time_do2d_xz = skip_time_data_output 1692 IF ( skip_time_do2d_yz == 9999999.9_wp ) & 1693 skip_time_do2d_yz = skip_time_data_output 1694 IF ( skip_time_do3d == 9999999.9_wp ) & 1695 skip_time_do3d = skip_time_data_output 1696 IF ( skip_time_data_output_av == 9999999.9_wp ) & 1697 skip_time_data_output_av = skip_time_data_output 1569 IF ( skip_time_dopr == 9999999.9_wp ) skip_time_dopr = skip_time_data_output 1570 IF ( skip_time_do2d_xy == 9999999.9_wp ) skip_time_do2d_xy = skip_time_data_output 1571 IF ( skip_time_do2d_xz == 9999999.9_wp ) skip_time_do2d_xz = skip_time_data_output 1572 IF ( skip_time_do2d_yz == 9999999.9_wp ) skip_time_do2d_yz = skip_time_data_output 1573 IF ( skip_time_do3d == 9999999.9_wp ) skip_time_do3d = skip_time_data_output 1574 IF ( skip_time_data_output_av == 9999999.9_wp ) & 1575 skip_time_data_output_av = skip_time_data_output 1698 1576 DO mid = 1, max_masks 1699 IF ( skip_time_domask(mid) == 9999999.9_wp ) &1700 skip_time_domask(mid) = skip_time_data_output1577 IF ( skip_time_domask(mid) == 9999999.9_wp ) & 1578 skip_time_domask(mid) = skip_time_data_output 1701 1579 ENDDO 1702 1580 … … 1704 1582 !-- Check the average intervals (first for 3d-data, then for profiles) 1705 1583 IF ( averaging_interval > dt_data_output_av ) THEN 1706 WRITE( message_string, * ) 'averaging_interval = ', & 1707 averaging_interval, ' must be <= dt_data_output_av = ', & 1708 dt_data_output_av 1584 WRITE( message_string, * ) 'averaging_interval = ', averaging_interval, & 1585 ' must be <= dt_data_output_av = ', dt_data_output_av 1709 1586 CALL message( 'check_parameters', 'PA0085', 1, 2, 0, 6, 0 ) 1710 1587 ENDIF … … 1715 1592 1716 1593 IF ( averaging_interval_pr > dt_dopr ) THEN 1717 WRITE( message_string, * ) 'averaging_interval_pr = ', 1718 averaging_interval_pr,' must be <= dt_dopr = ', dt_dopr1594 WRITE( message_string, * ) 'averaging_interval_pr = ', averaging_interval_pr, & 1595 ' must be <= dt_dopr = ', dt_dopr 1719 1596 CALL message( 'check_parameters', 'PA0086', 1, 2, 0, 6, 0 ) 1720 1597 ENDIF … … 1727 1604 1728 1605 ! 1729 !-- Set the default interval for the output of timeseries to a reasonable 1730 !-- value (tries to minimizethe number of calls of flow_statistics)1606 !-- Set the default interval for the output of timeseries to a reasonable value (tries to minimize 1607 !-- the number of calls of flow_statistics) 1731 1608 IF ( dt_dots == 9999999.9_wp ) THEN 1732 1609 IF ( averaging_interval_pr == 0.0_wp ) THEN … … 1740 1617 !-- Check the sample rate for averaging (first for 3d-data, then for profiles) 1741 1618 IF ( dt_averaging_input > averaging_interval ) THEN 1742 WRITE( message_string, * ) 'dt_averaging_input = ', & 1743 dt_averaging_input, ' must be <= averaging_interval = ', & 1744 averaging_interval 1619 WRITE( message_string, * ) 'dt_averaging_input = ', dt_averaging_input, & 1620 ' must be <= averaging_interval = ', averaging_interval 1745 1621 CALL message( 'check_parameters', 'PA0088', 1, 2, 0, 6, 0 ) 1746 1622 ENDIF 1747 1623 1748 1624 IF ( dt_averaging_input_pr > averaging_interval_pr ) THEN 1749 WRITE( message_string, * ) 'dt_averaging_input_pr = ', & 1750 dt_averaging_input_pr, ' must be <= averaging_interval_pr = ', & 1751 averaging_interval_pr 1625 WRITE( message_string, * ) 'dt_averaging_input_pr = ', dt_averaging_input_pr, & 1626 ' must be <= averaging_interval_pr = ', averaging_interval_pr 1752 1627 CALL message( 'check_parameters', 'PA0089', 1, 2, 0, 6, 0 ) 1753 1628 ENDIF 1754 1629 1755 1630 ! 1756 !-- Determine the number of output profiles and check whether they are 1757 !-- permissible 1631 !-- Determine the number of output profiles and check whether they are permissible 1758 1632 DO WHILE ( data_output_pr(dopr_n+1) /= ' ' ) 1759 1633 … … 1762 1636 1763 1637 ! 1764 !-- Determine internal profile number (for hom, homs) 1765 !-- and store height levels 1638 !-- Determine internal profile number (for hom, homs) and store height levels 1766 1639 SELECT CASE ( TRIM( data_output_pr(i) ) ) 1767 1640 … … 1792 1665 1793 1666 CASE ( 'theta', '#theta' ) 1794 IF ( .NOT. bulk_cloud_model ) THEN1667 IF ( .NOT. bulk_cloud_model ) THEN 1795 1668 dopr_index(i) = 4 1796 1669 dopr_unit(i) = 'K' … … 1974 1847 CASE ( 'q', '#q' ) 1975 1848 IF ( .NOT. humidity ) THEN 1976 message_string = 'data_output_pr = ' // & 1977 TRIM( data_output_pr(i) ) // ' is not imp' // & 1978 'lemented for humidity = .FALSE.' 1849 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 1850 ' is not implemented for humidity = .FALSE.' 1979 1851 CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 ) 1980 1852 ELSE … … 1992 1864 CASE ( 's', '#s' ) 1993 1865 IF ( .NOT. passive_scalar ) THEN 1994 message_string = 'data_output_pr = ' // & 1995 TRIM( data_output_pr(i) ) // ' is not imp' // & 1996 'lemented for passive_scalar = .FALSE.' 1866 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 1867 ' is not implemented for passive_scalar = .FALSE.' 1997 1868 CALL message( 'check_parameters', 'PA0093', 1, 2, 0, 6, 0 ) 1998 1869 ELSE … … 2033 1904 CASE ( 'thetal', '#thetal' ) 2034 1905 IF ( .NOT. bulk_cloud_model ) THEN 2035 message_string = 'data_output_pr = ' // & 2036 TRIM( data_output_pr(i) ) // ' is not imp' // & 2037 'lemented for bulk_cloud_model = .FALSE.' 1906 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 1907 ' is not implemented for bulk_cloud_model = .FALSE.' 2038 1908 CALL message( 'check_parameters', 'PA0094', 1, 2, 0, 6, 0 ) 2039 1909 ELSE … … 2076 1946 2077 1947 CASE ( 'w"q"' ) 2078 IF ( .NOT. humidity ) THEN 2079 message_string = 'data_output_pr = ' // & 2080 TRIM( data_output_pr(i) ) // ' is not imp' // & 2081 'lemented for humidity = .FALSE.' 1948 IF ( .NOT. humidity ) THEN 1949 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 1950 ' is not implemented for humidity = .FALSE.' 2082 1951 CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 ) 2083 1952 ELSE … … 2088 1957 2089 1958 CASE ( 'w*q*' ) 2090 IF ( .NOT. humidity ) THEN 2091 message_string = 'data_output_pr = ' // & 2092 TRIM( data_output_pr(i) ) // ' is not imp' // & 2093 'lemented for humidity = .FALSE.' 1959 IF ( .NOT. humidity ) THEN 1960 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 1961 ' is not implemented for humidity = .FALSE.' 2094 1962 CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 ) 2095 1963 ELSE … … 2100 1968 2101 1969 CASE ( 'wq' ) 2102 IF ( .NOT. humidity ) THEN 2103 message_string = 'data_output_pr = ' // & 2104 TRIM( data_output_pr(i) ) // ' is not imp' // & 2105 'lemented for humidity = .FALSE.' 1970 IF ( .NOT. humidity ) THEN 1971 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 1972 ' is not implemented for humidity = .FALSE.' 2106 1973 CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 ) 2107 1974 ELSE … … 2112 1979 2113 1980 CASE ( 'w"s"' ) 2114 IF ( .NOT. passive_scalar ) THEN 2115 message_string = 'data_output_pr = ' // & 2116 TRIM( data_output_pr(i) ) // ' is not imp' // & 2117 'lemented for passive_scalar = .FALSE.' 1981 IF ( .NOT. passive_scalar ) THEN 1982 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 1983 ' is not implemented for passive_scalar = .FALSE.' 2118 1984 CALL message( 'check_parameters', 'PA0093', 1, 2, 0, 6, 0 ) 2119 1985 ELSE … … 2124 1990 2125 1991 CASE ( 'w*s*' ) 2126 IF ( .NOT. passive_scalar ) THEN 2127 message_string = 'data_output_pr = ' // & 2128 TRIM( data_output_pr(i) ) // ' is not imp' // & 2129 'lemented for passive_scalar = .FALSE.' 1992 IF ( .NOT. passive_scalar ) THEN 1993 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 1994 ' is not implemented for passive_scalar = .FALSE.' 2130 1995 CALL message( 'check_parameters', 'PA0093', 1, 2, 0, 6, 0 ) 2131 1996 ELSE … … 2136 2001 2137 2002 CASE ( 'ws' ) 2138 IF ( .NOT. passive_scalar ) THEN 2139 message_string = 'data_output_pr = ' // & 2140 TRIM( data_output_pr(i) ) // ' is not imp' // & 2141 'lemented for passive_scalar = .FALSE.' 2003 IF ( .NOT. passive_scalar ) THEN 2004 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 2005 ' is not implemented for passive_scalar = .FALSE.' 2142 2006 CALL message( 'check_parameters', 'PA0093', 1, 2, 0, 6, 0 ) 2143 2007 ELSE … … 2148 2012 2149 2013 CASE ( 'w"qv"' ) 2150 IF ( humidity .AND. .NOT. 2014 IF ( humidity .AND. .NOT. bulk_cloud_model ) THEN 2151 2015 dopr_index(i) = 48 2152 2016 dopr_unit(i) = TRIM ( waterflux_output_unit ) … … 2157 2021 hom(:,2,51,:) = SPREAD( zw, 2, statistic_regions+1 ) 2158 2022 ELSE 2159 message_string = 'data_output_pr = ' // & 2160 TRIM( data_output_pr(i) ) // ' is not imp' // & 2161 'lemented for bulk_cloud_model = .FALSE. ' // & 2023 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 2024 ' is not implemented for bulk_cloud_model = .FALSE. ' // & 2162 2025 'and humidity = .FALSE.' 2163 2026 CALL message( 'check_parameters', 'PA0095', 1, 2, 0, 6, 0 ) … … 2169 2032 dopr_unit(i) = TRIM ( waterflux_output_unit ) 2170 2033 hom(:,2,49,:) = SPREAD( zw, 2, statistic_regions+1 ) 2171 ELSEIF( humidity .AND. bulk_cloud_model )THEN2034 ELSEIF( humidity .AND. bulk_cloud_model ) THEN 2172 2035 dopr_index(i) = 52 2173 2036 dopr_unit(i) = TRIM ( waterflux_output_unit ) 2174 2037 hom(:,2,52,:) = SPREAD( zw, 2, statistic_regions+1 ) 2175 2038 ELSE 2176 message_string = 'data_output_pr = ' // & 2177 TRIM( data_output_pr(i) ) // ' is not imp' // & 2178 'lemented for bulk_cloud_model = .FALSE. ' // & 2039 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 2040 ' is not implemented for bulk_cloud_model = .FALSE. ' // & 2179 2041 'and humidity = .FALSE.' 2180 2042 CALL message( 'check_parameters', 'PA0095', 1, 2, 0, 6, 0 ) … … 2182 2044 2183 2045 CASE ( 'wqv' ) 2184 IF ( humidity .AND. .NOT. 2046 IF ( humidity .AND. .NOT. bulk_cloud_model ) THEN 2185 2047 dopr_index(i) = 50 2186 2048 dopr_unit(i) = TRIM ( waterflux_output_unit ) … … 2191 2053 hom(:,2,53,:) = SPREAD( zw, 2, statistic_regions+1 ) 2192 2054 ELSE 2193 message_string = 'data_output_pr = ' // & 2194 TRIM( data_output_pr(i) ) // ' is not imp' // & 2195 'lemented for bulk_cloud_model = .FALSE. ' // & 2055 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 2056 ' is not implemented for bulk_cloud_model = .FALSE. ' // & 2196 2057 'and humidity = .FALSE.' 2197 2058 CALL message( 'check_parameters', 'PA0095', 1, 2, 0, 6, 0 ) … … 2199 2060 2200 2061 CASE ( 'ql' ) 2201 IF ( .NOT. bulk_cloud_model .AND. .NOT. cloud_droplets ) THEN 2202 message_string = 'data_output_pr = ' // & 2203 TRIM( data_output_pr(i) ) // ' is not imp' // & 2204 'lemented for bulk_cloud_model = .FALSE. ' // & 2062 IF ( .NOT. bulk_cloud_model .AND. .NOT. cloud_droplets ) THEN 2063 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 2064 ' is not implemented for bulk_cloud_model = .FALSE. ' // & 2205 2065 'and cloud_droplets = .FALSE.' 2206 2066 CALL message( 'check_parameters', 'PA0096', 1, 2, 0, 6, 0 ) … … 2268 2128 CASE ( 'q*2' ) 2269 2129 IF ( .NOT. humidity ) THEN 2270 message_string = 'data_output_pr = ' // & 2271 TRIM( data_output_pr(i) ) // ' is not imp' // & 2272 'lemented for humidity = .FALSE.' 2130 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 2131 ' is not implemented for humidity = .FALSE.' 2273 2132 CALL message( 'check_parameters', 'PA0092', 1, 2, 0, 6, 0 ) 2274 2133 ELSE … … 2305 2164 CASE ( 'w_subs' ) 2306 2165 IF ( .NOT. large_scale_subsidence ) THEN 2307 message_string = 'data_output_pr = ' // & 2308 TRIM( data_output_pr(i) ) // ' is not imp' // & 2309 'lemented for large_scale_subsidence = .FALSE.' 2166 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 2167 ' is not implemented for large_scale_subsidence = .FALSE.' 2310 2168 CALL message( 'check_parameters', 'PA0382', 1, 2, 0, 6, 0 ) 2311 2169 ELSE … … 2317 2175 CASE ( 's*2' ) 2318 2176 IF ( .NOT. passive_scalar ) THEN 2319 message_string = 'data_output_pr = ' // & 2320 TRIM( data_output_pr(i) ) // ' is not imp' // & 2321 'lemented for passive_scalar = .FALSE.' 2177 message_string = 'data_output_pr = ' // TRIM( data_output_pr(i) ) // & 2178 ' is not implemented for passive_scalar = .FALSE.' 2322 2179 CALL message( 'check_parameters', 'PA0185', 1, 2, 0, 6, 0 ) 2323 2180 ELSE … … 2338 2195 ! 2339 2196 !-- Check for other modules 2340 CALL module_interface_check_data_output_pr( data_output_pr(i), i, & 2341 unit, dopr_unit(i) ) 2197 CALL module_interface_check_data_output_pr( data_output_pr(i), i, unit, dopr_unit(i) ) 2342 2198 2343 2199 ! … … 2345 2201 IF ( unit == 'illegal' ) THEN 2346 2202 IF ( data_output_pr_user(1) /= ' ' ) THEN 2347 message_string = 'illegal value for data_output_pr or ' // & 2348 'data_output_pr_user = "' // & 2349 TRIM( data_output_pr(i) ) // '"' 2203 message_string = 'illegal value for data_output_pr or ' // & 2204 'data_output_pr_user = "' // TRIM( data_output_pr(i) ) // '"' 2350 2205 CALL message( 'check_parameters', 'PA0097', 1, 2, 0, 6, 0 ) 2351 2206 ELSE 2352 message_string = 'illegal value for data_output_pr = "' // &2207 message_string = 'illegal value for data_output_pr = "' // & 2353 2208 TRIM( data_output_pr(i) ) // '"' 2354 2209 CALL message( 'check_parameters', 'PA0098', 1, 2, 0, 6, 0 ) … … 2371 2226 DO WHILE ( data_output_user(j) /= ' ' .AND. j <= 500 ) 2372 2227 IF ( i > 500 ) THEN 2373 message_string = 'number of output quantitities given by data' // &2374 '_output and data_output_user exceeds the limit of 500'2228 message_string = 'number of output quantitities given by data' // & 2229 '_output and data_output_user exceeds the limit of 500' 2375 2230 CALL message( 'check_parameters', 'PA0102', 1, 2, 0, 6, 0 ) 2376 2231 ENDIF … … 2401 2256 var = data_output(i)(1:ilen) 2402 2257 IF ( ilen > 3 ) THEN 2403 IF ( data_output(i)(ilen-2:ilen) == '_xy' .OR. & 2404 data_output(i)(ilen-2:ilen) == '_xz' .OR. & 2405 data_output(i)(ilen-2:ilen) == '_yz' ) THEN 2258 IF ( data_output(i)(ilen-2:ilen) == '_xy' .OR. data_output(i)(ilen-2:ilen) == '_xz' & 2259 .OR. data_output(i)(ilen-2:ilen) == '_yz' ) THEN 2406 2260 k = 1 ! 2d data 2407 2261 var = data_output(i)(1:ilen-3) … … 2415 2269 CASE ( 'e' ) 2416 2270 IF ( constant_diffusion ) THEN 2417 message_string = 'output of "' // TRIM( var ) // '" requi ' //&2418 ' resconstant_diffusion = .FALSE.'2271 message_string = 'output of "' // TRIM( var ) // '" requires ' // & 2272 'constant_diffusion = .FALSE.' 2419 2273 CALL message( 'check_parameters', 'PA0103', 1, 2, 0, 6, 0 ) 2420 2274 ENDIF … … 2422 2276 2423 2277 CASE ( 'thetal' ) 2424 IF ( .NOT.bulk_cloud_model ) THEN2425 message_string = 'output of "' // TRIM( var ) // '" requi ' //&2426 'resbulk_cloud_model = .TRUE.'2278 IF ( .NOT. bulk_cloud_model ) THEN 2279 message_string = 'output of "' // TRIM( var ) // '" requires ' // & 2280 'bulk_cloud_model = .TRUE.' 2427 2281 CALL message( 'check_parameters', 'PA0108', 1, 2, 0, 6, 0 ) 2428 2282 ENDIF … … 2430 2284 2431 2285 CASE ( 'pc', 'pr' ) 2432 IF ( .NOT. particle_advection ) THEN 2433 message_string = 'output of "' // TRIM( var ) // '" requir' // & 2434 'es a "particle_parameters"-NAMELIST in the parameter ' // & 2435 'file (PARIN)' 2286 IF ( .NOT. particle_advection ) THEN 2287 message_string = 'output of "' // TRIM( var ) // '" requires ' // & 2288 'a "particle_parameters"-NAMELIST in the parameter file (PARIN)' 2436 2289 CALL message( 'check_parameters', 'PA0104', 1, 2, 0, 6, 0 ) 2437 2290 ENDIF … … 2440 2293 2441 2294 CASE ( 'q', 'thetav' ) 2442 IF ( .NOT. humidity ) THEN 2443 message_string = 'output of "' // TRIM( var ) // '" requi' // & 2444 'res humidity = .TRUE.' 2295 IF ( .NOT. humidity ) THEN 2296 message_string = 'output of "' // TRIM( var ) // '" requires humidity = .TRUE.' 2445 2297 CALL message( 'check_parameters', 'PA0105', 1, 2, 0, 6, 0 ) 2446 2298 ENDIF … … 2450 2302 CASE ( 'ql' ) 2451 2303 IF ( .NOT. ( bulk_cloud_model .OR. cloud_droplets ) ) THEN 2452 message_string = 'output of "' // TRIM( var ) // '" requi ' //&2453 'resbulk_cloud_model = .TRUE. or cloud_droplets = .TRUE.'2304 message_string = 'output of "' // TRIM( var ) // '" requires ' // & 2305 'bulk_cloud_model = .TRUE. or cloud_droplets = .TRUE.' 2454 2306 CALL message( 'check_parameters', 'PA0106', 1, 2, 0, 6, 0 ) 2455 2307 ENDIF … … 2457 2309 2458 2310 CASE ( 'ql_c', 'ql_v', 'ql_vp' ) 2459 IF ( .NOT.cloud_droplets ) THEN2460 message_string = 'output of "' // TRIM( var ) // '" requi ' //&2461 ' rescloud_droplets = .TRUE.'2311 IF ( .NOT. cloud_droplets ) THEN 2312 message_string = 'output of "' // TRIM( var ) // '" requires ' // & 2313 'cloud_droplets = .TRUE.' 2462 2314 CALL message( 'check_parameters', 'PA0107', 1, 2, 0, 6, 0 ) 2463 2315 ENDIF … … 2467 2319 2468 2320 CASE ( 'qv' ) 2469 IF ( .NOT.bulk_cloud_model ) THEN2470 message_string = 'output of "' // TRIM( var ) // '" requi ' //&2471 ' resbulk_cloud_model = .TRUE.'2321 IF ( .NOT. bulk_cloud_model ) THEN 2322 message_string = 'output of "' // TRIM( var ) // '" requires ' // & 2323 'bulk_cloud_model = .TRUE.' 2472 2324 CALL message( 'check_parameters', 'PA0108', 1, 2, 0, 6, 0 ) 2473 2325 ENDIF … … 2475 2327 2476 2328 CASE ( 's' ) 2477 IF ( .NOT.passive_scalar ) THEN2478 message_string = 'output of "' // TRIM( var ) // '" requi ' //&2479 ' respassive_scalar = .TRUE.'2329 IF ( .NOT. passive_scalar ) THEN 2330 message_string = 'output of "' // TRIM( var ) // '" requires ' // & 2331 'passive_scalar = .TRUE.' 2480 2332 CALL message( 'check_parameters', 'PA0110', 1, 2, 0, 6, 0 ) 2481 2333 ENDIF … … 2490 2342 CONTINUE 2491 2343 2492 CASE ( 'ghf*', 'lwp*', 'ol*', 'qsurf*', 'qsws*', 'r_a*', & 2493 'shf*', 'ssurf*', 'ssws*', 't*', 'tsurf*', 'us*', & 2494 'z0*', 'z0h*', 'z0q*' ) 2344 CASE ( 'ghf*', 'lwp*', 'ol*', 'qsurf*', 'qsws*', 'r_a*', 'shf*', 'ssurf*', 'ssws*', 't*',& 2345 'tsurf*', 'us*', 'z0*', 'z0h*', 'z0q*' ) 2495 2346 IF ( k == 0 .OR. data_output(i)(ilen-2:ilen) /= '_xy' ) THEN 2496 message_string = 'illegal value for data_output: "' // & 2497 TRIM( var ) // '" & only 2d-horizontal ' // & 2498 'cross sections are allowed for this value' 2347 message_string = 'illegal value for data_output: "' // TRIM( var ) // & 2348 '" & only 2d-horizontal cross sections are allowed for this value' 2499 2349 CALL message( 'check_parameters', 'PA0111', 1, 2, 0, 6, 0 ) 2500 2350 ENDIF 2501 2351 2502 2352 IF ( TRIM( var ) == 'lwp*' .AND. .NOT. bulk_cloud_model ) THEN 2503 message_string = 'output of "' // TRIM( var ) // '" requi ' //&2504 ' resbulk_cloud_model = .TRUE.'2353 message_string = 'output of "' // TRIM( var ) // '" requires ' // & 2354 'bulk_cloud_model = .TRUE.' 2505 2355 CALL message( 'check_parameters', 'PA0108', 1, 2, 0, 6, 0 ) 2506 2356 ENDIF 2507 2357 IF ( TRIM( var ) == 'qsws*' .AND. .NOT. humidity ) THEN 2508 message_string = 'output of "' // TRIM( var ) // '" requi' // & 2509 'res humidity = .TRUE.' 2358 message_string = 'output of "' // TRIM( var ) // '" requires humidity = .TRUE.' 2510 2359 CALL message( 'check_parameters', 'PA0322', 1, 2, 0, 6, 0 ) 2511 2360 ENDIF 2512 2361 2513 2362 IF ( TRIM( var ) == 'ghf*' .AND. .NOT. land_surface ) THEN 2514 message_string = 'output of "' // TRIM( var ) // '" requi' // & 2515 'res land_surface = .TRUE.' 2363 message_string = 'output of "' // TRIM( var ) // '" requires land_surface = .TRUE.' 2516 2364 CALL message( 'check_parameters', 'PA0404', 1, 2, 0, 6, 0 ) 2517 2365 ENDIF 2518 2366 2519 IF ( ( TRIM( var ) == 'r_a*' .OR. TRIM( var ) == 'ghf*' ) & 2520 .AND. .NOT. land_surface .AND. .NOT. urban_surface ) & 2521 THEN 2522 message_string = 'output of "' // TRIM( var ) // '" requi' // & 2523 'res land_surface = .TRUE. or ' // & 2524 'urban_surface = .TRUE.' 2367 IF ( ( TRIM( var ) == 'r_a*' .OR. TRIM( var ) == 'ghf*' ) .AND. .NOT. land_surface & 2368 .AND. .NOT. urban_surface ) THEN 2369 message_string = 'output of "' // TRIM( var ) // '" requires ' // & 2370 'land_surface = .TRUE. or ' // 'urban_surface = .TRUE.' 2525 2371 CALL message( 'check_parameters', 'PA0404', 1, 2, 0, 6, 0 ) 2526 2372 ENDIF 2527 2373 2528 IF ( TRIM( var ) == 'ssws*' .AND. .NOT. 2529 message_string = 'output of "' // TRIM( var ) // '" requi ' //&2530 ' respassive_scalar = .TRUE.'2374 IF ( TRIM( var ) == 'ssws*' .AND. .NOT. passive_scalar ) THEN 2375 message_string = 'output of "' // TRIM( var ) // '" requires ' // & 2376 'passive_scalar = .TRUE.' 2531 2377 CALL message( 'check_parameters', 'PA0361', 1, 2, 0, 6, 0 ) 2532 2378 ENDIF … … 2547 2393 IF ( TRIM( var ) == 'z0h*' ) unit = 'm' 2548 2394 ! 2549 !-- Output of surface latent and sensible heat flux will be in W/m2 2550 !-- in case of natural- and urban-type surfaces, even if 2551 !-- flux_output_mode is set to kinematic units. 2395 !-- Output of surface latent and sensible heat flux will be in W/m2 in case of natural- and 2396 !-- urban-type surfaces, even if flux_output_mode is set to kinematic units. 2552 2397 IF ( land_surface .OR. urban_surface ) THEN 2553 2398 IF ( TRIM( var ) == 'shf*' ) unit = 'W/m2' … … 2562 2407 IF ( unit == 'illegal' ) THEN 2563 2408 IF ( data_output_user(1) /= ' ' ) THEN 2564 message_string = 'illegal value for data_output or ' // &2565 'data_output_user = "' // TRIM( data_output(i) ) // '"'2409 message_string = 'illegal value for data_output or ' // & 2410 'data_output_user = "' // TRIM( data_output(i) ) // '"' 2566 2411 CALL message( 'check_parameters', 'PA0114', 1, 2, 0, 6, 0 ) 2567 2412 ELSE 2568 message_string = 'illegal value for data_output = "' // &2413 message_string = 'illegal value for data_output = "' // & 2569 2414 TRIM( data_output(i) ) // '"' 2570 2415 CALL message( 'check_parameters', 'PA0115', 1, 2, 0, 6, 0 ) … … 2614 2459 !-- Averaged 2d or 3d output requires that an averaging interval has been set 2615 2460 IF ( doav_n > 0 .AND. averaging_interval == 0.0_wp ) THEN 2616 WRITE( message_string, * ) 'output of averaged quantity "', & 2617 TRIM( doav(1) ), '_av" requires to set a ', & 2618 'non-zero averaging interval' 2461 WRITE( message_string, * ) 'output of averaged quantity "', TRIM( doav(1) ), & 2462 '_av" requires to set a ', 'non-zero averaging interval' 2619 2463 CALL message( 'check_parameters', 'PA0323', 1, 2, 0, 6, 0 ) 2620 2464 ENDIF … … 2638 2482 section(:,3) = section_yz 2639 2483 2640 IF ( ANY( data_output_xy ) .AND. .NOT. ANY( section(:,1) /= -9999 ) ) THEN 2641 WRITE( message_string, * ) 'section_xy not defined for requested ' // & 2642 'xy-cross section output.&At least one ' // & 2643 'cross section must be given.' 2484 IF ( ANY( data_output_xy ) .AND. .NOT. ANY( section(:,1) /= -9999 ) ) THEN 2485 WRITE( message_string, * ) 'section_xy not defined for requested xy-cross section ' // & 2486 'output.&At least one cross section must be given.' 2644 2487 CALL message( 'check_parameters', 'PA0681', 1, 2, 0, 6, 0 ) 2645 2488 ENDIF 2646 IF ( ANY( data_output_xz ) .AND. .NOT. ANY( section(:,2) /= -9999 ) ) THEN 2647 WRITE( message_string, * ) 'section_xz not defined for requested ' // & 2648 'xz-cross section output.&At least one ' // & 2649 'cross section must be given.' 2489 IF ( ANY( data_output_xz ) .AND. .NOT. ANY( section(:,2) /= -9999 ) ) THEN 2490 WRITE( message_string, * ) 'section_xz not defined for requested xz-cross section ' // & 2491 'output.&At least one cross section must be given.' 2650 2492 CALL message( 'check_parameters', 'PA0681', 1, 2, 0, 6, 0 ) 2651 2493 ENDIF 2652 IF ( ANY( data_output_yz ) .AND. .NOT. ANY( section(:,3) /= -9999 ) ) THEN 2653 WRITE( message_string, * ) 'section_yz not defined for requested ' // & 2654 'yz-cross section output.&At least one ' // & 2655 'cross section must be given.' 2494 IF ( ANY( data_output_yz ) .AND. .NOT. ANY( section(:,3) /= -9999 ) ) THEN 2495 WRITE( message_string, * ) 'section_yz not defined for requested yz-cross section ' // & 2496 'output.&At least one cross section must be given.' 2656 2497 CALL message( 'check_parameters', 'PA0681', 1, 2, 0, 6, 0 ) 2657 2498 ENDIF … … 2681 2522 !-- Check mask conditions 2682 2523 DO mid = 1, max_masks 2683 IF ( data_output_masks(mid,1) /= ' ' .OR. & 2684 data_output_masks_user(mid,1) /= ' ' ) THEN 2524 IF ( data_output_masks(mid,1) /= ' ' .OR. data_output_masks_user(mid,1) /= ' ' ) THEN 2685 2525 masks = masks + 1 2686 2526 ENDIF … … 2688 2528 2689 2529 IF ( masks < 0 .OR. masks > max_masks ) THEN 2690 WRITE( message_string, * ) 'illegal value: masks must be >= 0 and ', &2691 '<= ', max_masks,' (=max_masks)'2530 WRITE( message_string, * ) 'illegal value: masks must be >= 0 and ', '<= ', max_masks, & 2531 ' (=max_masks)' 2692 2532 CALL message( 'check_parameters', 'PA0325', 1, 2, 0, 6, 0 ) 2693 2533 ENDIF … … 2697 2537 mask_scale(3) = mask_scale_z 2698 2538 IF ( ANY( mask_scale <= 0.0_wp ) ) THEN 2699 WRITE( message_string, * ) & 2700 'illegal value: mask_scale_x, mask_scale_y and mask_scale_z', & 2701 'must be > 0.0' 2539 WRITE( message_string, * ) 'illegal value: mask_scale_x, mask_scale_y and mask_scale_z',& 2540 'must be > 0.0' 2702 2541 CALL message( 'check_parameters', 'PA0326', 1, 2, 0, 6, 0 ) 2703 2542 ENDIF 2704 2543 ! 2705 !-- Generate masks for masked data output 2706 !-- Parallel netcdf output is not tested so far for masked data, hence 2707 !-- netcdf_data_format isswitched back to non-parallel output.2544 !-- Generate masks for masked data output. 2545 !-- Parallel netcdf output is not tested so far for masked data, hence netcdf_data_format is 2546 !-- switched back to non-parallel output. 2708 2547 netcdf_data_format_save = netcdf_data_format 2709 2548 IF ( netcdf_data_format > 4 ) THEN 2710 2549 IF ( netcdf_data_format == 5 ) netcdf_data_format = 3 2711 2550 IF ( netcdf_data_format == 6 ) netcdf_data_format = 4 2712 message_string = 'netCDF file formats '// & 2713 '5 (parallel netCDF 4) and ' // & 2714 '6 (parallel netCDF 4 Classic model) '// & 2715 '& are currently not supported (not yet tested) ' //& 2716 'for masked data. &Using respective non-parallel' //& 2551 message_string = 'netCDF file formats '// '5 (parallel netCDF 4) and 6 (parallel ' // & 2552 'netCDF 4 Classic model) & are currently not supported (not yet ' // & 2553 'tested) for masked data. &Using respective non-parallel' // & 2717 2554 ' output for masked data.' 2718 2555 CALL message( 'check_parameters', 'PA0383', 0, 0, 0, 6, 0 ) … … 2728 2565 CONTINUE 2729 2566 #else 2730 message_string = 'netCDF: netCDF4 format requested but no ' // & 2731 'cpp-directive __netcdf4 given & switch ' // & 2732 'back to 64-bit offset format' 2567 message_string = 'netCDF: netCDF4 format requested but no ' // & 2568 'cpp-directive __netcdf4 given & switch back to 64-bit offset format' 2733 2569 CALL message( 'check_parameters', 'PA0171', 0, 1, 0, 6, 0 ) 2734 2570 netcdf_data_format = 2 … … 2739 2575 CONTINUE 2740 2576 #else 2741 message_string = 'netCDF: netCDF4 parallel output requested but no ' // &2742 'cpp-directive __netcdf4_parallel given & switch ' //&2577 message_string = 'netCDF: netCDF4 parallel output requested but no ' // & 2578 'cpp-directive __netcdf4_parallel given & switch ' // & 2743 2579 'back to netCDF4 non-parallel output' 2744 2580 CALL message( 'check_parameters', 'PA0099', 0, 1, 0, 6, 0 ) … … 2749 2585 ! 2750 2586 !-- Calculate fixed number of output time levels for parallel netcdf output. 2751 !-- The time dimension has to be defined as limited for parallel output, 2752 !-- because otherwise the I/Operformance drops significantly.2587 !-- The time dimension has to be defined as limited for parallel output, because otherwise the I/O 2588 !-- performance drops significantly. 2753 2589 IF ( netcdf_data_format > 4 ) THEN 2754 2590 2755 2591 ! 2756 !-- Check if any of the follwoing data output interval is 0.0s, which is 2757 !-- not allowed for paralleloutput.2592 !-- Check if any of the follwoing data output interval is 0.0s, which is not allowed for parallel 2593 !-- output. 2758 2594 CALL check_dt_do( dt_do3d, 'dt_do3d' ) 2759 2595 CALL check_dt_do( dt_do2d_xy, 'dt_do2d_xy' ) … … 2762 2598 CALL check_dt_do( dt_data_output_av, 'dt_data_output_av' ) 2763 2599 2764 !-- Set needed time levels (ntdim) to 2765 !-- saved time levels + to be saved time levels. 2766 ntdim_3d(0) = do3d_time_count(0) + CEILING( & 2767 ( end_time - MAX( & 2768 MERGE(skip_time_do3d, skip_time_do3d + spinup_time, & 2769 data_output_during_spinup ), & 2770 simulated_time_at_begin ) & 2600 !-- Set needed time levels (ntdim) to saved time levels + to be saved time levels. 2601 ntdim_3d(0) = do3d_time_count(0) + CEILING( & 2602 ( end_time - MAX( & 2603 MERGE( skip_time_do3d, skip_time_do3d + spinup_time, & 2604 data_output_during_spinup ), & 2605 simulated_time_at_begin ) & 2771 2606 ) / dt_do3d ) 2772 2607 IF ( do3d_at_begin ) ntdim_3d(0) = ntdim_3d(0) + 1 2773 2608 2774 ntdim_3d(1) = do3d_time_count(1) + CEILING( &2775 ( end_time - MAX( &2776 MERGE( skip_time_data_output_av, skip_time_data_output_av&2777 + spinup_time, data_output_during_spinup ),&2778 simulated_time_at_begin ) &2609 ntdim_3d(1) = do3d_time_count(1) + CEILING( & 2610 ( end_time - MAX( & 2611 MERGE( skip_time_data_output_av, skip_time_data_output_av + spinup_time, & 2612 data_output_during_spinup ), & 2613 simulated_time_at_begin ) & 2779 2614 ) / dt_data_output_av ) 2780 2615 2781 ntdim_2d_xy(0) = do2d_xy_time_count(0) + CEILING( &2782 ( end_time - MAX( &2783 MERGE(skip_time_do2d_xy, skip_time_do2d_xy + spinup_time,&2784 data_output_during_spinup ),&2785 simulated_time_at_begin )&2616 ntdim_2d_xy(0) = do2d_xy_time_count(0) + CEILING( & 2617 ( end_time - MAX( & 2618 MERGE( skip_time_do2d_xy, skip_time_do2d_xy + spinup_time, & 2619 data_output_during_spinup ), & 2620 simulated_time_at_begin ) & 2786 2621 ) / dt_do2d_xy ) 2787 2622 2788 ntdim_2d_xz(0) = do2d_xz_time_count(0) + CEILING( &2789 ( end_time - MAX( &2790 MERGE(skip_time_do2d_xz, skip_time_do2d_xz + spinup_time,&2791 data_output_during_spinup ),&2792 simulated_time_at_begin )&2623 ntdim_2d_xz(0) = do2d_xz_time_count(0) + CEILING( & 2624 ( end_time - MAX( & 2625 MERGE( skip_time_do2d_xz, skip_time_do2d_xz + spinup_time, & 2626 data_output_during_spinup ), & 2627 simulated_time_at_begin ) & 2793 2628 ) / dt_do2d_xz ) 2794 2629 2795 ntdim_2d_yz(0) = do2d_yz_time_count(0) + CEILING( &2796 ( end_time - MAX( &2797 MERGE(skip_time_do2d_yz, skip_time_do2d_yz + spinup_time,&2798 data_output_during_spinup ),&2799 simulated_time_at_begin )&2630 ntdim_2d_yz(0) = do2d_yz_time_count(0) + CEILING( & 2631 ( end_time - MAX( & 2632 MERGE( skip_time_do2d_yz, skip_time_do2d_yz + spinup_time, & 2633 data_output_during_spinup ), & 2634 simulated_time_at_begin ) & 2800 2635 ) / dt_do2d_yz ) 2801 2636 … … 2806 2641 ENDIF 2807 2642 ! 2808 !-- Please note, for averaged 2D data skip_time_data_output_av is the relavant 2809 !-- output controlparameter.2810 ntdim_2d_xy(1) = do2d_xy_time_count(1) + CEILING( &2811 ( end_time - MAX( MERGE( skip_time_data_output_av,&2812 skip_time_data_output_av + spinup_time,&2813 data_output_during_spinup ),&2814 simulated_time_at_begin )&2815 ) / dt_data_output_av )2816 2817 ntdim_2d_xz(1) = do2d_xz_time_count(1) + CEILING( &2818 ( end_time - MAX( MERGE( skip_time_data_output_av,&2819 skip_time_data_output_av + spinup_time,&2820 data_output_during_spinup ),&2821 simulated_time_at_begin )&2822 ) / dt_data_output_av )2823 2824 ntdim_2d_yz(1) = do2d_yz_time_count(1) + CEILING( &2825 ( end_time - MAX( MERGE( skip_time_data_output_av,&2826 skip_time_data_output_av + spinup_time,&2827 data_output_during_spinup ),&2828 simulated_time_at_begin )&2829 ) / dt_data_output_av )2643 !-- Please note, for averaged 2D data skip_time_data_output_av is the relavant output control 2644 !-- parameter. 2645 ntdim_2d_xy(1) = do2d_xy_time_count(1) + CEILING( & 2646 ( end_time - MAX( MERGE( skip_time_data_output_av, & 2647 skip_time_data_output_av + spinup_time, & 2648 data_output_during_spinup ), & 2649 simulated_time_at_begin ) & 2650 ) / dt_data_output_av ) 2651 2652 ntdim_2d_xz(1) = do2d_xz_time_count(1) + CEILING( & 2653 ( end_time - MAX( MERGE( skip_time_data_output_av, & 2654 skip_time_data_output_av + spinup_time, & 2655 data_output_during_spinup ), & 2656 simulated_time_at_begin ) & 2657 ) / dt_data_output_av ) 2658 2659 ntdim_2d_yz(1) = do2d_yz_time_count(1) + CEILING( & 2660 ( end_time - MAX( MERGE( skip_time_data_output_av, & 2661 skip_time_data_output_av + spinup_time, & 2662 data_output_during_spinup ), & 2663 simulated_time_at_begin ) & 2664 ) / dt_data_output_av ) 2830 2665 2831 2666 ENDIF … … 2839 2674 ELSE 2840 2675 IF ( prandtl_number < 0.0_wp ) THEN 2841 WRITE( message_string, * ) 'prandtl_number = ', prandtl_number, & 2842 ' < 0.0' 2676 WRITE( message_string, * ) 'prandtl_number = ', prandtl_number, ' < 0.0' 2843 2677 CALL message( 'check_parameters', 'PA0122', 1, 2, 0, 6, 0 ) 2844 2678 ENDIF … … 2846 2680 2847 2681 IF ( constant_flux_layer ) THEN 2848 message_string = 'constant_flux_layer is not allowed with fixed ' & 2849 // 'value of km' 2682 message_string = 'constant_flux_layer is not allowed with fixed value of km' 2850 2683 CALL message( 'check_parameters', 'PA0123', 1, 2, 0, 6, 0 ) 2851 2684 ENDIF … … 2854 2687 2855 2688 ! 2856 !-- In case of non-cyclic lateral boundaries and a damping layer for the 2857 !-- potential temperature,check the width of the damping layer2689 !-- In case of non-cyclic lateral boundaries and a damping layer for the potential temperature, 2690 !-- check the width of the damping layer 2858 2691 IF ( bc_lr /= 'cyclic' ) THEN 2859 IF ( pt_damping_width < 0.0_wp .OR. & 2860 pt_damping_width > REAL( (nx+1) * dx ) ) THEN 2692 IF ( pt_damping_width < 0.0_wp .OR. pt_damping_width > REAL( (nx+1) * dx ) ) THEN 2861 2693 message_string = 'pt_damping_width out of range' 2862 2694 CALL message( 'check_parameters', 'PA0124', 1, 2, 0, 6, 0 ) … … 2865 2697 2866 2698 IF ( bc_ns /= 'cyclic' ) THEN 2867 IF ( pt_damping_width < 0.0_wp .OR. & 2868 pt_damping_width > REAL( (ny+1) * dy ) ) THEN 2699 IF ( pt_damping_width < 0.0_wp .OR. pt_damping_width > REAL( (ny+1) * dy ) ) THEN 2869 2700 message_string = 'pt_damping_width out of range' 2870 2701 CALL message( 'check_parameters', 'PA0124', 1, 2, 0, 6, 0 ) … … 2875 2706 !-- Check value range for zeta = z/L 2876 2707 IF ( zeta_min >= zeta_max ) THEN 2877 WRITE( message_string, * ) 'zeta_min = ', zeta_min, ' must be less ', &2878 'than zeta_max = ',zeta_max2708 WRITE( message_string, * ) 'zeta_min = ', zeta_min, ' must be less ', 'than zeta_max = ', & 2709 zeta_max 2879 2710 CALL message( 'check_parameters', 'PA0125', 1, 2, 0, 6, 0 ) 2880 2711 ENDIF … … 2882 2713 ! 2883 2714 !-- Check random generator 2884 IF ( (random_generator /= 'system-specific' .AND. &2885 random_generator /= 'random-parallel' ) .AND. &2715 IF ( (random_generator /= 'system-specific' .AND. & 2716 random_generator /= 'random-parallel' ) .AND. & 2886 2717 random_generator /= 'numerical-recipes' ) THEN 2887 message_string = 'unknown random generator: random_generator = "' // &2718 message_string = 'unknown random generator: random_generator = "' // & 2888 2719 TRIM( random_generator ) // '"' 2889 2720 CALL message( 'check_parameters', 'PA0135', 1, 2, 0, 6, 0 ) … … 2901 2732 ENDIF 2902 2733 ELSEIF ( disturbance_level_b < zu(3) ) THEN 2903 WRITE( message_string, * ) 'disturbance_level_b = ', 2904 disturbance_level_b, ' must be >= ',zu(3), '(zu(3))'2734 WRITE( message_string, * ) 'disturbance_level_b = ', disturbance_level_b, ' must be >= ', & 2735 zu(3), '(zu(3))' 2905 2736 CALL message( 'check_parameters', 'PA0126', 1, 2, 0, 6, 0 ) 2906 2737 ELSEIF ( disturbance_level_b > zu(nzt-2) ) THEN 2907 WRITE( message_string, * ) 'disturbance_level_b = ', 2908 disturbance_level_b, ' must be <= ',zu(nzt-2), '(zu(nzt-2))'2738 WRITE( message_string, * ) 'disturbance_level_b = ', disturbance_level_b, ' must be <= ', & 2739 zu(nzt-2), '(zu(nzt-2))' 2909 2740 CALL message( 'check_parameters', 'PA0127', 1, 2, 0, 6, 0 ) 2910 2741 ELSE … … 2926 2757 ENDIF 2927 2758 ELSEIF ( disturbance_level_t > zu(nzt-2) ) THEN 2928 WRITE( message_string, * ) 'disturbance_level_t = ', 2929 disturbance_level_t, ' must be <= ',zu(nzt-2), '(zu(nzt-2))'2759 WRITE( message_string, * ) 'disturbance_level_t = ', disturbance_level_t, ' must be <= ', & 2760 zu(nzt-2), '(zu(nzt-2))' 2930 2761 CALL message( 'check_parameters', 'PA0128', 1, 2, 0, 6, 0 ) 2931 2762 ELSEIF ( disturbance_level_t < disturbance_level_b ) THEN 2932 WRITE( message_string, * ) 'disturbance_level_t = ', & 2933 disturbance_level_t, ' must be >= disturbance_level_b = ', & 2934 disturbance_level_b 2763 WRITE( message_string, * ) 'disturbance_level_t = ', disturbance_level_t, & 2764 ' must be >= disturbance_level_b = ', disturbance_level_b 2935 2765 CALL message( 'check_parameters', 'PA0129', 1, 2, 0, 6, 0 ) 2936 2766 ELSE … … 2945 2775 ! 2946 2776 !-- Check again whether the levels determined this way are ok. 2947 !-- Error may occur at automatic determination and too few grid points in 2948 !-- z-direction. 2777 !-- Error may occur at automatic determination and too few grid points in z-direction. 2949 2778 IF ( disturbance_level_ind_t < disturbance_level_ind_b ) THEN 2950 WRITE( message_string, * ) 'disturbance_level_ind_t = ', & 2951 disturbance_level_ind_t, ' must be >= ', & 2952 'disturbance_level_ind_b = ', disturbance_level_ind_b 2779 WRITE( message_string, * ) 'disturbance_level_ind_t = ', disturbance_level_ind_t, & 2780 ' must be >= ', 'disturbance_level_ind_b = ', disturbance_level_ind_b 2953 2781 CALL message( 'check_parameters', 'PA0130', 1, 2, 0, 6, 0 ) 2954 2782 ENDIF … … 2956 2784 ! 2957 2785 !-- Determine the horizontal index range for random perturbations. 2958 !-- In case of non-cyclic horizontal boundaries, no perturbations are imposed 2959 !-- near the inflow and the perturbation area is further limited to ...(1) 2960 !-- after the initial phase of the flow. 2786 !-- In case of non-cyclic horizontal boundaries, no perturbations are imposed near the inflow and 2787 !-- the perturbation area is further limited to ...(1) after the initial phase of the flow. 2961 2788 2962 2789 IF ( bc_lr /= 'cyclic' ) THEN … … 2964 2791 inflow_disturbance_begin = MIN( 10, nx/2 ) 2965 2792 ENDIF 2966 IF ( inflow_disturbance_begin < 0 .OR. inflow_disturbance_begin > nx )& 2967 THEN 2793 IF ( inflow_disturbance_begin < 0 .OR. inflow_disturbance_begin > nx ) THEN 2968 2794 message_string = 'inflow_disturbance_begin out of range' 2969 2795 CALL message( 'check_parameters', 'PA0131', 1, 2, 0, 6, 0 ) … … 2972 2798 inflow_disturbance_end = MIN( 100, 3*nx/4 ) 2973 2799 ENDIF 2974 IF ( inflow_disturbance_end < 0 .OR. inflow_disturbance_end > nx ) & 2975 THEN 2800 IF ( inflow_disturbance_end < 0 .OR. inflow_disturbance_end > nx ) THEN 2976 2801 message_string = 'inflow_disturbance_end out of range' 2977 2802 CALL message( 'check_parameters', 'PA0132', 1, 2, 0, 6, 0 ) … … 2981 2806 inflow_disturbance_begin = MIN( 10, ny/2 ) 2982 2807 ENDIF 2983 IF ( inflow_disturbance_begin < 0 .OR. inflow_disturbance_begin > ny )& 2984 THEN 2808 IF ( inflow_disturbance_begin < 0 .OR. inflow_disturbance_begin > ny ) THEN 2985 2809 message_string = 'inflow_disturbance_begin out of range' 2986 2810 CALL message( 'check_parameters', 'PA0131', 1, 2, 0, 6, 0 ) … … 2989 2813 inflow_disturbance_end = MIN( 100, 3*ny/4 ) 2990 2814 ENDIF 2991 IF ( inflow_disturbance_end < 0 .OR. inflow_disturbance_end > ny ) & 2992 THEN 2815 IF ( inflow_disturbance_end < 0 .OR. inflow_disturbance_end > ny ) THEN 2993 2816 message_string = 'inflow_disturbance_end out of range' 2994 2817 CALL message( 'check_parameters', 'PA0132', 1, 2, 0, 6, 0 ) … … 3045 2868 3046 2869 ! 3047 !-- A turbulent inflow requires Dirichlet conditions at the respective inflow 3048 !-- boundary (so far, a turbulent inflow is realized from the left side only)2870 !-- A turbulent inflow requires Dirichlet conditions at the respective inflow boundary (so far, a 2871 !-- turbulent inflow is realized from the left side only). 3049 2872 IF ( turbulent_inflow .AND. bc_lr /= 'dirichlet/radiation' ) THEN 3050 message_string = 'turbulent_inflow = .T. requires a Dirichlet ' // &2873 message_string = 'turbulent_inflow = .T. requires a Dirichlet ' // & 3051 2874 'condition at the inflow boundary' 3052 2875 CALL message( 'check_parameters', 'PA0133', 1, 2, 0, 6, 0 ) … … 3054 2877 3055 2878 ! 3056 !-- Turbulent inflow requires that 3d arrays have been cyclically filled with 3057 !-- data from prerun inthe first main run3058 IF ( turbulent_inflow .AND. initializing_actions /= 'cyclic_fill' .AND. &2879 !-- Turbulent inflow requires that 3d arrays have been cyclically filled with data from prerun in 2880 !-- the first main run 2881 IF ( turbulent_inflow .AND. initializing_actions /= 'cyclic_fill' .AND. & 3059 2882 initializing_actions /= 'read_restart_data' ) THEN 3060 message_string = 'turbulent_inflow = .T. requires ' // &3061 'initializing_actions = ''cyclic_fill'' or ' // &2883 message_string = 'turbulent_inflow = .T. requires ' // & 2884 'initializing_actions = ''cyclic_fill'' or ' // & 3062 2885 'initializing_actions = ''read_restart_data'' ' 3063 2886 CALL message( 'check_parameters', 'PA0055', 1, 2, 0, 6, 0 ) … … 3071 2894 !-- Calculate the index of the recycling plane 3072 2895 IF ( recycling_width <= dx .OR. recycling_width >= nx * dx ) THEN 3073 WRITE( message_string, * ) 'illegal value for recycling_width: ', & 3074 recycling_width 2896 WRITE( message_string, * ) 'illegal value for recycling_width: ', recycling_width 3075 2897 CALL message( 'check_parameters', 'PA0134', 1, 2, 0, 6, 0 ) 3076 2898 ENDIF … … 3080 2902 ! 3081 2903 !-- Check for correct input of recycling method for thermodynamic quantities 3082 IF ( TRIM( recycling_method_for_thermodynamic_quantities ) /= 'turbulent_fluctuation' .AND.&2904 IF ( TRIM( recycling_method_for_thermodynamic_quantities ) /= 'turbulent_fluctuation' .AND.& 3083 2905 TRIM( recycling_method_for_thermodynamic_quantities ) /= 'absolute_value' ) THEN 3084 2906 WRITE( message_string, * ) 'unknown recycling method for thermodynamic quantities: ', & … … 3092 2914 IF ( turbulent_outflow ) THEN 3093 2915 ! 3094 !-- Turbulent outflow requires Dirichlet conditions at the respective inflow 3095 !-- boundary (so far, a turbulent outflow is realized at the right side only)2916 !-- Turbulent outflow requires Dirichlet conditions at the respective inflow boundary (so far, a 2917 !-- turbulent outflow is realized at the right side only). 3096 2918 IF ( bc_lr /= 'dirichlet/radiation' ) THEN 3097 message_string = 'turbulent_outflow = .T. requires ' // & 3098 'bc_lr = "dirichlet/radiation"' 2919 message_string = 'turbulent_outflow = .T. requires bc_lr = "dirichlet/radiation"' 3099 2920 CALL message( 'check_parameters', 'PA0038', 1, 2, 0, 6, 0 ) 3100 2921 ENDIF 3101 2922 ! 3102 2923 !-- The ouflow-source plane must lay inside the model domain 3103 IF ( outflow_source_plane < dx .OR. & 3104 outflow_source_plane > nx * dx ) THEN 3105 WRITE( message_string, * ) 'illegal value for outflow_source'// & 3106 '_plane: ', outflow_source_plane 2924 IF ( outflow_source_plane < dx .OR. outflow_source_plane > nx * dx ) THEN 2925 WRITE( message_string, * ) 'illegal value for outflow_source'// '_plane: ', & 2926 outflow_source_plane 3107 2927 CALL message( 'check_parameters', 'PA0145', 1, 2, 0, 6, 0 ) 3108 2928 ENDIF … … 3116 2936 damp_level_ind_1d = nzt + 1 3117 2937 ELSEIF ( damp_level_1d < 0.0_wp .OR. damp_level_1d > zu(nzt+1) ) THEN 3118 WRITE( message_string, * ) 'damp_level_1d = ', damp_level_1d, 3119 ' must be >= 0.0 and <= ',zu(nzt+1), '(zu(nzt+1))'2938 WRITE( message_string, * ) 'damp_level_1d = ', damp_level_1d, ' must be >= 0.0 and <= ',& 2939 zu(nzt+1), '(zu(nzt+1))' 3120 2940 CALL message( 'check_parameters', 'PA0136', 1, 2, 0, 6, 0 ) 3121 2941 ELSE … … 3131 2951 ! 3132 2952 !-- Check some other 1d-model parameters 3133 IF ( TRIM( mixing_length_1d ) /= 'as_in_3d_model' .AND. &2953 IF ( TRIM( mixing_length_1d ) /= 'as_in_3d_model' .AND. & 3134 2954 TRIM( mixing_length_1d ) /= 'blackadar' ) THEN 3135 message_string = 'mixing_length_1d = "' // TRIM( mixing_length_1d ) // & 3136 '" is unknown' 2955 message_string = 'mixing_length_1d = "' // TRIM( mixing_length_1d ) // '" is unknown' 3137 2956 CALL message( 'check_parameters', 'PA0137', 1, 2, 0, 6, 0 ) 3138 2957 ENDIF 3139 IF ( TRIM( dissipation_1d ) /= 'as_in_3d_model' .AND. &3140 TRIM( dissipation_1d ) /= 'detering' .AND.&2958 IF ( TRIM( dissipation_1d ) /= 'as_in_3d_model' .AND. & 2959 TRIM( dissipation_1d ) /= 'detering' .AND. & 3141 2960 TRIM( dissipation_1d ) /= 'prognostic' ) THEN 3142 message_string = 'dissipation_1d = "' // TRIM( dissipation_1d ) // & 3143 '" is unknown' 2961 message_string = 'dissipation_1d = "' // TRIM( dissipation_1d ) // '" is unknown' 3144 2962 CALL message( 'check_parameters', 'PA0138', 1, 2, 0, 6, 0 ) 3145 2963 ENDIF 3146 IF ( TRIM( mixing_length_1d ) /= 'as_in_3d_model' .AND. &2964 IF ( TRIM( mixing_length_1d ) /= 'as_in_3d_model' .AND. & 3147 2965 TRIM( dissipation_1d ) == 'as_in_3d_model' ) THEN 3148 message_string = 'dissipation_1d = "' // TRIM( dissipation_1d ) // &2966 message_string = 'dissipation_1d = "' // TRIM( dissipation_1d ) // & 3149 2967 '" requires mixing_length_1d = "as_in_3d_model"' 3150 2968 CALL message( 'check_parameters', 'PA0485', 1, 2, 0, 6, 0 ) … … 3152 2970 3153 2971 ! 3154 !-- Set time for the next user defined restart (time_restart is the 3155 !-- internal parameter for steeringrestart events)2972 !-- Set time for the next user defined restart (time_restart is the internal parameter for steering 2973 !-- restart events) 3156 2974 IF ( restart_time /= 9999999.9_wp ) THEN 3157 2975 IF ( restart_time > time_since_reference_point ) THEN … … 3160 2978 ELSE 3161 2979 ! 3162 !-- In case of a restart run, set internal parameter to default (no restart) 3163 !-- if theNAMELIST-parameter restart_time is omitted2980 !-- In case of a restart run, set internal parameter to default (no restart) if the 2981 !-- NAMELIST-parameter restart_time is omitted 3164 2982 time_restart = 9999999.9_wp 3165 2983 ENDIF … … 3168 2986 !-- Check pressure gradient conditions 3169 2987 IF ( dp_external .AND. conserve_volume_flow ) THEN 3170 WRITE( message_string, * ) 'Both dp_external and conserve_volume_flo', &3171 'w are .TRUE. but one of them must be .FALSE.'2988 WRITE( message_string, * ) 'Both dp_external and conserve_volume_flo', & 2989 'w are .TRUE. but one of them must be .FALSE.' 3172 2990 CALL message( 'check_parameters', 'PA0150', 1, 2, 0, 6, 0 ) 3173 2991 ENDIF 3174 2992 IF ( dp_external ) THEN 3175 2993 IF ( dp_level_b < zu(nzb) .OR. dp_level_b > zu(nzt) ) THEN 3176 WRITE( message_string, * ) 'dp_level_b = ', dp_level_b, ' is out ', &3177 ' of range [zu(nzb), zu(nzt)]'2994 WRITE( message_string, * ) 'dp_level_b = ', dp_level_b, ' is out ', & 2995 ' of range [zu(nzb), zu(nzt)]' 3178 2996 CALL message( 'check_parameters', 'PA0151', 1, 2, 0, 6, 0 ) 3179 2997 ENDIF 3180 2998 IF ( .NOT. ANY( dpdxy /= 0.0_wp ) ) THEN 3181 WRITE( message_string, * ) 'dp_external is .TRUE. but dpdxy is ze', &3182 'ro, i.e. the external pressure gradient will not be applied'2999 WRITE( message_string, * ) 'dp_external is .TRUE. but dpdxy is ze', & 3000 'ro, i.e. the external pressure gradient will not be applied' 3183 3001 CALL message( 'check_parameters', 'PA0152', 0, 1, 0, 6, 0 ) 3184 3002 ENDIF 3185 3003 ENDIF 3186 3004 IF ( ANY( dpdxy /= 0.0_wp ) .AND. .NOT. dp_external ) THEN 3187 WRITE( message_string, * ) 'dpdxy is nonzero but dp_external is ', &3188 '.FALSE., i.e. the external pressure gradient & will not be applied'3005 WRITE( message_string, * ) 'dpdxy is nonzero but dp_external is ', & 3006 '.FALSE., i.e. the external pressure gradient & will not be applied' 3189 3007 CALL message( 'check_parameters', 'PA0153', 0, 1, 0, 6, 0 ) 3190 3008 ENDIF … … 3194 3012 conserve_volume_flow_mode = 'initial_profiles' 3195 3013 3196 ELSEIF ( TRIM( conserve_volume_flow_mode ) /= 'initial_profiles' .AND.&3197 TRIM( conserve_volume_flow_mode ) /= 'bulk_velocity' ) THEN3198 WRITE( message_string, * ) 'unknown conserve_volume_flow_mode: ', &3199 conserve_volume_flow_mode3014 ELSEIF ( TRIM( conserve_volume_flow_mode ) /= 'initial_profiles' .AND. & 3015 TRIM( conserve_volume_flow_mode ) /= 'bulk_velocity' ) THEN 3016 WRITE( message_string, * ) 'unknown conserve_volume_flow_mode: ', & 3017 conserve_volume_flow_mode 3200 3018 CALL message( 'check_parameters', 'PA0154', 1, 2, 0, 6, 0 ) 3201 3019 ENDIF 3202 IF ( ( bc_lr /= 'cyclic' .OR. bc_ns /= 'cyclic') .AND.&3203 TRIM( conserve_volume_flow_mode ) == 'bulk_velocity' ) THEN3204 WRITE( message_string, * ) 'non-cyclic boundary conditions ', &3205 'require conserve_volume_flow_mode = ''initial_profiles'''3020 IF ( ( bc_lr /= 'cyclic' .OR. bc_ns /= 'cyclic') .AND. & 3021 TRIM( conserve_volume_flow_mode ) == 'bulk_velocity' ) THEN 3022 WRITE( message_string, * ) 'non-cyclic boundary conditions ', & 3023 'require conserve_volume_flow_mode = ''initial_profiles''' 3206 3024 CALL message( 'check_parameters', 'PA0155', 1, 2, 0, 6, 0 ) 3207 3025 ENDIF 3208 3026 ENDIF 3209 IF ( ( u_bulk /= 0.0_wp .OR. v_bulk /= 0.0_wp ) .AND. & 3210 ( .NOT. conserve_volume_flow .OR. & 3211 TRIM( conserve_volume_flow_mode ) /= 'bulk_velocity' ) ) THEN 3212 WRITE( message_string, * ) 'nonzero bulk velocity requires ', & 3213 'conserve_volume_flow = .T. and ', & 3214 'conserve_volume_flow_mode = ''bulk_velocity''' 3027 IF ( ( u_bulk /= 0.0_wp .OR. v_bulk /= 0.0_wp ) .AND. & 3028 ( .NOT. conserve_volume_flow .OR. TRIM( conserve_volume_flow_mode ) /= 'bulk_velocity' ) )& 3029 THEN 3030 WRITE( message_string, * ) 'nonzero bulk velocity requires ', & 3031 'conserve_volume_flow = .T. and ', 'conserve_volume_flow_mode = ''bulk_velocity''' 3215 3032 CALL message( 'check_parameters', 'PA0157', 1, 2, 0, 6, 0 ) 3216 3033 ENDIF 3217 3034 3218 3035 ! 3219 !-- Prevent empty time records in volume, cross-section and masked data in case 3220 !-- of non-parallelnetcdf-output in restart runs3036 !-- Prevent empty time records in volume, cross-section and masked data in case of non-parallel 3037 !-- netcdf-output in restart runs 3221 3038 IF ( netcdf_data_format < 5 ) THEN 3222 3039 IF ( TRIM( initializing_actions ) == 'read_restart_data' ) THEN … … 3232 3049 ! 3233 3050 !-- Check roughness length, which has to be smaller than dz/2 3234 IF ( ( constant_flux_layer .OR. & 3235 INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) & 3236 .AND. roughness_length >= 0.5 * dz(1) ) THEN 3051 IF ( ( constant_flux_layer .OR. INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) & 3052 .AND. roughness_length >= 0.5 * dz(1) ) THEN 3237 3053 message_string = 'roughness_length must be smaller than dz/2' 3238 3054 CALL message( 'check_parameters', 'PA0424', 1, 2, 0, 6, 0 ) … … 3248 3064 !-- Check if topography is read from file in case of complex terrain simulations 3249 3065 IF ( complex_terrain .AND. TRIM( topography ) /= 'read_from_file' ) THEN 3250 message_string = 'complex_terrain requires topography' // & 3251 ' = ''read_from_file''' 3066 message_string = 'complex_terrain requires topography = ''read_from_file''' 3252 3067 CALL message( 'check_parameters', 'PA0295', 1, 2, 0, 6, 0 ) 3253 3068 ENDIF 3254 3069 3255 3070 ! 3256 !-- Check if vertical grid stretching is switched off in case of complex 3257 !-- terrain simulations 3258 IF ( complex_terrain .AND. & 3259 ANY( dz_stretch_level_start /= -9999999.9_wp ) ) THEN 3260 message_string = 'Vertical grid stretching is not allowed for ' // & 3261 'complex_terrain = .T.' 3071 !-- Check if vertical grid stretching is switched off in case of complex terrain simulations 3072 IF ( complex_terrain .AND. ANY( dz_stretch_level_start /= -9999999.9_wp ) ) THEN 3073 message_string = 'Vertical grid stretching is not allowed for complex_terrain = .TRUE.' 3262 3074 CALL message( 'check_parameters', 'PA0473', 1, 2, 0, 6, 0 ) 3263 3075 ENDIF … … 3267 3079 CONTAINS 3268 3080 3269 !------------------------------------------------------------------------------ !3081 !--------------------------------------------------------------------------------------------------! 3270 3082 ! Description: 3271 3083 ! ------------ 3272 !> Check the length of data output intervals. In case of parallel NetCDF output 3273 !> the time levels of the output files need to be fixed. Therefore setting the 3274 !> output interval to 0.0s (usually used to output each timestep) is not 3275 !> possible as long as a non-fixed timestep is used. 3276 !------------------------------------------------------------------------------! 3084 !> Check the length of data output intervals. In case of parallel NetCDF output the time levels of 3085 !> the output files need to be fixed. Therefore setting the output interval to 0.0s (usually used to 3086 !> output each timestep) is not possible as long as a non-fixed timestep is used. 3087 !--------------------------------------------------------------------------------------------------! 3277 3088 3278 3089 SUBROUTINE check_dt_do( dt_do, dt_do_name ) … … 3286 3097 IF ( dt_do == 0.0_wp ) THEN 3287 3098 IF ( dt_fixed ) THEN 3288 WRITE( message_string, '(A,F9.4,A)' ) 'Output at every ' // & 3289 'timestep is wanted (' // dt_do_name // ' = 0.0).&'// & 3290 'The output interval is set to the fixed timestep dt '// & 3291 '= ', dt, 's.' 3099 WRITE( message_string, '(A,F9.4,A)' ) 'Output at every timestep is wanted (' // & 3100 dt_do_name // ' = 0.0).&'// & 3101 'The output interval is set to the fixed timestep dt '// '= ', dt, 's.' 3292 3102 CALL message( 'check_parameters', 'PA0060', 0, 0, 0, 6, 0 ) 3293 3103 dt_do = dt 3294 3104 ELSE 3295 message_string = dt_do_name // ' = 0.0 while using a ' // & 3296 'variable timestep and parallel netCDF4 ' // & 3297 'is not allowed.' 3105 message_string = dt_do_name // ' = 0.0 while using a ' // & 3106 'variable timestep and parallel netCDF4 is not allowed.' 3298 3107 CALL message( 'check_parameters', 'PA0081', 1, 2, 0, 6, 0 ) 3299 3108 ENDIF … … 3304 3113 3305 3114 3306 !------------------------------------------------------------------------------ !3115 !--------------------------------------------------------------------------------------------------! 3307 3116 ! Description: 3308 3117 ! ------------ 3309 3118 !> Set the bottom and top boundary conditions for humidity and scalars. 3310 !------------------------------------------------------------------------------ !3119 !--------------------------------------------------------------------------------------------------! 3311 3120 3312 3121 SUBROUTINE set_bc_scalars( sq, bc_b, bc_t, ibc_b, ibc_t, err_nr_b, err_nr_t ) … … 3315 3124 IMPLICIT NONE 3316 3125 3317 CHARACTER (LEN=1) :: sq !< name of scalar quantity3318 3126 CHARACTER (LEN=*) :: bc_b !< bottom boundary condition 3319 3127 CHARACTER (LEN=*) :: bc_t !< top boundary condition 3320 3128 CHARACTER (LEN=*) :: err_nr_b !< error number if bottom bc is unknown 3321 3129 CHARACTER (LEN=*) :: err_nr_t !< error number if top bc is unknown 3130 CHARACTER (LEN=1) :: sq !< name of scalar quantity 3131 3322 3132 3323 3133 INTEGER(iwp) :: ibc_b !< index for bottom boundary condition … … 3325 3135 3326 3136 ! 3327 !-- Set Integer flags and check for possilbe errorneous settings for bottom 3328 !-- boundary condition 3137 !-- Set Integer flags and check for possilbe errorneous settings for bottom boundary condition 3329 3138 IF ( bc_b == 'dirichlet' ) THEN 3330 3139 ibc_b = 0 … … 3332 3141 ibc_b = 1 3333 3142 ELSE 3334 message_string = 'unknown boundary condition: bc_' // TRIM( sq ) // &3335 '_b ="' //TRIM( bc_b ) // '"'3143 message_string = 'unknown boundary condition: bc_' // TRIM( sq ) // '_b ="' // & 3144 TRIM( bc_b ) // '"' 3336 3145 CALL message( 'check_parameters', err_nr_b, 1, 2, 0, 6, 0 ) 3337 3146 ENDIF 3338 3147 ! 3339 !-- Set Integer flags and check for possilbe errorneous settings for top 3340 !-- boundary condition 3148 !-- Set Integer flags and check for possilbe errorneous settings for top boundary condition 3341 3149 IF ( bc_t == 'dirichlet' ) THEN 3342 3150 ibc_t = 0 … … 3348 3156 ibc_t = 3 3349 3157 ELSE 3350 message_string = 'unknown boundary condition: bc_' // TRIM( sq ) // &3351 '_t ="' //TRIM( bc_t ) // '"'3158 message_string = 'unknown boundary condition: bc_' // TRIM( sq ) // '_t ="' // & 3159 TRIM( bc_t ) // '"' 3352 3160 CALL message( 'check_parameters', err_nr_t, 1, 2, 0, 6, 0 ) 3353 3161 ENDIF … … 3358 3166 3359 3167 3360 !------------------------------------------------------------------------------ !3168 !--------------------------------------------------------------------------------------------------! 3361 3169 ! Description: 3362 3170 ! ------------ 3363 !> Check for consistent settings of bottom boundary conditions for humidity 3364 !> and scalars. 3365 !------------------------------------------------------------------------------! 3366 3367 SUBROUTINE check_bc_scalars( sq, bc_b, ibc_b, & 3368 err_nr_1, err_nr_2, & 3369 constant_flux, surface_initial_change ) 3171 !> Check for consistent settings of bottom boundary conditions for humidity and scalars. 3172 !--------------------------------------------------------------------------------------------------! 3173 3174 SUBROUTINE check_bc_scalars( sq, bc_b, ibc_b, err_nr_1, err_nr_2, constant_flux, & 3175 surface_initial_change ) 3370 3176 3371 3177 3372 3178 IMPLICIT NONE 3373 3179 3374 CHARACTER (LEN=1) :: sq !< name of scalar quantity3375 3180 CHARACTER (LEN=*) :: bc_b !< bottom boundary condition 3376 3181 CHARACTER (LEN=*) :: err_nr_1 !< error number of first error 3377 3182 CHARACTER (LEN=*) :: err_nr_2 !< error number of second error 3183 CHARACTER (LEN=1) :: sq !< name of scalar quantity 3184 3378 3185 3379 3186 INTEGER(iwp) :: ibc_b !< index of bottom boundary condition … … 3384 3191 3385 3192 ! 3386 !-- A given surface value implies Dirichlet boundary condition for 3387 !-- the respective quantity. In this case specification of a constant flux is 3388 !-- forbidden. However, an exception is made for large-scale forcing as well 3389 !-- as land-surface model. 3193 !-- A given surface value implies Dirichlet boundary condition for the respective quantity. In 3194 !-- this case specification of a constant flux is forbidden. However, an exception is made for 3195 !-- large-scale forcing as well as land-surface model. 3390 3196 IF ( .NOT. land_surface .AND. .NOT. large_scale_forcing ) THEN 3391 3197 IF ( ibc_b == 0 .AND. constant_flux ) THEN 3392 message_string = 'boundary condition: bc_' // TRIM( sq ) // & 3393 '_b ' // '= "' // TRIM( bc_b ) // & 3394 '" is not allowed with prescribed surface flux' 3198 message_string = 'boundary condition: bc_' // TRIM( sq ) // '_b = "' // & 3199 TRIM( bc_b ) // '" is not allowed with prescribed surface flux' 3395 3200 CALL message( 'check_parameters', err_nr_1, 1, 2, 0, 6, 0 ) 3396 3201 ENDIF 3397 3202 ENDIF 3398 3203 IF ( constant_flux .AND. surface_initial_change /= 0.0_wp ) THEN 3399 WRITE( message_string, * ) 'a prescribed surface flux is not allo', & 3400 'wed with ', sq, '_surface_initial_change (/=0) = ', & 3401 surface_initial_change 3204 WRITE( message_string, * ) 'a prescribed surface flux is not allo', 'wed with ', sq, & 3205 '_surface_initial_change (/=0) = ', surface_initial_change 3402 3206 CALL message( 'check_parameters', err_nr_2, 1, 2, 0, 6, 0 ) 3403 3207 ENDIF -
palm/trunk/SOURCE/chem_emissions_mod.f90
r4481 r4559 1 1 !> @file chem_emissions_mod.f90 2 !-------------------------------------------------------------------------------- !2 !--------------------------------------------------------------------------------------------------! 3 3 ! This file is part of PALM model system. 4 4 ! 5 ! PALM is free software: you can redistribute it and/or modify it under the 6 ! terms of the GNU General Public License as published by the Free Software 7 ! Foundation, either version 3 of the License, or (at your option) any later 8 ! 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/>. 5 ! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General 6 ! Public License as published by the Free Software Foundation, either version 3 of the License, or 7 ! (at your option) any later version. 8 ! 9 ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the 10 ! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General 11 ! Public License for more details. 12 ! 13 ! You should have received a copy of the GNU General Public License along with PALM. If not, see 14 ! <http://www.gnu.org/licenses/>. 16 15 ! 17 16 ! Copyright 2018-2020 Leibniz Universitaet Hannover 18 17 ! Copyright 2018-2020 Freie Universitaet Berlin 19 18 ! Copyright 2018-2020 Karlsruhe Institute of Technology 20 !-------------------------------------------------------------------------------- !19 !--------------------------------------------------------------------------------------------------! 21 20 ! 22 21 ! Current revisions: 23 22 ! ------------------ 24 ! 23 ! 25 24 ! 26 25 ! Former revisions: 27 26 ! ----------------- 28 27 ! $Id$ 28 ! file re-formatted to follow the PALM coding standard 29 ! 30 ! 4481 2020-03-31 18:55:54Z maronga 29 31 ! Implemented on-demand read mode for LOD 2 (ECC) 30 32 ! - added following module global variables … … 55 57 ! 56 58 ! 4242 2019-09-27 12:59:10Z suehring 57 ! Adjust index_hh access to new definition accompanied with new 59 ! Adjust index_hh access to new definition accompanied with new 58 60 ! palm_date_time_mod. Note, this is just a preleminary fix. (E Chan) 59 ! 61 ! 60 62 ! 4230 2019-09-11 13:58:14Z suehring 61 ! Bugfix, consider that time_since_reference_point can be also negative when 63 ! Bugfix, consider that time_since_reference_point can be also negative when 62 64 ! time indices are determined. 63 ! 65 ! 64 66 ! 4227 2019-09-10 18:04:34Z gronemeier 65 67 ! implement new palm_date_time_mod 66 ! 68 ! 67 69 ! 4223 2019-09-10 09:20:47Z gronemeier 68 70 ! Unused routine chem_emissions_check_parameters commented out due to uninitialized content 69 ! 71 ! 70 72 ! 4182 2019-08-22 15:20:23Z scharf 71 73 ! Corrected "Former revisions" section 72 ! 74 ! 73 75 ! 4157 2019-08-14 09:19:12Z suehring 74 76 ! Replace global arrays also in mode_emis branch 75 ! 77 ! 76 78 ! 4154 2019-08-13 13:35:59Z suehring 77 79 ! Replace global arrays for emissions by local ones. 78 ! 80 ! 79 81 ! 4144 2019-08-06 09:11:47Z raasch 80 82 ! relational operators .EQ., .NE., etc. replaced by ==, /=, etc. 81 ! 83 ! 82 84 ! 4055 2019-06-27 09:47:29Z suehring 83 ! - replaced local thermo. constants w/ module definitions in 84 ! basic_constants_and_equations_mod (rgas_univ, p_0, r_d_cp)85 ! - replaced local thermo. constants w/ module definitions in basic_constants_and_equations_mod 86 ! (rgas_univ, p_0, r_d_cp) 85 87 ! - initialize array emis_distribution immediately following allocation 86 ! - lots of minor formatting changes based on review sesson in 20190325 87 ! (E.C. Chan) 88 ! 88 ! - lots of minor formatting changes based on review sesson in 20190325 (E.C. Chan) 89 ! 89 90 ! 3968 2019-05-13 11:04:01Z suehring 90 ! - in subroutine chem_emissions_match replace all decision structures relating to 91 ! mode_emis toemiss_lod91 ! - in subroutine chem_emissions_match replace all decision structures relating to mode_emis to 92 ! emiss_lod 92 93 ! - in subroutine chem_check_parameters replace emt%nspec with emt%n_emiss_species 93 94 ! - spring cleaning (E.C. Chan) 94 ! 95 ! 95 96 ! 3885 2019-04-11 11:29:34Z kanani 96 ! Changes related to global restructuring of location messages and introduction 97 ! of additional debugmessages98 ! 97 ! Changes related to global restructuring of location messages and introduction of additional debug 98 ! messages 99 ! 99 100 ! 3831 2019-03-28 09:11:22Z forkel 100 ! added nvar to USE chem_gasphase_mod (chem_modules will not include nvar anymore) 101 ! 101 ! added nvar to USE chem_gasphase_mod (chem_modules will not include nvar anymore) 102 ! 102 103 ! 3788 2019-03-07 11:40:09Z banzhafs 103 104 ! Removed unused variables from chem_emissions_mod 104 ! 105 ! 3772 2019-02-28 15:51:57Z suehring 106 ! - In case of parametrized emissions, assure that emissions are only on natural 107 ! surfaces (i.e. streets) and not on urban surfaces.105 ! 106 ! 3772 2019-02-28 15:51:57Z suehring 107 ! - In case of parametrized emissions, assure that emissions are only on natural surfaces 108 ! (i.e. streets) and not on urban surfaces. 108 109 ! - some unnecessary if clauses removed 109 110 ! … … 117 118 ! @author Sabine Banzhaf (FU-Berlin) 118 119 ! @author Martijn Schaap (FU-Berlin, TNO Utrecht) 119 ! 120 ! 120 121 ! Description: 121 122 ! ------------ … … 131 132 !> @note <Enter notes on the module> 132 133 !> @bug <Enter known bugs here> 133 !------------------------------------------------------------------------------ !134 !--------------------------------------------------------------------------------------------------! 134 135 135 136 MODULE chem_emissions_mod 136 137 137 USE arrays_3d, &138 USE arrays_3d, & 138 139 ONLY: rho_air 139 140 140 USE basic_constants_and_equations_mod, & 141 ONLY: rgas_univ, p_0, rd_d_cp 142 143 USE control_parameters, & 144 ONLY: debug_output, & 145 end_time, message_string, initializing_actions, & 146 intermediate_timestep_count, dt_3d 147 141 USE basic_constants_and_equations_mod, & 142 ONLY: p_0, rd_d_cp, rgas_univ 143 144 USE control_parameters, & 145 ONLY: debug_output, end_time, initializing_actions, intermediate_timestep_count, & 146 message_string, dt_3d 147 148 148 USE indices 149 149 … … 154 154 #endif 155 155 156 USE netcdf_data_input_mod, &156 USE netcdf_data_input_mod, & 157 157 ONLY: chem_emis_att_type, chem_emis_val_type 158 158 159 USE chem_gasphase_mod, &159 USE chem_gasphase_mod, & 160 160 ONLY: nvar, spc_names 161 161 162 162 USE chem_modules 163 163 164 USE statistics, &164 USE statistics, & 165 165 ONLY: weight_pres 166 166 … … 169 169 !-- Added new palm_date_time_mod for on-demand emission reading 170 170 171 USE palm_date_time_mod, &171 USE palm_date_time_mod, & 172 172 ONLY: get_date_time 173 173 … … 175 175 176 176 ! 177 !-- Declare all global variables within the module 177 !-- Declare all global variables within the module 178 178 179 179 ! 180 180 !-- 20200203 (ECC) - variable unused 181 ! CHARACTER (LEN=80) :: filename_emis 181 ! CHARACTER (LEN=80) :: filename_emis !< Variable for the name of the netcdf input file 182 182 183 183 ! 184 184 !-- 20200203 (ECC) new variables for on-demand read mode 185 185 186 CHARACTER(LEN=512), ALLOCATABLE, DIMENSION(:) :: timestamps !< timestamps in chemistry file187 188 186 CHARACTER(LEN=*), PARAMETER :: input_file_chem = 'PIDS_CHEM' !< chemistry file 189 187 190 INTEGER(iwp) :: dt_emis !< Time Step Emissions 188 CHARACTER(LEN=512), ALLOCATABLE, DIMENSION(:) :: timestamps !< timestamps in chemistry file 189 190 191 INTEGER(iwp) :: dt_emis !< Time Step Emissions 191 192 INTEGER(iwp) :: i !< index 1st selected dimension (some dims are not spatial) 192 INTEGER(iwp) :: j !< index 2nd selected dimension 193 INTEGER(iwp) :: j !< index 2nd selected dimension 194 INTEGER(iwp) :: i_end !< Index to end read variable from netcdf in one dims 193 195 INTEGER(iwp) :: i_start !< Index to start read variable from netcdf along one dims 194 INTEGER(iwp) :: i_end !< Index to end read variable from netcdf in onedims196 INTEGER(iwp) :: j_end !< Index to end read variable from netcdf in additional dims 195 197 INTEGER(iwp) :: j_start !< Index to start read variable from netcdf in additional dims 196 INTEGER(iwp) :: j_end !< Index to end read variable from netcdf in additional dims197 198 INTEGER(iwp) :: len_index !< length of index (used for several indices) 198 199 INTEGER(iwp) :: len_index_pm !< length of PMs index 199 200 INTEGER(iwp) :: len_index_voc !< length of voc index 200 201 INTEGER(iwp) :: previous_timestamp_index !< index for current timestamp (20200203 ECC) 202 INTEGER(iwp) :: z_end !< Index to end read variable from netcdf in additional dims 201 203 INTEGER(iwp) :: z_start !< Index to start read variable from netcdf in additional dims 202 INTEGER(iwp) :: z_end !< Index to end read variable from netcdf in additional dims203 204 204 205 REAL(wp) :: conversion_factor !< Units Conversion Factor … … 212 213 ! END INTERFACE chem_emissions_check_parameters 213 214 ! 214 !-- Matching Emissions actions 215 !-- Matching Emissions actions 215 216 INTERFACE chem_emissions_match 216 217 MODULE PROCEDURE chem_emissions_match 217 218 END INTERFACE chem_emissions_match 218 219 ! 219 !-- Initialization actions 220 !-- Initialization actions 220 221 INTERFACE chem_emissions_init 221 222 MODULE PROCEDURE chem_emissions_init … … 231 232 232 233 ! 233 !-- initialization actions for on-demand mode 234 !-- initialization actions for on-demand mode 234 235 INTERFACE chem_emissions_header_init 235 236 MODULE PROCEDURE chem_emissions_header_init … … 246 247 ! PUBLIC chem_emissions_init, chem_emissions_match, chem_emissions_setup 247 248 248 PUBLIC chem_emissions_init, chem_emissions_match, chem_emissions_setup, &249 PUBLIC chem_emissions_init, chem_emissions_match, chem_emissions_setup, & 249 250 chem_emissions_header_init, chem_emissions_update_on_demand 250 251 ! … … 254 255 CONTAINS 255 256 256 ! !------------------------------------------------------------------------------ !257 ! !------------------------------------------------------------------------------------------------! 257 258 ! ! Description: 258 259 ! ! ------------ 259 260 ! !> Routine for checking input parameters 260 ! !------------------------------------------------------------------------------ !261 ! !------------------------------------------------------------------------------------------------! 261 262 ! SUBROUTINE chem_emissions_check_parameters 262 263 ! … … 281 282 282 283 283 !------------------------------------------------------------------------------ !284 !--------------------------------------------------------------------------------------------------! 284 285 ! Description: 285 286 ! ------------ 286 !> Matching the chemical species indices. The routine checks what are the 287 !> indices of the emission input species and the corresponding ones of the 288 !> model species. The routine gives as output a vector containing the number 289 !> of common species: it is important to note that while the model species 290 !> are distinct, their values could be given to a single species in input. 291 !> For example, in the case of NO2 and NO, values may be passed in input as 292 !> NOX values. 293 !------------------------------------------------------------------------------! 294 295 SUBROUTINE chem_emissions_match( emt_att,len_index ) 296 297 INTEGER(iwp) :: ind_inp !< Parameters for cycling through chemical input species 298 INTEGER(iwp) :: ind_mod !< Parameters for cycling through chemical model species 287 !> Matching the chemical species indices. The routine checks what are the indices of the emission 288 !> input species and the corresponding ones of the model species. The routine gives as output a 289 !> vector containing the number of common species: it is important to note that while the model 290 !> species are distinct, their values could be given to a single species in input. 291 !> For example, in the case of NO2 and NO, values may be passed in input as NOX values. 292 !--------------------------------------------------------------------------------------------------! 293 294 SUBROUTINE chem_emissions_match( emt_att,len_index ) 295 296 INTEGER(iwp) :: ind_inp !< Parameters for cycling through chemical input species 297 INTEGER(iwp) :: ind_mod !< Parameters for cycling through chemical model species 299 298 INTEGER(iwp) :: ind_voc !< Indices to check whether a split for voc should be done 300 299 INTEGER(iwp) :: ispec !< index for cycle over effective number of emission species … … 312 311 313 312 nspec_emis_inp = emt_att%n_emiss_species 314 ! nspec_emis_inp=emt_att%nspec 313 ! nspec_emis_inp=emt_att%nspec 315 314 316 315 ! 317 316 !-- Check the emission LOD: 0 (PARAMETERIZED), 1 (DEFAULT), 2 (PRE-PROCESSED) 318 !319 317 SELECT CASE (emiss_lod) 320 318 321 319 ! 322 !-- LOD 0 (PARAMETERIZED mode) 323 320 !-- LOD 0 (PARAMETERIZED mode) 324 321 CASE (0) 325 322 326 323 len_index = 0 327 328 ! number of species and number of matched species can be different 329 ! but call is only made if both are greater than zero 330 324 ! 325 !-- Number of species and number of matched species can be different but call is only made if 326 !-- both are greater than zero. 331 327 IF ( nvar > 0 .AND. nspec_emis_inp > 0 ) THEN 332 328 333 329 ! 334 !-- Cycle over model species 335 330 !-- Cycle over model species 336 331 DO ind_mod = 1, nvar 337 332 ind_inp = 1 338 DO WHILE ( TRIM( surface_csflux_name(ind_inp) ) /= 'novalue' ) !< 'novalue' is the default 333 DO WHILE ( TRIM( surface_csflux_name(ind_inp) ) /= 'novalue' ) !< 'novalue' is the default 339 334 IF ( TRIM( surface_csflux_name(ind_inp) ) == TRIM( spc_names(ind_mod) ) ) THEN 340 335 len_index = len_index + 1 … … 347 342 348 343 ! 349 !-- Allocation of Arrays of the matched species 350 351 ALLOCATE ( match_spec_input(len_index) ) 344 !-- Allocation of Arrays of the matched species 345 ALLOCATE ( match_spec_input(len_index) ) 352 346 ALLOCATE ( match_spec_model(len_index) ) 353 347 354 348 ! 355 !-- Pass species indices to declared arrays 356 349 !-- Pass species indices to declared arrays 357 350 len_index = 0 358 351 359 DO ind_mod = 1, nvar 352 DO ind_mod = 1, nvar 360 353 ind_inp = 1 361 354 DO WHILE ( TRIM( surface_csflux_name(ind_inp) ) /= 'novalue' ) 362 IF ( TRIM( surface_csflux_name(ind_inp)) ==&363 TRIM(spc_names(ind_mod)) )THEN355 IF ( TRIM( surface_csflux_name(ind_inp) ) == TRIM(spc_names(ind_mod) ) ) & 356 THEN 364 357 len_index = len_index + 1 365 358 match_spec_input(len_index) = ind_inp … … 371 364 372 365 ! 373 !-- Check 374 366 !-- Check 375 367 DO ispec = 1, len_index 376 368 377 IF ( emiss_factor_main(match_spec_input(ispec) ) < 0 .AND. &369 IF ( emiss_factor_main(match_spec_input(ispec) ) < 0 .AND. & 378 370 emiss_factor_side(match_spec_input(ispec) ) < 0 ) THEN 379 371 380 message_string = 'PARAMETERIZED emissions mode selected:' // 381 ' EMISSIONS POSSIBLE ONLY ON STREET SURFACES' // 382 ' but values of scaling factors for street types' // 383 ' emiss_factor_main AND emiss_factor_side' // 384 ' not provided for each of the emissions species' // 385 ' or not provided at all: PLEASE set a finite value' // 386 ' for these parameters in the chemistry namelist' 372 message_string = 'PARAMETERIZED emissions mode selected:' // & 373 ' EMISSIONS POSSIBLE ONLY ON STREET SURFACES' // & 374 ' but values of scaling factors for street types' // & 375 ' emiss_factor_main AND emiss_factor_side' // & 376 ' not provided for each of the emissions species' // & 377 ' or not provided at all: PLEASE set a finite value' // & 378 ' for these parameters in the chemistry namelist' 387 379 CALL message( 'chem_emissions_matching', 'CM0442', 2, 2, 0, 6, 0 ) 388 380 389 381 ENDIF 390 382 … … 393 385 394 386 ELSE 395 396 message_string = 'Non of given Emission Species' // &397 ' matches' // &398 ' model chemical species' // &399 ' Emission routine is not called' 387 388 message_string = 'Non of given Emission Species' // & 389 ' matches' // & 390 ' model chemical species' // & 391 ' Emission routine is not called' 400 392 CALL message( 'chem_emissions_matching', 'CM0443', 0, 0, 0, 6, 0 ) 401 393 402 394 ENDIF 403 395 404 396 ELSE 405 406 message_string = 'Array of Emission species not allocated: ' // &407 ' Either no emission species are provided as input or' // &408 ' no chemical species are used by PALM.' // &409 ' Emission routine is not called' 410 CALL message( 'chem_emissions_matching', 'CM0444', 0, 2, 0, 6, 0 ) 411 397 398 message_string = 'Array of Emission species not allocated: ' // & 399 ' Either no emission species are provided as input or' // & 400 ' no chemical species are used by PALM.' // & 401 ' Emission routine is not called' 402 CALL message( 'chem_emissions_matching', 'CM0444', 0, 2, 0, 6, 0 ) 403 412 404 ENDIF 413 405 414 406 ! 415 !-- LOD 1 (DEFAULT mode) 416 407 !-- LOD 1 (DEFAULT mode) 417 408 CASE (1) 418 409 419 len_index = 0 ! total number of species (to be accumulated) 410 len_index = 0 ! total number of species (to be accumulated) 420 411 len_index_voc = 0 ! total number of VOCs (to be accumulated) 421 412 len_index_pm = 3 ! total number of PMs: PM1, PM2.5, PM10. 422 413 423 414 ! 424 !-- number of model species and input species could be different 425 !-- but process this only when both are non-zero 426 415 !-- Number of model species and input species could be different but process this only when both are 416 !-- non-zero 427 417 IF ( nvar > 0 .AND. nspec_emis_inp > 0 ) THEN 428 418 429 419 ! 430 !-- Cycle over model species420 !-- Cycle over model species 431 421 DO ind_mod = 1, nvar 432 422 433 423 ! 434 !-- Cycle over input species 435 424 !-- Cycle over input species 436 425 DO ind_inp = 1, nspec_emis_inp 437 426 438 427 ! 439 !-- Check for VOC Species 440 428 !-- Check for VOC Species 441 429 IF ( TRIM( emt_att%species_name(ind_inp) ) == "VOC" ) THEN 442 430 DO ind_voc= 1, emt_att%nvoc 443 444 IF ( TRIM( emt_att%voc_name(ind_voc) ) == TRIM( spc_names(ind_mod) ) ) THEN 431 432 IF ( TRIM( emt_att%voc_name(ind_voc) ) == TRIM( spc_names(ind_mod) ) ) & 433 THEN 445 434 len_index = len_index + 1 446 435 len_index_voc = len_index_voc + 1 447 436 ENDIF 448 437 449 438 END DO 450 439 ENDIF 451 440 452 441 ! 453 !-- PMs: There is one input species name for all PM 454 !-- This variable has 3 dimensions, one for PM1, PM2.5 and PM10 455 442 !-- PMs: There is one input species name for all PM. This variable has 3 dimensions, one for PM1, 443 !-- PM2.5 and PM10 456 444 IF ( TRIM( emt_att%species_name(ind_inp) ) == "PM" ) THEN 457 445 … … 467 455 468 456 ! 469 !-- NOX: NO2 and NO 470 471 IF ( TRIM( emt_att%species_name(ind_inp) ) == "NOX" ) THEN 457 !-- NOX: NO2 and NO 458 IF ( TRIM( emt_att%species_name(ind_inp) ) == "NOX" ) THEN 472 459 473 460 IF ( TRIM( spc_names(ind_mod) ) == "NO" ) THEN … … 480 467 481 468 ! 482 !-- SOX: SO2 and SO4 483 469 !-- SOX: SO2 and SO4 484 470 IF ( TRIM( emt_att%species_name(ind_inp) ) == "SOX" ) THEN 485 471 … … 493 479 494 480 ! 495 !-- Other Species 496 497 IF ( TRIM( emt_att%species_name(ind_inp) ) == & 498 TRIM( spc_names(ind_mod) ) ) THEN 481 !-- Other Species 482 IF ( TRIM( emt_att%species_name(ind_inp) ) == TRIM( spc_names(ind_mod) ) ) THEN 499 483 len_index = len_index + 1 500 484 ENDIF … … 506 490 507 491 ! 508 !-- Allocate arrays 509 492 !-- Allocate arrays 510 493 IF ( len_index > 0 ) THEN 511 494 … … 514 497 515 498 IF ( len_index_voc > 0 ) THEN 516 517 ! 518 !-- Contains indices of the VOC model species 519 499 ! 500 !-- Contains indices of the VOC model species 520 501 ALLOCATE( match_spec_voc_model(len_index_voc) ) 521 522 ! 523 !-- Contains the indices of different values of VOC composition 524 !-- of input variable VOC_composition 525 502 ! 503 !-- Contains the indices of different values of VOC composition of input variable 504 !-- VOC_composition 526 505 ALLOCATE( match_spec_voc_input(len_index_voc) ) 527 506 … … 529 508 530 509 ! 531 !-- Pass the species indices to declared arrays 532 510 !-- Pass the species indices to declared arrays 533 511 len_index = 0 534 512 len_index_voc = 0 535 513 536 514 DO ind_mod = 1, nvar 537 DO ind_inp = 1, nspec_emis_inp 538 539 ! 540 !-- VOCs 541 542 IF ( TRIM( emt_att%species_name(ind_inp) ) == "VOC" .AND. & 543 ALLOCATED (match_spec_voc_input) ) THEN 515 DO ind_inp = 1, nspec_emis_inp 516 517 ! 518 !-- VOCs 519 IF ( TRIM( emt_att%species_name(ind_inp) ) == "VOC" .AND. & 520 ALLOCATED( match_spec_voc_input ) ) THEN 544 521 545 522 DO ind_voc = 1, emt_att%nvoc 546 523 547 IF ( TRIM( emt_att%voc_name(ind_voc) ) == 548 TRIM( spc_names(ind_mod) ) )THEN524 IF ( TRIM( emt_att%voc_name(ind_voc) ) == TRIM( spc_names(ind_mod) ) )& 525 THEN 549 526 550 527 len_index = len_index + 1 551 528 len_index_voc = len_index_voc + 1 552 529 553 530 match_spec_input(len_index) = ind_inp 554 531 match_spec_model(len_index) = ind_mod … … 564 541 565 542 ! 566 !-- PMs 567 543 !-- PMs 568 544 IF ( TRIM( emt_att%species_name(ind_inp) ) == "PM" ) THEN 569 545 … … 585 561 586 562 ! 587 !-- NOX563 !-- NOX 588 564 IF ( TRIM( emt_att%species_name(ind_inp) ) == "NOX" ) THEN 589 565 … … 599 575 match_spec_input(len_index) = ind_inp 600 576 match_spec_model(len_index) = ind_mod 601 577 602 578 ENDIF 603 579 … … 606 582 607 583 ! 608 !-- SOX 609 584 !-- SOX 610 585 IF ( TRIM( emt_att%species_name(ind_inp) ) == "SOX" ) THEN 611 586 … … 623 598 624 599 ! 625 !-- Other Species626 627 IF ( TRIM( emt_att%species_name(ind_inp) ) == TRIM( spc_names(ind_mod) ) )THEN600 !-- Other Species 601 IF ( TRIM( emt_att%species_name(ind_inp) ) == TRIM( spc_names(ind_mod) ) ) & 602 THEN 628 603 len_index = len_index + 1 629 604 match_spec_input(len_index) = ind_inp … … 636 611 637 612 ! 638 !-- Error reporting (no matching) 639 613 !-- Error reporting (no matching) 640 614 ELSE 641 615 642 message_string = 'None of given Emission Species matches' // &643 ' model chemical species' // &644 ' Emission routine is not called' 645 CALL message( 'chem_emissions_matching', 'CM0440', 0, 0, 0, 6, 0 ) 616 message_string = 'None of given Emission Species matches' // & 617 ' model chemical species' // & 618 ' Emission routine is not called' 619 CALL message( 'chem_emissions_matching', 'CM0440', 0, 0, 0, 6, 0 ) 646 620 647 621 ENDIF 648 622 649 623 ! 650 !-- Error reporting (no species) 651 624 !-- Error reporting (no species) 652 625 ELSE 653 626 654 message_string = 'Array of Emission species not allocated: ' // &655 ' Either no emission species are provided as input or' // &656 ' no chemical species are used by PALM:' // &657 ' Emission routine is not called' 658 CALL message( 'chem_emissions_matching', 'CM0441', 0, 2, 0, 6, 0 ) 659 627 message_string = 'Array of Emission species not allocated: ' // & 628 ' Either no emission species are provided as input or' // & 629 ' no chemical species are used by PALM:' // & 630 ' Emission routine is not called' 631 CALL message( 'chem_emissions_matching', 'CM0441', 0, 2, 0, 6, 0 ) 632 660 633 ENDIF 661 634 662 635 ! 663 !-- LOD 2 (PRE-PROCESSED mode) 664 636 !-- LOD 2 (PRE-PROCESSED mode) 665 637 CASE (2) 666 638 … … 670 642 IF ( nvar > 0 .AND. nspec_emis_inp > 0 ) THEN 671 643 ! 672 !-- Cycle over model species673 DO ind_mod = 1, nvar 674 675 ! 676 !-- Cycle over input species644 !-- Cycle over model species 645 DO ind_mod = 1, nvar 646 647 ! 648 !-- Cycle over input species 677 649 DO ind_inp = 1, nspec_emis_inp 678 650 679 651 ! 680 !-- Check for VOC Species 681 682 IF ( TRIM( emt_att%species_name(ind_inp) ) == "VOC" ) THEN 652 !-- Check for VOC Species 653 IF ( TRIM( emt_att%species_name(ind_inp) ) == "VOC" ) THEN 683 654 DO ind_voc = 1, emt_att%nvoc 684 IF ( TRIM( emt_att%voc_name(ind_voc) ) == TRIM( spc_names(ind_mod) ) ) THEN 655 IF ( TRIM( emt_att%voc_name(ind_voc) ) == TRIM( spc_names(ind_mod) ) ) & 656 THEN 685 657 len_index = len_index + 1 686 658 len_index_voc = len_index_voc + 1 … … 690 662 691 663 ! 692 !-- Other Species 693 694 IF ( TRIM(emt_att%species_name(ind_inp)) == TRIM(spc_names(ind_mod)) ) THEN 664 !-- Other Species 665 IF ( TRIM( emt_att%species_name(ind_inp) ) == TRIM( spc_names(ind_mod) ) ) THEN 695 666 len_index = len_index + 1 696 667 ENDIF … … 699 670 700 671 ! 701 !-- Allocate array for storing the indices of the matched species 702 672 !-- Allocate array for storing the indices of the matched species 703 673 IF ( len_index > 0 ) THEN 704 705 ALLOCATE ( match_spec_input(len_index) ) 706 674 675 ALLOCATE ( match_spec_input(len_index) ) 676 707 677 ALLOCATE ( match_spec_model(len_index) ) 708 678 709 679 IF ( len_index_voc > 0 ) THEN 710 680 ! 711 !-- contains indices of the VOC model species681 !-- Contains indices of the VOC model species 712 682 ALLOCATE( match_spec_voc_model(len_index_voc) ) 713 683 ! 714 !-- contains the indices of different values of VOC composition of input variable VOC_composition 684 !-- Contains the indices of different values of VOC composition of input variable 685 !-- VOC_composition 715 686 ALLOCATE( match_spec_voc_input(len_index_voc) ) 716 687 … … 718 689 719 690 ! 720 !-- pass the species indices to declared arrays 721 691 !-- Pass the species indices to declared arrays 722 692 len_index = 0 723 693 724 694 ! 725 !-- Cycle over model species 726 695 !-- Cycle over model species 727 696 DO ind_mod = 1, nvar 728 729 ! 730 !-- Cycle over Input species 731 697 698 ! 699 !-- Cycle over Input species 732 700 DO ind_inp = 1, nspec_emis_inp 733 701 734 702 ! 735 !-- VOCs 736 737 IF ( TRIM(emt_att%species_name(ind_inp) ) == "VOC" .AND. & 738 ALLOCATED(match_spec_voc_input) ) THEN 739 703 !-- VOCs 704 IF ( TRIM( emt_att%species_name(ind_inp) ) == "VOC" .AND. & 705 ALLOCATED( match_spec_voc_input ) ) THEN 706 740 707 DO ind_voc= 1, emt_att%nvoc 741 IF ( TRIM( emt_att%voc_name(ind_voc) ) == TRIM( spc_names(ind_mod) ) ) THEN 708 IF ( TRIM( emt_att%voc_name(ind_voc) ) == TRIM( spc_names(ind_mod) ) )& 709 THEN 742 710 len_index = len_index + 1 743 711 len_index_voc = len_index_voc + 1 744 712 745 713 match_spec_input(len_index) = ind_inp 746 714 match_spec_model(len_index) = ind_mod 747 715 748 716 match_spec_voc_input(len_index_voc) = ind_voc 749 match_spec_voc_model(len_index_voc) = ind_mod 717 match_spec_voc_model(len_index_voc) = ind_mod 750 718 ENDIF 751 719 END DO … … 753 721 754 722 ! 755 !-- Other Species756 757 IF ( TRIM( emt_att%species_name(ind_inp) ) == TRIM( spc_names(ind_mod) ) )THEN723 !-- Other Species 724 IF ( TRIM( emt_att%species_name(ind_inp) ) == TRIM( spc_names(ind_mod) ) ) & 725 THEN 758 726 len_index = len_index + 1 759 727 match_spec_input(len_index) = ind_inp … … 767 735 768 736 ! 769 !-- in case there are no species matching (just informational message) 770 771 message_string = 'Non of given emission species' // & 772 ' matches' // & 773 ' model chemical species:' // & 774 ' Emission routine is not called' 737 !-- In case there are no species matching (just informational message) 738 message_string = 'Non of given emission species' // & 739 ' matches' // & 740 ' model chemical species:' // & 741 ' Emission routine is not called' 775 742 CALL message( 'chem_emissions_matching', 'CM0438', 0, 0, 0, 6, 0 ) 776 743 ENDIF 777 744 778 745 ! 779 !-- Error check (no matching) 780 746 !-- Error check (no matching) 781 747 ELSE 782 748 783 749 ! 784 !-- either spc_names is zero or nspec_emis_inp is not allocated785 message_string = 'Array of Emission species not allocated:' // &786 ' Either no emission species are provided as input or' // &787 ' no chemical species are used by PALM:' // &788 ' Emission routine is not called' 789 CALL message( 'chem_emissions_matching', 'CM0439', 0, 2, 0, 6, 0 ) 790 791 ENDIF 750 !-- Either spc_names is zero or nspec_emis_inp is not allocated 751 message_string = 'Array of Emission species not allocated:' // & 752 ' Either no emission species are provided as input or' // & 753 ' no chemical species are used by PALM:' // & 754 ' Emission routine is not called' 755 CALL message( 'chem_emissions_matching', 'CM0439', 0, 2, 0, 6, 0 ) 756 757 ENDIF 792 758 793 759 ! … … 795 761 796 762 ! 797 !-- Error check (no species) 798 763 !-- Error check (no species) 799 764 CASE DEFAULT 800 765 801 766 message_string = 'Emission Module switched ON, but' // & 802 767 ' either no emission mode specified or incorrectly given :' // & 803 ' please, pass the correct value to the namelist parameter "mode_emis"' 804 CALL message( 'chem_emissions_matching', 'CM0445', 2, 2, 0, 6, 0 ) 768 ' please, pass the correct value to the namelist parameter "mode_emis"' 769 CALL message( 'chem_emissions_matching', 'CM0445', 2, 2, 0, 6, 0 ) 805 770 806 771 END SELECT … … 810 775 END SUBROUTINE chem_emissions_match 811 776 812 813 !------------------------------------------------------------------------------ !777 778 !--------------------------------------------------------------------------------------------------! 814 779 ! Description: 815 780 ! ------------ 816 781 !> Initialization: 817 !> Netcdf reading, arrays allocation and first calculation of cssws 818 !> fluxes at timestep 0 819 !------------------------------------------------------------------------------! 782 !> Netcdf reading, arrays allocation and first calculation of cssws fluxes at timestep 0 783 !--------------------------------------------------------------------------------------------------! 820 784 821 785 SUBROUTINE chem_emissions_init 822 786 823 USE netcdf_data_input_mod, &787 USE netcdf_data_input_mod, & 824 788 ONLY: chem_emis, chem_emis_att 825 789 826 790 IMPLICIT NONE 827 791 828 792 INTEGER(iwp) :: ispec !< running index 829 793 830 ! 831 !-- Actions for initial runs 794 ! 795 !-- Actions for initial runs 832 796 ! IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN 833 !-- ... 834 ! 797 !-- ... 798 ! 835 799 ! 836 800 !-- Actions for restart runs … … 845 809 ! 846 810 !-- Matching 847 848 811 CALL chem_emissions_match( chem_emis_att, n_matched_vars ) 849 812 850 813 IF ( n_matched_vars == 0 ) THEN 851 814 852 815 emission_output_required = .FALSE. 853 816 … … 858 821 859 822 ! 860 !-- Set molecule masses (in kg/mol) 861 823 !-- Set molecule masses (in kg/mol) 862 824 ALLOCATE( chem_emis_att%xm(n_matched_vars) ) 863 825 … … 878 840 ENDDO 879 841 880 881 ! 882 !-- Get emissions for the first time step base on LOD (if defined) 883 !-- or emission mode (if no LOD defined) 884 885 ! 886 !-- NOTE - I could use a combined if ( lod = xxx .or. mode = 'XXX' ) 887 !-- type of decision structure but I think it is much better 888 !-- to implement it this way (i.e., conditional on lod if it 889 !-- is defined, and mode if not) as we can easily take out 890 !-- the case structure for mode_emis later on. 842 843 ! 844 !-- Get emissions for the first time step base on LOD (if defined) or emission mode 845 !-- (if no LOD defined) 846 847 ! 848 !-- NOTE - I could use a combined if ( lod = xxx .or. mode = 'XXX' ) type of decision structure but 849 ! I think it is much better to implement it this way (i.e., conditional on lod if it is 850 ! defined, and mode if not) as we can easily take out the case structure for mode_emis 851 ! later on. 891 852 892 853 IF ( emiss_lod < 0 ) THEN !-- no LOD defined (not likely) 893 854 894 SELECT CASE ( TRIM( mode_emis ) ) 855 SELECT CASE ( TRIM( mode_emis ) ) 895 856 896 857 CASE ( 'PARAMETERIZED' ) ! LOD 0 897 858 898 IF ( .NOT.ALLOCATED( emis_distribution) ) THEN859 IF ( .NOT. ALLOCATED( emis_distribution) ) THEN 899 860 ALLOCATE( emis_distribution(1,nys:nyn,nxl:nxr,n_matched_vars) ) 900 861 ENDIF … … 904 865 CASE ( 'DEFAULT' ) ! LOD 1 905 866 906 IF ( .NOT.ALLOCATED( emis_distribution) ) THEN867 IF ( .NOT. ALLOCATED( emis_distribution) ) THEN 907 868 ALLOCATE( emis_distribution(1,nys:nyn,nxl:nxr,n_matched_vars) ) 908 869 ENDIF … … 912 873 CASE ( 'PRE-PROCESSED' ) ! LOD 2 913 874 914 IF ( .NOT.ALLOCATED( emis_distribution) ) THEN915 ! 916 !-- Note, at the moment emissions are considered only by surface fluxes 917 !-- rather than by volume sources. Therefore, no vertical dimension is918 !-- required and is thus allocated with 1. Later when volume sources919 !-- are considered, the vertical dimension will increase.875 IF ( .NOT. ALLOCATED( emis_distribution) ) THEN 876 ! 877 !-- Note, at the moment emissions are considered only by surface fluxes rather than 878 !-- by volume sources. Therefore, no vertical dimension is required and is thus 879 !-- allocated with 1. Later when volume sources are considered, the vertical 880 !-- dimension will increase. 920 881 !ALLOCATE( emis_distribution(nzb:nzt+1,nys:nyn,nxl:nxr,n_matched_vars) ) 921 882 ALLOCATE( emis_distribution(1,nys:nyn,nxl:nxr,n_matched_vars) ) 922 883 ENDIF 923 884 924 885 CALL chem_emissions_setup( chem_emis_att, chem_emis, n_matched_vars ) 925 886 … … 932 893 CASE ( 0 ) ! parameterized mode 933 894 934 IF ( .NOT.ALLOCATED( emis_distribution) ) THEN895 IF ( .NOT. ALLOCATED( emis_distribution) ) THEN 935 896 ALLOCATE( emis_distribution(1,nys:nyn,nxl:nxr,n_matched_vars) ) 936 897 ENDIF … … 940 901 CASE ( 1 ) ! default mode 941 902 942 IF ( .NOT.ALLOCATED( emis_distribution) ) THEN903 IF ( .NOT. ALLOCATED( emis_distribution) ) THEN 943 904 ALLOCATE( emis_distribution(1,nys:nyn,nxl:nxr,n_matched_vars) ) 944 905 ENDIF … … 948 909 CASE ( 2 ) ! pre-processed mode 949 910 950 IF ( .NOT.ALLOCATED( emis_distribution) ) THEN911 IF ( .NOT. ALLOCATED( emis_distribution) ) THEN 951 912 ALLOCATE( emis_distribution(nzb:nzt+1,nys:nyn,nxl:nxr,n_matched_vars) ) 952 913 ENDIF 953 914 954 915 CALL chem_emissions_setup( chem_emis_att, chem_emis, n_matched_vars ) 955 916 … … 959 920 960 921 ! 961 ! -- initialize 962 922 ! -- Initialize 963 923 emis_distribution = 0.0_wp 964 924 … … 971 931 972 932 973 !------------------------------------------------------------------------------ !933 !--------------------------------------------------------------------------------------------------! 974 934 ! Description: 975 935 ! ------------ 976 936 !> Routine for Update of Emission values at each timestep. 977 937 !> 978 !> @todo Clarify the correct usage of index_dd, index_hh and index_mm. Consider 979 !> renaming of thesevariables.938 !> @todo Clarify the correct usage of index_dd, index_hh and index_mm. Consider renaming of these 939 !> variables. 980 940 !> @todo Clarify time used in emis_lod=2 mode. ATM, the used time seems strange. 981 !------------------------------------------------------------------------------- !941 !--------------------------------------------------------------------------------------------------! 982 942 983 943 SUBROUTINE chem_emissions_setup( emt_att, emt, n_matched_vars ) 984 985 USE surface_mod, &944 945 USE surface_mod, & 986 946 ONLY: surf_def_h, surf_lsm_h, surf_usm_h 987 947 988 USE netcdf_data_input_mod, &948 USE netcdf_data_input_mod, & 989 949 ONLY: street_type_f 990 950 991 USE arrays_3d, &992 ONLY: hyp, pt 993 994 USE control_parameters, &951 USE arrays_3d, & 952 ONLY: hyp, pt 953 954 USE control_parameters, & 995 955 ONLY: time_since_reference_point 996 956 997 USE palm_date_time_mod, &957 USE palm_date_time_mod, & 998 958 ONLY: days_per_week, get_date_time, hours_per_day, months_per_year, seconds_per_day 999 959 1000 960 IMPLICIT NONE 1001 1002 1003 TYPE(chem_emis_att_type), INTENT(INOUT) :: emt_att !< variable to store emission information 1004 1005 TYPE(chem_emis_val_type), INTENT(INOUT), ALLOCATABLE, DIMENSION(:) :: emt !< variable to store emission input values, 961 962 INTEGER(iwp) :: day_of_month !< day of the month 963 INTEGER(iwp) :: day_of_week !< day of the week 964 INTEGER(iwp) :: day_of_year !< day of the year 965 INTEGER(iwp) :: days_since_reference_point !< days since reference point 966 INTEGER(iwp) :: i !< running index for grid in x-direction 967 INTEGER(iwp) :: i_pm_comp !< index for number of PM components 968 INTEGER(iwp) :: icat !< Index for number of categories 969 INTEGER(iwp) :: index_dd !< index day 970 INTEGER(iwp) :: index_hh !< index hour 971 INTEGER(iwp) :: index_mm !< index month 972 INTEGER(iwp) :: ispec !< index for number of species 973 INTEGER(iwp) :: ivoc !< Index for number of VOCs 974 INTEGER(iwp) :: hour_of_day !< hour of the day 975 INTEGER(iwp) :: j !< running index for grid in y-direction 976 INTEGER(iwp) :: k !< running index for grid in z-direction 977 INTEGER(iwp) :: m !< running index for horizontal surfaces 978 INTEGER(iwp) :: month_of_year !< month of the year 979 980 INTEGER,INTENT(IN) :: n_matched_vars !< Output of matching routine with number 981 !< of matched species 982 983 REAL(wp) :: time_utc_init !< second of day of initial date 984 985 TYPE(chem_emis_att_type), INTENT(INOUT) :: emt_att !< variable to store emission information 986 987 TYPE(chem_emis_val_type), INTENT(INOUT), ALLOCATABLE, DIMENSION(:) :: emt !< variable to store emission input values, 1006 988 !< depending on the considered species 1007 1008 INTEGER,INTENT(IN) :: n_matched_vars !< Output of matching routine with number 1009 !< of matched species 1010 1011 INTEGER(iwp) :: i !< running index for grid in x-direction 1012 INTEGER(iwp) :: i_pm_comp !< index for number of PM components 1013 INTEGER(iwp) :: icat !< Index for number of categories 1014 INTEGER(iwp) :: ispec !< index for number of species 1015 INTEGER(iwp) :: ivoc !< Index for number of VOCs 1016 INTEGER(iwp) :: j !< running index for grid in y-direction 1017 INTEGER(iwp) :: k !< running index for grid in z-direction 1018 INTEGER(iwp) :: m !< running index for horizontal surfaces 1019 1020 INTEGER(iwp) :: day_of_month !< day of the month 1021 INTEGER(iwp) :: day_of_week !< day of the week 1022 INTEGER(iwp) :: day_of_year !< day of the year 1023 INTEGER(iwp) :: days_since_reference_point !< days since reference point 1024 INTEGER(iwp) :: hour_of_day !< hour of the day 1025 INTEGER(iwp) :: month_of_year !< month of the year 1026 INTEGER(iwp) :: index_dd !< index day 1027 INTEGER(iwp) :: index_hh !< index hour 1028 INTEGER(iwp) :: index_mm !< index month 1029 1030 REAL(wp) :: time_utc_init !< second of day of initial date 1031 1032 ! 1033 !-- CONVERSION FACTORS: TIME 1034 REAL(wp), PARAMETER :: hour_per_year = 8760.0_wp !< number of hours in a year of 365 days 1035 REAL(wp), PARAMETER :: s_per_hour = 3600.0_wp !< number of sec per hour (s)/(hour) 1036 REAL(wp), PARAMETER :: s_per_day = 86400.0_wp !< number of sec per day (s)/(day) 989 ! 990 !-- CONVERSION FACTORS: TIME 991 REAL(wp), PARAMETER :: hour_per_year = 8760.0_wp !< number of hours in a year of 365 days 992 REAL(wp), PARAMETER :: s_per_hour = 3600.0_wp !< number of sec per hour (s)/(hour) 993 REAL(wp), PARAMETER :: s_per_day = 86400.0_wp !< number of sec per day (s)/(day) 1037 994 1038 995 REAL(wp), PARAMETER :: day_to_s = 1.0_wp/s_per_day !< conversion day -> sec 1039 996 REAL(wp), PARAMETER :: hour_to_s = 1.0_wp/s_per_hour !< conversion hours -> sec 1040 997 REAL(wp), PARAMETER :: year_to_s = 1.0_wp/(s_per_hour*hour_per_year) !< conversion year -> sec 1041 ! 1042 !-- CONVERSION FACTORS: MASS 1043 REAL(wp), PARAMETER :: g_to_kg = 1.0E-03_wp !< Conversion from g to kg (kg/g) 998 999 1000 ! 1001 !-- CONVERSION FACTORS: MASS 1002 REAL(wp), PARAMETER :: g_to_kg = 1.0E-03_wp !< Conversion from g to kg (kg/g) 1044 1003 REAL(wp), PARAMETER :: miug_to_kg = 1.0E-09_wp !< Conversion from g to kg (kg/g) 1045 REAL(wp), PARAMETER :: tons_to_kg = 100.0_wp !< Conversion from tons to kg (kg/tons) 1046 1047 1048 REAL(wp), PARAMETER :: ratio2ppm = 1.0E+06_wp 1049 1004 REAL(wp), PARAMETER :: tons_to_kg = 100.0_wp !< Conversion from tons to kg (kg/tons) 1005 ! 1006 !-- CONVERSION FACTORS: PPM 1007 REAL(wp), PARAMETER :: ratio2ppm = 1.0E+06_wp 1008 1050 1009 REAL(wp), DIMENSION(24) :: par_emis_time_factor !< time factors for the parameterized mode: 1051 1010 !< fixed houlry profile for example day 1052 REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) :: conv_to_ratio !< factor used for converting input 1011 REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) :: conv_to_ratio !< factor used for converting input 1053 1012 !< to concentration ratio 1054 1013 REAL(wp), DIMENSION(nzb:nzt+1,nys:nyn,nxl:nxr) :: tmp_temp !< temporary variable for abs. temperature 1055 1014 1056 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: delta_emis !< incremental emission factor1057 1015 REAL(wp), DIMENSION(:), ALLOCATABLE :: time_factor !< factor for time scaling of emissions 1016 1017 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: delta_emis !< incremental emission factor 1058 1018 REAL(wp), DIMENSION(:,:), ALLOCATABLE :: emis !< emission factor 1059 1019 1020 1060 1021 IF ( emission_output_required ) THEN 1061 1022 1062 1023 ! 1063 !-- Set emis_dt to be used - since chemistry ODEs can be stiff, the option 1064 !-- to solve them at every RK substep is present to help improve stability 1065 !-- should the need arises 1066 1024 !-- Set emis_dt to be used - since chemistry ODEs can be stiff, the option to solve them at every 1025 !-- RK substep is present to help improve stability should the need arises 1026 1067 1027 IF ( call_chem_at_all_substeps ) THEN 1068 1028 … … 1076 1036 1077 1037 ! 1078 !-- Conversion of units to the ones employed in PALM 1079 !-- In PARAMETERIZED mode no conversion is performed: in this case input units are fixed 1080 1038 !-- Conversion of units to the ones employed in PALM 1039 !-- In PARAMETERIZED mode no conversion is performed: in this case input units are fixed 1081 1040 IF ( TRIM( mode_emis ) == "DEFAULT" .OR. TRIM( mode_emis ) == "PRE-PROCESSED" ) THEN 1082 1041 … … 1101 1060 1102 1061 ! 1103 !-- Error check (need units) 1104 1105 CASE DEFAULT 1106 message_string = 'The Units of the provided emission input' // & 1107 ' are not the ones required by PALM-4U: please check ' // & 1108 ' emission module documentation.' 1062 !-- Error check (need units) 1063 CASE DEFAULT 1064 message_string = 'The Units of the provided emission input' // & 1065 ' are not the ones required by PALM-4U: please check ' // & 1066 ' emission module documentation.' 1109 1067 CALL message( 'chem_emissions_setup', 'CM0446', 2, 2, 0, 6, 0 ) 1110 1068 … … 1114 1072 1115 1073 ! 1116 !-- Conversion factor to convert kg/m**2/s to ppm/s 1117 1074 !-- Conversion factor to convert kg/m**2/s to ppm/s 1118 1075 DO i = nxl, nxr 1119 1076 DO j = nys, nyn 1120 1077 1121 1078 ! 1122 !-- Derive Temperature from Potential Temperature 1123 1124 tmp_temp(nzb:nzt+1,j,i) = pt(nzb:nzt+1,j,i) * & 1125 ( hyp(nzb:nzt+1) / p_0 )**rd_d_cp 1126 1127 ! 1128 !-- We need to pass to cssws <- (ppm/s) * dz 1129 !-- Input is Nmole/(m^2*s) 1130 !-- To go to ppm*dz multiply the input by (m**2/N)*dz 1131 !-- (m**2/N)*dz == V/N 1132 !-- V/N = RT/P 1133 1134 conv_to_ratio(nzb:nzt+1,j,i) = rgas_univ * & ! J K-1 mol-1 1135 tmp_temp(nzb:nzt+1,j,i) / & ! K 1136 hyp(nzb:nzt+1) ! Pa 1079 !-- Derive Temperature from Potential Temperature 1080 tmp_temp(nzb:nzt+1,j,i) = pt(nzb:nzt+1,j,i) * ( hyp(nzb:nzt+1) / p_0 )**rd_d_cp 1081 1082 ! 1083 !-- We need to pass to cssws <- (ppm/s) * dz 1084 !-- Input is Nmole/(m^2*s) 1085 !-- To go to ppm*dz multiply the input by (m**2/N)*dz 1086 !-- (m**2/N)*dz == V/N 1087 !-- V/N = RT/P 1088 conv_to_ratio(nzb:nzt+1,j,i) = rgas_univ * & ! J K-1 mol-1 1089 tmp_temp(nzb:nzt+1,j,i) / & ! K 1090 hyp(nzb:nzt+1) ! Pa 1137 1091 1138 1092 ! (ecc) for reference 1139 ! m**3/Nmole (J/mol)*K^-1 K Pa 1140 ! conv_to_ratio(nzb:nzt+1,j,i) = ( (Rgas * tmp_temp(nzb:nzt+1,j,i)) / ((hyp(nzb:nzt+1))) ) 1093 ! m**3/Nmole (J/mol)*K^-1 K Pa 1094 ! conv_to_ratio(nzb:nzt+1,j,i) = ( (Rgas * tmp_temp(nzb:nzt+1,j,i)) / ((hyp(nzb:nzt+1))) ) 1141 1095 1142 1096 ENDDO … … 1150 1104 ! emis_distribution(:,nys:nyn,nxl:nxr,:) = 0.0_wp 1151 1105 1152 1106 1153 1107 ! 1154 1108 !-- LOD 2 (PRE-PROCESSED MODE) … … 1160 1114 1161 1115 ! 1162 !-- Update time indices 1163 1116 !-- Update time indices 1164 1117 CALL get_date_time( 0.0_wp, second_of_day=time_utc_init ) 1165 CALL get_date_time( MAX( 0.0_wp, time_since_reference_point ), & 1166 hour=hour_of_day ) 1167 1168 days_since_reference_point = INT( FLOOR( ( & 1169 time_utc_init + MAX( 0.0_wp, time_since_reference_point ) ) & 1170 / seconds_per_day ) ) 1118 CALL get_date_time( MAX( 0.0_wp, time_since_reference_point ), hour=hour_of_day ) 1119 1120 days_since_reference_point = INT( FLOOR( ( time_utc_init + & 1121 MAX( 0.0_wp, time_since_reference_point ) ) & 1122 / seconds_per_day ) ) 1171 1123 1172 1124 index_hh = days_since_reference_point * hours_per_day + hour_of_day 1173 1125 1174 1126 ! 1175 !-- LOD 1 (DEFAULT MODE) 1176 1127 !-- LOD 1 (DEFAULT MODE) 1177 1128 ELSEIF ( emiss_lod == 1 ) THEN 1178 1129 … … 1181 1132 1182 1133 ! 1183 !-- Allocate array where to store temporary emission values 1184 1185 IF ( .NOT. ALLOCATED(emis) ) ALLOCATE( emis(nys:nyn,nxl:nxr) ) 1186 1187 ! 1188 !-- Allocate time factor per category 1189 1134 !-- Allocate array where to store temporary emission values 1135 IF ( .NOT. ALLOCATED(emis) ) ALLOCATE( emis(nys:nyn,nxl:nxr) ) 1136 1137 ! 1138 !-- Allocate time factor per category 1190 1139 ALLOCATE( time_factor(emt_att%ncat) ) 1191 1140 1192 1141 ! 1193 !-- Read-in hourly emission time factor 1194 1195 IF ( TRIM(time_fac_type) == "HOUR" ) THEN 1196 1197 ! 1198 !-- Update time indices 1199 1200 CALL get_date_time( MAX( time_since_reference_point, 0.0_wp ), & 1142 !-- Read-in hourly emission time factor 1143 IF ( TRIM( time_fac_type ) == "HOUR" ) THEN 1144 1145 ! 1146 !-- Update time indices 1147 CALL get_date_time( MAX( time_since_reference_point, 0.0_wp ), & 1201 1148 day_of_year=day_of_year, hour=hour_of_day ) 1202 1149 index_hh = ( day_of_year - 1_iwp ) * hour_of_day 1203 1150 1204 1151 ! 1205 !-- Check if the index is less or equal to the temporal dimension of HOURLY emission files 1206 1152 !-- Check if the index is less or equal to the temporal dimension of HOURLY emission files 1207 1153 IF ( index_hh <= SIZE( emt_att%hourly_emis_time_factor(1,:) ) ) THEN 1208 1154 1209 1155 ! 1210 !-- Read-in the correspondant time factor 1211 1212 time_factor(:) = emt_att%hourly_emis_time_factor(:,index_hh+1) 1213 1214 ! 1215 !-- Error check (time out of range) 1216 1156 !-- Read-in the correspondant time factor 1157 time_factor(:) = emt_att%hourly_emis_time_factor(:,index_hh+1) 1158 1159 ! 1160 !-- Error check (time out of range) 1217 1161 ELSE 1218 1162 1219 message_string = 'The "HOUR" time-factors in the DEFAULT mode ' // &1220 ' are not provided for each hour of the total simulation time'1221 CALL message( 'chem_emissions_setup', 'CM0448', 2, 2, 0, 6, 0 ) 1163 message_string = 'The "HOUR" time-factors in the DEFAULT mode ' // & 1164 ' are not provided for each hour of the total simulation time' 1165 CALL message( 'chem_emissions_setup', 'CM0448', 2, 2, 0, 6, 0 ) 1222 1166 1223 1167 ENDIF 1224 1168 1225 1169 ! 1226 !-- Read-in MDH emissions time factors 1227 1170 !-- Read-in MDH emissions time factors 1228 1171 ELSEIF ( TRIM( time_fac_type ) == "MDH" ) THEN 1229 1172 1230 1173 ! 1231 !-- Update time indices 1232 CALL get_date_time( MAX( time_since_reference_point, 0.0_wp ), & 1233 month=month_of_year, & 1234 day=day_of_month, & 1235 hour=hour_of_day, & 1236 day_of_week=day_of_week ) 1174 !-- Update time indices 1175 CALL get_date_time( MAX( time_since_reference_point, 0.0_wp ), & 1176 month = month_of_year, & 1177 day = day_of_month, & 1178 hour = hour_of_day, & 1179 day_of_week = day_of_week & 1180 ) 1237 1181 index_mm = month_of_year 1238 1182 index_dd = months_per_year + day_of_week 1239 SELECT CASE( TRIM(daytype_mdh))1183 SELECT CASE( TRIM( daytype_mdh ) ) 1240 1184 1241 1185 CASE ("workday") … … 1249 1193 1250 1194 END SELECT 1251 ! 1252 !-- Check if the index is less or equal to the temporal dimension of MDH emission files 1253 1254 IF ( ( index_hh + index_dd + index_mm) <= SIZE( emt_att%mdh_emis_time_factor(1,:) ) ) THEN 1255 1256 ! 1257 !-- Read in corresponding time factor 1258 1259 time_factor(:) = emt_att%mdh_emis_time_factor(:,index_mm) * & 1260 emt_att%mdh_emis_time_factor(:,index_dd) * & 1195 1196 ! 1197 !-- Check if the index is less or equal to the temporal dimension of MDH emission files 1198 IF ( ( index_hh + index_dd + index_mm) <= SIZE( emt_att%mdh_emis_time_factor(1,:) ) )& 1199 THEN 1200 ! 1201 !-- Read in corresponding time factor 1202 time_factor(:) = emt_att%mdh_emis_time_factor(:,index_mm) * & 1203 emt_att%mdh_emis_time_factor(:,index_dd) * & 1261 1204 emt_att%mdh_emis_time_factor(:,index_hh+1) 1262 1205 1263 1206 ! 1264 !-- Error check (MDH time factor not provided) 1265 1207 !-- Error check (MDH time factor not provided) 1266 1208 ELSE 1267 1209 1268 message_string = 'The "MDH" time-factors in the DEFAULT mode ' // &1269 ' are not provided for each hour/day/month of the total simulation time'1210 message_string = 'The "MDH" time-factors in the DEFAULT mode ' // & 1211 ' are not provided for each hour/day/month of the total simulation time' 1270 1212 CALL message( 'chem_emissions_setup', 'CM0449', 2, 2, 0, 6, 0 ) 1271 1213 1272 ENDIF 1273 1274 ! 1275 !-- Error check (no time factor defined) 1276 1214 ENDIF 1215 1216 ! 1217 !-- Error check (no time factor defined) 1277 1218 ELSE 1278 1279 message_string = 'In the DEFAULT mode the time factor' // &1280 ' has to be defined in the NAMELIST' 1219 1220 message_string = 'In the DEFAULT mode the time factor' // & 1221 ' has to be defined in the NAMELIST' 1281 1222 CALL message( 'chem_emissions_setup', 'CM0450', 2, 2, 0, 6, 0 ) 1282 1223 1283 1224 ENDIF 1284 1225 1285 1226 ! 1286 !-- PARAMETERIZED MODE 1287 1227 !-- PARAMETERIZED MODE 1288 1228 ELSEIF ( emiss_lod == 0 ) THEN 1289 1229 … … 1291 1231 ! for reference (ecc) 1292 1232 ! ELSEIF ( TRIM( mode_emis ) == "PARAMETERIZED" ) THEN 1293 1294 ! 1295 !-- assign constant values of time factors, diurnal profile for traffic sector 1296 1297 par_emis_time_factor( : ) = (/ 0.009, 0.004, 0.004, 0.009, 0.029, 0.039, & 1298 0.056, 0.053, 0.051, 0.051, 0.052, 0.055, & 1299 0.059, 0.061, 0.064, 0.067, 0.069, 0.069, & 1233 1234 ! 1235 !-- Assign constant values of time factors, diurnal profile for traffic sector 1236 par_emis_time_factor(:) = (/ 0.009, 0.004, 0.004, 0.009, 0.029, 0.039, & 1237 0.056, 0.053, 0.051, 0.051, 0.052, 0.055, & 1238 0.059, 0.061, 0.064, 0.067, 0.069, 0.069, & 1300 1239 0.049, 0.039, 0.039, 0.029, 0.024, 0.019 /) 1301 1302 IF ( .NOT. ALLOCATED (time_factor) ) ALLOCATE (time_factor(1))1240 1241 IF ( .NOT. ALLOCATED( time_factor ) ) ALLOCATE( time_factor(1) ) 1303 1242 1304 1243 ! 1305 1244 !-- Get time-factor for specific hour 1306 CALL get_date_time( MAX( time_since_reference_point, 0.0_wp ), & 1307 hour=hour_of_day ) 1245 CALL get_date_time( MAX( time_since_reference_point, 0.0_wp ), hour = hour_of_day ) 1308 1246 1309 1247 index_hh = hour_of_day … … 1317 1255 1318 1256 ! 1319 !-- LOD 0 (PARAMETERIZED mode) 1320 1257 !-- LOD 0 (PARAMETERIZED mode) 1321 1258 IF ( emiss_lod == 0 ) THEN 1322 1259 … … 1328 1265 ! 1329 1266 !-- Units are micromoles/m**2*day (or kilograms/m**2*day for PMs) 1330 1331 emis_distribution(1,nys:nyn,nxl:nxr,ispec) = & 1332 surface_csflux(match_spec_input(ispec)) * & 1333 time_factor(1) * hour_to_s 1334 1335 ENDDO 1336 1337 1338 ! 1339 !-- LOD 1 (DEFAULT mode) 1340 1341 1267 emis_distribution(1,nys:nyn,nxl:nxr,ispec) = surface_csflux( match_spec_input(ispec) )& 1268 * time_factor(1) * hour_to_s 1269 1270 ENDDO 1271 1272 1273 ! 1274 !-- LOD 1 (DEFAULT mode) 1342 1275 ELSEIF ( emiss_lod == 1 ) THEN 1343 1276 … … 1346 1279 1347 1280 ! 1348 !-- Allocate array for the emission value corresponding to a specific category and time factor 1349 1281 !-- Allocate array for the emission value corresponding to a specific category and time factor 1350 1282 ALLOCATE (delta_emis(nys:nyn,nxl:nxr)) 1351 1283 1352 1284 ! 1353 !-- Cycle over categories 1354 1285 !-- Cycle over categories 1355 1286 DO icat = 1, emt_att%ncat 1356 1357 ! 1358 !-- Cycle over Species: n_matched_vars represents the number of species 1359 !-- in common between the emission input data and the chemistry mechanism used 1360 1287 1288 ! 1289 !-- Cycle over Species: n_matched_vars represents the number of species in common between 1290 !-- the emission input data and the chemistry mechanism used 1361 1291 DO ispec = 1, n_matched_vars 1362 1292 1363 emis(nys:nyn,nxl:nxr) = & 1364 emt(match_spec_input(ispec))% & 1365 default_emission_data(icat,nys+1:nyn+1,nxl+1:nxr+1) 1366 1367 ! 1368 !-- NO 1369 1370 IF ( TRIM(spc_names(match_spec_model(ispec))) == "NO" ) THEN 1371 1372 delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr) * & ! kg/m2/s 1373 time_factor(icat) * & 1374 emt_att%nox_comp(icat,1) * & 1293 emis(nys:nyn,nxl:nxr) = emt( match_spec_input(ispec) )% & 1294 default_emission_data(icat,nys+1:nyn+1,nxl+1:nxr+1) 1295 1296 ! 1297 !-- NO 1298 IF ( TRIM( spc_names( match_spec_model(ispec) ) ) == "NO" ) THEN 1299 1300 delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr) * & ! kg/m2/s 1301 time_factor(icat) * & 1302 emt_att%nox_comp(icat,1) * & 1375 1303 conversion_factor * hours_per_day 1376 1304 1377 emis_distribution(1,nys:nyn,nxl:nxr,ispec) = & 1378 emis_distribution(1,nys:nyn,nxl:nxr,ispec) + & 1379 delta_emis(nys:nyn,nxl:nxr) 1380 ! 1381 !-- NO2 1382 1383 ELSEIF ( TRIM(spc_names(match_spec_model(ispec))) == "NO2" ) THEN 1384 1385 delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr) * & ! kg/m2/s 1386 time_factor(icat) * & 1387 emt_att%nox_comp(icat,2) * & 1305 emis_distribution(1,nys:nyn,nxl:nxr,ispec) = & 1306 emis_distribution(1,nys:nyn,nxl:nxr,ispec)& 1307 + delta_emis(nys:nyn,nxl:nxr) 1308 ! 1309 !-- NO2 1310 ELSEIF ( TRIM( spc_names( match_spec_model(ispec) ) ) == "NO2" ) THEN 1311 1312 delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr) * & ! kg/m2/s 1313 time_factor(icat) * & 1314 emt_att%nox_comp(icat,2) * & 1388 1315 conversion_factor * hours_per_day 1389 1316 1390 emis_distribution(1,nys:nyn,nxl:nxr,ispec) = &1391 emis_distribution(1,nys:nyn,nxl:nxr,ispec) +&1392 delta_emis(nys:nyn,nxl:nxr)1393 1394 ! 1395 !-- SO21396 ELSEIF ( TRIM( spc_names(match_spec_model(ispec))) == "SO2" ) THEN1397 1398 delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr) * & ! kg/m2/s1399 time_factor(icat) * &1400 emt_att%sox_comp(icat,1) * &1317 emis_distribution(1,nys:nyn,nxl:nxr,ispec) = & 1318 emis_distribution(1,nys:nyn,nxl:nxr,ispec) & 1319 + delta_emis(nys:nyn,nxl:nxr) 1320 1321 ! 1322 !-- SO2 1323 ELSEIF ( TRIM( spc_names( match_spec_model(ispec) ) ) == "SO2" ) THEN 1324 1325 delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr) * & ! kg/m2/s 1326 time_factor(icat) * & 1327 emt_att%sox_comp(icat,1) * & 1401 1328 conversion_factor * hours_per_day 1402 1329 1403 emis_distribution(1,nys:nyn,nxl:nxr,ispec) = & 1404 emis_distribution(1,nys:nyn,nxl:nxr,ispec) + & 1405 delta_emis(nys:nyn,nxl:nxr) 1406 1407 ! 1408 !-- SO4 1409 1410 ELSEIF ( TRIM(spc_names(match_spec_model(ispec))) == "SO4" ) THEN 1411 1412 1413 delta_emis(nys:nyn,nxl:nxr) = emis(nys:nyn,nxl:nxr) * & ! kg/m2/s 1414 time_factor(icat) * & 1415 emt_att%sox_comp(icat,2) * &