Changeset 146


Ignore:
Timestamp:
Jan 17, 2008 1:08:34 PM (16 years ago)
Author:
raasch
Message:

further updates for turbulent inflow: PE-grid change for restart is working

Location:
palm/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SCRIPTS/mrun

    r145 r146  
    207207 read_from_config=""
    208208 restart_run=false
    209 # return_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}')
     209 return_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}')
    210210 if [[ $return_addres = 130.75.105.158 ]]
    211211 then
  • palm/trunk/SOURCE/CURRENT_MODIFICATIONS

    r145 r146  
    2929to ..._var_list, hom_sum is now allocated in parin instead of init_3d_model
    3030
    31 init_3d_model, parin, read_var_list, read_3d_binary, write_var_list, write_3d_binary
     31npex, npey moved from inipar- to d3par-namelist (parin)
     32
     33myid_char14 removed. This was used since on IBM machines the process rank may
     34be changed when the final communicator is defined, in order to save the
     35preliminary processor-id for opening the binary output file for restarts
     36(unit 14), because otherwise a mismatch occured when reading this file in a
     37restart job. This mechanism is not needed any more since the subdomain
     38informations are now contained in file _0000. (parin, check_open)
     39
     40check_open, init_3d_model, modules, parin, read_var_list, read_3d_binary, write_var_list, write_3d_binary
    3241
    3342
  • palm/trunk/SOURCE/calc_spectra.f90

    r144 r146  
    291291    IF ( myid == 0 )  THEN
    292292!
    293 !--    Sum of spectra for later averaging (see routine plot_spectra)
     293!--    Sum of spectra for later averaging (see routine data_output_spectra)
    294294!--    Temperton fft results need to be normalized
    295295       IF ( fft_method == 'temperton-algorithm' )  THEN
     
    307307
    308308!
    309 !-- n_sp_x is needed by plot_spectra_x
     309!-- n_sp_x is needed by data_output_spectra_x
    310310    n_sp_x = n
    311311
     
    403403    IF ( myid == 0 )  THEN
    404404!
    405 !--    Sum of spectra for later averaging (see routine plot_spectra)
     405!--    Sum of spectra for later averaging (see routine data_output_spectra)
    406406!--    Temperton fft results need to be normalized
    407407       IF ( fft_method == 'temperton-algorithm' )  THEN
     
    419419
    420420!
    421 !-- n_sp_y is needed by plot_spectra_y
     421!-- n_sp_y is needed by data_output_spectra_y
    422422    n_sp_y = n
    423423
  • palm/trunk/SOURCE/check_open.f90

    r143 r146  
    55! -----------------
    66! First opening of unit 13 openes file _0000 on all PEs (parallel version)
    7 ! because only this file contains the global variables
     7! because only this file contains the global variables,
     8! myid_char_14 removed
    89!
    910! Former revisions:
     
    191192             CALL MPI_BARRIER( comm2d, ierr )
    192193#endif
    193              OPEN ( 14, FILE='BINOUT'//TRIM(coupling_char)//'/'//myid_char_14, &
     194             OPEN ( 14, FILE='BINOUT'//TRIM(coupling_char)//'/'//myid_char, &
    194195                        FORM='UNFORMATTED', POSITION='APPEND' )
    195196          ENDIF
  • palm/trunk/SOURCE/init_3d_model.f90

    r143 r146  
    77! Actual revisions:
    88! -----------------
    9 ! Allocation of hom_sum moved to parin
     9! Allocation of hom_sum moved to parin, initialization of spectrum_x|y directly
     10! after allocating theses arrays
    1011!
    1112! Former revisions:
     
    234235       ALLOCATE( spectrum_x( 1:nx/2, 1:10, 1:10 ), &
    235236                 spectrum_y( 1:ny/2, 1:10, 1:10 ) )
     237       spectrum_x = 0.0
     238       spectrum_y = 0.0
    236239    ENDIF
    237240
     
    809812          ql = 0.0
    810813          IF ( precipitation )  precipitation_amount = 0.0
    811        ENDIF
    812 
    813 !
    814 !--    Initialize spectra
    815        IF ( dt_dosp /= 9999999.9 )  THEN
    816           spectrum_x = 0.0
    817           spectrum_y = 0.0
    818814       ENDIF
    819815
  • palm/trunk/SOURCE/modules.f90

    r145 r146  
    66! -----------------
    77! +hor_index_bounds, hor_index_bounds_previous_run, numprocs_previous_run
     8! -myid_char_14
    89!
    910! Former revisions:
     
    957958#endif
    958959#endif
    959     CHARACTER(LEN=5)       ::  myid_char = '', myid_char_14 = ''
     960    CHARACTER(LEN=5)       ::  myid_char = ''
    960961    INTEGER                ::  myid=0, npex = -1, npey = -1, numprocs = 1, &
    961962                               numprocs_previous_run = -1,                 &
  • palm/trunk/SOURCE/parin.f90

    r145 r146  
    44! Actual revisions:
    55! -----------------
    6 ! Allocation of hom_sum moved from init_3d_model to here
     6! Allocation of hom_sum moved from init_3d_model to here,
     7! npex, npey moved from inipar to d3par, setting of myid_char_14 removed,
     8! lad is allways allocated
    79!
    810! Former revisions:
     
    8789             lad_vertical_gradient, lad_vertical_gradient_level, &
    8890             long_filter_factor, loop_optimization, mixing_length_1d, &
    89              momentum_advec, netcdf_precision, npex, npey, nsor_ini, nx, ny, &
     91             momentum_advec, netcdf_precision, nsor_ini, nx, ny, &
    9092             nz, ocean, omega, outflow_damping_width, overshoot_limit_e, &
    9193             overshoot_limit_pt, overshoot_limit_u, overshoot_limit_v, &
     
    126128                       end_time, force_print_header, mg_cycles, &
    127129                       mg_switch_to_pe0_level, netcdf_64bit, netcdf_64bit_3d, &
    128                        ngsrb, normalizing_region, nsor, nz_do3d, omega_sor, &
     130                       ngsrb, normalizing_region, npex, npey, nsor, nz_do3d, &
     131                       omega_sor, &
    129132                       prandtl_number, precipitation_amount_interval, &
    130133                       profile_columns, profile_rows, psolver, &
     
    142145                       return_username, run_identifier, tasks_per_node, &
    143146                       write_binary
    144 
    145 
    146 #if defined( __parallel )
    147 !
    148 !-- Preliminary determination of processor-id which is needed here to open the
    149 !-- input files belonging to the corresponding processor and to produce
    150 !-- messages by PE0 only (myid and myid_char are later determined in
    151 !-- init_pegrid)
    152     CALL MPI_COMM_RANK( comm_palm, myid, ierr )
    153     WRITE (myid_char,'(''_'',I4.4)')  myid
    154 !
    155 !-- Since on IBM machines the process rank may be changed when the final
    156 !-- communicator is defined, save the preliminary processor-id for opening
    157 !-- the binary output file for restarts (unit 14), because otherwise
    158 !-- a mismatch occurs when reading this file in the next job
    159     myid_char_14 = myid_char
    160 #endif
    161147
    162148!
     
    186172!
    187173!-- If required, read control parameters from restart file (produced by
    188 !-- a prior run)
     174!-- a prior run). All PEs are reading from file created by PE0 (see check_open)
    189175 12 IF ( TRIM( initializing_actions ) == 'read_restart_data' )  THEN
    190176
    191177       CALL read_var_list
     178!
     179!--    The restart file will be reopened when reading the subdomain data
     180       CALL close_file( 13 )
     181
    192182!
    193183!--    Increment the run count
     
    242232       ENDIF
    243233
    244        ALLOCATE( ug(0:nz+1), vg(0:nz+1), &
    245                  pt_init(0:nz+1), q_init(0:nz+1), sa_init(0:nz+1),          &
    246                  u_init(0:nz+1), v_init(0:nz+1),                            &
    247                  hom(0:nz+1,2,pr_palm+max_pr_user,0:statistic_regions),     &
     234       ALLOCATE( lad(0:nz+1),pt_init(0:nz+1), q_init(0:nz+1), sa_init(0:nz+1), &
     235                 ug(0:nz+1), u_init(0:nz+1), v_init(0:nz+1), vg(0:nz+1),       &
     236                 hom(0:nz+1,2,pr_palm+max_pr_user,0:statistic_regions),        &
    248237                 hom_sum(0:nz+1,pr_palm+max_pr_user,0:statistic_regions) )
    249238       hom = 0.0
    250 
    251        IF ( plant_canopy ) THEN
    252           ALLOCATE( lad(0:nz+1) )
    253           lad(:) = 0.0
    254        ENDIF
    255239
    256240    ENDIF
  • palm/trunk/SOURCE/read_3d_binary.f90

    r145 r146  
    44! Actual revisions:
    55! -----------------
    6 ! Restart file has to be re-opened on all PEs except PE0
    7 ! +call of user_read_restart_data,
    8 ! -dopr_time_count,
     6! Files from which restart data are to be read are determined and subsequently
     7! opened,
     8! +call of user_read_restart_data, -dopr_time_count,
    99! hom_sum, volume_flow_area, volume_flow_initial moved to read_var_list,
    1010! reading of old profil parameters (cross_..., dopr_crossindex, profile_***)
    11 ! removed
     11! removed, initialization of spectrum_x|y removed
    1212!
    1313! Former revisions:
     
    5757    IMPLICIT NONE
    5858
     59    CHARACTER (LEN=5)  ::  myid_char_save
    5960    CHARACTER (LEN=10) ::  binary_version, version_on_file
    6061    CHARACTER (LEN=20) ::  field_chr
    6162
    62     INTEGER ::  idum1, myid_on_file, numprocs_on_file, nxl_on_file, &
    63                 nxr_on_file, nyn_on_file, nys_on_file, nzb_on_file, nzt_on_file
    64 
    65 !
    66 !-- Read data from previous model run. unit 13 already opened in parin
     63    INTEGER ::  files_to_be_opened, i, idum1, j, myid_on_file,                &
     64                numprocs_on_file, nxlc, nxl_on_file, nxrc, nxr_on_file, nync, &
     65                nyn_on_file, nysc, nys_on_file, nzb_on_file, nzt_on_file
     66
     67    INTEGER, DIMENSION(:), ALLOCATABLE ::  file_list
     68
     69    REAL, DIMENSION(:,:), ALLOCATABLE     ::  tmp_2d
     70    REAL, DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3d, tmp_3dw
     71    REAL, DIMENSION(:,:,:,:), ALLOCATABLE ::  tmp_4d
     72
     73
     74!
     75!-- Read data from previous model run.
    6776    CALL cpu_log( log_point_s(14), 'read_3d_binary', 'start' )
    6877
    6978!
    70 !-- Restart file has to be re-opened on all PEs except PE0
    71     CALL check_open( 13 )
    72 
    73 !
    74 !-- First compare the version numbers
    75     READ ( 13 )  version_on_file
    76     binary_version = '3.1'
    77     IF ( TRIM( version_on_file ) /= TRIM( binary_version ) )  THEN
    78        IF ( myid == 0 )  THEN
    79           PRINT*, '+++ init_3d_model: version mismatch concerning data ', &
    80                   'from prior run'
    81           PRINT*, '        version on file    = "', TRIM( version_on_file ),&
    82                   '"'
    83           PRINT*, '        version in program = "', TRIM( binary_version ), &
    84                   '"'
     79!-- Check which of the restart files contain data needed for the subdomain
     80!-- of this PE
     81    files_to_be_opened = 0
     82    ALLOCATE( file_list(numprocs_previous_run) )
     83
     84    DO  i = 1, numprocs_previous_run
     85
     86!
     87!--    Only data which overlap with the current subdomain have to be read
     88       IF ( hor_index_bounds_previous_run(1,i-1) <= nxr  .AND.  &
     89            hor_index_bounds_previous_run(2,i-1) >= nxl  .AND.  &
     90            hor_index_bounds_previous_run(3,i-1) <= nyn  .AND.  &
     91            hor_index_bounds_previous_run(4,i-1) >= nys )  THEN
     92
     93          files_to_be_opened = files_to_be_opened + 1
     94          file_list(files_to_be_opened) = i-1
     95
    8596       ENDIF
    86        CALL local_stop
     97
     98    ENDDO
     99
     100    myid_char_save = myid_char
     101
     102    DO i = 1, numprocs_previous_run
     103       WRITE (9,*) 'i=',i-1, ' ibs= ',hor_index_bounds_previous_run(1:4,i-1)
     104    ENDDO
     105    CALL local_flush( 9 )
     106
     107    IF ( files_to_be_opened /= 1  .OR.  numprocs /= numprocs_previous_run ) &
     108    THEN
     109       PRINT*, '*** number of PEs or virtual PE-grid changed in restart run'
     110       PRINT*, '    PE', myid, ' will read from files ', &
     111               file_list(1:files_to_be_opened)
    87112    ENDIF
    88113
    89114!
    90 !-- Read and compare number of processors, processor-id and array ranges
    91     READ ( 13 )  numprocs_on_file, myid_on_file, nxl_on_file, nxr_on_file, &
    92                  nys_on_file, nyn_on_file, nzb_on_file, nzt_on_file
    93 
    94     IF ( numprocs_on_file /= numprocs )  THEN
    95        PRINT*, '+++ init_3d_model: mismatch between actual data and data '
    96        PRINT*, '                   from prior run on PE ', myid
    97        PRINT*, '                   numprocs on file = ', numprocs_on_file
    98        PRINT*, '                   numprocs         = ', numprocs
    99        CALL local_stop
    100     ENDIF
    101 
    102     IF ( myid_on_file /= myid )  THEN
    103        PRINT*, '+++ init_3d_model: mismatch between actual data and data '
    104        PRINT*, '                   from prior run'
    105        PRINT*, '                   myid_on_file = ', myid_on_file
    106        PRINT*, '                   myid         = ', myid
     115!-- Read data from all restart files determined above
     116    DO  i = 1, files_to_be_opened
     117
     118       j = file_list(i)
     119!
     120!--    Set the filename (underscore followed by four digit processor id)
     121       WRITE (myid_char,'(''_'',I4.4)')  j
     122       WRITE (9,*) 'myid=',myid,' opening file "',myid_char,'"'
     123       CALL local_flush( 9 )
     124
     125!
     126!--    Open the restart file. If this file has been created by PE0 (_0000),
     127!--    the global variables at the beginning of the file have to be skipped
     128!--    first.
     129       CALL check_open( 13 )
     130       IF ( j == 0 )  CALL skip_var_list
     131
     132!
     133!--    First compare the version numbers
     134       READ ( 13 )  version_on_file
     135       binary_version = '3.1'
     136       IF ( TRIM( version_on_file ) /= TRIM( binary_version ) )  THEN
     137          IF ( myid == 0 )  THEN
     138             PRINT*, '+++ init_3d_model: version mismatch concerning data ', &
     139                     'from prior run'
     140             PRINT*, '        version on file    = "', TRIM( version_on_file ),&
     141                     '"'
     142             PRINT*, '        version in program = "', TRIM( binary_version ), &
     143                     '"'
     144          ENDIF
     145          CALL local_stop
     146       ENDIF
     147
     148!
     149!--    Read number of processors, processor-id, and array ranges.
     150!--    Compare the array ranges with those stored in the index bound array.
     151       READ ( 13 )  numprocs_on_file, myid_on_file, nxl_on_file, nxr_on_file, &
     152                    nys_on_file, nyn_on_file, nzb_on_file, nzt_on_file
     153
     154       IF ( nxl_on_file /= hor_index_bounds_previous_run(1,j) )  THEN
     155          PRINT*, '+++ read_3d_binary: problem with index bound nxl on ', &
     156                       ' restart file "', myid_char, '"'
     157          PRINT*, '                    nxl = ', nxl_on_file, ' but it should be'
     158          PRINT*, '                    = ', hor_index_bounds_previous_run(1,j)
     159          PRINT*, '                    from the index bound information array'
    107160#if defined( __parallel )
    108        CALL MPI_ABORT( comm2d, 9999, ierr )
     161          CALL MPI_ABORT( comm2d, 9999, ierr )
    109162#else
    110        CALL local_stop
     163          CALL local_stop
    111164#endif
    112     ENDIF
    113 
    114     IF ( nxl_on_file /= nxl )  THEN
    115        PRINT*, '+++ init_3d_model: mismatch between actual data and data '
    116        PRINT*, '                   from prior run on PE ', myid
    117        PRINT*, '                   nxl on file = ', nxl_on_file
    118        PRINT*, '                   nxl         = ', nxl
     165       ENDIF
     166
     167       IF ( nxr_on_file /= hor_index_bounds_previous_run(2,j) )  THEN
     168          PRINT*, '+++ read_3d_binary: problem with index bound nxr on ', &
     169                       ' restart file "', myid_char, '"'
     170          PRINT*, '                    nxr = ', nxr_on_file, ' but it should be'
     171          PRINT*, '                    = ', hor_index_bounds_previous_run(2,j)
     172          PRINT*, '                    from the index bound information array'
    119173#if defined( __parallel )
    120        CALL MPI_ABORT( comm2d, 9999, ierr )
     174          CALL MPI_ABORT( comm2d, 9999, ierr )
    121175#else
    122        CALL local_stop
     176          CALL local_stop
    123177#endif
    124     ENDIF
    125 
    126     IF ( nxr_on_file /= nxr )  THEN
    127        PRINT*, '+++ init_3d_model: mismatch between actual data and data '
    128        PRINT*, '                   from prior run on PE ', myid
    129        PRINT*, '                   nxr on file = ', nxr_on_file
    130        PRINT*, '                   nxr         = ', nxr
     178       ENDIF
     179
     180       IF ( nys_on_file /= hor_index_bounds_previous_run(3,j) )  THEN
     181          PRINT*, '+++ read_3d_binary: problem with index bound nys on ', &
     182                       ' restart file "', myid_char, '"'
     183          PRINT*, '                    nys = ', nys_on_file, ' but it should be'
     184          PRINT*, '                    = ', hor_index_bounds_previous_run(3,j)
     185          PRINT*, '                    from the index bound information array'
    131186#if defined( __parallel )
    132        CALL MPI_ABORT( comm2d, 9999, ierr )
     187          CALL MPI_ABORT( comm2d, 9999, ierr )
    133188#else
    134        CALL local_stop
     189          CALL local_stop
    135190#endif
    136     ENDIF
    137 
    138     IF ( nys_on_file /= nys )  THEN
    139        PRINT*, '+++ init_3d_model: mismatch between actual data and data '
    140        PRINT*, '                   from prior run on PE ', myid
    141        PRINT*, '                   nys on file = ', nys_on_file
    142        PRINT*, '                   nys         = ', nys
     191       ENDIF
     192
     193       IF ( nyn_on_file /= hor_index_bounds_previous_run(4,j) )  THEN
     194          PRINT*, '+++ read_3d_binary: problem with index bound nyn on ', &
     195                       ' restart file "', myid_char, '"'
     196          PRINT*, '                    nyn = ', nyn_on_file, ' but it should be'
     197          PRINT*, '                    = ', hor_index_bounds_previous_run(4,j)
     198          PRINT*, '                    from the index bound information array'
    143199#if defined( __parallel )
    144        CALL MPI_ABORT( comm2d, 9999, ierr )
     200          CALL MPI_ABORT( comm2d, 9999, ierr )
    145201#else
    146        CALL local_stop
     202          CALL local_stop
    147203#endif
    148     ENDIF
    149 
    150     IF ( nyn_on_file /= nyn )  THEN
    151        PRINT*, '+++ init_3d_model: mismatch between actual data and data '
    152        PRINT*, '                   from prior run on PE ', myid
    153        PRINT*, '                   nyn on file = ', nyn_on_file
    154        PRINT*, '                   nyn         = ', nyn
    155 #if defined( __parallel )
    156        CALL MPI_ABORT( comm2d, 9999, ierr )
    157 #else
    158        CALL local_stop
    159 #endif
    160     ENDIF
    161 
    162     IF ( nzb_on_file /= nzb )  THEN
    163        PRINT*, '+++ init_3d_model: mismatch between actual data and data '
    164        PRINT*, '                   from prior run on PE ', myid
    165        PRINT*, '                   nzb on file = ', nzb_on_file
    166        PRINT*, '                   nzb         = ', nzb
    167        CALL local_stop
    168     ENDIF
    169 
    170     IF ( nzt_on_file /= nzt )  THEN
    171        PRINT*, '+++ init_3d_model: mismatch between actual data and data '
    172        PRINT*, '                   from prior run on PE ', myid
    173        PRINT*, '                   nzt on file = ', nzt_on_file
    174        PRINT*, '                   nzt         = ', nzt
    175        CALL local_stop
    176     ENDIF
    177 
    178 !
    179 !-- Initialize spectra (for the case of just starting spectra computation
    180 !-- in continuation runs)
    181     IF ( dt_dosp /= 9999999.9 )  THEN
    182        spectrum_x = 0.0
    183        spectrum_y = 0.0
    184     ENDIF
    185 
    186 !
    187 !-- Read arrays
    188 !-- ATTENTION: If the following read commands have been altered, the
    189 !-- ---------- version number of the variable binary_version must be altered,
    190 !--            too. Furthermore, the output list of arrays in write_3d_binary
    191 !--            must also be altered accordingly.
    192     READ ( 13 )  field_chr
    193     DO  WHILE ( TRIM( field_chr ) /= '*** end ***' )
    194 
    195        SELECT CASE ( TRIM( field_chr ) )
    196 
    197           CASE ( 'e' )
    198              READ ( 13 )  e
    199           CASE ( 'e_av' )
    200              ALLOCATE( e_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    201              READ ( 13 )  e_av
    202           CASE ( 'e_m' )
    203              READ ( 13 )  e_m
    204           CASE ( 'iran' )
    205              READ ( 13 )  iran, iran_part
    206           CASE ( 'kh' )
    207              READ ( 13 )  kh
    208           CASE ( 'kh_m' )
    209              READ ( 13 )  kh_m
    210           CASE ( 'km' )
    211              READ ( 13 )  km
    212           CASE ( 'km_m' )
    213              READ ( 13 )  km_m
    214           CASE ( 'lwp_av' )
    215              ALLOCATE( lwp_av(nys-1:nyn+1,nxl-1:nxr+1) )
    216              READ ( 13 )  lwp_av
    217           CASE ( 'p' )
    218              READ ( 13 )  p
    219           CASE ( 'p_av' )
    220              ALLOCATE( p_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    221              READ ( 13 )  p_av
    222           CASE ( 'pc_av' )
    223              ALLOCATE( pc_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    224              READ ( 13 )  pc_av
    225           CASE ( 'pr_av' )
    226              ALLOCATE( pr_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    227              READ ( 13 )  pr_av
    228           CASE ( 'precipitation_amount' )
    229              READ ( 13 )  precipitation_amount
    230           CASE ( 'precipitation_rate_a' )
    231              ALLOCATE( precipitation_rate_av(nys-1:nyn+1,nxl-1:nxr+1) )
    232              READ ( 13 )  precipitation_rate_av
    233           CASE ( 'pt' )
    234              READ ( 13 )  pt
    235           CASE ( 'pt_av' )
    236              ALLOCATE( pt_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    237              READ ( 13 )  pt_av
    238           CASE ( 'pt_m' )
    239              READ ( 13 )  pt_m
    240           CASE ( 'q' )
    241              READ ( 13 )  q
    242           CASE ( 'q_av' )
    243              ALLOCATE( q_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    244              READ ( 13 )  q_av
    245           CASE ( 'q_m' )
    246              READ ( 13 )  q_m
    247           CASE ( 'ql' )
    248              READ ( 13 )  ql
    249           CASE ( 'ql_av' )
    250              ALLOCATE( ql_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    251              READ ( 13 )  ql_av
    252           CASE ( 'ql_c_av' )
    253              ALLOCATE( ql_c_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    254              READ ( 13 )  ql_c_av
    255           CASE ( 'ql_v_av' )
    256              ALLOCATE( ql_v_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    257              READ ( 13 )  ql_v_av
    258           CASE ( 'ql_vp_av' )
    259              ALLOCATE( ql_vp_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    260              READ ( 13 )  ql_vp_av
    261           CASE ( 'qs' )
    262              READ ( 13 )  qs
    263           CASE ( 'qsws' )
    264              READ ( 13 )  qsws
    265           CASE ( 'qsws_m' )
    266              READ ( 13 )  qsws_m
    267           CASE ( 'qswst' )
    268              READ ( 13 )  qswst
    269           CASE ( 'qswst_m' )
    270              READ ( 13 )  qswst_m
    271           CASE ( 'qv_av' )
    272              ALLOCATE( qv_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    273              READ ( 13 )  qv_av
    274           CASE ( 'random_iv' )
    275              READ ( 13 )  random_iv
    276              READ ( 13 )  random_iy
    277           CASE ( 'rho_av' )
    278              ALLOCATE( rho_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    279              READ ( 13 )  rho_av
    280           CASE ( 'rif' )
    281              READ ( 13 )  rif
    282           CASE ( 'rif_m' )
    283              READ ( 13 )  rif_m
    284           CASE ( 'rif_wall' )
    285              READ ( 13 )  rif_wall
    286           CASE ( 's_av' )
    287              ALLOCATE( s_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    288              READ ( 13 )  s_av
    289           CASE ( 'sa' )
    290              READ ( 13 )  sa
    291           CASE ( 'sa_av' )
    292              ALLOCATE( sa_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    293              READ ( 13 )  sa_av
    294           CASE ( 'saswsb' )
    295              READ ( 13 )  saswsb
    296           CASE ( 'saswst' )
    297              READ ( 13 )  saswst
    298           CASE ( 'shf' )
    299              READ ( 13 )  shf
    300           CASE ( 'shf_m' )
    301              READ ( 13 )  shf_m
    302           CASE ( 'spectrum_x' )
    303              READ ( 13 )  spectrum_x
    304           CASE ( 'spectrum_y' )
    305              READ ( 13 )  spectrum_y
    306           CASE ( 'ts' )
    307              READ ( 13 )  ts
    308           CASE ( 'ts_av' )
    309              ALLOCATE( ts_av(nys-1:nyn+1,nxl-1:nxr+1) )
    310              READ ( 13 )  ts_av
    311           CASE ( 'tswst' )
    312              READ ( 13 )  tswst
    313           CASE ( 'tswst_m' )
    314              READ ( 13 )  tswst_m
    315           CASE ( 'u' )
    316              READ ( 13 )  u
    317           CASE ( 'u_av' )
    318              ALLOCATE( u_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    319              READ ( 13 )  u_av
    320           CASE ( 'u_m' )
    321              READ ( 13 )  u_m
    322           CASE ( 'u_m_l' )
    323              READ ( 13 )  u_m_l
    324           CASE ( 'u_m_n' )
    325              READ ( 13 )  u_m_n
    326           CASE ( 'u_m_r' )
    327              READ ( 13 )  u_m_r
    328           CASE ( 'u_m_s' )
    329              READ ( 13 )  u_m_s
    330           CASE ( 'us' )
    331              READ ( 13 )  us
    332           CASE ( 'usws' )
    333              READ ( 13 )  usws
    334           CASE ( 'uswst' )
    335              READ ( 13 )  uswst
    336           CASE ( 'usws_m' )
    337              READ ( 13 )  usws_m
    338           CASE ( 'uswst_m' )
    339              READ ( 13 )  uswst_m
    340           CASE ( 'us_av' )
    341              ALLOCATE( us_av(nys-1:nyn+1,nxl-1:nxr+1) )
    342              READ ( 13 )  us_av
    343           CASE ( 'v' )
    344              READ ( 13 )  v
    345           CASE ( 'v_av' )
    346              ALLOCATE( v_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    347              READ ( 13 )  v_av
    348           CASE ( 'v_m' )
    349              READ (13 )   v_m
    350           CASE ( 'v_m_l' )
    351              READ ( 13 )  v_m_l
    352           CASE ( 'v_m_n' )
    353              READ ( 13 )  v_m_n
    354           CASE ( 'v_m_r' )
    355              READ ( 13 )  v_m_r
    356           CASE ( 'v_m_s' )
    357              READ ( 13 )  v_m_s
    358           CASE ( 'vpt' )
    359              READ ( 13 )  vpt
    360           CASE ( 'vpt_av' )
    361              ALLOCATE( vpt_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    362              READ ( 13 )  vpt_av
    363           CASE ( 'vpt_m' )
    364              READ ( 13 )  vpt_m
    365           CASE ( 'vsws' )
    366              READ ( 13 )  vsws
    367           CASE ( 'vswst' )
    368              READ ( 13 )  vswst
    369           CASE ( 'vsws_m' )
    370              READ ( 13 )  vsws_m
    371           CASE ( 'vswst_m' )
    372              READ ( 13 )  vswst_m
    373           CASE ( 'w' )
    374              READ ( 13 )  w
    375           CASE ( 'w_av' )
    376              ALLOCATE( w_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
    377              READ ( 13 )  w_av
    378           CASE ( 'w_m' )
    379              READ ( 13 )  w_m
    380           CASE ( 'w_m_l' )
    381              READ ( 13 )  w_m_l
    382           CASE ( 'w_m_n' )
    383              READ ( 13 )  w_m_n
    384           CASE ( 'w_m_r' )
    385              READ ( 13 )  w_m_r
    386           CASE ( 'w_m_s' )
    387              READ ( 13 )  w_m_s
    388           CASE ( 'z0' )
    389              READ ( 13 )  z0
    390           CASE ( 'z0_av' )
    391              ALLOCATE( z0_av(nys-1:nyn+1,nxl-1:nxr+1) )
    392              READ ( 13 )  z0_av
    393 
    394           CASE DEFAULT
    395              PRINT*, '+++ init_3d_model: unknown field named "', &
    396                      TRIM( field_chr ), '" found in'
    397              PRINT*, '                   data from prior run on PE ', myid
    398              CALL local_stop
    399 
    400        END SELECT
    401 !
    402 !--    Read next character string
     204       ENDIF
     205
     206       IF ( nzb_on_file /= nzb )  THEN
     207          PRINT*, '+++ read_3d_binary: mismatch between actual data and data '
     208          PRINT*, '                    from prior run on PE ', myid
     209          PRINT*, '                    nzb on file = ', nzb_on_file
     210          PRINT*, '                    nzb         = ', nzb
     211          CALL local_stop
     212       ENDIF
     213
     214       IF ( nzt_on_file /= nzt )  THEN
     215          PRINT*, '+++ read_3d_binary: mismatch between actual data and data '
     216          PRINT*, '                    from prior run on PE ', myid
     217          PRINT*, '                    nzt on file = ', nzt_on_file
     218          PRINT*, '                    nzt         = ', nzt
     219          CALL local_stop
     220       ENDIF
     221
     222!
     223!--    Allocate temporary arrays sized as the arrays on the restart file
     224       ALLOCATE( tmp_2d(nys_on_file-1:nyn_on_file+1,           &
     225                        nxl_on_file-1:nxr_on_file+1),          &
     226                 tmp_3d(nzb:nzt+1,nys_on_file-1:nyn_on_file+1, &
     227                        nxl_on_file-1:nxr_on_file+1) )
     228
     229!
     230!--    Determine the index range of those gridpoints to be copied from
     231!--    the subdomains on the restart files to the current subdomain
     232       nxlc = MAX( nxl, nxl_on_file )
     233       nxrc = MIN( nxr, nxr_on_file )
     234       nysc = MAX( nys, nys_on_file )
     235       nync = MIN( nyn, nyn_on_file )
     236
     237!
     238!--    Read arrays
     239!--    ATTENTION: If the following read commands have been altered, the
     240!--    ---------- version number of the variable binary_version must be altered,
     241!--               too. Furthermore, the output list of arrays in write_3d_binary
     242!--               must also be altered accordingly.
    403243       READ ( 13 )  field_chr
    404 
    405     ENDDO
    406 
    407 !
    408 !-- Read user-defined restart data
    409     CALL user_read_restart_data
     244       DO  WHILE ( TRIM( field_chr ) /= '*** end ***' )
     245
     246          SELECT CASE ( TRIM( field_chr ) )
     247
     248             CASE ( 'e' )
     249                READ ( 13 )  tmp_3d
     250                e(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     251                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     252
     253             CASE ( 'e_av' )
     254                IF ( .NOT. ALLOCATED( e_av ) )  THEN
     255                   ALLOCATE( e_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     256                ENDIF
     257                READ ( 13 )  tmp_3d
     258                e_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     259                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     260
     261             CASE ( 'e_m' )
     262                READ ( 13 )  tmp_3d
     263                e_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     264                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     265
     266             CASE ( 'iran' ) ! matching random numbers is still unresolved issue
     267                READ ( 13 )  iran, iran_part
     268
     269             CASE ( 'kh' )
     270                READ ( 13 )  tmp_3d
     271                kh(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     272                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     273
     274             CASE ( 'kh_m' )
     275                READ ( 13 )  tmp_3d
     276                kh_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     277                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     278
     279             CASE ( 'km' )
     280                READ ( 13 )  tmp_3d
     281                km(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     282                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     283
     284             CASE ( 'km_m' )
     285                READ ( 13 )  tmp_3d
     286                km_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     287                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     288
     289             CASE ( 'lwp_av' )
     290                IF ( .NOT. ALLOCATED( lwp_av ) )  THEN
     291                   ALLOCATE( lwp_av(nys-1:nyn+1,nxl-1:nxr+1) )
     292                ENDIF
     293                READ ( 13 )  tmp_2d
     294                lwp_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     295                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     296
     297             CASE ( 'p' )
     298                READ ( 13 )  tmp_3d
     299                p(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     300                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     301
     302             CASE ( 'p_av' )
     303                IF ( .NOT. ALLOCATED( p_av ) )  THEN
     304                   ALLOCATE( p_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     305                ENDIF
     306                READ ( 13 )  tmp_3d
     307                p_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     308                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     309
     310             CASE ( 'pc_av' )
     311                IF ( .NOT. ALLOCATED( pc_av ) )  THEN
     312                   ALLOCATE( pc_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     313                ENDIF
     314                READ ( 13 )  tmp_3d
     315                pc_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     316                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     317
     318             CASE ( 'pr_av' )
     319                IF ( .NOT. ALLOCATED( pr_av ) )  THEN
     320                   ALLOCATE( pr_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     321                ENDIF
     322                READ ( 13 )  tmp_3d
     323                pr_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     324                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     325
     326             CASE ( 'precipitation_amount' )
     327                READ ( 13 )  tmp_2d
     328                precipitation_amount(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     329                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     330
     331             CASE ( 'precipitation_rate_a' )
     332                IF ( .NOT. ALLOCATED( precipitation_rate_av ) )  THEN
     333                   ALLOCATE( precipitation_rate_av(nys-1:nyn+1,nxl-1:nxr+1) )
     334                ENDIF
     335                READ ( 13 )  tmp_2d
     336                precipitation_rate_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     337                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     338
     339             CASE ( 'pt' )
     340                READ ( 13 )  tmp_3d
     341                pt(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     342                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     343
     344             CASE ( 'pt_av' )
     345                IF ( .NOT. ALLOCATED( pt_av ) )  THEN
     346                   ALLOCATE( pt_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     347                ENDIF
     348                READ ( 13 )  tmp_3d
     349                pt_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     350                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     351
     352             CASE ( 'pt_m' )
     353                READ ( 13 )  tmp_3d
     354                pt_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     355                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     356
     357             CASE ( 'q' )
     358                READ ( 13 )  tmp_3d
     359                q(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     360                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     361
     362             CASE ( 'q_av' )
     363                IF ( .NOT. ALLOCATED( q_av ) )  THEN
     364                   ALLOCATE( q_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     365                ENDIF
     366                READ ( 13 )  tmp_3d
     367                q_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     368                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     369
     370             CASE ( 'q_m' )
     371                READ ( 13 )  tmp_3d
     372                q_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     373                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     374
     375             CASE ( 'ql' )
     376                READ ( 13 )  tmp_3d
     377                ql(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     378                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     379
     380             CASE ( 'ql_av' )
     381                IF ( .NOT. ALLOCATED( ql_av ) )  THEN
     382                   ALLOCATE( ql_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     383                ENDIF
     384                READ ( 13 )  tmp_3d
     385                ql_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     386                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     387
     388             CASE ( 'ql_c_av' )
     389                IF ( .NOT. ALLOCATED( ql_c_av ) )  THEN
     390                   ALLOCATE( ql_c_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     391                ENDIF
     392                READ ( 13 )  tmp_3d
     393                ql_c_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     394                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     395
     396             CASE ( 'ql_v_av' )
     397                IF ( .NOT. ALLOCATED( ql_v_av ) )  THEN
     398                   ALLOCATE( ql_v_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     399                ENDIF
     400                READ ( 13 )  tmp_3d
     401                ql_v_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     402                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     403
     404             CASE ( 'ql_vp_av' )
     405                IF ( .NOT. ALLOCATED( ql_vp_av ) )  THEN
     406                   ALLOCATE( ql_vp_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     407                ENDIF
     408                READ ( 13 )  tmp_3d
     409                ql_vp_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     410                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     411
     412             CASE ( 'qs' )
     413                READ ( 13 )  tmp_2d
     414                qs(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     415                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     416
     417             CASE ( 'qsws' )
     418                READ ( 13 )  tmp_2d
     419                qsws(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     420                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     421
     422             CASE ( 'qsws_m' )
     423                READ ( 13 )  tmp_2d
     424                qsws_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     425                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     426
     427             CASE ( 'qswst' )
     428                READ ( 13 )  tmp_2d
     429                qswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     430                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     431
     432             CASE ( 'qswst_m' )
     433                READ ( 13 )  tmp_2d
     434                qswst_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     435                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     436
     437             CASE ( 'qv_av' )
     438                IF ( .NOT. ALLOCATED( qv_av ) )  THEN
     439                   ALLOCATE( qv_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     440                ENDIF
     441                READ ( 13 )  tmp_3d
     442                qv_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     443                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     444
     445             CASE ( 'random_iv' )  ! still unresolved issue
     446                READ ( 13 )  random_iv
     447                READ ( 13 )  random_iy
     448
     449             CASE ( 'rho_av' )
     450                IF ( .NOT. ALLOCATED( rho_av ) )  THEN
     451                   ALLOCATE( rho_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     452                ENDIF
     453                READ ( 13 )  tmp_3d
     454                rho_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     455                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     456
     457             CASE ( 'rif' )
     458                READ ( 13 )  tmp_2d
     459                rif(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     460                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     461
     462             CASE ( 'rif_m' )
     463                READ ( 13 )  tmp_2d
     464                rif_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     465                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     466
     467             CASE ( 'rif_wall' )
     468                ALLOCATE( tmp_4d(nzb:nzt+1,nys_on_file-1:nyn_on_file+1, &
     469                                 nxl_on_file-1:nxr_on_file+1,1:4) )
     470                READ ( 13 )  tmp_4d
     471                rif_wall(:,nysc-1:nync+1,nxlc-1:nxrc+1,:) = &
     472                                         tmp_4d(:,nysc-1:nync+1,nxlc-1:nxrc+1,:)
     473                DEALLOCATE( tmp_4d )
     474
     475             CASE ( 's_av' )
     476                IF ( .NOT. ALLOCATED( s_av ) )  THEN
     477                   ALLOCATE( s_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     478                ENDIF
     479                READ ( 13 )  tmp_3d
     480                s_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     481                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     482
     483             CASE ( 'sa' )
     484                READ ( 13 )  tmp_3d
     485                sa(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     486                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     487
     488             CASE ( 'sa_av' )
     489                IF ( .NOT. ALLOCATED( sa_av ) )  THEN
     490                   ALLOCATE( sa_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     491                ENDIF
     492                READ ( 13 )  tmp_3d
     493                sa_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     494                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     495
     496             CASE ( 'saswsb' )
     497                READ ( 13 )  tmp_2d
     498                saswsb(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     499                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     500
     501             CASE ( 'saswst' )
     502                READ ( 13 )  tmp_2d
     503                saswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     504                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     505
     506             CASE ( 'shf' )
     507                READ ( 13 )  tmp_2d
     508                shf(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     509                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     510
     511             CASE ( 'shf_m' )
     512                READ ( 13 )  tmp_2d
     513                shf_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     514                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     515
     516             CASE ( 'spectrum_x' )
     517                READ ( 13 )  spectrum_x
     518
     519             CASE ( 'spectrum_y' )
     520                READ ( 13 )  spectrum_y
     521
     522             CASE ( 'ts' )
     523                READ ( 13 )  tmp_2d
     524                ts(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     525                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     526
     527             CASE ( 'ts_av' )
     528                IF ( .NOT. ALLOCATED( ts_av ) )  THEN
     529                   ALLOCATE( ts_av(nys-1:nyn+1,nxl-1:nxr+1) )
     530                ENDIF
     531                READ ( 13 )  tmp_2d
     532                ts_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     533                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     534
     535             CASE ( 'tswst' )
     536                READ ( 13 )  tmp_2d
     537                tswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     538                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     539
     540             CASE ( 'tswst_m' )
     541                READ ( 13 )  tmp_2d
     542                tswst_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     543                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     544
     545             CASE ( 'u' )
     546                READ ( 13 )  tmp_3d
     547                u(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     548                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     549
     550             CASE ( 'u_av' )
     551                IF ( .NOT. ALLOCATED( u_av ) )  THEN
     552                   ALLOCATE( u_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     553                ENDIF
     554                READ ( 13 )  tmp_3d
     555                u_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     556                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     557
     558             CASE ( 'u_m' )
     559                READ ( 13 )  tmp_3d
     560                u_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     561                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     562
     563             CASE ( 'u_m_l' )
     564                ALLOCATE( tmp_3dw(nzb:nzt+1,nys_on_file-1:nyn_on_file+1,1:2) )
     565                READ ( 13 )  tmp_3dw
     566                IF ( outflow_l )  THEN
     567                   u_m_l(:,nysc-1:nync+1,:) = tmp_3dw(:,nysc-1:nync+1,:)
     568                ENDIF
     569                DEALLOCATE( tmp_3dw )
     570
     571             CASE ( 'u_m_n' )
     572                ALLOCATE( tmp_3dw(nzb:nzt+1,ny-1:ny, &
     573                                  nxl_on_file-1:nxr_on_file+1) )
     574                READ ( 13 )  tmp_3dw
     575                IF ( outflow_n )  THEN
     576                   u_m_n(:,:,nxlc-1:nxrc+1) = tmp_3dw(:,:,nxlc-1:nxrc+1)
     577                ENDIF
     578                DEALLOCATE( tmp_3dw )
     579
     580             CASE ( 'u_m_r' )
     581                ALLOCATE( tmp_3dw(nzb:nzt+1,nys_on_file-1:nyn_on_file+1, &
     582                                  nx-1:nx) )
     583                READ ( 13 )  tmp_3dw
     584                IF ( outflow_r )  THEN
     585                   u_m_r(:,nysc-1:nync+1,:) = tmp_3dw(:,nysc-1:nync+1,:)
     586                ENDIF
     587                DEALLOCATE( tmp_3dw )
     588
     589             CASE ( 'u_m_s' )
     590                ALLOCATE( tmp_3dw(nzb:nzt+1,0:1, &
     591                                  nxl_on_file-1:nxr_on_file+1) )
     592                READ ( 13 )  tmp_3dw
     593                IF ( outflow_s )  THEN
     594                   u_m_s(:,:,nxlc-1:nxrc+1) = tmp_3dw(:,:,nxlc-1:nxrc+1)
     595                ENDIF
     596                DEALLOCATE( tmp_3dw )
     597
     598             CASE ( 'us' )
     599                READ ( 13 )  tmp_2d
     600                us(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     601                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     602
     603             CASE ( 'usws' )
     604                READ ( 13 )  tmp_2d
     605                usws(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     606                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     607
     608             CASE ( 'uswst' )
     609                READ ( 13 )  tmp_2d
     610                uswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     611                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     612
     613             CASE ( 'usws_m' )
     614                READ ( 13 )  tmp_2d
     615                usws_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     616                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     617
     618             CASE ( 'uswst_m' )
     619                READ ( 13 )  tmp_2d
     620                uswst_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     621                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     622
     623             CASE ( 'us_av' )
     624                IF ( .NOT. ALLOCATED( us_av ) )  THEN
     625                   ALLOCATE( us_av(nys-1:nyn+1,nxl-1:nxr+1) )
     626                ENDIF
     627                READ ( 13 )  tmp_2d
     628                us_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     629                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     630
     631             CASE ( 'v' )
     632                READ ( 13 )  tmp_3d
     633                v(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     634                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     635
     636             CASE ( 'v_av' )
     637                IF ( .NOT. ALLOCATED( v_av ) )  THEN
     638                   ALLOCATE( v_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     639                ENDIF
     640                READ ( 13 )  tmp_3d
     641                v_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     642                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     643
     644             CASE ( 'v_m' )
     645                READ ( 13 )  tmp_3d
     646                v_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     647                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     648
     649             CASE ( 'v_m_l' )
     650                ALLOCATE( tmp_3dw(nzb:nzt+1,nys_on_file-1:nyn_on_file+1,0:1) )
     651                READ ( 13 )  tmp_3dw
     652                IF ( outflow_l )  THEN
     653                   v_m_l(:,nysc-1:nync+1,:) = tmp_3dw(:,nysc-1:nync+1,:)
     654                ENDIF
     655                DEALLOCATE( tmp_3dw )
     656
     657             CASE ( 'v_m_n' )
     658                ALLOCATE( tmp_3dw(nzb:nzt+1,ny-1:ny, &
     659                                  nxl_on_file-1:nxr_on_file+1) )
     660                READ ( 13 )  tmp_3dw
     661                IF ( outflow_n )  THEN
     662                   v_m_n(:,:,nxlc-1:nxrc+1) = tmp_3dw(:,:,nxlc-1:nxrc+1)
     663                ENDIF
     664                DEALLOCATE( tmp_3dw )
     665
     666             CASE ( 'v_m_r' )
     667                ALLOCATE( tmp_3dw(nzb:nzt+1,nys_on_file-1:nyn_on_file+1, &
     668                                  nx-1:nx) )
     669                READ ( 13 )  tmp_3dw
     670                IF ( outflow_r )  THEN
     671                   v_m_r(:,nysc-1:nync+1,:) = tmp_3dw(:,nysc-1:nync+1,:)
     672                ENDIF
     673                DEALLOCATE( tmp_3dw )
     674
     675             CASE ( 'v_m_s' )
     676                ALLOCATE( tmp_3dw(nzb:nzt+1,1:2, &
     677                                  nxl_on_file-1:nxr_on_file+1) )
     678                READ ( 13 )  tmp_3dw
     679                IF ( outflow_s )  THEN
     680                   v_m_s(:,:,nxlc-1:nxrc+1) = tmp_3dw(:,:,nxlc-1:nxrc+1)
     681                ENDIF
     682                DEALLOCATE( tmp_3dw )
     683
     684             CASE ( 'vpt' )
     685                READ ( 13 )  tmp_3d
     686                vpt(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     687                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     688
     689             CASE ( 'vpt_av' )
     690                IF ( .NOT. ALLOCATED( vpt_av ) )  THEN
     691                   ALLOCATE( vpt_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     692                ENDIF
     693                READ ( 13 )  tmp_3d
     694                vpt_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     695                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     696
     697             CASE ( 'vpt_m' )
     698                READ ( 13 )  tmp_3d
     699                vpt_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     700                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     701
     702             CASE ( 'vsws' )
     703                READ ( 13 )  tmp_2d
     704                vsws(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     705                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     706
     707             CASE ( 'vswst' )
     708                READ ( 13 )  tmp_2d
     709                vswst(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     710                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     711
     712             CASE ( 'vsws_m' )
     713                READ ( 13 )  tmp_2d
     714                vsws_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     715                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     716
     717             CASE ( 'vswst_m' )
     718                READ ( 13 )  tmp_2d
     719                vswst_m(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     720                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     721
     722             CASE ( 'w' )
     723                READ ( 13 )  tmp_3d
     724                w(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     725                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     726
     727             CASE ( 'w_av' )
     728                IF ( .NOT. ALLOCATED( w_av ) )  THEN
     729                   ALLOCATE( w_av(nzb:nzt+1,nys-1:nyn+1,nxl-1:nxr+1) )
     730                ENDIF
     731                READ ( 13 )  tmp_3d
     732                w_av(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     733                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     734
     735             CASE ( 'w_m' )
     736                READ ( 13 )  tmp_3d
     737                w_m(:,nysc-1:nync+1,nxlc-1:nxrc+1) = &
     738                                          tmp_3d(:,nysc-1:nync+1,nxlc-1:nxrc+1)
     739
     740             CASE ( 'w_m_l' )
     741                ALLOCATE( tmp_3dw(nzb:nzt+1,nys_on_file-1:nyn_on_file+1,0:1) )
     742                READ ( 13 )  tmp_3dw
     743                IF ( outflow_l )  THEN
     744                   w_m_l(:,nysc-1:nync+1,:) = tmp_3dw(:,nysc-1:nync+1,:)
     745                ENDIF
     746                DEALLOCATE( tmp_3dw )
     747
     748             CASE ( 'w_m_n' )
     749                ALLOCATE( tmp_3dw(nzb:nzt+1,ny-1:ny, &
     750                                  nxl_on_file-1:nxr_on_file+1) )
     751                READ ( 13 )  tmp_3dw
     752                IF ( outflow_n )  THEN
     753                   w_m_n(:,:,nxlc-1:nxrc+1) = tmp_3dw(:,:,nxlc-1:nxrc+1)
     754                ENDIF
     755                DEALLOCATE( tmp_3dw )
     756
     757             CASE ( 'w_m_r' )
     758                ALLOCATE( tmp_3dw(nzb:nzt+1,nys_on_file-1:nyn_on_file+1, &
     759                                  nx-1:nx) )
     760                READ ( 13 )  tmp_3dw
     761                IF ( outflow_r )  THEN
     762                   w_m_r(:,nysc-1:nync+1,:) = tmp_3dw(:,nysc-1:nync+1,:)
     763                ENDIF
     764                DEALLOCATE( tmp_3dw )
     765
     766             CASE ( 'w_m_s' )
     767                ALLOCATE( tmp_3dw(nzb:nzt+1,0:1, &
     768                                  nxl_on_file-1:nxr_on_file+1) )
     769                READ ( 13 )  tmp_3dw
     770                IF ( outflow_s )  THEN
     771                   w_m_s(:,:,nxlc-1:nxrc+1) = tmp_3dw(:,:,nxlc-1:nxrc+1)
     772                ENDIF
     773                DEALLOCATE( tmp_3dw )
     774
     775             CASE ( 'z0' )
     776                READ ( 13 )  tmp_2d
     777                z0(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     778                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     779
     780             CASE ( 'z0_av' )
     781                IF ( .NOT. ALLOCATED( z0_av ) )  THEN
     782                   ALLOCATE( z0_av(nys-1:nyn+1,nxl-1:nxr+1) )
     783                ENDIF
     784                READ ( 13 )  tmp_2d
     785                z0_av(nysc-1:nync+1,nxlc-1:nxrc+1) = &
     786                                          tmp_2d(nysc-1:nync+1,nxlc-1:nxrc+1)
     787
     788             CASE DEFAULT
     789                PRINT*, '+++ read_3d_binary: unknown field named "', &
     790                        TRIM( field_chr ), '" found in'
     791                PRINT*, '                    data from prior run on PE ', myid
     792                CALL local_stop
     793
     794          END SELECT
     795!
     796!--       Read next character string
     797          READ ( 13 )  field_chr
     798
     799       ENDDO  ! loop over variables
     800
     801!
     802!--    Read user-defined restart data
     803       CALL user_read_restart_data
     804
     805!
     806!--    Close the restart file
     807       CALL close_file( 13 )
     808
     809       DEALLOCATE( tmp_2d, tmp_3d )
     810
     811    ENDDO  ! loop over restart files
     812
     813
     814!
     815!-- Restore the original filename for the restart file to be written
     816    myid_char = myid_char_save
     817
    410818
    411819!
  • palm/trunk/SOURCE/read_var_list.f90

    r145 r146  
    44! Actual revisions:
    55! -----------------
    6 ! After reading the global variables, unit 13 is closed for all PEs except PE0
    76! +numprocs_previous_run, hor_index_bounds_previous_run,
    87! -cross_ts_*, npex, npey,
    98! hom_sum, volume_flow_area, volume_flow_initial moved from
    10 ! read_3d_binary to here
     9! read_3d_binary to here,
     10! routine skip_var_list added at the end
    1111!
    1212! Former revisions:
     
    9797    READ ( 13 )  numprocs_previous_run
    9898
    99     ALLOCATE( hor_index_bounds_previous_run(4,0:numprocs_previous_run-1) )
     99    IF ( .NOT. ALLOCATED( hor_index_bounds_previous_run ) )  THEN
     100       ALLOCATE( hor_index_bounds_previous_run(4,0:numprocs_previous_run-1) )
     101    ENDIF
    100102
    101103    READ ( 13 )  variable_chr
     
    145147    ENDIF
    146148    READ ( 13 )  statistic_regions
    147     ALLOCATE( ug(0:nz+1), u_init(0:nz+1), vg(0:nz+1), v_init(0:nz+1), &
    148               pt_init(0:nz+1), q_init(0:nz+1), sa_init(0:nz+1),       &
    149               hom(0:nz+1,2,pr_palm+max_pr_user,0:statistic_regions),  &
    150               hom_sum(0:nz+1,pr_palm+max_pr_user,0:statistic_regions) )
     149    IF ( .NOT. ALLOCATED( ug ) )  THEN
     150       ALLOCATE( ug(0:nz+1), u_init(0:nz+1), vg(0:nz+1), v_init(0:nz+1), &
     151                 pt_init(0:nz+1), q_init(0:nz+1), sa_init(0:nz+1),       &
     152                 hom(0:nz+1,2,pr_palm+max_pr_user,0:statistic_regions),  &
     153                 hom_sum(0:nz+1,pr_palm+max_pr_user,0:statistic_regions) )
     154    ENDIF
    151155
    152156!
     
    533537    ENDDO
    534538
    535     IF ( myid /= 0 )  CALL close_file( 13 )
    536 
    537539
    538540 END SUBROUTINE read_var_list
     541
     542
     543
     544 SUBROUTINE skip_var_list
     545
     546!------------------------------------------------------------------------------!
     547! Description:
     548! ------------
     549! Skipping the global control variables from restart-file (binary format)
     550!------------------------------------------------------------------------------!
     551
     552    CHARACTER (LEN=10) ::  version_on_file
     553    CHARACTER (LEN=30) ::  variable_chr
     554
     555    INTEGER ::  idum
     556
     557
     558    READ ( 13 )  version_on_file
     559
     560    READ ( 13 )  variable_chr
     561
     562    DO  WHILE ( TRIM( variable_chr ) /= '*** end ***' )
     563
     564       READ ( 13 )  idum
     565       READ ( 13 )  variable_chr
     566
     567    ENDDO
     568
     569
     570 END SUBROUTINE skip_var_list
Note: See TracChangeset for help on using the changeset viewer.