Index: palm/trunk/TUTORIALS/cases/lsm_short/INPUT/lsm_short_p3d
===================================================================
--- palm/trunk/TUTORIALS/cases/lsm_short/INPUT/lsm_short_p3d	(revision 4446)
+++ palm/trunk/TUTORIALS/cases/lsm_short/INPUT/lsm_short_p3d	(revision 4765)
@@ -27,5 +27,4 @@
     pt_vertical_gradient_level = 0.0, 800.0, ! height level of temp gradients
 
-    origin_date_time           = '2019-08-20 11:00:00 +00'
 !
 !-- boundary conditions
@@ -67,8 +66,39 @@
     dt_do3d                    = 60.0,   ! output interval for 3d data
     dt_do2d_xy                 = 60.0,   ! output interval for 2d-xy data
-
-    data_output                = 'theta', 'w', 'u', 'v', 'us*_xy', 'ghf*_xy', 'shf*_xy', 'tsurf*_xy', 't_soil',    ! 2d and/or 3d output
-
-    data_output_pr             = '#u', '#v', '#theta', '#km', '#kh', '#l', 'w', 'e', 'e*', 'p', 'w"theta"', 'w*theta*', 'wtheta', 'w*e*', 'theta*2','u*2', 'v*2', 'w*2', '#t_soil',   ! Profile output
+!
+!-- 2d and/or 3d data output
+!-------------------------------------------------------------------------------
+    data_output                = 'theta',
+                                 'w',
+                                 'u',
+                                 'v',
+                                 'us*_xy',
+                                 'ghf*_xy',
+                                 'shf*_xy',
+                                 'tsurf*_xy',
+                                 'theta_xy',
+                                 't_soil',
+!
+!-- profile output
+!-------------------------------------------------------------------------------
+    data_output_pr             = '#u',
+                                 '#v',
+                                 '#theta',
+                                 '#km',
+                                 '#kh',
+                                 '#l',
+                                 'w',
+                                 'e',
+                                 'e*',
+                                 'p',
+                                 'w"theta"',
+                                 'w*theta*',
+                                 'wtheta',
+                                 'w*e*',
+                                 'theta*2',
+                                 'u*2',
+                                 'v*2',
+                                 'w*2',
+                                 '#t_soil',
 
     section_xy                 = 0, ! grid index for 2D XY cross sections
@@ -87,8 +117,11 @@
 !-------------------------------------------------------------------------------
 &land_surface_parameters
+!
+!-- define soil type and tempature
+!-------------------------------------------------------------------------------
     soil_type                  = 3,  ! type to be used in soil model
-    soil_moisture              = 0.0,   0.0,   0.0,   0.0, 0.0,   0.0,   0.0,   0.0,
-    soil_temperature           = 293,   293,   293,   293, 293,   293,   293,   293, ! every soil level
-    deep_soil_temperature      = 293,  ! temperature of deep soil
+    soil_moisture              = 0.0,   0.0,   0.0,   0.0,   0.0,   0.0,   0.0,   0.0,
+    soil_temperature           = 293.0, 293.0, 293.0, 293.0, 293.0, 293.0, 293.0, 293.0,
+    deep_soil_temperature      = 293.0,  ! temperature of deep soil
 
     surface_type               = 'vegetation',  ! surface classification
Index: palm/trunk/TUTORIALS/cases/lsm_short/MONITORING/lsm_short_rc.000
===================================================================
--- palm/trunk/TUTORIALS/cases/lsm_short/MONITORING/lsm_short_rc.000	(revision 4446)
+++ palm/trunk/TUTORIALS/cases/lsm_short/MONITORING/lsm_short_rc.000	(revision 4765)
@@ -1,9 +1,9 @@
 
  ******************************    --------------------------------------------
- * PALM 6.0  Rev: 4402        *    atmosphere - run without 1D - prerun
+ * PALM 6.0  Rev: 4761        *    atmosphere - run without 1D - prerun
  ******************************    --------------------------------------------
 
- Date:               2020-02-14    Run:       lsm_short__gfortran_default__4    
- Time:                 11:14:41    Run-No.:   00
+ Date:               2020-10-30    Run:       lsm_short__gfortran_default__4    
+ Time:                 11:08:51    Run-No.:   00
  Run on host:        gfortran_d
  Number of PEs:               4    Processor grid (x,y): (   2,   2) calculated
@@ -13,5 +13,5 @@
  -----------------
 
- --> Use the Moeng_Wyngaard turbulence closure (LES mode).
+ --> Use the 1.5-order turbulence closure (LES mode).
  --> Use the boussinesq approximation for the model equations.
  --> Solve perturbation pressure via FFT using temperton-algorithm routines
@@ -86,5 +86,5 @@
 
        z_mo =  12.50 m   z0 = 0.1000 m   z0h = 0.10000 m   kappa = 0.40
-       Rif value range:     -20.00 <= rif <= 20.00
+       zeta value range:     -20.00 <= zeta <= 20.00
        Predefined surface temperature
 
@@ -136,5 +136,5 @@
 
 
-       XY-cross-section  Arrays:  us*, ghf*, shf*, tsurf*,                                             
+       XY-cross-section  Arrays:  us*, ghf*, shf*, tsurf*, theta,                                      
        Output every                60.00 s  
        Cross sections at k = /0/
@@ -175,5 +175,5 @@
                             f*     =  0.000084 1/s
 
-    Date and time at model start : 2019-08-20 11:00:00 +00
+    Date and time at model start : 2019-06-21 12:00:00 +00
 
     Gravity             :   g      =  9.8 m/s**2
@@ -190,5 +190,5 @@
  ---------------------------
 
-    Mixing length is limited to 1.80 * z
+    Mixing length is limited close to surfaces
 
 
@@ -309,67 +309,67 @@
   0    577 00:54:03.39   3.8800A   3.4627   3.8573   5.7958  0.119  2.15  -0.304E+01    875.  0.645E+00  0.641E+00  0.333E-03  0.323E-13    1  14  18    1   4   5   20  33  28    0.000    0.000       0
   0    593 00:55:01.02   3.5200A  -3.3128   3.9400   6.3881  0.121  2.22  -0.303E+01    950.  0.649E+00  0.645E+00  0.303E-03  0.290E-13    7  33   1    1   5   3   25  32  28    0.000    0.000       0
-  0    611 00:56:03.39   3.5300A   3.4932  -3.8873   6.3763  0.121  2.20  -0.310E+01    925.  0.655E+00  0.650E+00  0.308E-03  0.292E-13    1   3   9   37  30  29   30  32  29    0.000    0.000       0
+  0    611 00:56:03.39   3.5300A   3.4933  -3.8873   6.3763  0.121  2.20  -0.310E+01    925.  0.655E+00  0.650E+00  0.308E-03  0.292E-13    1   3   9   37  30  29   30  32  29    0.000    0.000       0
   0    627 00:57:00.97   3.5400A  -3.0215  -3.8977   6.3630  0.120  2.18  -0.306E+01    900.  0.662E+00  0.657E+00  0.308E-03  0.294E-13   31  13   8   38  27  30   27  15  21    0.000    0.000       0
-  0    643 00:58:00.99   3.8200A  -3.1488   3.6350   5.8895  0.119  2.20  -0.309E+01    925.  0.662E+00  0.659E+00  0.342E-03  0.331E-13   38  33  22   21  35   1   18  27   9    0.000    0.000       0
-  0    659 00:59:02.72   3.9000A  -3.0297  -3.5710   5.7698  0.120  2.19  -0.308E+01    900.  0.663E+00  0.660E+00  0.351E-03  0.338E-13   33  11   7   16   2  38   32  26   6    0.000    0.000       0
+  0    643 00:58:00.99   3.8200A  -3.1488   3.6349   5.8895  0.119  2.20  -0.309E+01    925.  0.662E+00  0.659E+00  0.342E-03  0.331E-13   38  33  22   21  35   1   18  27   9    0.000    0.000       0
+  0    659 00:59:02.72   3.9000A  -3.0297  -3.5710   5.7697  0.120  2.19  -0.308E+01    900.  0.663E+00  0.660E+00  0.351E-03  0.338E-13   33  11   7   16   2  38   32  26   6    0.000    0.000       0
   0    674 01:00:01.39   3.8800A   3.4608   3.5710   5.7932  0.121  2.15  -0.309E+01    850.  0.666E+00  0.664E+00  0.354E-03  0.336E-13   17  19  29   26  33   4   18  11  20    0.000    0.000       0
   0    690 01:01:02.32   3.8400A  -3.4325   3.6644   5.8597  0.120  2.26  -0.311E+01    975.  0.670E+00  0.669E+00  0.356E-03  0.334E-13   35  12   6    9  33  33   26  11  20    0.000    0.000       0
   0    705 01:02:01.15   3.9100A  -3.2987   3.6724   5.7587  0.120  2.22  -0.314E+01    925.  0.675E+00  0.673E+00  0.367E-03  0.342E-13   38  10   4   33  16  20   30  11  21    0.000    0.000       0
-  0    720 01:03:00.72   4.0900A  -3.7833   3.4857   5.5061  0.121  2.23  -0.313E+01    925.  0.673E+00  0.670E+00  0.380E-03  0.356E-13   27  10   9   11  36  34   29   5   9    0.000    0.000       0
+  0    720 01:03:00.72   4.0900A  -3.7833   3.4857   5.5060  0.121  2.23  -0.313E+01    925.  0.673E+00  0.670E+00  0.380E-03  0.356E-13   27  10   9   11  36  34   29   5   9    0.000    0.000       0
   0    735 01:04:02.70   4.0600A   3.3044  -3.0846   5.5471  0.124  2.22  -0.312E+01    900.  0.665E+00  0.661E+00  0.383E-03  0.350E-13    8  32  13    1  19  22   18   1  20    0.000    0.000       0
   0    750 01:05:03.17   3.8900A   3.1157   3.3684   5.7783  0.127  2.21  -0.311E+01    875.  0.664E+00  0.660E+00  0.372E-03  0.333E-13   29   2  24   26  38  32   15  33  32    0.000    0.000       0
   0    765 01:06:00.29   3.7300A  -4.0851   3.4941   6.0342  0.128  2.22  -0.311E+01    875.  0.680E+00  0.676E+00  0.357E-03  0.323E-13   27  32  28   31   0  31   22  33  32    0.000    0.000       0
   0    783 01:07:02.40   3.1600A  -3.5715   4.0555   7.1273  0.128  2.30  -0.312E+01    975.  0.709E+00  0.706E+00  0.304E-03  0.275E-13   30  34  27   37   0  33   25  33  32    0.000    0.000       0
-  0    802 01:08:00.66   3.1700A   3.0024   4.1980   7.0976  0.128  2.26  -0.314E+01    925.  0.732E+00  0.730E+00  0.302E-03  0.273E-13   40  34  35   39   3  33   33  33  32    0.000    0.000       0
-  0    819 01:09:01.36   3.9000A   3.4808  -3.6022   5.7651  0.127  2.22  -0.316E+01    875.  0.749E+00  0.747E+00  0.378E-03  0.340E-13   42  33  34   44  30  32   34  38  30    0.000    0.000       0
-  0    834 01:10:02.25   4.0400A   3.5322   3.3613   5.5643  0.126  2.28  -0.316E+01    950.  0.766E+00  0.764E+00  0.400E-03  0.364E-13    8  12  14   41   2  29   19  10  21    0.000    0.000       0
-  0    849 01:11:01.06   3.9100A  -4.1580   4.5664   5.7530  0.126  2.27  -0.326E+01    925.  0.783E+00  0.780E+00  0.402E-03  0.365E-13   39  38  29   31  14  22   22   9  23    0.000    0.000       0
-  0    866 01:12:02.48   3.5600A  -3.9940   4.9015   6.3170  0.128  2.27  -0.319E+01    925.  0.800E+00  0.795E+00  0.358E-03  0.326E-13   40  36  25   32  17  21   29   9  23    0.000    0.000       0
-  0    882 01:13:02.68   3.9600A  -3.5532   4.0541   5.6783  0.130  2.31  -0.316E+01    950.  0.808E+00  0.804E+00  0.399E-03  0.366E-13   35  32  22   33  19  20   33   9  21    0.000    0.000       0
-  0    898 01:14:02.30   3.6800A   3.6534  -3.7072   6.1220  0.132  2.29  -0.314E+01    925.  0.819E+00  0.815E+00  0.372E-03  0.347E-13   27   6  28   37  29  36   21   2  20    0.000    0.000       0
-  0    915 01:15:02.84   3.4300A   3.7497  -3.8179   6.5666  0.132  2.27  -0.316E+01    900.  0.844E+00  0.839E+00  0.363E-03  0.332E-13   28   6  30    1  13  24   21  13  10    0.000    0.000       0
-  0    933 01:16:01.69   3.3500A   3.5352  -4.1565   6.7211  0.130  2.29  -0.318E+01    925.  0.866E+00  0.861E+00  0.359E-03  0.324E-13   24  10  11    2  12  24   31  38  38    0.000    0.000       0
-  0    950 01:17:01.39   3.4800A  -3.8042  -4.0536   6.4733  0.129  2.35  -0.320E+01   1000.  0.888E+00  0.883E+00  0.378E-03  0.344E-13    9  11  24    2  11  24   22  37  14    0.000    0.000       0
-  0    968 01:18:02.70   3.4500A   4.2935  -3.9053   6.5190  0.129  2.33  -0.321E+01    975.  0.897E+00  0.894E+00  0.371E-03  0.342E-13   29  11  12    1   6  23   31  38  15    0.000    0.000       0
-  0    985 01:19:01.26   3.6800A   3.9624  -4.1758   6.1135  0.130  2.29  -0.320E+01    925.  0.909E+00  0.905E+00  0.397E-03  0.364E-13   34  11  13    1   5  22   33   0  16    0.000    0.000       0
-  0   1001 01:20:00.04   3.6900A  -4.1990  -4.5214   6.0971  0.130  2.26  -0.321E+01    875.  0.901E+00  0.895E+00  0.417E-03  0.383E-13    1   4  24    2   4  22   19  23  29    0.000    0.000       0
-  0   1018 01:21:03.35   3.7400A  -3.8121  -4.5139   6.0204  0.131  2.28  -0.323E+01    900.  0.893E+00  0.886E+00  0.432E-03  0.391E-13    1   4  23    2   3  21   26  22  30    0.000    0.000       0
-  0   1034 01:22:03.87   3.9100A  -4.3708  -4.1757   5.7585  0.130  2.30  -0.323E+01    925.  0.888E+00  0.880E+00  0.445E-03  0.402E-13    1   3  23    2   2  21   33  21  30    0.000    0.000       0
-  0   1050 01:23:03.32   3.7000A   4.1322  -4.3210   6.0868  0.129  2.34  -0.324E+01    975.  0.895E+00  0.887E+00  0.422E-03  0.385E-13   27   1  27    2   2  20   24  24  26    0.000    0.000       0
-  0   1065 01:24:00.31   3.7500A  -4.4515  -3.9577   5.9974  0.131  2.35  -0.324E+01    975.  0.893E+00  0.885E+00  0.433E-03  0.395E-13    1   2  21    1   2  19   28   5  10    0.000    0.000       0
-  0   1081 01:25:00.62   3.6900A  -3.8178  -3.4814   6.1009  0.134  2.32  -0.321E+01    925.  0.888E+00  0.879E+00  0.438E-03  0.396E-13    8   1  20    4   3   9   29   5  10    0.000    0.000       0
-  0   1097 01:26:00.72   4.2300A  -4.0595  -3.4137   5.3217  0.136  2.37  -0.321E+01    975.  0.881E+00  0.872E+00  0.479E-03  0.430E-13    1   1  26   25  35  15   36   5  10    0.000    0.000       0
-  0   1112 01:27:02.31   3.7300A  -4.1024  -3.7793   6.0274  0.139  2.36  -0.317E+01    950.  0.877E+00  0.869E+00  0.429E-03  0.380E-13    1   2  25   27  33  15   18  21  25    0.000    0.000       0
-  0   1127 01:28:00.44   3.8400A  -4.1132  -4.3536   5.8628  0.144  2.34  -0.316E+01    900.  0.895E+00  0.889E+00  0.455E-03  0.399E-13    1   2  23   17  38   9   19  38  17    0.000    0.000       0
-  0   1143 01:29:00.87   3.7900A   4.2107  -3.9932   5.9380  0.146  2.39  -0.316E+01    950.  0.926E+00  0.921E+00  0.446E-03  0.386E-13   34   1  23   24  37   8   29  36  18    0.000    0.000       0
-  0   1158 01:30:01.55   4.1900A  -4.2576  -3.6350   5.3679  0.146  2.45  -0.313E+01   1025.  0.951E+00  0.947E+00  0.497E-03  0.425E-13   35  36   9   35  35  11   32  35   9    0.000    0.000       0
-  0   1173 01:31:01.99   3.8000A  -4.0657  -4.1395   5.9181  0.145  2.42  -0.316E+01   1000.  0.983E+00  0.980E+00  0.465E-03  0.397E-13   38  35   7   16  12  10   11   2   8    0.000    0.000       0
-  0   1191 01:32:01.06   2.9900A   3.9585  -4.3963   7.5211  0.143  2.40  -0.314E+01    975.  0.103E+01  0.103E+01  0.359E-03  0.310E-13   39  32  24   30  34   8   20   3   9    0.000    0.000       0
-  0   1211 01:33:00.15   3.1200A  -4.9115  -5.0019   7.2108  0.142  2.45  -0.313E+01   1050.  0.107E+01  0.106E+01  0.371E-03  0.323E-13   38   0   4   34  31   5   31   3   9    0.000    0.000       0
-  0   1230 01:34:02.73   3.1600A  -5.0792  -5.0448   7.1132  0.141  2.45  -0.314E+01   1050.  0.109E+01  0.108E+01  0.392E-03  0.342E-13   39  39   1   37  29  11   24   2  17    0.000    0.000       0
-  0   1248 01:35:00.62   3.1600A   4.7965  -4.5551   7.1103  0.142  2.40  -0.314E+01    975.  0.112E+01  0.110E+01  0.398E-03  0.346E-13   36   2  21   36  26  10   24   1  17    0.000    0.000       0
-  0   1268 01:36:01.04   2.8400A   5.0566  -4.3069   7.9208  0.142  2.38  -0.316E+01    950.  0.114E+01  0.112E+01  0.365E-03  0.320E-13   40   2  24   41  31   3   28  26  18    0.000    0.000       0
-  0   1290 01:37:01.63   2.7800A   4.1688  -4.3049   8.0935  0.142  2.42  -0.319E+01   1000.  0.115E+01  0.112E+01  0.352E-03  0.309E-13   43   3  25   39  38  16   34  27  18    0.000    0.000       0
-  0   1311 01:38:02.08   3.1200A  -4.5463  -4.3848   7.2076  0.142  2.44  -0.318E+01   1025.  0.114E+01  0.112E+01  0.387E-03  0.348E-13   42  24  14   41  20  17   29   3  17    0.000    0.000       0
-  0   1331 01:39:00.07   2.8600A  -4.6898  -3.8181   7.8612  0.143  2.43  -0.317E+01   1000.  0.113E+01  0.112E+01  0.372E-03  0.335E-13   44  25  13   42  18  16   36   3  17    0.000    0.000       0
-  0   1352 01:40:00.07   3.0100A  -4.8562   4.2191   7.4706  0.146  2.48  -0.314E+01   1050.  0.111E+01  0.110E+01  0.408E-03  0.361E-13   44  29  13   45  32  16   36  30  15    0.000    0.000       0
-  0   1371 01:41:02.28   3.6700A  -5.2011   3.5977   6.1234  0.147  2.44  -0.314E+01   1000.  0.108E+01  0.107E+01  0.481E-03  0.430E-13   41  29  10   42  12  22   20  25  25    0.000    0.000       0
-  0   1387 01:42:00.91   3.6100A  -4.7229   4.0121   6.2254  0.147  2.42  -0.314E+01    975.  0.106E+01  0.105E+01  0.463E-03  0.411E-13   41  31   7   41  10  16   15  25  13    0.000    0.000       0
-  0   1404 01:43:02.04   3.5000A  -5.0764   3.4659   6.4262  0.144  2.41  -0.317E+01    975.  0.107E+01  0.106E+01  0.440E-03  0.381E-13   34  29   9    1  27  21   29  24  15    0.000    0.000       0
-  0   1421 01:44:01.81   3.3400A  -4.3755  -3.6993   6.7441  0.137  2.46  -0.324E+01   1075.  0.109E+01  0.108E+01  0.430E-03  0.367E-13   34  30   5   35  22  12   23  32  20    0.000    0.000       0
-  0   1440 01:45:00.65   2.9200A  -4.2136  -3.6976   7.6976  0.132  2.41  -0.329E+01   1025.  0.109E+01  0.108E+01  0.381E-03  0.326E-13   32  28  11   40  19  12   25  30  18    0.000    0.000       0
-  0   1461 01:46:02.89   3.1100A  -4.4747  -3.8814   7.2275  0.130  2.38  -0.334E+01   1000.  0.110E+01  0.109E+01  0.401E-03  0.348E-13   40  32  10   44  30  17   34  30  18    0.000    0.000       0
-  0   1480 01:47:02.71   3.3000A  -5.7419   3.9887   6.8194  0.129  2.44  -0.342E+01   1075.  0.108E+01  0.107E+01  0.428E-03  0.376E-13   39  32   7   34  30   9   33  30  18    0.000    0.000       0
-  0   1498 01:48:02.32   3.0600A  -5.1730   3.8710   7.3581  0.130  2.37  -0.342E+01    975.  0.105E+01  0.104E+01  0.402E-03  0.351E-13   38  33   4    1  30  30   20  30  15    0.000    0.000       0
-  0   1517 01:49:00.43   3.0700A  -4.6641   4.1815   7.3345  0.134  2.37  -0.339E+01    950.  0.103E+01  0.102E+01  0.404E-03  0.342E-13   37  34   1   39  38  21   33  31  15    0.000    0.000       0
-  0   1536 01:50:01.30   3.6100A   4.1902   4.2292   6.2258  0.141  2.35  -0.329E+01    900.  0.101E+01  0.101E+01  0.471E-03  0.399E-13   12   3   7    1  33  31   32   4  15    0.000    0.000       0
-  0   1553 01:51:01.13   3.2300A   3.9049  -3.6179   6.9573  0.147  2.40  -0.325E+01    925.  0.101E+01  0.100E+01  0.421E-03  0.354E-13   17   4   7    1   0  26   21  33  28    0.000    0.000       0
-  0   1573 01:52:02.53   2.9900A  -3.8620  -3.6876   7.5304  0.150  2.49  -0.322E+01   1025.  0.101E+01  0.100E+01  0.383E-03  0.315E-13   43  29  10   34   0  11   32  33  28    0.000    0.000       0
-  0   1592 01:53:00.20   3.1600A   3.7698   3.6672   7.1142  0.148  2.29  -0.321E+01    800.  0.101E+01  0.100E+01  0.408E-03  0.335E-13    1  35  11   44  38  27   38  33  28    0.000    0.000       0
-  0   1611 01:54:03.23   3.2500A   4.3997   3.4270   6.9161  0.144  2.38  -0.326E+01    925.  0.101E+01  0.100E+01  0.438E-03  0.361E-13    1  35  13   37   0  24   28  35  21    0.000    0.000       0
-  0   1630 01:55:01.76   2.9600A   4.2012  -3.8586   7.5911  0.141  2.39  -0.329E+01    950.  0.104E+01  0.103E+01  0.400E-03  0.328E-13   18   2  21   15   6  19   31  28  13    0.000    0.000       0
-  0   1648 01:56:01.11   3.4800A   4.9521   3.9985   6.4697  0.138  2.34  -0.335E+01    900.  0.106E+01  0.106E+01  0.462E-03  0.383E-13   21   2  23   38   2  24   32  35  22    0.000    0.000       0
-  0   1665 01:57:00.84   3.4600A   3.9706   4.2439   6.4952  0.134  2.37  -0.339E+01    950.  0.107E+01  0.106E+01  0.469E-03  0.389E-13   28   4  23   29   7  20   33  27  11    0.000    0.000       0
-  0   1684 01:58:02.96   3.1500A   4.0927   4.1890   7.1317  0.131  2.40  -0.342E+01   1000.  0.109E+01  0.108E+01  0.424E-03  0.350E-13   31   5  25   46   2  20   26   7  19    0.000    0.000       0
-  0   1702 01:59:00.62   3.2700A   3.8317  -3.5119   6.8745  0.129  2.47  -0.346E+01   1100.  0.107E+01  0.107E+01  0.447E-03  0.372E-13   17  22  12    1   6  22   33   8  18    0.000    0.000       0
-  0   1720 02:00:01.87   3.2800A  -3.7534   3.9650   6.8552  0.128  2.40  -0.347E+01   1000.  0.107E+01  0.106E+01  0.454E-03  0.376E-13    8   4  22   37  14  17   28  36  19    0.000    0.000       0
+  0    802 01:08:00.66   3.1700A   3.0024   4.1981   7.0976  0.128  2.26  -0.314E+01    925.  0.732E+00  0.730E+00  0.302E-03  0.273E-13   40  34  35   39   3  33   33  33  32    0.000    0.000       0
+  0    819 01:09:01.36   3.9000A   3.4808  -3.6023   5.7653  0.127  2.22  -0.316E+01    875.  0.749E+00  0.747E+00  0.378E-03  0.340E-13   42  33  34   44  30  32   34  38  30    0.000    0.000       0
+  0    834 01:10:02.25   4.0400A   3.5324   3.3613   5.5641  0.126  2.28  -0.316E+01    950.  0.766E+00  0.764E+00  0.400E-03  0.364E-13    8  12  14   41   2  29   19  10  21    0.000    0.000       0
+  0    849 01:11:01.06   3.9100A  -4.1581   4.5665   5.7530  0.126  2.27  -0.326E+01    925.  0.783E+00  0.780E+00  0.402E-03  0.365E-13   39  38  29   31  14  22   22   9  23    0.000    0.000       0
+  0    866 01:12:02.48   3.5600A  -3.9940   4.9012   6.3170  0.128  2.27  -0.319E+01    925.  0.800E+00  0.795E+00  0.358E-03  0.326E-13   40  36  25   32  17  21   29   9  23    0.000    0.000       0
+  0    882 01:13:02.68   3.9600A  -3.5532   4.0539   5.6782  0.130  2.31  -0.316E+01    950.  0.808E+00  0.804E+00  0.399E-03  0.366E-13   35  32  22   33  19  20   33   9  21    0.000    0.000       0
+  0    898 01:14:02.30   3.6800A   3.6537  -3.7073   6.1221  0.132  2.29  -0.314E+01    925.  0.819E+00  0.815E+00  0.372E-03  0.347E-13   27   6  28   37  29  36   21   2  20    0.000    0.000       0
+  0    915 01:15:02.84   3.4300A   3.7496  -3.8177   6.5666  0.132  2.27  -0.316E+01    900.  0.844E+00  0.839E+00  0.363E-03  0.332E-13   28   6  30    1  13  24   21  13  10    0.000    0.000       0
+  0    933 01:16:01.69   3.3500A   3.5353  -4.1563   6.7222  0.130  2.29  -0.318E+01    925.  0.866E+00  0.861E+00  0.359E-03  0.324E-13   24  10  11    2  12  24   31  38  38    0.000    0.000       0
+  0    950 01:17:01.39   3.4800A  -3.8050  -4.0535   6.4726  0.129  2.35  -0.320E+01   1000.  0.888E+00  0.883E+00  0.378E-03  0.344E-13    9  11  24    2  11  24   22  37  14    0.000    0.000       0
+  0    968 01:18:02.70   3.4500A   4.2929  -3.9052   6.5161  0.129  2.33  -0.321E+01    975.  0.897E+00  0.894E+00  0.371E-03  0.342E-13   29  11  12    1   6  23   31  38  15    0.000    0.000       0
+  0    985 01:19:01.21   3.6700A   3.9660  -4.1744   6.1283  0.130  2.29  -0.320E+01    925.  0.909E+00  0.905E+00  0.395E-03  0.363E-13   34  11  13    1   5  22   33   0  16    0.000    0.000       0
+  0   1002 01:20:03.67   3.6700A  -4.3289  -4.5634   6.1373  0.131  2.26  -0.321E+01    875.  0.901E+00  0.895E+00  0.415E-03  0.382E-13    1   4  24    2   4  22   20  23  29    0.000    0.000       0
+  0   1018 01:21:03.27   3.7400A  -3.8139  -4.5109   6.0196  0.131  2.28  -0.323E+01    900.  0.893E+00  0.886E+00  0.432E-03  0.391E-13    1   4  23    2   3  21   26  22  30    0.000    0.000       0
+  0   1034 01:22:03.77   3.9100A  -4.3747  -4.1774   5.7617  0.130  2.30  -0.323E+01    925.  0.888E+00  0.880E+00  0.444E-03  0.401E-13    1   3  23    2   2  21   33  21  30    0.000    0.000       0
+  0   1050 01:23:03.17   3.6900A   4.1338  -4.3159   6.0979  0.129  2.34  -0.324E+01    975.  0.895E+00  0.887E+00  0.421E-03  0.384E-13   27   1  27    2   2  20   24  24  26    0.000    0.000       0
+  0   1065 01:24:00.10   3.7500A  -4.4530  -3.9701   6.0040  0.131  2.35  -0.324E+01    975.  0.893E+00  0.885E+00  0.433E-03  0.395E-13    1   2  21    1   2  19   28   5  10    0.000    0.000       0
+  0   1081 01:25:00.46   3.6900A  -3.8227  -3.4844   6.0932  0.134  2.32  -0.321E+01    925.  0.888E+00  0.879E+00  0.438E-03  0.395E-13    8   1  20    4   3   9   29   5  10    0.000    0.000       0
+  0   1097 01:26:00.59   4.2300A  -4.0440   3.4144   5.3210  0.136  2.37  -0.321E+01    975.  0.881E+00  0.872E+00  0.479E-03  0.430E-13    1   1  26   32  34  14   36   5  10    0.000    0.000       0
+  0   1112 01:27:02.29   3.7300A  -4.1101  -3.7705   6.0290  0.139  2.36  -0.317E+01    950.  0.877E+00  0.869E+00  0.429E-03  0.380E-13    1   2  25   27  33  15   18  21  25    0.000    0.000       0
+  0   1127 01:28:00.39   3.8300A  -4.1216  -4.3556   5.8719  0.144  2.34  -0.316E+01    900.  0.895E+00  0.889E+00  0.454E-03  0.398E-13    1   2  23   17  38   9   19  38  17    0.000    0.000       0
+  0   1143 01:29:00.57   3.7600A   4.2122  -3.9660   5.9830  0.146  2.39  -0.317E+01    950.  0.925E+00  0.920E+00  0.442E-03  0.382E-13   34   1  23   24  37   8   29  36  18    0.000    0.000       0
+  0   1158 01:30:01.10   4.2000A  -4.3122  -3.5934   5.3602  0.146  2.45  -0.313E+01   1025.  0.951E+00  0.947E+00  0.501E-03  0.428E-13   35  36   9   35  35  11   32  35   9    0.000    0.000       0
+  0   1173 01:31:01.32   3.8400A  -4.0059  -4.1383   5.8524  0.145  2.42  -0.314E+01   1000.  0.983E+00  0.980E+00  0.463E-03  0.395E-13   38  35   7   16  12  10   11   2   8    0.000    0.000       0
+  0   1191 01:32:00.68   2.9900A   3.7369  -4.4189   7.5260  0.143  2.40  -0.313E+01    975.  0.103E+01  0.103E+01  0.358E-03  0.310E-13   39  32  24   30  34   8   20   3   9    0.000    0.000       0
+  0   1212 01:33:02.80   3.1400A  -4.7984  -5.1513   7.1550  0.142  2.45  -0.313E+01   1050.  0.107E+01  0.106E+01  0.375E-03  0.327E-13   38   0   4   34  31   5   32   3   9    0.000    0.000       0
+  0   1230 01:34:02.11   3.1600A  -5.0090  -4.9103   7.1215  0.141  2.45  -0.314E+01   1050.  0.109E+01  0.107E+01  0.391E-03  0.342E-13   40  39   2   37  30  11   24   2  17    0.000    0.000       0
+  0   1249 01:35:03.11   3.1800A   5.0450  -4.5437   7.0838  0.143  2.40  -0.315E+01    975.  0.112E+01  0.110E+01  0.399E-03  0.348E-13   36   2  21   36  26  10   26   0  18    0.000    0.000       0
+  0   1268 01:36:01.73   3.0200A   4.7551  -4.1479   7.4503  0.143  2.38  -0.316E+01    950.  0.114E+01  0.112E+01  0.379E-03  0.330E-13   40   2  24   42  30   0   30  26  19    0.000    0.000       0
+  0   1287 01:37:00.46   3.0700A  -4.3104  -4.2302   7.3349  0.142  2.44  -0.319E+01   1025.  0.114E+01  0.112E+01  0.389E-03  0.342E-13   36   1  39   38  31  12   26  27  17    0.000    0.000       0
+  0   1307 01:38:02.96   3.1900A   4.3117  -4.1504   7.0488  0.143  2.44  -0.317E+01   1025.  0.114E+01  0.112E+01  0.400E-03  0.359E-13   42   0  24   42  37  17   29   3  16    0.000    0.000       0
+  0   1327 01:39:01.23   2.8300A   4.5941  -3.9671   7.9441  0.143  2.42  -0.316E+01   1000.  0.114E+01  0.113E+01  0.367E-03  0.329E-13   43   1  26   22  12  13   37   3  17    0.000    0.000       0
+  0   1348 01:40:01.20   2.8500A   4.3287   3.9442   7.8927  0.144  2.47  -0.316E+01   1050.  0.112E+01  0.111E+01  0.380E-03  0.339E-13   38   3  28   46  32  15   39  29  15    0.000    0.000       0
+  0   1367 01:41:03.44   3.5500A   4.5522   4.0462   6.3317  0.146  2.42  -0.315E+01    975.  0.108E+01  0.107E+01  0.472E-03  0.420E-13   42   6  26    2  24  23   21   6  26    0.000    0.000       0
+  0   1383 01:42:00.86   3.6600A  -4.1438   3.9905   6.1427  0.148  2.40  -0.315E+01    950.  0.106E+01  0.105E+01  0.469E-03  0.413E-13   41   7  15    2  25  23   26  25  25    0.000    0.000       0
+  0   1399 01:43:00.39   4.0100A  -4.3311   3.6270   5.6106  0.145  2.43  -0.316E+01   1000.  0.107E+01  0.106E+01  0.495E-03  0.426E-13   37  32   8    1  26  22   25  25  16    0.000    0.000       0
+  0   1415 01:44:00.47   3.2700A  -4.1867  -3.3786   6.8865  0.137  2.36  -0.325E+01    950.  0.109E+01  0.108E+01  0.424E-03  0.358E-13   35  24   6   16  22  25   15  30  18    0.000    0.000       0
+  0   1436 01:45:01.41   2.8400A  -4.4120   4.0902   7.9099  0.129  2.39  -0.333E+01   1025.  0.112E+01  0.111E+01  0.365E-03  0.310E-13   35  33  10   31  34  18   25  30  18    0.000    0.000       0
+  0   1457 01:46:00.53   2.9200A  -5.3352   4.3138   7.7076  0.125  2.38  -0.341E+01   1025.  0.114E+01  0.113E+01  0.374E-03  0.322E-13   40  28  11   37  35  14   31  31  15    0.000    0.000       0
+  0   1476 01:47:00.82   3.3100A  -5.7525  -3.8622   6.7879  0.126  2.29  -0.341E+01    900.  0.112E+01  0.111E+01  0.430E-03  0.381E-13   38  31   8   44  28  19   37  30  19    0.000    0.000       0
+  0   1493 01:48:00.07   3.5500A  -4.5315   3.7301   6.3411  0.130  2.37  -0.341E+01    975.  0.107E+01  0.106E+01  0.463E-03  0.411E-13   40  35   6   43  38  21   24  28  15    0.000    0.000       0
+  0   1511 01:49:03.29   3.6200A  -4.0956   3.6587   6.2192  0.134  2.35  -0.338E+01    925.  0.102E+01  0.101E+01  0.480E-03  0.411E-13    7  30  30    1  30  31   32  29  16    0.000    0.000       0
+  0   1526 01:50:00.23   3.7100A  -4.0100  -4.2427   6.0692  0.139  2.28  -0.334E+01    825.  0.993E+00  0.987E+00  0.499E-03  0.426E-13    7  30  30   44  26  17   20  32  16    0.000    0.000       0
+  0   1543 01:51:02.61   3.6700A  -4.0450  -3.9755   6.1301  0.144  2.47  -0.329E+01   1025.  0.999E+00  0.992E+00  0.478E-03  0.405E-13   25   8  11   39  21  16   32  33  15    0.000    0.000       0
+  0   1560 01:52:03.17   3.4300A  -3.6568  -3.8067   6.5608  0.144  2.45  -0.327E+01   1000.  0.102E+01  0.101E+01  0.454E-03  0.378E-13    6  13  27   16  36  32   20  24  14    0.000    0.000       0
+  0   1577 01:53:02.06   3.5500A  -3.7761  -3.6516   6.3344  0.142  2.42  -0.329E+01    975.  0.104E+01  0.103E+01  0.476E-03  0.393E-13    7  13  25   21  34  31   27  35  20    0.000    0.000       0
+  0   1594 01:54:00.98   3.2800A   3.6477   3.4656   6.8510  0.142  2.42  -0.328E+01    975.  0.106E+01  0.105E+01  0.454E-03  0.373E-13    1  33  16   32  38  22   25  35  22    0.000    0.000       0
+  0   1613 01:55:02.36   3.0900A  -3.7118  -3.8361   7.2711  0.145  2.37  -0.324E+01    900.  0.106E+01  0.105E+01  0.416E-03  0.344E-13   39  35  15   29   0  19   25   0  19    0.000    0.000       0
+  0   1631 01:56:02.32   3.2900A   3.8617   4.1773   6.8302  0.146  2.42  -0.326E+01    950.  0.107E+01  0.106E+01  0.449E-03  0.367E-13   30   1  25    1   2   5   16  35  20    0.000    0.000       0
+  0   1650 01:57:00.64   2.9500A   3.9181   3.9853   7.6317  0.145  2.45  -0.327E+01   1000.  0.108E+01  0.108E+01  0.404E-03  0.329E-13   33   1  26    1   4   5   33  36  18    0.000    0.000       0
+  0   1670 01:58:00.42   2.9100A  -4.5577   4.4882   7.7277  0.143  2.53  -0.332E+01   1100.  0.112E+01  0.112E+01  0.400E-03  0.330E-13   44  35  13   45   2  19   32  34  21    0.000    0.000       0
+  0   1691 01:59:02.58   3.3300A   4.7480   4.6393   6.7572  0.141  2.46  -0.330E+01   1025.  0.113E+01  0.113E+01  0.459E-03  0.384E-13   21   4  21   45   3  19   39  35  20    0.000    0.000       0
+  0   1708 02:00:01.82   3.2100A   4.3269   4.6137   6.9986  0.141  2.42  -0.328E+01    975.  0.114E+01  0.114E+01  0.453E-03  0.377E-13   26   3  24   44   4  17   19  35  27    0.000    0.000       0
Index: palm/trunk/TUTORIALS/cases/lsm_short/USER_CODE/user_module.f90
===================================================================
--- palm/trunk/TUTORIALS/cases/lsm_short/USER_CODE/user_module.f90	(revision 4446)
+++ palm/trunk/TUTORIALS/cases/lsm_short/USER_CODE/user_module.f90	(revision 4765)
@@ -1,20 +1,20 @@
 !> @file user_module.f90
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! This file is part of the PALM model system.
 !
-! PALM is free software: you can redistribute it and/or modify it under the
-! terms of the GNU General Public License as published by the Free Software
-! Foundation, either version 3 of the License, or (at your option) any later
-! version.
-!
-! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
-! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-!
-! You should have received a copy of the GNU General Public License along with
-! PALM. If not, see <http://www.gnu.org/licenses/>.
+! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General
+! Public License as published by the Free Software Foundation, either version 3 of the License, or
+! (at your option) any later version.
+!
+! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
+! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+! Public License for more details.
+!
+! You should have received a copy of the GNU General Public License along with PALM. If not, see
+! <http://www.gnu.org/licenses/>.
 !
 ! Copyright 1997-2020 Leibniz Universitaet Hannover
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
+!
 !
 ! Current revisions:
@@ -24,10 +24,40 @@
 ! Former revisions:
 ! -----------------
-! $Id: user_module.f90 3986 2019-05-20 14:08:14Z Giersch $
+! $Id: user_module.f90 4535 2020-05-15 12:07:23Z raasch $
+! bugfix for restart data format query
+! 
+! 4517 2020-05-03 14:29:30Z raasch
+! added restart with MPI-IO for reading local arrays
+!
+! 4504 2020-04-20 12:11:24Z raasch
+! hint for setting rmask arrays added
+! 
+! 4497 2020-04-15 10:20:51Z raasch
+! file re-formatted to follow the PALM coding standard
+!
+! 4495 2020-04-13 20:11:20Z raasch
+! restart data handling with MPI-IO added
+!
+! 4360 2020-01-07 11:25:50Z suehring
+! Introduction of wall_flags_total_0, which currently sets bits based on static topography
+! information used in wall_flags_static_0
+!
+! 4329 2019-12-10 15:46:36Z motisi
+! Renamed wall_flags_0 to wall_flags_static_0
+!
+! 4287 2019-11-01 14:50:20Z raasch
+! reading of namelist file and actions in case of namelist errors revised so that statement labels
+! and goto statements are not required any more; this revision also removes a previous bug which
+! appeared when the namelist has been commented out in the namelist file
+!
+! 4182 2019-08-22 15:20:23Z scharf
+! Corrected "Former revisions" section
+!
+! 3986 2019-05-20 14:08:14Z Giersch
 ! Redundant integration of control parameters in user_rrd_global removed
-! 
+!
 ! 3911 2019-04-17 12:26:19Z knoop
 ! Bugfix: added before_prognostic_equations case in user_actions
-! 
+!
 ! 3768 2019-02-27 14:35:58Z raasch
 ! variables commented + statements added to avoid compiler warnings about unused variables
@@ -35,43 +65,10 @@
 ! 3767 2019-02-27 08:18:02Z raasch
 ! unused variable for file index removed from rrd-subroutines parameter list
-! 
+!
 ! 3747 2019-02-16 15:15:23Z gronemeier
 ! Add routine user_init_arrays
-! 
+!
 ! 3703 2019-01-29 16:43:53Z knoop
 ! An example for a user defined global variable has been added (Giersch)
-! 
-! 2718 2018-01-02 08:49:38Z suehring
-! Corrected "Former revisions" section
-! 
-! 2696 2017-12-14 17:12:51Z kanani
-! Change in file header (GPL part)
-!
-! 2101 2017-01-05 16:42:31Z suehring
-!
-! 2000 2016-08-20 18:09:15Z knoop
-! Forced header and separation lines into 80 columns
-! 
-! 1873 2016-04-18 14:50:06Z maronga
-! Module renamed (removed _mod)
-! 
-! 
-! 1850 2016-04-08 13:29:27Z maronga
-! Module renamed
-! 
-! 
-! 1682 2015-10-07 23:56:08Z knoop
-! Code annotations made doxygen readable 
-!
-! 1320 2014-03-20 08:40:49Z raasch
-! kind-parameters added to all INTEGER and REAL declaration statements, 
-! kinds are defined in new module kinds, 
-! old module precision_kind is removed,
-! revision history before 2012 removed,
-! comment fields (!:) to be used for variable explanations added to
-! all variable declaration statements 
-!
-! 1036 2012-10-22 13:43:42Z raasch
-! code put under GPL (PALM 3.9)
 !
 ! Revision 1.1  1998/03/24 15:29:04  raasch
@@ -81,10 +78,9 @@
 ! Description:
 ! ------------
-!> Declaration of user-defined variables. This module may only be used
-!> in the user-defined routines (contained in user_interface.f90).
-!------------------------------------------------------------------------------!
+!> Declaration of user-defined variables. This module may only be used in the user-defined routines
+!> (contained in user_interface.f90).
+!--------------------------------------------------------------------------------------------------!
  MODULE user
 
-
     USE arrays_3d
 
@@ -105,19 +101,19 @@
     IMPLICIT NONE
 
-    INTEGER(iwp) ::  dots_num_palm   !< 
-    INTEGER(iwp) ::  dots_num_user = 0  !< 
-    INTEGER(iwp) ::  user_idummy     !< 
-    
-    LOGICAL ::  user_module_enabled = .FALSE.   !< 
-    
-    REAL(wp) ::  user_rdummy   !< 
+    INTEGER(iwp) ::  dots_num_palm      !<
+    INTEGER(iwp) ::  dots_num_user = 0  !<
+    INTEGER(iwp) ::  user_idummy        !<
+
+    LOGICAL ::  user_module_enabled = .FALSE.  !<
+
+    REAL(wp) ::  user_rdummy  !<
 
 !
 !-- Sample for user-defined output
-!    REAL(wp) :: global_parameter !< user defined global parameter 
-!
-!    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  u2       !< user defined array
-!    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  u2_av    !< user defined array
-!    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  ustvst   !< user defined array
+!    REAL(wp) :: global_parameter  !< user defined global parameter
+!
+!    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  u2      !< user defined array
+!    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  u2_av   !< user defined array
+!    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  ustvst  !< user defined array
      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  v_h, v_h_av       !< user defined array
 
@@ -128,28 +124,29 @@
 !
 !- Public functions
-    PUBLIC &
-       user_parin, &
-       user_check_parameters, &
-       user_check_data_output_ts, &
-       user_check_data_output_pr, &
-       user_check_data_output, &
-       user_define_netcdf_grid, &
-       user_init, &
-       user_init_arrays, &
-       user_header, &
-       user_actions, &
-       user_3d_data_averaging, &
-       user_data_output_2d, &
-       user_data_output_3d, &
-       user_statistics, &
-       user_rrd_global, &
-       user_rrd_local, &
-       user_wrd_global, &
-       user_wrd_local, &
-       user_last_actions
+    PUBLIC                                                                                         &
+       user_actions,                                                                               &
+       user_check_data_output,                                                                     &
+       user_check_data_output_pr,                                                                  &
+       user_check_data_output_ts,                                                                  &
+       user_check_parameters,                                                                      &
+       user_data_output_2d,                                                                        &
+       user_data_output_3d,                                                                        &
+       user_define_netcdf_grid,                                                                    &
+       user_header,                                                                                &
+       user_init,                                                                                  &
+       user_init_arrays,                                                                           &
+       user_last_actions,                                                                          &
+       user_parin,                                                                                 &
+       user_rrd_global,                                                                            &
+       user_rrd_local,                                                                             &
+       user_statistics,                                                                            &
+       user_3d_data_averaging,                                                                     &
+       user_wrd_global,                                                                            &
+       user_wrd_local
+
 
 !
 !- Public parameters, constants and initial values
-   PUBLIC &
+   PUBLIC                                                                                          &
       user_module_enabled
 
@@ -212,9 +209,11 @@
 
     INTERFACE user_rrd_global
-       MODULE PROCEDURE user_rrd_global
+       MODULE PROCEDURE user_rrd_global_ftn
+       MODULE PROCEDURE user_rrd_global_mpi
     END INTERFACE user_rrd_global
 
     INTERFACE user_rrd_local
-       MODULE PROCEDURE user_rrd_local
+       MODULE PROCEDURE user_rrd_local_ftn
+       MODULE PROCEDURE user_rrd_local_mpi
     END INTERFACE user_rrd_local
 
@@ -235,24 +234,23 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Parin for &user_parameters for user module
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_parin
 
-
-    CHARACTER (LEN=80) ::  line   !< 
-
-    INTEGER(iwp) ::  i                 !< 
-    INTEGER(iwp) ::  j                 !< 
-
-
-    NAMELIST /user_parameters/  &
-       user_module_enabled, &
-       data_output_pr_user, &
-       data_output_user, &
-       region, &
-       data_output_masks_user
+    CHARACTER (LEN=80) ::  line  !< string containing the last line read from namelist file
+
+    INTEGER(iwp) ::  i          !<
+    INTEGER(iwp) ::  io_status  !< status after reading the namelist file
+    INTEGER(iwp) ::  j          !<
+
+
+    NAMELIST /user_parameters/                                                                     &
+       data_output_masks_user,                                                                     &
+       data_output_pr_user,                                                                        &
+       data_output_user,                                                                           &
+       region
 
 !
@@ -263,39 +261,37 @@
 
 !
-!-- Set revision number of this default interface version. It will be checked within
-!-- the main program (palm). Please change the revision number in case that the
-!-- current revision does not match with previous revisions (e.g. if routines
-!-- have been added/deleted or if parameter lists in subroutines have been changed).
-    user_interface_current_revision = 'r3703'
-
-!
-!-- Position the namelist-file at the beginning (it was already opened in
-!-- parin), search for user-defined namelist-group ("userpar", but any other
-!-- name can be choosed) and position the file at this line.
+!-- Set revision number of this default interface version. It will be checked within the main
+!-- program (palm). Please change the revision number in case that the current revision does not
+!-- match with previous revisions (e.g. if routines have been added/deleted or if parameter lists
+!-- in subroutines have been changed).
+    user_interface_current_revision = 'r4495'
+
+!
+!-- Position the namelist-file at the beginning (it has already been opened in parin), and try to
+!-- read (find) a namelist named "user_parameters".
     REWIND ( 11 )
-
-    line = ' '
-    DO WHILE ( INDEX( line, '&user_parameters' ) == 0 )
-       READ ( 11, '(A)', END=12 )  line
-    ENDDO
-    BACKSPACE ( 11 )
-
-!-- Set default module switch to true
-    user_module_enabled = .TRUE.
-
-!-- Read user-defined namelist
-    READ ( 11, user_parameters, ERR = 10 )
-
-    GOTO 12
-
-10  BACKSPACE( 11 )
-    READ( 11 , '(A)') line
-    CALL parin_fail_message( 'user_parameters', line )
-
-12  CONTINUE
-
-!
-!-- Determine the number of user-defined profiles and append them to the
-!-- standard data output (data_output_pr)
+    READ( 11, user_parameters, IOSTAT=io_status )
+
+!
+!-- Actions depending on the READ status
+    IF ( io_status == 0 )  THEN
+!
+!--    User namelist found and correctly read. Set default module switch to true. This activates
+!--    calls of the user-interface subroutines.
+       user_module_enabled = .TRUE.
+
+    ELSEIF ( io_status > 0 )  THEN
+!
+!--    User namelist was found, but contained errors. Print an error message containing the line
+!--    that caused the problem
+       BACKSPACE( 11 )
+       READ( 11 , '(A)') line
+       CALL parin_fail_message( 'user_parameters', line )
+
+    ENDIF
+
+!
+!-- Determine the number of user-defined profiles and append them to the standard data output
+!-- (data_output_pr)
     IF ( user_module_enabled )  THEN
        IF ( data_output_pr_user(1) /= ' ' )  THEN
@@ -318,14 +314,14 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Check &userpar control parameters and deduce further quantities.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_check_parameters
 
-
-!-- Here the user may add code to check the validity of further &userpar 
-!-- control parameters or deduce further quantities.
+!
+!-- Here the user may add code to check the validity of further &userpar control parameters or
+!-- deduce further quantities.
 
 
@@ -333,16 +329,16 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Set module-specific timeseries units and labels
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_check_data_output_ts( dots_max, dots_num, dots_label, dots_unit )
 
-
-    INTEGER(iwp),      INTENT(IN)     ::  dots_max
-    INTEGER(iwp),      INTENT(INOUT)  ::  dots_num
-    CHARACTER (LEN=*), DIMENSION(dots_max), INTENT(INOUT)  :: dots_label
-    CHARACTER (LEN=*), DIMENSION(dots_max), INTENT(INOUT)  :: dots_unit
+    INTEGER(iwp),      INTENT(IN)     ::  dots_max  !<
+    INTEGER(iwp),      INTENT(INOUT)  ::  dots_num  !<
+
+    CHARACTER(LEN=*), DIMENSION(dots_max), INTENT(INOUT)  ::  dots_label  !<
+    CHARACTER(LEN=*), DIMENSION(dots_max), INTENT(INOUT)  ::  dots_unit   !<
 
 !
@@ -351,11 +347,9 @@
 
 !
-!-- Sample for user-defined time series
-!-- For each time series quantity you have to give a label and a unit,
-!-- which will be used for the NetCDF file. They must not contain more than
-!-- seven characters. The value of dots_num has to be increased by the
-!-- number of new time series quantities. Its old value has to be store in
-!-- dots_num_palm. See routine user_statistics on how to output calculate
-!-- and output these quantities.
+!-- Sample for user-defined time series:
+!-- For each time series quantity you have to give a label and a unit, which will be used for the
+!-- NetCDF file. They must not contain more than seven characters. The value of dots_num has to be
+!-- increased by the number of new time series quantities. Its old value has to be stored in
+!-- dots_num_palm. See routine user_statistics on how to calculate and output these quantities.
 
 !    dots_num_palm = dots_num
@@ -375,12 +369,11 @@
 
 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Set the unit of user defined profile output quantities. For those variables
-!> not recognized by the user, the parameter unit is set to "illegal", which
-!> tells the calling routine that the output variable is not defined and leads
-!> to a program abort.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Set the unit of user defined profile output quantities. For those variables not recognized by the
+!> user, the parameter unit is set to "illegal", which tells the calling routine that the
+!> output variable is not defined and leads to a program abort.
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_check_data_output_pr( variable, var_count, unit, dopr_unit )
 
@@ -389,10 +382,10 @@
 
 
-    CHARACTER (LEN=*) ::  unit     !< 
-    CHARACTER (LEN=*) ::  variable !< 
+    CHARACTER (LEN=*) ::  unit      !<
+    CHARACTER (LEN=*) ::  variable  !<
     CHARACTER (LEN=*) ::  dopr_unit !< local value of dopr_unit
 
-!    INTEGER(iwp) ::  user_pr_index !<
-    INTEGER(iwp) ::  var_count     !<
+!    INTEGER(iwp) ::  user_pr_index  !<
+    INTEGER(iwp) ::  var_count      !<
 
 !
@@ -404,20 +397,18 @@
 !
 !--    Uncomment and extend the following lines, if necessary.
-!--    Add additional CASE statements depending on the number of quantities
-!--    for which profiles are to be calculated. The respective calculations
-!--    to be performed have to be added in routine user_statistics.
-!--    The quantities are (internally) identified by a user-profile-number
-!--    (see variable "user_pr_index" below). The first user-profile must be assigned
-!--    the number "pr_palm+1", the second one "pr_palm+2", etc. The respective
-!--    user-profile-numbers have also to be used in routine user_statistics!
-!       CASE ( 'u*v*' )                      ! quantity string as given in
-!                                            ! data_output_pr_user
+!--    Add additional CASE statements depending on the number of quantities for which profiles are
+!--    to be calculated. The respective calculations to be performed have to be added in routine
+!--    user_statistics. The quantities are (internally) identified by a user-profile-number
+!--    (see variable "user_pr_index" below). The first user-profile must be assigned the number
+!--    "pr_palm+1", the second one "pr_palm+2", etc. The respective user-profile-numbers have also
+!--    to be used in routine user_statistics!
+!       CASE ( 'u*v*' )                      ! quantity string as given in data_output_pr_user
 !          user_pr_index = pr_palm + 1
 !          dopr_index(var_count)  = user_pr_index    ! quantities' user-profile-number
 !          dopr_unit = 'm2/s2'  ! quantity unit
 !          unit = dopr_unit
-!          hom(:,2,user_pr_index,:)       = SPREAD( zu, 2, statistic_regions+1 )
-!                                            ! grid on which the quantity is
-!                                            ! defined (use zu or zw)
+!          hom(:,2,user_pr_index,:) = SPREAD( zu, 2, statistic_regions+1 )
+!                                            ! grid on which the quantity is defined (use zu or zw)
+!
 
        CASE DEFAULT
@@ -430,17 +421,16 @@
 
 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Set the unit of user defined output quantities. For those variables
-!> not recognized by the user, the parameter unit is set to "illegal", which
-!> tells the calling routine that the output variable is not defined and leads
-!> to a program abort.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Set the unit of user defined output quantities. For those variables not recognized by the user,
+!> the parameter unit is set to "illegal", which tells the calling routine that the output variable
+!> is not defined and leads to a program abort.
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_check_data_output( variable, unit )
 
 
-    CHARACTER (LEN=*) ::  unit     !< 
-    CHARACTER (LEN=*) ::  variable !<
+    CHARACTER (LEN=*) ::  unit      !<
+    CHARACTER (LEN=*) ::  variable  !<
 
 
@@ -451,11 +441,11 @@
 !       CASE ( 'u2' )
 !          unit = 'm2/s2'
-
+!
+!       CASE ( 'u*v*' )
+!          unit = 'm2/s2'
+!
       CASE ( 'v_h' )
          unit = 'm/s'
-!
-!       CASE ( 'u*v*' )
-!          unit = 'm2/s2'
-!
+
        CASE DEFAULT
           unit = 'illegal'
@@ -467,9 +457,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Initialize user-defined arrays
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_init_arrays
 
@@ -486,9 +476,14 @@
     ALLOCATE( v_h(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
 
+
 !
 !-- Example for defining a statistic region:
+!-- ATTENTION: rmask = 0 is required at the ghost boundaries to guarantee correct statistic
+!--            evaluations (otherwise ghost points would be counted twice). This setting has
+!--            already been cared for in routine init_3d_model. Please don't set the ghost points
+!--            /= 0. i.e. run the following loop only over nxl,nxr and nys,nyn.
 !     IF ( statistic_regions >= 1 )  THEN
 !        region = 1
-! 
+!
 !        rmask(:,:,region) = 0.0_wp
 !        DO  i = nxl, nxr
@@ -501,5 +496,5 @@
 !           ENDIF
 !        ENDDO
-! 
+!
 !     ENDIF
 
@@ -507,13 +502,13 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Execution of user-defined initializing actions
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_init
 
 
-!    CHARACTER (LEN=20) :: field_char   !<
+!    CHARACTER(LEN=20) :: field_char  !<
 !
 !-- Here the user-defined initializing actions follow:
@@ -526,11 +521,10 @@
 
 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Set the grids on which user-defined output quantities are defined.
-!> Allowed values for grid_x are "x" and "xu", for grid_y "y" and "yv", and
-!> for grid_z "zu" and "zw".
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Set the grids on which user-defined output quantities are defined. Allowed values for grid_x are
+!> "x" and "xu", for grid_y "y" and "yv", and for grid_z "zu" and "zw".
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_define_netcdf_grid( variable, found, grid_x, grid_y, grid_z )
 
@@ -560,5 +554,4 @@
 !          grid_z = 'zu'
 
-
       CASE ( 'v_h', 'v_h_av' )
          found  = .TRUE.
@@ -581,18 +574,17 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Print a header with user-defined information.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_header( io )
 
 
-    INTEGER(iwp) ::  i    !< 
-    INTEGER(iwp) ::  io   !< 
-
-!
-!-- If no user-defined variables are read from the namelist-file, no
-!-- information will be printed.
+    INTEGER(iwp) ::  i   !<
+    INTEGER(iwp) ::  io  !<
+
+!
+!-- If no user-defined variables are read from the namelist-file, no information will be printed.
     IF ( .NOT. user_module_enabled )  THEN
        WRITE ( io, 100 )
@@ -614,7 +606,6 @@
 !-- Format-descriptors
 100 FORMAT (//' *** no user-defined variables found'/)
-110 FORMAT (//1X,78('#')                                                       &
-            //' User-defined variables and actions:'/                          &
-              ' -----------------------------------'//)
+110 FORMAT (//1X,78('#') // ' User-defined variables and actions:' /                               &
+            ' -----------------------------------'//)
 200 FORMAT (' Output of profiles and time series for following regions:' /)
 201 FORMAT (4X,'Region ',I1,':   ',A)
@@ -624,24 +615,23 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Call for all grid points
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_actions( location )
 
 
-    CHARACTER (LEN=*) ::  location !< 
-
-    INTEGER(iwp) ::  i !< 
-    INTEGER(iwp) ::  j !< 
-    INTEGER(iwp) ::  k !< 
+    CHARACTER(LEN=*) ::  location  !<
+
+    INTEGER(iwp) ::  i  !<
+    INTEGER(iwp) ::  j  !<
+    INTEGER(iwp) ::  k  !<
 
     CALL cpu_log( log_point(24), 'user_actions', 'start' )
 
 !
-!-- Here the user-defined actions follow
-!-- No calls for single grid points are allowed at locations before and
-!-- after the timestep, since these calls are not within an i,j-loop
+!-- Here the user-defined actions follow. No calls for single grid points are allowed at locations
+!-- before and after the timestep, since these calls are not within an i,j-loop
     SELECT CASE ( location )
 
@@ -656,6 +646,5 @@
        CASE ( 'after_integration' )
 !
-!--       Enter actions to be done after every time integration (before
-!--       data output)
+!--       Enter actions to be done after every time integration (before data output)
 !--       Sample for user-defined output:
 !          DO  i = nxlg, nxrg
@@ -670,5 +659,5 @@
 !                DO  k = nzb, nzt+1
 !                   ustvst(k,j,i) =  &
-!                      ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,0) ) * &
+!                      ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,0) ) *                      &
 !                      ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,0) )
 !                ENDDO
@@ -679,10 +668,9 @@
              DO  j = nysg, nyng
                 DO  k = nzb, nzt
-                   v_h(k,j,i) = SQRT(u(k,j,i)**2.+v(k,j,i)**2.)
+                   v_h(k,j,i) = SQRT( u(k,j,i)**2.0_wp + v(k,j,i)**2.0_wp )
                 ENDDO
              ENDDO
           ENDDO
 
-
        CASE ( 'after_timestep' )
 !
@@ -726,16 +714,16 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Call for grid point i,j
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_actions_ij( i, j, location )
 
 
-    CHARACTER (LEN=*) ::  location
-
-    INTEGER(iwp) ::  i
-    INTEGER(iwp) ::  j
+    CHARACTER(LEN=*) ::  location  !<
+
+    INTEGER(iwp) ::  i  !<
+    INTEGER(iwp) ::  j  !<
 
 !
@@ -782,19 +770,19 @@
 
 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Sum up and time-average user-defined output quantities as well as allocate
-!> the array necessary for storing the average.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Sum up and time-average user-defined output quantities as well as allocate the array necessary
+!> for storing the average.
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_3d_data_averaging( mode, variable )
 
 
-    CHARACTER (LEN=*) ::  mode    !< 
-    CHARACTER (LEN=*) :: variable !< 
-
-    INTEGER(iwp) ::  i !< 
-    INTEGER(iwp) ::  j !< 
-    INTEGER(iwp) ::  k !< 
+    CHARACTER(LEN=*) ::  mode      !<
+    CHARACTER(LEN=*) ::  variable  !<
+
+    INTEGER(iwp) ::  i  !<
+    INTEGER(iwp) ::  j  !<
+    INTEGER(iwp) ::  k  !<
 
     IF ( mode == 'allocate' )  THEN
@@ -804,6 +792,6 @@
 !
 !--       Uncomment and extend the following lines, if necessary.
-!--       The arrays for storing the user defined quantities (here u2_av) have
-!--       to be declared and defined by the user!
+!--       The arrays for storing the user defined quantities (here u2_av) have to be declared and
+!--       defined by the user!
 !--       Sample for user-defined output:
 !          CASE ( 'u2' )
@@ -830,9 +818,9 @@
 !
 !--       Uncomment and extend the following lines, if necessary.
-!--       The arrays for storing the user defined quantities (here u2 and
-!--       u2_av) have to be declared and defined by the user!
+!--       The arrays for storing the user defined quantities (here u2 and u2_av) have to be declared
+!--       and defined by the user!
 !--       Sample for user-defined output:
 !          CASE ( 'u2' )
-!             IF ( ALLOCATED( u2_av ) ) THEN
+!             IF ( ALLOCATED( u2_av ) )  THEN
 !                DO  i = nxlg, nxrg
 !                   DO  j = nysg, nyng
@@ -845,4 +833,5 @@
 
           CASE ( 'v_h' )
+
              IF ( ALLOCATED( v_h_av ) ) THEN
                 DO  i = nxlg, nxrg
@@ -855,4 +844,5 @@
              ENDIF
 
+
           CASE DEFAULT
              CONTINUE
@@ -866,9 +856,9 @@
 !
 !--       Uncomment and extend the following lines, if necessary.
-!--       The arrays for storing the user defined quantities (here u2_av) have
-!--       to be declared and defined by the user!
+!--       The arrays for storing the user defined quantities (here u2_av) have to be declared and
+!--       defined by the user!
 !--       Sample for user-defined output:
 !          CASE ( 'u2' )
-!             IF ( ALLOCATED( u2_av ) ) THEN
+!             IF ( ALLOCATED( u2_av ) )  THEN
 !                DO  i = nxlg, nxrg
 !                   DO  j = nysg, nyng
@@ -881,4 +871,5 @@
 
           CASE ( 'v_h' )
+
              IF ( ALLOCATED( v_h_av ) ) THEN
                 DO  i = nxlg, nxrg
@@ -891,4 +882,5 @@
              ENDIF
 
+
        END SELECT
 
@@ -899,31 +891,30 @@
 
 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Resorts the user-defined output quantity with indices (k,j,i) to a
-!> temporary array with indices (i,j,k) and sets the grid on which it is defined.
-!> Allowed values for grid are "zu" and "zw".
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Resorts the user-defined output quantity with indices (k,j,i) to a temporary array with indices
+!> (i,j,k) and sets the grid on which it is defined. Allowed values for grid are "zu" and "zw".
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_data_output_2d( av, variable, found, grid, local_pf, two_d, nzb_do, nzt_do )
 
 
-    CHARACTER (LEN=*) ::  grid     !< 
-    CHARACTER (LEN=*) ::  variable !< 
-
-    INTEGER(iwp) ::  av     !< flag to control data output of instantaneous or time-averaged data
-    INTEGER(iwp) ::  i      !< grid index along x-direction
-    INTEGER(iwp) ::  j      !< grid index along y-direction
-    INTEGER(iwp) ::  k      !< grid index along z-direction
-!    INTEGER(iwp) ::  m      !< running index surface elements
-    INTEGER(iwp) ::  nzb_do !< lower limit of the domain (usually nzb)
-    INTEGER(iwp) ::  nzt_do !< upper limit of the domain (usually nzt+1)
-
-    LOGICAL      ::  found !< 
-    LOGICAL      ::  two_d !< flag parameter that indicates 2D variables (horizontal cross sections)
-
-    REAL(wp) ::  fill_value = -999.0_wp    !< value for the _FillValue attribute
-
-    REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf !< 
+    CHARACTER(LEN=*) ::  grid      !<
+    CHARACTER(LEN=*) ::  variable  !<
+
+    INTEGER(iwp) ::  av      !< flag to control data output of instantaneous or time-averaged data
+    INTEGER(iwp) ::  i       !< grid index along x-direction
+    INTEGER(iwp) ::  j       !< grid index along y-direction
+    INTEGER(iwp) ::  k       !< grid index along z-direction
+!    INTEGER(iwp) ::  m       !< running index surface elements
+    INTEGER(iwp) ::  nzb_do  !< lower limit of the domain (usually nzb)
+    INTEGER(iwp) ::  nzt_do  !< upper limit of the domain (usually nzt+1)
+
+    LOGICAL      ::  found  !<
+    LOGICAL      ::  two_d  !< flag parameter that indicates 2D variables (horizontal cross sections)
+
+   REAL(wp) ::  fill_value = -999.0_wp    !< value for the _FillValue attribute
+
+    REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf  !<
 
 !
@@ -931,4 +922,5 @@
     IF ( av == 0  .OR.  local_pf(nxl,nys,nzb_do) == 0.0_wp  .OR.  two_d )  CONTINUE
 
+
     found = .TRUE.
 
@@ -937,6 +929,6 @@
 !
 !--    Uncomment and extend the following lines, if necessary.
-!--    The arrays for storing the user defined quantities (here u2 and u2_av)
-!--    have to be declared and defined by the user!
+!--    The arrays for storing the user defined quantities (here u2 and u2_av) have to be declared
+!--    and defined by the user!
 !--    Sample for user-defined output:
 !       CASE ( 'u2_xy', 'u2_xz', 'u2_yz' )
@@ -950,5 +942,5 @@
 !             ENDDO
 !          ELSE
-!             IF ( .NOT. ALLOCATED( u2_av ) ) THEN
+!             IF ( .NOT. ALLOCATED( u2_av ) )  THEN
 !                ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
 !                u2_av = REAL( fill_value, KIND = wp )
@@ -989,10 +981,10 @@
 
           grid = 'zu'
-!
-!--    In case two-dimensional surface variables are output, the user
-!--    has to access related surface-type. Uncomment and extend following lines
-!--    appropriately (example output of vertical surface momentum flux of u-
-!--    component). Please note, surface elements can be distributed over 
-!--    several data type, depending on their respective surface properties.
+
+!
+!--    In case two-dimensional surface variables are output, the user has to access related
+!--    surface-type. Uncomment and extend following lines appropriately (example output of vertical
+!--    surface momentum flux of u-component). Please note, surface elements can be distributed over
+!--    several data types, depending on their respective surface properties.
 !       CASE ( 'usws_xy' )
 !          IF ( av == 0 )  THEN
@@ -1021,5 +1013,5 @@
 !
 !          grid = 'zu'
-!--       
+!--
 
 
@@ -1034,27 +1026,31 @@
 
 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Resorts the user-defined output quantity with indices (k,j,i) to a
-!> temporary array with indices (i,j,k).
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Resorts the user-defined output quantity with indices (k,j,i) to a temporary array with indices
+!> (i,j,k).
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
 
 
-    CHARACTER (LEN=*) ::  variable !< 
-
-    INTEGER(iwp) ::  av    !< 
-    INTEGER(iwp) ::  i     !< 
-    INTEGER(iwp) ::  j     !< 
-    INTEGER(iwp) ::  k     !< 
+    CHARACTER(LEN=*) ::  variable  !<
+
+    INTEGER(iwp) ::  av     !<
+    INTEGER(iwp) ::  i      !<
+    INTEGER(iwp) ::  j      !<
+    INTEGER(iwp) ::  k      !<
     INTEGER(iwp) ::  nzb_do !< lower limit of the data output (usually 0)
     INTEGER(iwp) ::  nzt_do !< vertical upper limit of the data output (usually nz_do3d)
 
-    LOGICAL      ::  found !< 
-
-    REAL(wp) ::  fill_value = -999.0_wp    !< value for the _FillValue attribute
-
-    REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf !< 
+    LOGICAL      ::  found  !<
+
+   REAL(wp) ::  fill_value = -999.0_wp  !< value for the _FillValue attribute
+
+    REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do) ::  local_pf  !<
+
+!
+!-- Next line is to avoid compiler warning about unused variables. Please remove.
+    IF ( av == 0  .OR.  local_pf(nxl,nys,nzb_do) == 0.0_wp )  CONTINUE
 
 
@@ -1065,6 +1061,6 @@
 !
 !--    Uncomment and extend the following lines, if necessary.
-!--    The arrays for storing the user defined quantities (here u2 and u2_av)
-!--    have to be declared and defined by the user!
+!--    The arrays for storing the user defined quantities (here u2 and u2_av) have to be declared
+!--    and defined by the user!
 !--    Sample for user-defined output:
 !       CASE ( 'u2' )
@@ -1078,5 +1074,5 @@
 !             ENDDO
 !          ELSE
-!             IF ( .NOT. ALLOCATED( u2_av ) ) THEN
+!             IF ( .NOT. ALLOCATED( u2_av ) )  THEN
 !                ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
 !                u2_av = REAL( fill_value, KIND = wp )
@@ -1090,5 +1086,4 @@
 !             ENDDO
 !          ENDIF
-
 
        CASE ( 'v_h' )
@@ -1114,5 +1109,5 @@
              ENDDO
           ENDIF
-!
+
 
        CASE DEFAULT
@@ -1125,25 +1120,23 @@
 
 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Calculation of user-defined statistics, i.e. horizontally averaged profiles
-!> and time series.
-!> This routine is called for every statistic region sr defined by the user,
-!> but at least for the region "total domain" (sr=0).
-!> See section 3.5.4 on how to define, calculate, and output user defined
-!> quantities.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Calculation of user-defined statistics, i.e. horizontally averaged profiles and time series.
+!> This routine is called for every statistic region sr defined by the user, but at least for the
+!> region "total domain" (sr=0). See section 3.5.4 on how to define, calculate, and output user
+!> defined quantities.
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_statistics( mode, sr, tn )
 
 
-    CHARACTER (LEN=*) ::  mode   !< 
-!    INTEGER(iwp) ::  i    !<
-!    INTEGER(iwp) ::  j    !<
-!    INTEGER(iwp) ::  k    !<
-    INTEGER(iwp) ::  sr   !< 
-    INTEGER(iwp) ::  tn   !< 
-
-!    REAL(wp), DIMENSION(:), ALLOCATABLE ::  ts_value_l   !<
+    CHARACTER(LEN=*) ::  mode  !<
+!    INTEGER(iwp) ::  i   !<
+!    INTEGER(iwp) ::  j   !<
+!    INTEGER(iwp) ::  k   !<
+    INTEGER(iwp) ::  sr  !<
+    INTEGER(iwp) ::  tn  !<
+
+!    REAL(wp), DIMENSION(:), ALLOCATABLE ::  ts_value_l  !<
 
 !
@@ -1154,9 +1147,8 @@
 
 !
-!--    Sample on how to calculate horizontally averaged profiles of user-
-!--    defined quantities. Each quantity is identified by the index
-!--    "pr_palm+#" where "#" is an integer starting from 1. These
-!--    user-profile-numbers must also be assigned to the respective strings
-!--    given by data_output_pr_user in routine user_check_data_output_pr.
+!--    Sample on how to calculate horizontally averaged profiles of user-defined quantities. Each
+!--    quantity is identified by the index "pr_palm+#" where "#" is an integer starting from 1.
+!--    These user-profile-numbers must also be assigned to the respective strings given by
+!--    data_output_pr_user in routine user_check_data_output_pr.
 !       !$OMP DO
 !       DO  i = nxl, nxr
@@ -1164,17 +1156,15 @@
 !             DO  k = nzb+1, nzt
 !!
-!!--             Sample on how to calculate the profile of the resolved-scale
-!!--             horizontal momentum flux u*v*
-!                sums_l(k,pr_palm+1,tn) = sums_l(k,pr_palm+1,tn) +             &
-!                      ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,sr) ) *&
-!                      ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) )  &
-!                                     * rmask(j,i,sr)                          &
-!                                     * MERGE( 1.0_wp, 0.0_wp,                 &
-!                                              BTEST( wall_flags_0(k,j,i), 0 ) )
+!!--             Sample on how to calculate the profile of the resolved-scale horizontal momentum
+!!--             flux u*v*
+!                sums_l(k,pr_palm+1,tn) = sums_l(k,pr_palm+1,tn) +                                  &
+!                                         ( 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - hom(k,1,1,sr) ) *  &
+!                                         ( 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - hom(k,1,2,sr) ) *  &
+!                                         rmask(j,i,sr) * MERGE( 1.0_wp, 0.0_wp,                    &
+!                                         BTEST( wall_flags_total_0(k,j,i), 0 ) )
 !!
-!!--             Further profiles can be defined and calculated by increasing
-!!--             the second index of array sums_l (replace ... appropriately)
-!                sums_l(k,pr_palm+2,tn) = sums_l(k,pr_palm+2,tn) + ...           &
-!                                         * rmask(j,i,sr)
+!!--             Further profiles can be defined and calculated by increasing the second index of
+!!--             array sums_l (replace ... appropriately)
+!                sums_l(k,pr_palm+2,tn) = sums_l(k,pr_palm+2,tn) + ...   * rmask(j,i,sr)
 !             ENDDO
 !          ENDDO
@@ -1187,7 +1177,6 @@
 !
 !--    Sample on how to add values for the user-defined time series quantities.
-!--    These have to be defined before in routine user_init. This sample
-!--    creates two time series for the absolut values of the horizontal
-!--    velocities u and v.
+!--    These have to be defined before in routine user_init. This sample creates two time series for
+!--    the absolut values of the horizontal velocities u and v.
 !       ts_value_l = 0.0_wp
 !       ts_value_l(1) = ABS( u_max )
@@ -1195,17 +1184,13 @@
 !
 !--     Collect / send values to PE0, because only PE0 outputs the time series.
-!--     CAUTION: Collection is done by taking the sum over all processors.
-!--              You may have to normalize this sum, depending on the quantity
-!--              that you like to calculate. For serial runs, nothing has to be
-!--              done.
-!--     HINT: If the time series value that you are calculating has the same
-!--           value on all PEs, you can omit the MPI_ALLREDUCE call and
-!--           assign ts_value(dots_num_palm+1:,sr) = ts_value_l directly.
+!--     CAUTION: Collection is done by taking the sum over all processors. You may have to normalize
+!--              this sum, depending on the quantity that you like to calculate. For serial runs,
+!--              nothing has to be done.
+!--     HINT: If the time series value that you are calculating has the same value on all PEs, you
+!--           can omit the MPI_ALLREDUCE call and assign ts_value(dots_num_palm+1:,sr) = ts_value_l directly.
 !#if defined( __parallel )
 !       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-!       CALL MPI_ALLREDUCE( ts_value_l(1),                         &
-!                           ts_value(dots_num_palm+1,sr),                        &
-!                           dots_num_user, MPI_REAL, MPI_MAX, comm2d,   &
-!                           ierr )
+!       CALL MPI_ALLREDUCE( ts_value_l(1), ts_value(dots_num_palm+1,sr), dots_num_user, MPI_REAL,   &
+!                           MPI_MAX, comm2d, ierr )
 !#else
 !       ts_value(dots_num_palm+1:dots_num_palm+dots_num_user,sr) = ts_value_l
@@ -1217,13 +1202,13 @@
 
 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Reading global restart data that has been defined by the user.
-!------------------------------------------------------------------------------!
- SUBROUTINE user_rrd_global( found )
-
-
-    LOGICAL, INTENT(OUT)  ::  found
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific global restart data (Fortran binary format).
+!--------------------------------------------------------------------------------------------------!
+ SUBROUTINE user_rrd_global_ftn( found )
+
+
+    LOGICAL, INTENT(OUT)  ::  found  !<
 
 
@@ -1237,5 +1222,5 @@
 
        CASE DEFAULT
- 
+
           found = .FALSE.
 
@@ -1243,20 +1228,34 @@
 
 
- END SUBROUTINE user_rrd_global
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Reading processor specific restart data from file(s) that has been defined 
-!> by the user.
-!> Subdomain index limits on file are given by nxl_on_file, etc.
-!> Indices nxlc, etc. indicate the range of gridpoints to be mapped from the
-!> subdomain on file (f) to the subdomain of the current PE (c). They have been
-!> calculated in routine rrd_local.
-!------------------------------------------------------------------------------!
- SUBROUTINE user_rrd_local( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc,         &
-                            nxr_on_file, nynf, nync, nyn_on_file, nysf,     &
-                            nysc, nys_on_file, tmp_3d, found )
+ END SUBROUTINE user_rrd_global_ftn
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific global restart data (MPI-IO).
+!--------------------------------------------------------------------------------------------------!
+ SUBROUTINE user_rrd_global_mpi
+
+!    USE restart_data_mpi_io_mod,                                                                   &
+!        ONLY:  rrd_mpi_io
+
+!    CALL rrd_mpi_io( 'global_parameter', global_parameter )
+    CONTINUE
+
+ END SUBROUTINE user_rrd_global_mpi
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (Fortran binary format).
+!> Subdomain
+!> index limits on file are given by nxl_on_file, etc. Indices nxlc, etc. indicate the range of
+!> gridpoints to be mapped from the subdomain on file (f) to the subdomain of the current PE (c).
+!> They have been calculated in routine rrd_local.
+!--------------------------------------------------------------------------------------------------!
+ SUBROUTINE user_rrd_local_ftn( k, nxlf, nxlc, nxl_on_file, nxrf, nxrc, nxr_on_file, nynf, nync,   &
+                                nyn_on_file, nysf, nysc, nys_on_file, tmp_3d, found )
 
 
@@ -1276,7 +1275,7 @@
     INTEGER(iwp) ::  nys_on_file     !<
 
-    LOGICAL, INTENT(OUT)  ::  found
-
-    REAL(wp), DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d   !<
+    LOGICAL, INTENT(OUT)  ::  found  !<
+
+    REAL(wp), DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d  !<
 
 !
@@ -1294,10 +1293,10 @@
 
        CASE ( 'u2_av' )
-!          IF ( .NOT. ALLOCATED( u2_av ) ) THEN
+!          IF ( .NOT. ALLOCATED( u2_av ) )  THEN
 !               ALLOCATE( u2_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
 !          ENDIF
 !          IF ( k == 1 )  READ ( 13 )  tmp_3d
-!             u2_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =         &
-!                tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+!             u2_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                    &
+!             tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 !
        CASE DEFAULT
@@ -1307,45 +1306,86 @@
     END SELECT
 
- END SUBROUTINE user_rrd_local
-
-
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Writes global and user-defined restart data into binary file(s) for restart
-!> runs.
-!------------------------------------------------------------------------------!
+ END SUBROUTINE user_rrd_local_ftn
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Read module-specific local restart data arrays (MPI-IO).
+!--------------------------------------------------------------------------------------------------!
+ SUBROUTINE user_rrd_local_mpi
+
+!    USE restart_data_mpi_io_mod,                                                                   &
+!        ONLY:  rd_mpi_io_check_array, rrd_mpi_io
+
+!    CALL rd_mpi_io_check_array( 'u2_av' , found = array_found )
+!    IF ( array_found )  THEN
+!       IF ( .NOT. ALLOCATED( u2_av ) )  ALLOCATE( u2_av(nysg:nyng,nxlg:nxrg) )
+!       CALL rrd_mpi_io( 'rad_u2_av', rad_u2_av )
+!    ENDIF
+
+    CONTINUE
+
+ END SUBROUTINE user_rrd_local_mpi
+
+
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Writes global and user-defined restart data into binary file(s) for restart runs.
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_wrd_global
 
-!    CALL wrd_write_string( 'global_parameter' )
-!    WRITE ( 14 )  global_parameter
+!    USE restart_data_mpi_io_mod,                                                                   &
+!        ONLY:  wrd_mpi_io
+
+    IF ( TRIM( restart_data_format_output ) == 'fortran_binary' )  THEN
+
+!       CALL wrd_write_string( 'global_parameter' )
+!       WRITE ( 14 )  global_parameter
+
+    ELSEIF ( restart_data_format_output(1:3) == 'mpi' )  THEN
+
+!    CALL rrd_mpi_io( 'global_parameter', global_parameter )
+
+    ENDIF
 
  END SUBROUTINE user_wrd_global
 
 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Writes processor specific and user-defined restart data into binary file(s) 
-!> for restart runs.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Writes processor specific and user-defined restart data into binary file(s) for restart runs.
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_wrd_local
+
+!    USE restart_data_mpi_io_mod,                                                                   &
+!        ONLY:  wrd_mpi_io
 
 !
 !-- Here the user-defined actions at the end of a job follow.
 !-- Sample for user-defined output:
-!    IF ( ALLOCATED( u2_av ) )  THEN
-!       CALL wrd_write_string( 'u2_av' )
-!       WRITE ( 14 )  u2_av
-!    ENDIF
+    IF ( TRIM( restart_data_format_output ) == 'fortran_binary' )  THEN
+
+!       IF ( ALLOCATED( u2_av ) )  THEN
+!          CALL wrd_write_string( 'u2_av' )
+!          WRITE ( 14 )  u2_av
+!       ENDIF
+
+    ELSEIF ( restart_data_format_output(1:3) == 'mpi' )  THEN
+
+!       IF ( ALLOCATED( u2_av ) )  CALL wrd_mpi_io( 'u2_av', u2_av )
+
+    ENDIF
 
  END SUBROUTINE user_wrd_local
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Execution of user-defined actions at the end of a job.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE user_last_actions
 
