Changeset 4783 for palm/trunk/SOURCE


Ignore:
Timestamp:
Nov 13, 2020 1:58:45 PM (4 years ago)
Author:
raasch
Message:

bugfix for reading restart data with MPI-I/O (does not work with blockwise I/O); missed revision comments from previous commit added

Location:
palm/trunk/SOURCE
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/indoor_model_mod.f90

    r4780 r4783  
    2020! Current revisions:
    2121! -----------------
    22 ! Change parameters for summer_pars and winter_pars (responsible: S. Rissmann)
     22!
    2323!
    2424! Former revisions:
    2525! -----------------
    2626! $Id$
     27! Change parameters for summer_pars and winter_pars (responsible: S. Rissmann)
     28!
     29! 4780 2020-11-10 11:17:10Z suehring
    2730! Enable 3D data output also with 64-bit precision
    2831!
  • palm/trunk/SOURCE/init_3d_model.f90

    r4680 r4783  
    2424! -----------------
    2525! $Id$
     26! bugfix for reading restart data with MPI-I/O (does not work with blockwise I/O)
     27!
     28! 4680 2020-09-16 10:20:34Z gronemeier
    2629! Add option to fix date or time of the simulation
    2730!
     
    10861089       IF ( TRIM( initializing_actions ) == 'cyclic_fill' )  THEN
    10871090
     1091!
     1092!--       Blockwise I/O does not work together with MPI-I/O
     1093          IF ( restart_data_format_input(1:3) == 'mpi' )  THEN
     1094             CALL rrd_read_parts_of_global
     1095          ELSE
     1096             DO  i = 0, io_blocks-1
     1097                IF ( i == io_group )  THEN
     1098                   CALL rrd_read_parts_of_global
     1099                ENDIF
     1100#if defined( __parallel )
     1101                CALL MPI_BARRIER( comm2d, ierr )
     1102#endif
     1103             ENDDO
     1104          ENDIF
     1105
     1106       ENDIF
     1107
     1108!
     1109!--    Read processor specific binary data from restart file.
     1110!--    Blockwise I/O does not work together with MPI-I/O
     1111       IF ( restart_data_format_input(1:3) == 'mpi' )  THEN
     1112          CALL rrd_local
     1113       ELSE
    10881114          DO  i = 0, io_blocks-1
    10891115             IF ( i == io_group )  THEN
    1090                 CALL rrd_read_parts_of_global
     1116                CALL rrd_local
    10911117             ENDIF
    10921118#if defined( __parallel )
     
    10941120#endif
    10951121          ENDDO
    1096 
    1097        ENDIF
    1098 
    1099 !
    1100 !--    Read processor specific binary data from restart file
    1101        DO  i = 0, io_blocks-1
    1102           IF ( i == io_group )  THEN
    1103              CALL rrd_local
    1104           ENDIF
    1105 #if defined( __parallel )
    1106           CALL MPI_BARRIER( comm2d, ierr )
    1107 #endif
    1108        ENDDO
     1122       ENDIF
    11091123
    11101124
  • palm/trunk/SOURCE/parin.f90

    r4680 r4783  
    2525! -----------------
    2626! $Id$
     27! bugfix for reading restart data with MPI-I/O (does not work with blockwise I/O)
     28!
     29! 4680 2020-09-16 10:20:34Z gronemeier
    2730! Add option to fix date or time of the simulation
    2831!
     
    393396
    394397    CALL location_message( 'reading environment parameters from ENVPAR', 'finished' )
     398
     399    CALL location_message( 'reading NAMELIST parameters from PARIN', 'start' )
     400
     401!
     402!-- Open the NAMELIST-file which is send with this job
     403    CALL check_open( 11 )
     404
     405!
     406!-- Read the control parameters for initialization.
     407!-- The namelist "inipar" must be provided in the NAMELIST-file.
     408    READ ( 11, initialization_parameters, ERR=10, END=11 )
     409    GOTO 14
     410
     411 10 BACKSPACE( 11 )
     412    READ( 11 , '(A)') line
     413    CALL parin_fail_message( 'initialization_parameters', line )
     414
     415 11 REWIND ( 11 )
     416    READ ( 11, inipar, ERR=12, END=13 )
     417
     418    message_string = 'namelist inipar is deprecated and will be ' //    &
     419                     'removed in near future. & Please use namelist ' // &
     420                     'initialization_parameters instead'
     421    CALL message( 'parin', 'PA0017', 0, 1, 0, 6, 0 )
     422
     423    GOTO 14
     424
     425 12 BACKSPACE( 11 )
     426    READ( 11 , '(A)') line
     427    CALL parin_fail_message( 'inipar', line )
     428
     429 13 message_string = 'no initialization_parameters-namelist found'
     430    CALL message( 'parin', 'PA0272', 1, 2, 0, 6, 0 )
     431
     432!
     433!-- Try to read runtime parameters given by the user for this run
     434!-- (namelist "runtime_parameters"). The namelist "runtime_parmeters"
     435!-- can be omitted. In that case default values are used for the
     436!-- parameters.
     437 14 line = ' '
     438
     439    REWIND ( 11 )
     440    line = ' '
     441    DO WHILE ( INDEX( line, '&runtime_parameters' ) == 0 )
     442       READ ( 11, '(A)', END=16 )  line
     443    ENDDO
     444    BACKSPACE ( 11 )
     445
     446!
     447!-- Read namelist
     448    READ ( 11, runtime_parameters, ERR = 15 )
     449    GOTO 18
     450
     451 15 BACKSPACE( 11 )
     452    READ( 11 , '(A)') line
     453    CALL parin_fail_message( 'runtime_parameters', line )
     454
     455 16 REWIND ( 11 )
     456    line = ' '
     457    DO WHILE ( INDEX( line, '&d3par' ) == 0 )
     458       READ ( 11, '(A)', END=18 )  line
     459    ENDDO
     460    BACKSPACE ( 11 )
     461
     462!
     463!-- Read namelist
     464    READ ( 11, d3par, ERR = 17, END = 18 )
     465
     466    message_string = 'namelist d3par is deprecated and will be ' //      &
     467                     'removed in near future. &Please use namelist ' //   &
     468                     'runtime_parameters instead'
     469    CALL message( 'parin', 'PA0487', 0, 1, 0, 6, 0 )
     470
     471    GOTO 18
     472
     473 17 BACKSPACE( 11 )
     474    READ( 11 , '(A)') line
     475    CALL parin_fail_message( 'd3par', line )
     476
     477 18 CONTINUE
     478
     479!
     480!-- Check for module namelists and read them
     481    CALL module_interface_parin
     482
    395483!
    396484!-- Calculate the number of groups into which parallel I/O is split.
     
    424512    io_group  = MOD( global_id+1, io_blocks )
    425513
    426     CALL location_message( 'reading NAMELIST parameters from PARIN', 'start' )
    427 !
    428 !-- Data is read in parallel by groups of PEs
    429     DO  i = 0, io_blocks-1
    430        IF ( i == io_group )  THEN
    431 
    432 !
    433 !--       Open the NAMELIST-file which is send with this job
    434           CALL check_open( 11 )
    435 
    436 !
    437 !--       Read the control parameters for initialization.
    438 !--       The namelist "inipar" must be provided in the NAMELIST-file.
    439           READ ( 11, initialization_parameters, ERR=10, END=11 )
    440           GOTO 14
    441 
    442  10       BACKSPACE( 11 )
    443           READ( 11 , '(A)') line
    444           CALL parin_fail_message( 'initialization_parameters', line )
    445 
    446  11       REWIND ( 11 )
    447           READ ( 11, inipar, ERR=12, END=13 )
    448 
    449           message_string = 'namelist inipar is deprecated and will be ' //    &
    450                           'removed in near future. & Please use namelist ' // &
    451                           'initialization_parameters instead'
    452           CALL message( 'parin', 'PA0017', 0, 1, 0, 6, 0 )
    453 
    454           GOTO 14
    455 
    456  12       BACKSPACE( 11 )
    457           READ( 11 , '(A)') line
    458           CALL parin_fail_message( 'inipar', line )
    459 
    460  13       message_string = 'no initialization_parameters-namelist found'
    461           CALL message( 'parin', 'PA0272', 1, 2, 0, 6, 0 )
    462 
    463 !
    464 !--       Try to read runtime parameters given by the user for this run
    465 !--       (namelist "runtime_parameters"). The namelist "runtime_parmeters"
    466 !--       can be omitted. In that case default values are used for the
    467 !--       parameters.
    468  14       line = ' '
    469 
    470           REWIND ( 11 )
    471           line = ' '
    472           DO WHILE ( INDEX( line, '&runtime_parameters' ) == 0 )
    473              READ ( 11, '(A)', END=16 )  line
     514!
     515!-- If required, read control parameters from restart file (produced by
     516!-- a prior run). All PEs are reading from file created by PE0 (see
     517!-- check_open)
     518    IF ( TRIM( initializing_actions ) == 'read_restart_data' )  THEN
     519
     520!
     521!--    If not set by the user in the runtime parameters, the data format for restart
     522!--    input needs to be set now! This is normally done later in check parameters.
     523       IF ( TRIM( restart_data_format ) /= 'fortran_binary'  .AND.                           &
     524            TRIM( restart_data_format ) /= 'mpi'             .AND.                           &
     525            TRIM( restart_data_format ) /= 'mpi_shared_memory' )  THEN
     526          message_string = 'illegal restart data format "' // TRIM( restart_data_format ) // '"'
     527          CALL message( 'parin', 'PA0724', 1, 2, 0, 6, 0 )
     528       ENDIF
     529       IF ( TRIM( restart_data_format_input ) == 'undefined' )  THEN
     530          restart_data_format_input = restart_data_format
     531       ENDIF
     532
     533!
     534!--    Blockwise I/O does not work together with MPI-I/O
     535       IF ( restart_data_format_input(1:3) == 'mpi'  .AND.  io_blocks /= 1 )  THEN
     536          CALL rrd_global
     537       ELSE
     538!
     539!--       Data is read in parallel by groups of PEs
     540          DO  i = 0, io_blocks-1
     541             IF ( i == io_group )  THEN
     542                CALL rrd_global
     543             ENDIF
     544#if defined( __parallel )
     545             CALL MPI_BARRIER( comm2d, ierr )
     546#endif
    474547          ENDDO
    475           BACKSPACE ( 11 )
    476 
    477 !
    478 !--       Read namelist
    479           READ ( 11, runtime_parameters, ERR = 15 )
    480           GOTO 18
    481 
    482  15       BACKSPACE( 11 )
    483           READ( 11 , '(A)') line
    484           CALL parin_fail_message( 'runtime_parameters', line )
    485 
    486  16       REWIND ( 11 )
    487           line = ' '
    488           DO WHILE ( INDEX( line, '&d3par' ) == 0 )
    489              READ ( 11, '(A)', END=18 )  line
    490           ENDDO
    491           BACKSPACE ( 11 )
    492 
    493 !
    494 !--       Read namelist
    495           READ ( 11, d3par, ERR = 17, END = 18 )
    496 
    497           message_string = 'namelist d3par is deprecated and will be ' //      &
    498                           'removed in near future. &Please use namelist ' //   &
    499                           'runtime_parameters instead'
    500           CALL message( 'parin', 'PA0487', 0, 1, 0, 6, 0 )
    501 
    502           GOTO 18
    503 
    504  17       BACKSPACE( 11 )
    505           READ( 11 , '(A)') line
    506           CALL parin_fail_message( 'd3par', line )
    507 
    508  18       CONTINUE
    509 
    510 !
    511 !--       Check for module namelists and read them
    512           CALL module_interface_parin
    513 
    514 !
    515 !--       If required, read control parameters from restart file (produced by
    516 !--       a prior run). All PEs are reading from file created by PE0 (see
    517 !--       check_open)
    518           IF ( TRIM( initializing_actions ) == 'read_restart_data' )  THEN
    519 
    520 !
    521 !--          If not set by the user in the runtime parameters, the data format for restart
    522 !--          input needs to be set now! This is normally done later in check parameters.
    523              IF ( TRIM( restart_data_format ) /= 'fortran_binary'  .AND.                           &
    524                   TRIM( restart_data_format ) /= 'mpi'             .AND.                           &
    525                   TRIM( restart_data_format ) /= 'mpi_shared_memory' )  THEN
    526                 message_string = 'illegal restart data format "' // TRIM( restart_data_format ) // '"'
    527                 CALL message( 'parin', 'PA0724', 1, 2, 0, 6, 0 )
    528              ENDIF
    529              IF ( TRIM( restart_data_format_input ) == 'undefined' )  THEN
    530                 restart_data_format_input = restart_data_format
    531              ENDIF
    532 
    533              CALL rrd_global
    534 !
    535 !--          Increment the run count
    536              runnr = runnr + 1
    537 !
    538 !--          In case of a restart run, the number of user-defined profiles on
    539 !--          the restart file (already stored in max_pr_user) has to match the
    540 !--          one given for the current run. max_pr_user_tmp is calculated in
    541 !--          user_parin and max_pr_user is read in via rrd_global.
    542              IF ( max_pr_user /= max_pr_user_tmp )  THEN
    543                 WRITE( message_string, * ) 'the number of user-defined ',      &
    544                       'profiles given in data_output_pr (', max_pr_user_tmp,   &
    545                       ') does not match the one ',                             &
    546                       'found in the restart file (', max_pr_user, ')'
    547                 CALL message( 'user_parin', 'UI0009', 1, 2, 0, 6, 0 )
    548              ENDIF
    549           ELSE
    550              max_pr_user = max_pr_user_tmp
     548       ENDIF
     549
     550
     551!
     552!--    Increment the run count
     553       runnr = runnr + 1
     554!
     555!--    In case of a restart run, the number of user-defined profiles on
     556!--    the restart file (already stored in max_pr_user) has to match the
     557!--    one given for the current run. max_pr_user_tmp is calculated in
     558!--    user_parin and max_pr_user is read in via rrd_global.
     559       IF ( max_pr_user /= max_pr_user_tmp )  THEN
     560          WRITE( message_string, * ) 'the number of user-defined ',      &
     561                 'profiles given in data_output_pr (', max_pr_user_tmp,   &
     562                 ') does not match the one ',                             &
     563                 'found in the restart file (', max_pr_user, ')'
     564          CALL message( 'user_parin', 'UI0009', 1, 2, 0, 6, 0 )
     565       ENDIF
     566    ELSE
     567       max_pr_user = max_pr_user_tmp
     568    ENDIF
     569!
     570!-- Activate spinup
     571    IF ( land_surface .OR. urban_surface )  THEN
     572       IF ( spinup_time > 0.0_wp )  THEN
     573          coupling_start_time = spinup_time
     574          time_since_reference_point = simulated_time - coupling_start_time
     575          IF ( spinup_pt_mean == 9999999.9_wp )  THEN
     576             spinup_pt_mean = pt_surface
    551577          ENDIF
    552 !
    553 !--       Activate spinup
    554           IF ( land_surface .OR. urban_surface )  THEN
    555              IF ( spinup_time > 0.0_wp )  THEN
    556                 coupling_start_time = spinup_time
    557                 time_since_reference_point = simulated_time - coupling_start_time
    558                 IF ( spinup_pt_mean == 9999999.9_wp )  THEN
    559                    spinup_pt_mean = pt_surface
    560                 ENDIF
    561                 end_time = end_time + spinup_time
    562                 IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
    563                    spinup = .TRUE.
    564                 ELSEIF (        TRIM( initializing_actions ) == 'read_restart_data'      &
    565                          .AND.  time_since_reference_point > 0.0_wp )  THEN
    566                    data_output_during_spinup = .FALSE.  !< required for correct ntdim calculation
    567                                                         !< in check_parameters for restart run
    568                 ENDIF
    569              ENDIF
     578          end_time = end_time + spinup_time
     579          IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
     580             spinup = .TRUE.
     581          ELSEIF (        TRIM( initializing_actions ) == 'read_restart_data'      &
     582                   .AND.  time_since_reference_point > 0.0_wp )  THEN
     583             data_output_during_spinup = .FALSE.  !< required for correct ntdim calculation
     584                                                  !< in check_parameters for restart run
    570585          ENDIF
    571 
    572 !
    573 !--       In case of nested runs, explicitly set nesting boundary conditions.
    574 !--       This will overwrite the user settings and basic defaults.
    575 !--       bc_lr and bc_ns always need to be cyclic for vertical nesting.
    576           IF ( nested_run )  THEN
    577              IF ( nesting_mode == 'vertical' )  THEN
    578                 IF (bc_lr /= 'cyclic' .OR. bc_ns /= 'cyclic' )  THEN
    579                    WRITE ( message_string, *) 'bc_lr and bc_ns were set to ,', &
    580                         'cyclic for vertical nesting'
    581                    CALL message( 'parin', 'PA0428', 0, 0, 0, 6, 0 )
    582                    bc_lr   = 'cyclic'
    583                    bc_ns   = 'cyclic'
    584                 ENDIF
    585                 IF ( child_domain )  THEN
    586                    bc_uv_t  = 'nested'
    587                    bc_pt_t  = 'nested'
    588                    bc_q_t   = 'nested'
    589                    bc_s_t   = 'nested'
    590                    bc_cs_t  = 'nested'
    591                    bc_p_t   = 'neumann'
    592                 ENDIF
    593 !
    594 !--          For other nesting modes only set boundary conditions for
    595 !--          nested domains.
    596              ELSE
    597                 IF ( child_domain )  THEN
    598                    bc_lr    = 'nested'
    599                    bc_ns    = 'nested'
    600                    bc_uv_t  = 'nested'
    601                    bc_pt_t  = 'nested'
    602                    bc_q_t   = 'nested'
    603                    bc_s_t   = 'nested'
    604                    bc_cs_t  = 'nested'
    605                    bc_p_t   = 'neumann'
    606                 ENDIF
    607              ENDIF
     586       ENDIF
     587    ENDIF
     588
     589!
     590!-- In case of nested runs, explicitly set nesting boundary conditions.
     591!-- This will overwrite the user settings and basic defaults.
     592!-- bc_lr and bc_ns always need to be cyclic for vertical nesting.
     593    IF ( nested_run )  THEN
     594       IF ( nesting_mode == 'vertical' )  THEN
     595          IF (bc_lr /= 'cyclic' .OR. bc_ns /= 'cyclic' )  THEN
     596             WRITE ( message_string, *) 'bc_lr and bc_ns were set to ,', &
     597                     'cyclic for vertical nesting'
     598             CALL message( 'parin', 'PA0428', 0, 0, 0, 6, 0 )
     599             bc_lr   = 'cyclic'
     600             bc_ns   = 'cyclic'
    608601          ENDIF
    609 !
    610 !--       Set boundary conditions also in case the model is offline-nested in
    611 !--       larger-scale models.
    612           IF ( nesting_offline )  THEN
    613              bc_lr    = 'nesting_offline'
    614              bc_ns    = 'nesting_offline'
    615              bc_uv_t  = 'nesting_offline'
    616              bc_pt_t  = 'nesting_offline'
    617              bc_q_t   = 'nesting_offline'
    618            !  bc_s_t   = 'nesting_offline'  ! scalar boundary condition is not clear yet
    619            !  bc_cs_t  = 'nesting_offline'  ! same for chemical species
     602          IF ( child_domain )  THEN
     603             bc_uv_t  = 'nested'
     604             bc_pt_t  = 'nested'
     605             bc_q_t   = 'nested'
     606             bc_s_t   = 'nested'
     607             bc_cs_t  = 'nested'
    620608             bc_p_t   = 'neumann'
    621609          ENDIF
    622 
    623 !
    624 !--       In case of nested runs, make sure that initializing_actions =
    625 !--       'set_constant_profiles' even though the constant-profiles
    626 !--       initializations for the prognostic variables will be overwritten
    627 !--       by pmci_child_initialize and pmci_parent_initialize. This is,
    628 !--       however, important e.g. to make sure that diagnostic variables
    629 !--       are set properly. An exception is made in case of restart runs and
    630 !--       if user decides to do everything by its own.
    631           IF ( child_domain  .AND.  .NOT. (                                    &
    632                TRIM( initializing_actions ) == 'read_restart_data'      .OR.   &
    633                TRIM( initializing_actions ) == 'set_constant_profiles'  .OR.   &
    634                TRIM( initializing_actions ) == 'by_user' ) )  THEN
    635              message_string = 'initializing_actions = ' //                     &
    636                               TRIM( initializing_actions ) // ' has been ' //  &
    637                               'changed to set_constant_profiles in child ' //  &
    638                               'domain.'
    639              CALL message( 'parin', 'PA0492', 0, 0, 0, 6, 0 )
    640 
    641              initializing_actions = 'set_constant_profiles'
     610!
     611!--    For other nesting modes only set boundary conditions for
     612!--    nested domains.
     613       ELSE
     614          IF ( child_domain )  THEN
     615             bc_lr    = 'nested'
     616             bc_ns    = 'nested'
     617             bc_uv_t  = 'nested'
     618             bc_pt_t  = 'nested'
     619             bc_q_t   = 'nested'
     620             bc_s_t   = 'nested'
     621             bc_cs_t  = 'nested'
     622             bc_p_t   = 'neumann'
    642623          ENDIF
    643 !
    644 !--       Check validity of lateral boundary conditions. This has to be done
    645 !--       here because they are already used in init_pegrid and init_grid and
    646 !--       therefore cannot be check in check_parameters
    647           IF ( bc_lr /= 'cyclic'  .AND.  bc_lr /= 'dirichlet/radiation'  .AND. &
    648                bc_lr /= 'radiation/dirichlet'  .AND.  bc_lr /= 'nested'  .AND. &
    649                bc_lr /= 'nesting_offline' )  THEN
    650              message_string = 'unknown boundary condition: bc_lr = "' // &
    651                               TRIM( bc_lr ) // '"'
    652              CALL message( 'parin', 'PA0049', 1, 2, 0, 6, 0 )
    653           ENDIF
    654           IF ( bc_ns /= 'cyclic'  .AND.  bc_ns /= 'dirichlet/radiation'  .AND. &
    655                bc_ns /= 'radiation/dirichlet'  .AND.  bc_ns /= 'nested'  .AND. &
    656                bc_ns /= 'nesting_offline' )  THEN
    657              message_string = 'unknown boundary condition: bc_ns = "' // &
    658                               TRIM( bc_ns ) // '"'
    659              CALL message( 'parin', 'PA0050', 1, 2, 0, 6, 0 )
    660           ENDIF
    661 !
    662 !--       Set internal variables used for speed optimization in if clauses
    663           IF ( bc_lr /= 'cyclic' )               bc_lr_cyc    = .FALSE.
    664           IF ( bc_lr == 'dirichlet/radiation' )  bc_lr_dirrad = .TRUE.
    665           IF ( bc_lr == 'radiation/dirichlet' )  bc_lr_raddir = .TRUE.
    666           IF ( bc_ns /= 'cyclic' )               bc_ns_cyc    = .FALSE.
    667           IF ( bc_ns == 'dirichlet/radiation' )  bc_ns_dirrad = .TRUE.
    668           IF ( bc_ns == 'radiation/dirichlet' )  bc_ns_raddir = .TRUE.
    669 !
    670 !--       Radiation-Dirichlet conditions are allowed along one of the horizontal directions only.
    671 !--       In general, such conditions along x and y may work, but require a) some code changes
    672 !--       (e.g. concerning allocation of c_u, c_v ... arrays), and b) a careful model setup by the
    673 !--       user, in order to guarantee that there is a clearly defined outflow at two sides.
    674 !--       Otherwise, the radiation condition may produce wrong results.
    675           IF ( ( bc_lr_dirrad .OR. bc_lr_raddir )  .AND.  ( bc_ns_dirrad .OR. bc_ns_raddir ) )  THEN
    676              message_string = 'bc_lr = "' // TRIM( bc_lr ) // '" and bc_ns = "' //                 &
    677                               TRIM( bc_ns ) // '" are not allowed to be set at the same time'
    678              CALL message( 'parin', 'PA0589', 1, 2, 0, 6, 0 )
    679           ENDIF
    680 !
    681 !--       Check in case of initial run, if the grid point numbers are well
    682 !--       defined and allocate some arrays which are already needed in
    683 !--       init_pegrid or check_parameters. During restart jobs, these arrays
    684 !--       will be allocated in rrd_global. All other arrays are allocated
    685 !--       in init_3d_model.
    686           IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
    687 
    688              IF ( nx <= 0 )  THEN
    689                 WRITE( message_string, * ) 'no value or wrong value given',    &
    690                                            ' for nx: nx=', nx
    691                 CALL message( 'parin', 'PA0273', 1, 2, 0, 6, 0 )
    692              ENDIF
    693              IF ( ny <= 0 )  THEN
    694                 WRITE( message_string, * ) 'no value or wrong value given',    &
    695                                            ' for ny: ny=', ny
    696                 CALL message( 'parin', 'PA0274', 1, 2, 0, 6, 0 )
    697              ENDIF
    698              IF ( nz <= 0 )  THEN
    699                 WRITE( message_string, * ) 'no value or wrong value given',    &
    700                                            ' for nz: nz=', nz
    701                 CALL message( 'parin', 'PA0275', 1, 2, 0, 6, 0 )
    702              ENDIF
    703 
    704 !
    705 !--          As a side condition, routine flow_statistics require at least 14
    706 !--          vertical grid levels (they are used to store time-series data)
    707 !>           @todo   Remove this restriction
    708              IF ( nz < 14 )  THEN
    709                 WRITE( message_string, * ) 'nz >= 14 is required'
    710                 CALL message( 'parin', 'PA0362', 1, 2, 0, 6, 0 )
    711              ENDIF
    712 
    713 !
    714 !--          ATTENTION: in case of changes to the following statement please
    715 !--                  also check the allocate statement in routine rrd_global
    716              ALLOCATE( pt_init(0:nz+1), q_init(0:nz+1), s_init(0:nz+1),        &
    717                        ref_state(0:nz+1), sa_init(0:nz+1), ug(0:nz+1),         &
    718                        u_init(0:nz+1), v_init(0:nz+1), vg(0:nz+1),             &
    719                     hom(0:nz+1,2,pr_palm+max_pr_user+max_pr_cs+max_pr_salsa,0:statistic_regions),  &
    720                     hom_sum(0:nz+1,pr_palm+max_pr_user+max_pr_cs+max_pr_salsa,0:statistic_regions) )
    721 
    722              hom = 0.0_wp
    723 
    724           ENDIF
    725 
    726 !
    727 !--       NAMELIST-file is not needed anymore
    728           CALL close_file( 11 )
    729 
    730        ENDIF
    731 #if defined( __parallel )
    732        CALL MPI_BARRIER( MPI_COMM_WORLD, ierr )
    733 #endif
    734     ENDDO
     624       ENDIF
     625    ENDIF
     626!
     627!-- Set boundary conditions also in case the model is offline-nested in
     628!-- larger-scale models.
     629    IF ( nesting_offline )  THEN
     630       bc_lr    = 'nesting_offline'
     631       bc_ns    = 'nesting_offline'
     632       bc_uv_t  = 'nesting_offline'
     633       bc_pt_t  = 'nesting_offline'
     634       bc_q_t   = 'nesting_offline'
     635     !  bc_s_t   = 'nesting_offline'  ! scalar boundary condition is not clear yet
     636     !  bc_cs_t  = 'nesting_offline'  ! same for chemical species
     637       bc_p_t   = 'neumann'
     638    ENDIF
     639
     640!
     641!-- In case of nested runs, make sure that initializing_actions =
     642!-- 'set_constant_profiles' even though the constant-profiles
     643!-- initializations for the prognostic variables will be overwritten
     644!-- by pmci_child_initialize and pmci_parent_initialize. This is,
     645!-- however, important e.g. to make sure that diagnostic variables
     646!-- are set properly. An exception is made in case of restart runs and
     647!-- if user decides to do everything by its own.
     648    IF ( child_domain  .AND.  .NOT. (                                    &
     649         TRIM( initializing_actions ) == 'read_restart_data'      .OR.   &
     650         TRIM( initializing_actions ) == 'set_constant_profiles'  .OR.   &
     651         TRIM( initializing_actions ) == 'by_user' ) )  THEN
     652       message_string = 'initializing_actions = ' //                     &
     653                        TRIM( initializing_actions ) // ' has been ' //  &
     654                        'changed to set_constant_profiles in child ' //  &
     655                        'domain.'
     656       CALL message( 'parin', 'PA0492', 0, 0, 0, 6, 0 )
     657
     658       initializing_actions = 'set_constant_profiles'
     659    ENDIF
     660!
     661!-- Check validity of lateral boundary conditions. This has to be done
     662!-- here because they are already used in init_pegrid and init_grid and
     663!-- therefore cannot be check in check_parameters
     664    IF ( bc_lr /= 'cyclic'  .AND.  bc_lr /= 'dirichlet/radiation'  .AND. &
     665         bc_lr /= 'radiation/dirichlet'  .AND.  bc_lr /= 'nested'  .AND. &
     666         bc_lr /= 'nesting_offline' )  THEN
     667       message_string = 'unknown boundary condition: bc_lr = "' // &
     668                        TRIM( bc_lr ) // '"'
     669       CALL message( 'parin', 'PA0049', 1, 2, 0, 6, 0 )
     670    ENDIF
     671    IF ( bc_ns /= 'cyclic'  .AND.  bc_ns /= 'dirichlet/radiation'  .AND. &
     672         bc_ns /= 'radiation/dirichlet'  .AND.  bc_ns /= 'nested'  .AND. &
     673         bc_ns /= 'nesting_offline' )  THEN
     674       message_string = 'unknown boundary condition: bc_ns = "' // &
     675                        TRIM( bc_ns ) // '"'
     676       CALL message( 'parin', 'PA0050', 1, 2, 0, 6, 0 )
     677    ENDIF
     678!
     679!-- Set internal variables used for speed optimization in if clauses
     680    IF ( bc_lr /= 'cyclic' )               bc_lr_cyc    = .FALSE.
     681    IF ( bc_lr == 'dirichlet/radiation' )  bc_lr_dirrad = .TRUE.
     682    IF ( bc_lr == 'radiation/dirichlet' )  bc_lr_raddir = .TRUE.
     683    IF ( bc_ns /= 'cyclic' )               bc_ns_cyc    = .FALSE.
     684    IF ( bc_ns == 'dirichlet/radiation' )  bc_ns_dirrad = .TRUE.
     685    IF ( bc_ns == 'radiation/dirichlet' )  bc_ns_raddir = .TRUE.
     686!
     687!-- Radiation-Dirichlet conditions are allowed along one of the horizontal directions only.
     688!-- In general, such conditions along x and y may work, but require a) some code changes
     689!-- (e.g. concerning allocation of c_u, c_v ... arrays), and b) a careful model setup by the
     690!-- user, in order to guarantee that there is a clearly defined outflow at two sides.
     691!-- Otherwise, the radiation condition may produce wrong results.
     692    IF ( ( bc_lr_dirrad .OR. bc_lr_raddir )  .AND.  ( bc_ns_dirrad .OR. bc_ns_raddir ) )  THEN
     693       message_string = 'bc_lr = "' // TRIM( bc_lr ) // '" and bc_ns = "' //                 &
     694                        TRIM( bc_ns ) // '" are not allowed to be set at the same time'
     695       CALL message( 'parin', 'PA0589', 1, 2, 0, 6, 0 )
     696    ENDIF
     697!
     698!-- Check in case of initial run, if the grid point numbers are well
     699!-- defined and allocate some arrays which are already needed in
     700!-- init_pegrid or check_parameters. During restart jobs, these arrays
     701!-- will be allocated in rrd_global. All other arrays are allocated
     702!-- in init_3d_model.
     703    IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
     704
     705       IF ( nx <= 0 )  THEN
     706          WRITE( message_string, * ) 'no value or wrong value given',    &
     707                                     ' for nx: nx=', nx
     708          CALL message( 'parin', 'PA0273', 1, 2, 0, 6, 0 )
     709       ENDIF
     710       IF ( ny <= 0 )  THEN
     711          WRITE( message_string, * ) 'no value or wrong value given',    &
     712                                     ' for ny: ny=', ny
     713          CALL message( 'parin', 'PA0274', 1, 2, 0, 6, 0 )
     714       ENDIF
     715       IF ( nz <= 0 )  THEN
     716          WRITE( message_string, * ) 'no value or wrong value given',    &
     717                                     ' for nz: nz=', nz
     718          CALL message( 'parin', 'PA0275', 1, 2, 0, 6, 0 )
     719       ENDIF
     720
     721!
     722!--    As a side condition, routine flow_statistics require at least 14
     723!--    vertical grid levels (they are used to store time-series data)
     724!>     @todo   Remove this restriction
     725       IF ( nz < 14 )  THEN
     726          WRITE( message_string, * ) 'nz >= 14 is required'
     727          CALL message( 'parin', 'PA0362', 1, 2, 0, 6, 0 )
     728       ENDIF
     729
     730!
     731!--    ATTENTION: in case of changes to the following statement please
     732!--               also check the allocate statement in routine rrd_global
     733       ALLOCATE( pt_init(0:nz+1), q_init(0:nz+1), s_init(0:nz+1),        &
     734                 ref_state(0:nz+1), sa_init(0:nz+1), ug(0:nz+1),         &
     735                 u_init(0:nz+1), v_init(0:nz+1), vg(0:nz+1),             &
     736                 hom(0:nz+1,2,pr_palm+max_pr_user+max_pr_cs+max_pr_salsa,0:statistic_regions),  &
     737                 hom_sum(0:nz+1,pr_palm+max_pr_user+max_pr_cs+max_pr_salsa,0:statistic_regions) )
     738
     739       hom = 0.0_wp
     740
     741    ENDIF
     742
     743!
     744!-- NAMELIST-file is not needed anymore
     745    CALL close_file( 11 )
    735746
    736747    CALL location_message( 'reading NAMELIST parameters from PARIN', 'finished' )
  • palm/trunk/SOURCE/radiation_model_mod.f90

    r4780 r4783  
    2323! Current revisions:
    2424! ------------------
    25 ! Albedo parameter list extended - building facades added
     25!
    2626!
    2727! Former revisions:
    2828! -----------------
    2929! $Id$
     30! Albedo parameter list extended - building facades added
     31!
     32! 4780 2020-11-10 11:17:10Z suehring
    3033! Enable 3D data output also with 64-bit precision
    3134!
  • palm/trunk/SOURCE/urban_surface_mod.f90

    r4780 r4783  
    2222! Current revisions:
    2323! -----------------
     24!
     25!
     26! Former revisions:
     27! -----------------
     28! $Id$
    2429! - Default building parameters updated and extended (responsible: S. Rissmann)
    2530! - First and second wall layer initialized with individual building properties rather than with
    2631!   with the same properties (heat capacity and conductivity)
    2732!
    28 ! Former revisions:
    29 ! -----------------
    30 ! $Id$
     33! 4780 2020-11-10 11:17:10Z suehring
    3134! Enable 3D data output also with 64-bit precision
    3235!
Note: See TracChangeset for help on using the changeset viewer.