Index: palm/trunk/SOURCE/read_restart_data_mod.f90
===================================================================
--- palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 4008)
+++ palm/trunk/SOURCE/read_restart_data_mod.f90	(revision 4009)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! bugfix for r3998, allocation of 3d temporary arrays of various dimensions revised
+! 
+! 3998 2019-05-23 13:38:11Z suehring
 ! Formatting adjustment
 ! 
@@ -1102,18 +1105,6 @@
     REAL(wp), DIMENSION(:,:),   ALLOCATABLE   ::  tmp_2d         !< temporary array for storing 2D data
     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3d         !< temporary array for storing 3D data
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3d_noghost !< temporary array for storing 3D data without ghost points
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwul      !<
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwun      !<
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwur      !<
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwus      !<
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwvl      !<
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwvn      !<
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwvr      !<
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwvs      !<
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwwl      !<
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwwn      !<
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwwr      !<
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3dwws      !<
-
+    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  tmp_3d_non_standard !< temporary array for storing 3D data
+                                                                 !< with non standard dimensions
 
 !
@@ -1159,8 +1150,7 @@
 !
 !--                   Array bound exceeded
-                      message_string = 'data from subdomain of previous' //    &
+                      message_string = 'data from subdomain of previous' //                        &
                                        ' run mapped more than 1000 times'
-                      CALL message( 'rrd_local', 'PA0284', 2, 2, -1,           &
-                                       6, 1 )
+                      CALL message( 'rrd_local', 'PA0284', 2, 2, -1, 6, 1 )
                    ENDIF
 
@@ -1174,12 +1164,8 @@
 !
 !--                Index bounds of overlapping data
-                   nxlfa(files_to_be_opened,j) = MAX( nxl-offset_x-shift_x,    &
-                                                      nxlpr )
-                   nxrfa(files_to_be_opened,j) = MIN( nxr-offset_x-shift_x,    &
-                                                      nxrpr )
-                   nysfa(files_to_be_opened,j) = MAX( nys-offset_y-shift_y,    & 
-                                                      nyspr )
-                   nynfa(files_to_be_opened,j) = MIN( nyn-offset_y-shift_y,    & 
-                                                      nynpr )
+                   nxlfa(files_to_be_opened,j) = MAX( nxl-offset_x-shift_x, nxlpr )
+                   nxrfa(files_to_be_opened,j) = MIN( nxr-offset_x-shift_x, nxrpr )
+                   nysfa(files_to_be_opened,j) = MAX( nys-offset_y-shift_y, nyspr )
+                   nynfa(files_to_be_opened,j) = MIN( nyn-offset_y-shift_y, nynpr )
 
                 ENDIF
@@ -1202,9 +1188,8 @@
     myid_char_save = myid_char
 
-    IF ( files_to_be_opened /= 1  .OR.  numprocs /= numprocs_previous_run )    &
-    THEN
-       WRITE( message_string, * ) 'number of PEs or virtual PE-grid changed ', &
-                        'in restart run & PE', myid, ' will read from files ', &
-                         file_list(1:files_to_be_opened)
+    IF ( files_to_be_opened /= 1  .OR.  numprocs /= numprocs_previous_run )  THEN
+       WRITE( message_string, * ) 'number of PEs or virtual PE-grid changed ',                     &
+                                  'in restart run & PE', myid, ' will read from files ',           &
+                                  file_list(1:files_to_be_opened)
        CALL message( 'rrd_local', 'PA0285', 0, 0, 0, 6, 0 )
     ENDIF
@@ -1234,8 +1219,8 @@
        binary_version_local = '4.7'
        IF ( TRIM( version_on_file ) /= TRIM( binary_version_local ) )  THEN
-          WRITE( message_string, * ) 'version mismatch concerning ',           &
-                      'binary_version_local:',                                 &
-                      '&version on file    = "', TRIM( version_on_file ), '"', &
-                      '&version in program = "', TRIM( binary_version_local ), '"'
+          WRITE( message_string, * ) 'version mismatch concerning ',                               &
+                                     'binary_version_local:',                                      &
+                                     '&version on file    = "', TRIM( version_on_file ), '"',      &
+                                     '&version in program = "', TRIM( binary_version_local ), '"'
           CALL message( 'rrd_local', 'PA0286', 1, 2, 0, 6, 0 )
        ENDIF
@@ -1244,22 +1229,22 @@
 !--    Read number of processors, processor-id, and array ranges.
 !--    Compare the array ranges with those stored in the index bound array.
-       READ ( 13 )  numprocs_on_file, myid_on_file, nxl_on_file, nxr_on_file,  &
-                    nys_on_file, nyn_on_file, nzb_on_file, nzt_on_file
+       READ ( 13 )  numprocs_on_file, myid_on_file, nxl_on_file, nxr_on_file, nys_on_file,         &
+                    nyn_on_file, nzb_on_file, nzt_on_file
 
        IF ( nxl_on_file /= hor_index_bounds_previous_run(1,j) )  THEN
-          WRITE( message_string, * ) 'problem with index bound nxl on ',       &
-                            'restart file "', myid_char, '"',                  &
-                            '&nxl = ', nxl_on_file, ' but it should be',       &
-                            '&= ', hor_index_bounds_previous_run(1,j),         &
-                            '&from the index bound information array'
+          WRITE( message_string, * ) 'problem with index bound nxl on ',                           &
+                                     'restart file "', myid_char, '"',                             &
+                                     '&nxl = ', nxl_on_file, ' but it should be',                  &
+                                     '&= ', hor_index_bounds_previous_run(1,j),                    &
+                                     '&from the index bound information array'
           CALL message( 'rrd_local', 'PA0287', 2, 2, -1, 6, 1 )
        ENDIF
 
        IF ( nxr_on_file /= hor_index_bounds_previous_run(2,j) )  THEN
-           WRITE( message_string, * ) 'problem with index bound nxr on ',      &
-                               'restart file "', myid_char, '"'  ,             &
-                               ' nxr = ', nxr_on_file, ' but it should be',    &
-                               ' = ', hor_index_bounds_previous_run(2,j),      &
-                               ' from the index bound information array' 
+           WRITE( message_string, * ) 'problem with index bound nxr on ',                          &
+                                      'restart file "', myid_char, '"'  ,                          &
+                                      ' nxr = ', nxr_on_file, ' but it should be',                 &
+                                      ' = ', hor_index_bounds_previous_run(2,j),                   &
+                                      ' from the index bound information array'
           CALL message( 'rrd_local', 'PA0288', 2, 2, -1, 6, 1 )
 
@@ -1267,25 +1252,25 @@
 
        IF ( nys_on_file /= hor_index_bounds_previous_run(3,j) )  THEN
-          WRITE( message_string, * ) 'problem with index bound nys on ',       &
-                                 'restart file "', myid_char, '"',             &
-                                 '&nys = ', nys_on_file, ' but it should be',  &
-                                 '&= ', hor_index_bounds_previous_run(3,j),    &
-                                 '&from the index bound information array'
+          WRITE( message_string, * ) 'problem with index bound nys on ',                           &
+                                     'restart file "', myid_char, '"',                             &
+                                     '&nys = ', nys_on_file, ' but it should be',                  &
+                                     '&= ', hor_index_bounds_previous_run(3,j),                    &
+                                     '&from the index bound information array'
           CALL message( 'rrd_local', 'PA0289', 2, 2, -1, 6, 1 ) 
        ENDIF
 
        IF ( nyn_on_file /= hor_index_bounds_previous_run(4,j) )  THEN
-          WRITE( message_string, * ) 'problem with index bound nyn on ',       &
-                               'restart file "', myid_char, '"',               &
-                               '&nyn = ', nyn_on_file, ' but it should be',    &
-                               '&= ', hor_index_bounds_previous_run(4,j),      &
-                               '&from the index bound information array'
+          WRITE( message_string, * ) 'problem with index bound nyn on ',                           &
+                                     'restart file "', myid_char, '"',                             &
+                                     '&nyn = ', nyn_on_file, ' but it should be',                  &
+                                     '&= ', hor_index_bounds_previous_run(4,j),                    &
+                                     '&from the index bound information array'
           CALL message( 'rrd_local', 'PA0290', 2, 2, -1, 6, 1 ) 
        ENDIF
 
        IF ( nzb_on_file /= nzb )  THEN
-          WRITE( message_string, * ) 'mismatch between actual data and data ', &
-                                     'from prior run on PE ', myid,            &
-                                     '&nzb on file = ', nzb_on_file,           &
+          WRITE( message_string, * ) 'mismatch between actual data and data ',                     &
+                                     'from prior run on PE ', myid,                                &
+                                     '&nzb on file = ', nzb_on_file,                               &
                                      '&nzb         = ', nzb
           CALL message( 'rrd_local', 'PA0291', 1, 2, 0, 6, 0 )  
@@ -1293,7 +1278,7 @@
 
        IF ( nzt_on_file /= nzt )  THEN
-          WRITE( message_string, * ) 'mismatch between actual data and data ', &
-                                     'from prior run on PE ', myid,            &
-                                     '&nzt on file = ', nzt_on_file,           &
+          WRITE( message_string, * ) 'mismatch between actual data and data ',                     &
+                                     'from prior run on PE ', myid,                                &
+                                     '&nzt on file = ', nzt_on_file,                               &
                                      '&nzt         = ', nzt
           CALL message( 'rrd_local', 'PA0292', 1, 2, 0, 6, 0 )  
@@ -1302,10 +1287,7 @@
 !
 !--    Allocate temporary arrays sized as the arrays on the restart file
-       ALLOCATE( tmp_2d(nys_on_file-nbgp:nyn_on_file+nbgp,                     &
-                        nxl_on_file-nbgp:nxr_on_file+nbgp),                    &
-                 tmp_3d(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,           &
-                        nxl_on_file-nbgp:nxr_on_file+nbgp),                    &
-                 tmp_3d_noghost(nzb:nzt+1,nys_on_file:nyn_on_file,             &
-                        nxl_on_file:nxr_on_file) )
+       ALLOCATE( tmp_2d(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp),      &
+                 tmp_3d(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,                               &
+                        nxl_on_file-nbgp:nxr_on_file+nbgp) )
 
 !
@@ -1350,28 +1332,27 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   ghf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
+                   ghf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
                       tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'e' )
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   e(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =              &
+                   e(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'e_av' )
                    IF ( .NOT. ALLOCATED( e_av ) )  THEN
-                      ALLOCATE( e_av(nzb:nzt+1,nys-nbgp:nyn+nbgp,              &
+                      ALLOCATE( e_av(nzb:nzt+1,nys-nbgp:nyn+nbgp,                                  &
                                      nxl-nbgp:nxr+nbgp) )    
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   e_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
-                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-
-                CASE ( 'iran' ) ! matching random numbers is still unresolved
-                                ! issue
+                   e_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
+                      tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+
+                CASE ( 'iran' ) ! matching random numbers is still unresolved issue
                    IF ( k == 1 )  READ ( 13 )  iran, iran_part
 
                 CASE ( 'kh' )
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   kh(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =             &
+                   kh(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                 &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1381,10 +1362,10 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   kh_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
+                   kh_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'km' )
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   km(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =             &
+                   km(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                 &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1394,5 +1375,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   km_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
+                   km_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1402,5 +1383,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   lpt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =         &
+                   lpt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                             &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1410,10 +1391,10 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   lwp_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
+                   lwp_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
                       tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'p' )
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   p(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =              &
+                   p(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1423,5 +1404,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   p_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
+                   p_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1431,5 +1412,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   pc_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
+                   pc_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1439,10 +1420,10 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   pr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
+                   pr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'pt' )
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   pt(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =             &
+                   pt(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                 &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1452,5 +1433,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   pt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
+                   pt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1460,10 +1441,10 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   pt_2m_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =        &
+                   pt_2m_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                            &
                       tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'q' )
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   q(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =              &
+                   q(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1473,10 +1454,10 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   q_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
+                   q_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'ql' )
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   ql(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =             &
+                   ql(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                 &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1486,5 +1467,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   ql_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
+                   ql_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1494,5 +1475,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   ql_c_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =        &
+                   ql_c_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                            &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1502,5 +1483,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   ql_v_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =        &
+                   ql_v_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                            &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1510,5 +1491,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   ql_vp_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =       &
+                   ql_vp_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                           &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1518,5 +1499,5 @@
                    ENDIF  
                    IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   qsws_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =         &
+                   qsws_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                             &
                       tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1526,5 +1507,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   qv_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
+                   qv_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                              &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1534,5 +1515,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   r_a_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
+                   r_a_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
                       tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1542,8 +1523,6 @@
 
                 CASE ( 'seq_random_array' )
-                   ALLOCATE( tmp_2d_id_random(nys_on_file:nyn_on_file,         &
-                                              nxl_on_file:nxr_on_file) )
-                   ALLOCATE( tmp_2d_seq_random(5,nys_on_file:nyn_on_file,      &
-                                                 nxl_on_file:nxr_on_file) )
+                   ALLOCATE( tmp_2d_id_random(nys_on_file:nyn_on_file,nxl_on_file:nxr_on_file) )
+                   ALLOCATE( tmp_2d_seq_random(5,nys_on_file:nyn_on_file,nxl_on_file:nxr_on_file) )
                    IF ( .NOT. ALLOCATED( id_random_array ) )  THEN
                       ALLOCATE( id_random_array(nys:nyn,nxl:nxr) )
@@ -1554,13 +1533,11 @@
                    IF ( k == 1 )  READ ( 13 )  tmp_2d_id_random
                    IF ( k == 1 )  READ ( 13 )  tmp_2d_seq_random
-                   id_random_array(nysc:nync,nxlc:nxrc) =                      &
-                      tmp_2d_id_random(nysf:nynf,nxlf:nxrf)
-                   seq_random_array(:,nysc:nync,nxlc:nxrc) =                   &
-                      tmp_2d_seq_random(:,nysf:nynf,nxlf:nxrf)
+                   id_random_array(nysc:nync,nxlc:nxrc) = tmp_2d_id_random(nysf:nynf,nxlf:nxrf)
+                   seq_random_array(:,nysc:nync,nxlc:nxrc) = tmp_2d_seq_random(:,nysf:nynf,nxlf:nxrf)
                    DEALLOCATE( tmp_2d_id_random, tmp_2d_seq_random )
 
                 CASE ( 's' )
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   s(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =              &
+                   s(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1570,5 +1547,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   s_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
+                   s_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1578,5 +1555,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   shf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =          &
+                   shf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                              &
                       tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
                    
@@ -1586,5 +1563,5 @@
                    ENDIF  
                    IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   ssws_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =         &
+                   ssws_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                             &
                       tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1593,7 +1570,10 @@
                       ALLOCATE( ti_av(nzb:nzt+1,nys:nyn,nxl:nxr) )
                    ENDIF
-                   IF ( k == 1 )  READ ( 13 )  tmp_3d_noghost
-                   ti_av(:,nysc:nync,nxlc:nxrc) =                              &
-                      tmp_3d_noghost(:,nysf:nynf,nxlf:nxrf)
+                   IF ( k == 1 )  THEN
+                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file:nyn_on_file,             &
+                                                    nxl_on_file:nxr_on_file) )
+                      READ ( 13 )  tmp_3d_non_standard
+                   ENDIF
+                   ti_av(:,nysc:nync,nxlc:nxrc) = tmp_3d_non_standard(:,nysf:nynf,nxlf:nxrf)
 
                 CASE ( 'ts_av' )
@@ -1602,5 +1582,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   ts_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =           &
+                   ts_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                               &
                         tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1610,10 +1590,10 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   tsurf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =         &
+                   tsurf_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                             &
                       tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'u' )
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   u(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =              &
+                   u(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1623,49 +1603,45 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   u_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
+                   u_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'u_m_l' )
                    IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3dwul(nzb:nzt+1,                           &
-                                nys_on_file-nbgp:nyn_on_file+nbgp,1:2) )
-                      READ ( 13 )  tmp_3dwul
+                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
+                                                    1:2) )
+                      READ ( 13 )  tmp_3d_non_standard
                    ENDIF
                    IF ( bc_radiation_l )  THEN
-                      u_m_l(:,nysc-nbgp:nync+nbgp,:) =                         & 
-                         tmp_3dwul(:,nysf-nbgp:nynf+nbgp,:)
+                      u_m_l(:,nysc-nbgp:nync+nbgp,:) =  tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
                    ENDIF
 
                 CASE ( 'u_m_n' )
                    IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3dwun(nzb:nzt+1,ny-1:ny,                   &
-                                          nxl_on_file-nbgp:nxr_on_file+nbgp) )
-                      READ ( 13 )  tmp_3dwun
+                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,ny-1:ny,                             &
+                                                    nxl_on_file-nbgp:nxr_on_file+nbgp) )
+                      READ ( 13 )  tmp_3d_non_standard
                    ENDIF
                    IF ( bc_radiation_n )  THEN
-                      u_m_n(:,:,nxlc-nbgp:nxrc+nbgp) =                         & 
-                         tmp_3dwun(:,:,nxlf-nbgp:nxrf+nbgp)
+                      u_m_n(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
                    ENDIF
 
                 CASE ( 'u_m_r' )
                    IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3dwur(nzb:nzt+1,                           &
-                                nys_on_file-nbgp:nyn_on_file+nbgp,nx-1:nx) )
-                      READ ( 13 )  tmp_3dwur
+                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
+                                                    nx-1:nx) )
+                      READ ( 13 )  tmp_3d_non_standard
                    ENDIF
                    IF ( bc_radiation_r )  THEN
-                      u_m_r(:,nysc-nbgp:nync+nbgp,:) =                         & 
-                         tmp_3dwur(:,nysf-nbgp:nynf+nbgp,:)
+                      u_m_r(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
                    ENDIF
 
                 CASE ( 'u_m_s' )
                    IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3dwus(nzb:nzt+1,0:1,                       &
-                                          nxl_on_file-nbgp:nxr_on_file+nbgp) )
-                      READ ( 13 )  tmp_3dwus
+                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,0:1,                                 &
+                                                    nxl_on_file-nbgp:nxr_on_file+nbgp) )
+                      READ ( 13 )  tmp_3d_non_standard
                    ENDIF
                    IF ( bc_radiation_s )  THEN
-                      u_m_s(:,:,nxlc-nbgp:nxrc+nbgp) =                         &
-                         tmp_3dwus(:,:,nxlf-nbgp:nxrf+nbgp)
+                      u_m_s(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
                    ENDIF
 
@@ -1675,10 +1651,10 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   us_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =           &
+                   us_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                               &
                       tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'v' )
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   v(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =              &
+                   v(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1688,54 +1664,50 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   v_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
+                   v_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'v_m_l' )
                    IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3dwvl(nzb:nzt+1,                           &
-                                nys_on_file-nbgp:nyn_on_file+nbgp,0:1) )
-                      READ ( 13 )  tmp_3dwvl
+                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
+                                                    0:1) )
+                      READ ( 13 )  tmp_3d_non_standard
                    ENDIF
                    IF ( bc_radiation_l )  THEN
-                      v_m_l(:,nysc-nbgp:nync+nbgp,:) =                         & 
-                         tmp_3dwvl(:,nysf-nbgp:nynf+nbgp,:)
+                      v_m_l(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
                    ENDIF
 
                 CASE ( 'v_m_n' )
                    IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3dwvn(nzb:nzt+1,ny-1:ny,                   &
-                                          nxl_on_file-nbgp:nxr_on_file+nbgp) )
-                      READ ( 13 )  tmp_3dwvn
+                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,ny-1:ny,                             &
+                                                    nxl_on_file-nbgp:nxr_on_file+nbgp) )
+                      READ ( 13 )  tmp_3d_non_standard
                    ENDIF
                    IF ( bc_radiation_n )  THEN
-                      v_m_n(:,:,nxlc-nbgp:nxrc+nbgp) =                         &
-                         tmp_3dwvn(:,:,nxlf-nbgp:nxrf+nbgp)
+                      v_m_n(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
                    ENDIF
 
                 CASE ( 'v_m_r' )
                    IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3dwvr(nzb:nzt+1,                           &
-                                nys_on_file-nbgp:nyn_on_file+nbgp,nx-1:nx) )
-                      READ ( 13 )  tmp_3dwvr
+                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
+                                                    nx-1:nx) )
+                      READ ( 13 )  tmp_3d_non_standard
                    ENDIF
                    IF ( bc_radiation_r )  THEN
-                      v_m_r(:,nysc-nbgp:nync+nbgp,:) =                         &
-                         tmp_3dwvr(:,nysf-nbgp:nynf+nbgp,:)
+                      v_m_r(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
                    ENDIF
 
                 CASE ( 'v_m_s' )
                    IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3dwvs(nzb:nzt+1,1:2,                       &
-                                          nxl_on_file-nbgp:nxr_on_file+nbgp) )
-                      READ ( 13 )  tmp_3dwvs
+                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,1:2,                                 &
+                                                    nxl_on_file-nbgp:nxr_on_file+nbgp) )
+                      READ ( 13 )  tmp_3d_non_standard
                    ENDIF
                    IF ( bc_radiation_s )  THEN
-                      v_m_s(:,:,nxlc-nbgp:nxrc+nbgp) =                         &
-                         tmp_3dwvs(:,:,nxlf-nbgp:nxrf+nbgp)
+                      v_m_s(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
                    ENDIF
 
                 CASE ( 'vpt' )
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   vpt(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =            &
+                   vpt(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1745,10 +1717,10 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   vpt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =         &
+                   vpt_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                             &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'w' )
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   w(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =              &
+                   w(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                  &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1758,49 +1730,45 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_3d
-                   w_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =           &
+                   w_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                               &
                       tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
                 CASE ( 'w_m_l' )
                    IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3dwwl(nzb:nzt+1,&
-                                nys_on_file-nbgp:nyn_on_file+nbgp,0:1) )
-                      READ ( 13 )  tmp_3dwwl
+                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
+                                                    0:1) )
+                      READ ( 13 )  tmp_3d_non_standard
                    ENDIF
                    IF ( bc_radiation_l )  THEN
-                      w_m_l(:,nysc-nbgp:nync+nbgp,:) =                         & 
-                         tmp_3dwwl(:,nysf-nbgp:nynf+nbgp,:)
+                      w_m_l(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
                    ENDIF
 
                 CASE ( 'w_m_n' )
                    IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3dwwn(nzb:nzt+1,ny-1:ny, &
-                                          nxl_on_file-nbgp:nxr_on_file+nbgp) )
-                      READ ( 13 )  tmp_3dwwn
+                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,ny-1:ny,                             &
+                                                    nxl_on_file-nbgp:nxr_on_file+nbgp) )
+                      READ ( 13 )  tmp_3d_non_standard
                    ENDIF
                    IF ( bc_radiation_n )  THEN
-                      w_m_n(:,:,nxlc-nbgp:nxrc+nbgp) =                         &
-                         tmp_3dwwn(:,:,nxlf-nbgp:nxrf+nbgp)
+                      w_m_n(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
                    ENDIF
 
                 CASE ( 'w_m_r' )
                    IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3dwwr(nzb:nzt+1,&
-                                nys_on_file-nbgp:nyn_on_file+nbgp,nx-1:nx) )
-                      READ ( 13 )  tmp_3dwwr
+                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,   &
+                                                    nx-1:nx) )
+                      READ ( 13 )  tmp_3d_non_standard
                    ENDIF
                    IF ( bc_radiation_r )  THEN
-                      w_m_r(:,nysc-nbgp:nync+nbgp,:) =                         & 
-                         tmp_3dwwr(:,nysf-nbgp:nynf+nbgp,:)
+                      w_m_r(:,nysc-nbgp:nync+nbgp,:) = tmp_3d_non_standard(:,nysf-nbgp:nynf+nbgp,:)
                    ENDIF
 
                 CASE ( 'w_m_s' )
                    IF ( k == 1 )  THEN
-                      ALLOCATE( tmp_3dwws(nzb:nzt+1,0:1, &
-                                          nxl_on_file-nbgp:nxr_on_file+nbgp) )
-                      READ ( 13 )  tmp_3dwws
+                      ALLOCATE( tmp_3d_non_standard(nzb:nzt+1,0:1,                                 &
+                                                    nxl_on_file-nbgp:nxr_on_file+nbgp) )
+                      READ ( 13 )  tmp_3d_non_standard
                    ENDIF
                    IF ( bc_radiation_s )  THEN
-                      w_m_s(:,:,nxlc-nbgp:nxrc+nbgp) =                         & 
-                         tmp_3dwws(:,:,nxlf-nbgp:nxrf+nbgp)
+                      w_m_s(:,:,nxlc-nbgp:nxrc+nbgp) = tmp_3d_non_standard(:,:,nxlf-nbgp:nxrf+nbgp)
                    ENDIF
 
@@ -1810,5 +1778,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   z0_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =           &
+                   z0_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                               &
                       tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1818,5 +1786,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   z0h_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =          &
+                   z0h_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                              &
                        tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1826,5 +1794,5 @@
                    ENDIF
                    IF ( k == 1 )  READ ( 13 )  tmp_2d
-                   z0q_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =          &
+                   z0q_av(nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp)  =                              &
                        tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -1833,25 +1801,20 @@
 !
 !--                Read restart data of surfaces
-                   IF ( .NOT. found ) CALL surface_rrd_local( k, nxlf,         &
-                                           nxlc, nxl_on_file, nxrf,            &
-                                           nxr_on_file, nynf,                  &
-                                           nyn_on_file, nysf, nysc,            &
-                                           nys_on_file, found )
-
+                   IF ( .NOT. found )  CALL surface_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf,   &
+                                                               nxr_on_file, nynf, nyn_on_file,     &
+                                                               nysf, nysc, nys_on_file, found )
 !
 !--                Read restart data of other modules
-                   IF ( .NOT. found ) CALL module_interface_rrd_local(         &
-                                           k,                                  &
-                                           nxlf, nxlc, nxl_on_file,            &
-                                           nxrf, nxrc, nxr_on_file,            &
-                                           nynf, nync, nyn_on_file,            &
-                                           nysf, nysc, nys_on_file,            &
-                                           tmp_2d, tmp_3d, found )
+                   IF ( .NOT. found ) CALL module_interface_rrd_local(                             &
+                                                               k, nxlf, nxlc, nxl_on_file, nxrf,   &
+                                                               nxrc, nxr_on_file, nynf, nync,      &
+                                                               nyn_on_file, nysf, nysc,            &
+                                                               nys_on_file, tmp_2d, tmp_3d, found )
 
 
                    IF ( .NOT. found )  THEN
-                      WRITE( message_string, * ) 'unknown variable named "',   &
-                                                 restart_string(1:length),     &
-                                                '" found in subdomain data ',  & 
+                      WRITE( message_string, * ) 'unknown variable named "',                       &
+                                                 restart_string(1:length),                         &
+                                                '" found in subdomain data ',                      &
                                                 'from prior run on PE ', myid
                       CALL message( 'rrd_local', 'PA0302', 1, 2, 0, 6, 0 )
@@ -1864,17 +1827,6 @@
 
 !
-!--       Deallocate arrays needed for specific variables only
-          IF ( ALLOCATED( tmp_3dwul ) )  DEALLOCATE( tmp_3dwul )
-          IF ( ALLOCATED( tmp_3dwun ) )  DEALLOCATE( tmp_3dwun )
-          IF ( ALLOCATED( tmp_3dwur ) )  DEALLOCATE( tmp_3dwur )
-          IF ( ALLOCATED( tmp_3dwus ) )  DEALLOCATE( tmp_3dwus )
-          IF ( ALLOCATED( tmp_3dwvl ) )  DEALLOCATE( tmp_3dwvl )
-          IF ( ALLOCATED( tmp_3dwvn ) )  DEALLOCATE( tmp_3dwvn )
-          IF ( ALLOCATED( tmp_3dwvr ) )  DEALLOCATE( tmp_3dwvr )
-          IF ( ALLOCATED( tmp_3dwvs ) )  DEALLOCATE( tmp_3dwvs )
-          IF ( ALLOCATED( tmp_3dwwl ) )  DEALLOCATE( tmp_3dwwl )
-          IF ( ALLOCATED( tmp_3dwwn ) )  DEALLOCATE( tmp_3dwwn )
-          IF ( ALLOCATED( tmp_3dwwr ) )  DEALLOCATE( tmp_3dwwr )
-          IF ( ALLOCATED( tmp_3dwws ) )  DEALLOCATE( tmp_3dwws )
+!--       Deallocate non standard array needed for specific variables only
+          IF ( ALLOCATED( tmp_3d_non_standard ) )  DEALLOCATE( tmp_3d_non_standard )
 
 !
@@ -1892,5 +1844,4 @@
 
     ENDDO  ! loop over restart files
-
 
 !
