Index: palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 46)
+++ palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 48)
@@ -4,8 +4,11 @@
 new d3par-parameter netcdf_64bit_3d to switch on 64bit offset only for 3D files
 
-new initializing action "by_user" calls user_init_3d_model and allows the
-initial setting of all 3d arrays
+new initializing action "by_user" calls user_init_3d_model and allows the initial setting of all 3d arrays
 
-check_open, check_parameters, header, init_3d_model, modules, parin, user_interface
+topography height informations are stored on arrays zu_s_inner and zw_w_inner and output to the 2d/3d NetCDF files
+
+samples added to the user interface which show how to add user-define time series quantities.
+
+check_open, check_parameters, header, init_3d_model, modules, netcdf, parin, user_interface
 
 
@@ -14,7 +17,9 @@
 
 Move call of user_actions( 'after_integration' ) below increment of times
-and counters
+and counters. user_actions is now called for each statistic region and has as an argument the number of the respective region (sr)
 
-time_integration
+d3par-parameter data_output_ts removed. Timeseries output for "profil" removed. Timeseries are now switched on by dt_dots. Timeseries data is collected in flow_statistics.
+
+check_parameters, data_output_ts, flow_statistics, init_3d_model, modules, parin, time_integration
 
 
@@ -24,3 +29,7 @@
 Bugfix: preset of tendencies te_em, te_um, te_vm in init_1d_model
 
+in Makefile, default suffixes removed from the suffix list to avoid calling of m2c in
+# case of .mod files
+
+Makefile
 init_1d_model
Index: palm/trunk/SOURCE/Makefile
===================================================================
--- palm/trunk/SOURCE/Makefile	(revision 46)
+++ palm/trunk/SOURCE/Makefile	(revision 48)
@@ -4,5 +4,6 @@
 # Actual revisions:
 # -----------------
-# 
+# default suffixes removed from the suffix list to avoid calling of m2c in
+# case of .mod files
 #
 # Former revisions:
@@ -93,5 +94,7 @@
 LDFLAGS =
 
-.SUFFIXES: $(SUFFIXES) .f90
+
+.SUFFIXES:
+.SUFFIXES: .o .f90
 
 
Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 46)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 48)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! "by_user" allowed as initializing action
+! "by_user" allowed as initializing action, -data_output_ts
 !
 ! Former revisions:
@@ -1681,86 +1681,4 @@
     ENDIF
 
-!
-!-- Determine parameters for time series output and check whether permissible
-    i = 0
-    DO  WHILE ( data_output_ts(i+1) /= '          '  .AND.  i+1 <= 100 )
-
-       dots_n = dots_n + 1
-       i = i + 1
-!
-!--    Check whether time series is permissible and determine internal number
-       SELECT CASE ( TRIM( data_output_ts(i) ) )
-
-          CASE ( 'E' )
-             dots_index(i) = 1
-          CASE ( 'E*' )
-             dots_index(i) = 2
-          CASE ( 'dt' )
-             dots_index(i) = 3
-          CASE ( 'u*' )
-             dots_index(i) = 4
-          CASE ( 'th*' )
-             dots_index(i) = 5
-          CASE ( 'umax' )
-             dots_index(i) = 6
-          CASE ( 'vmax' )
-             dots_index(i) = 7
-          CASE ( 'wmax' )
-             dots_index(i) = 8
-          CASE ( 'div_new' )
-             dots_index(i) = 9
-          CASE ( 'div_old' )
-             dots_index(i) = 10
-          CASE ( 'z_i_wpt' )
-             dots_index(i) = 11
-          CASE ( 'z_i_pt' )
-             dots_index(i) = 12
-          CASE ( 'w*' )
-             dots_index(i) = 13
-          CASE ( 'w"pt"0' )
-             dots_index(i) = 14
-          CASE ( 'w"pt"' )
-             dots_index(i) = 15
-          CASE ( 'wpt' )
-             dots_index(i) = 16
-          CASE ( 'pt(0)' )
-             dots_index(i) = 17
-          CASE ( 'pt(zp)' )
-             dots_index(i) = 18
-          CASE ( 'splptx'  )
-             dots_index(i) = 19
-          CASE ( 'splpty'  )
-             dots_index(i) = 20
-          CASE ( 'splptz'  )
-             dots_index(i) = 21
-          CASE ( 'L'       )
-             dots_index(i) = 22
-
-          CASE DEFAULT
-             IF ( myid == 0 )  THEN
-                PRINT*, '+++ check_parameters:  unknown time series:  ', &
-                             'data_output_ts = ',&
-                        data_output_ts(i)
-             ENDIF
-             CALL local_stop
-
-       END SELECT
-
-!
-!--    Check, to which predefined coordinate system the time series belongs, and
-!--    store corresponding internal number. Furthermore determine, how many and 
-!--    which graphs are being drawn into the corresponding system
-       DO  k = 1, crmax
-          IF ( INDEX( cross_ts_profiles(k), ' ' // TRIM( data_output_ts(i) ) &
-                      // ' ' ) /=0 )  &
-          THEN
-             dots_crossindex(i) = k
-             cross_ts_number_count(k) = cross_ts_number_count(k) + 1
-             cross_ts_numbers(cross_ts_number_count(k),k) = dots_index(i)
-             EXIT
-          ENDIF
-       ENDDO
-
-    ENDDO
 
 !
Index: palm/trunk/SOURCE/data_output_tseries.f90
===================================================================
--- palm/trunk/SOURCE/data_output_tseries.f90	(revision 46)
+++ palm/trunk/SOURCE/data_output_tseries.f90	(revision 48)
@@ -4,5 +4,6 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Collection of time series quantities moved to routine flow_statistics,
+! output for "profil" removed
 !
 ! Former revisions:
@@ -37,5 +38,4 @@
 
     INTEGER ::  file_id, i, j, sr
-    REAL    ::  ts_value(30)
 
 
@@ -70,40 +70,4 @@
 !--    applicable)
        DO  sr = 0, statistic_regions
-!
-!--       Open file for time series output.
-          IF ( profil_output )  THEN
-             file_id = 50 + sr
-             CALL check_open( file_id )
-          ENDIF
-
-!
-!--       Collect and printout all time series quantities in a single line.
-          ts_value(1) = hom(nzb+4,1,var_hom,sr)     ! E
-          ts_value(2) = hom(nzb+5,1,var_hom,sr)     ! E*
-          ts_value(3) = dt_3d
-          ts_value(4) = hom(nzb,1,var_hom,sr)       ! u*
-          ts_value(5) = hom(nzb+3,1,var_hom,sr)     ! th*
-          ts_value(6) = u_max
-          ts_value(7) = v_max
-          ts_value(8) = w_max
-          ts_value(9) = hom(nzb+10,1,var_sum,sr)    ! new divergence
-          ts_value(10) = hom(nzb+9,1,var_hom,sr)    ! old Divergence
-          ts_value(11) = hom(nzb+6,1,var_hom,sr)    ! z_i(1)
-          ts_value(12) = hom(nzb+7,1,var_hom,sr)    ! z_i(2)
-          ts_value(13) = hom(nzb+8,1,var_hom,sr)    ! w*
-          ts_value(14) = hom(nzb,1,16,sr)           ! w'pt'   at k=0
-          ts_value(15) = hom(nzb+1,1,16,sr)         ! w'pt'   at k=1
-          ts_value(16) = hom(nzb+1,1,18,sr)         ! wpt     at k=1
-          ts_value(17) = hom(nzb,1,4,sr)            ! pt(0)
-          ts_value(18) = hom(nzb+1,1,4,sr)          ! pt(zp)
-          ts_value(19) = hom(nzb+9,1,var_hom-1,sr)  ! splptx
-          ts_value(20) = hom(nzb+10,1,var_hom-1,sr) ! splpty
-          ts_value(21) = hom(nzb+11,1,var_hom-1,sr) ! splptz
-          IF ( ts_value(5) /= 0.0 )  THEN
-             ts_value(22) = ts_value(4)**2 / &
-                            ( kappa * g * ts_value(5) / ts_value(18) )  ! L
-          ELSE
-             ts_value(22) = 10000.0
-          ENDIF
 
 #if defined( __netcdf )
@@ -111,5 +75,5 @@
              DO  i = 1, dots_num
                 nc_stat = NF90_PUT_VAR( id_set_ts, id_var_dots(i,sr),  &
-                                        (/ ts_value(i) /),             &
+                                        (/ ts_value(i,sr) /),          &
                                         start = (/ dots_time_count /), &
                                         count = (/ 1 /) )
@@ -119,46 +83,5 @@
 #endif
 
-          IF ( profil_output )  THEN
-             WRITE ( file_id, 500 )  simulated_time, ts_value(1:22)
-!
-!--          y-value range of the crosses to be drawn by PROFIL
-!--          If required, enlarge them, provided they have not yet been
-!--          specified in
-!--          check_parameters
-             DO  i = 1, dots_n
-
-                j = dots_crossindex(i)
-
-                IF ( cross_ts_uymin(j) == 999.999 )  THEN
-!
-!--                When the value range of the first line in the corresponding
-!--                cross is determined, its value range is simply adopted.
-                   IF ( cross_ts_uymin_computed(j) == 999.999 ) &
-                   THEN
-                      cross_ts_uymin_computed(j) = ts_value(dots_index(i))
-                   ELSE
-                      cross_ts_uymin_computed(j) = &
-                         MIN(cross_ts_uymin_computed(j),ts_value(dots_index(i)))
-                   ENDIF
-                ENDIF
-
-                IF ( cross_ts_uymax(j) == 999.999 )  THEN
-!
-!--                When the value range of the first line in the corresponding
-!--                cross is determined, its value range is simply adopted.
-                   IF ( cross_ts_uymax_computed(j) == 999.999 ) &
-                   THEN
-                      cross_ts_uymax_computed(j) = ts_value(dots_index(i))
-                   ELSE
-                      cross_ts_uymax_computed(j) = &
-                         MAX(cross_ts_uymax_computed(j),ts_value(dots_index(i)))
-                   ENDIF
-                ENDIF
-
-             ENDDO
-
-          ENDIF
-
-       ENDDO   ! Loop of subregions.
+       ENDDO
 
     ENDIF
Index: palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- palm/trunk/SOURCE/flow_statistics.f90	(revision 46)
+++ palm/trunk/SOURCE/flow_statistics.f90	(revision 48)
@@ -801,9 +801,39 @@
        ENDIF
 
+!
+!--    Collect the time series quantities
+       ts_value(1,sr) = hom(nzb+4,1,var_hom,sr)     ! E
+       ts_value(2,sr) = hom(nzb+5,1,var_hom,sr)     ! E*
+       ts_value(3,sr) = dt_3d
+       ts_value(4,sr) = hom(nzb,1,var_hom,sr)       ! u*
+       ts_value(5,sr) = hom(nzb+3,1,var_hom,sr)     ! th*
+       ts_value(6,sr) = u_max
+       ts_value(7,sr) = v_max
+       ts_value(8,sr) = w_max
+       ts_value(9,sr) = hom(nzb+10,1,var_sum,sr)    ! new divergence
+       ts_value(10,sr) = hom(nzb+9,1,var_hom,sr)    ! old Divergence
+       ts_value(11,sr) = hom(nzb+6,1,var_hom,sr)    ! z_i(1)
+       ts_value(12,sr) = hom(nzb+7,1,var_hom,sr)    ! z_i(2)
+       ts_value(13,sr) = hom(nzb+8,1,var_hom,sr)    ! w*
+       ts_value(14,sr) = hom(nzb,1,16,sr)           ! w'pt'   at k=0
+       ts_value(15,sr) = hom(nzb+1,1,16,sr)         ! w'pt'   at k=1
+       ts_value(16,sr) = hom(nzb+1,1,18,sr)         ! wpt     at k=1
+       ts_value(17,sr) = hom(nzb,1,4,sr)            ! pt(0)
+       ts_value(18,sr) = hom(nzb+1,1,4,sr)          ! pt(zp)
+       ts_value(19,sr) = hom(nzb+9,1,var_hom-1,sr)  ! splptx
+       ts_value(20,sr) = hom(nzb+10,1,var_hom-1,sr) ! splpty
+       ts_value(21,sr) = hom(nzb+11,1,var_hom-1,sr) ! splptz
+       IF ( ts_value(5,sr) /= 0.0 )  THEN
+          ts_value(22,sr) = ts_value(4,sr)**2 / &
+                            ( kappa * g * ts_value(5,sr) / ts_value(18,sr) ) ! L
+       ELSE
+          ts_value(22,sr) = 10000.0
+       ENDIF
+
+!
+!--    Calculate additional statistics provided by the user interface
+       CALL user_statistics( sr )
+
     ENDDO    ! loop of the subregions
-
-!
-!-- Calculate additional statistics provided by the user interface
-    CALL user_statistics
 
 !
Index: palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- palm/trunk/SOURCE/init_3d_model.f90	(revision 46)
+++ palm/trunk/SOURCE/init_3d_model.f90	(revision 48)
@@ -7,5 +7,6 @@
 ! Actual revisions:
 ! -----------------
-! New initializing action "by_user" calls user_init_3d_model
+! New initializing action "by_user" calls user_init_3d_model,
+! ts_value is allocated
 !
 ! Former revisions:
@@ -78,5 +79,6 @@
               sums_l_l(nzb:nzt+1,0:statistic_regions,0:threads_per_task-1), &
               sums_up_fraction_l(10,3,0:statistic_regions),                 &
-              sums_wsts_bc_l(nzb:nzt+1,0:statistic_regions) )
+              sums_wsts_bc_l(nzb:nzt+1,0:statistic_regions),                &
+              ts_value(var_ts,0:statistic_regions) )
     ALLOCATE( km_damp_x(nxl-1:nxr+1), km_damp_y(nys-1:nyn+1) )
 
Index: palm/trunk/SOURCE/init_grid.f90
===================================================================
--- palm/trunk/SOURCE/init_grid.f90	(revision 46)
+++ palm/trunk/SOURCE/init_grid.f90	(revision 48)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! 
+! storage of topography height arrays zu_s_inner and zw_s_inner
 !
 ! Former revisions:
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 46)
+++ palm/trunk/SOURCE/modules.f90	(revision 48)
@@ -5,5 +5,8 @@
 ! Actual revisions:
 ! -----------------
-! +netcdf_64bit_3d
+! +netcdf_64bit_3d, zu_s_inner, zw_w_inner, id_var_zusi_*, id_var_zwwi_*,
+! ts_value
+! -data_output_ts, dots_n
+! arrays dots_label and dots_unit now dimensioned with dots_max
 !
 ! Former revisions:
@@ -228,5 +231,4 @@
     CHARACTER (LEN=10), DIMENSION(100) ::  data_output = ' ',    &
                                            data_output_pr = ' ', &
-                                           data_output_ts = ' ', &
                                            data_output_user = ' ', doav = ' '
     CHARACTER (LEN=20), DIMENSION(10)  ::  netcdf_precision = ' '
@@ -239,5 +241,5 @@
                 disturbance_level_ind_t, doav_n = 0, dopr_n = 0, &
                 dopr_time_count = 0, dopts_time_count = 0, &
-                dosp_time_count = 0, dots_n = 0, dots_time_count = 0, &
+                dosp_time_count = 0, dots_time_count = 0, &
                 do2d_xy_n = 0, do2d_xz_n = 0, do2d_yz_n = 0, do3d_avs_n = 0, &
                 dvrp_filecount = 0, dz_stretch_level_index, gamma_mg, &
@@ -489,7 +491,8 @@
     REAL, DIMENSION(:), ALLOCATABLE ::  ddx2_mg, ddy2_mg
 
-    REAL, DIMENSION(:,:), ALLOCATABLE ::  fwxm, fwxp, fwym, fwyp, fxm, fxp, &
-                                          fym, fyp, wall_e_x, wall_e_y, &
-                                          wall_u, wall_v, wall_w_x, wall_w_y
+    REAL, DIMENSION(:,:), ALLOCATABLE ::  fwxm, fwxp, fwym, fwyp, fxm, fxp,   &
+                                          fym, fyp, wall_e_x, wall_e_y,       &
+                                          wall_u, wall_v, wall_w_x, wall_w_y, &
+                                          zu_s_inner, zw_w_inner
 
     SAVE
@@ -648,6 +651,8 @@
 #endif
 
-    INTEGER, PARAMETER ::  dopr_norm_num = 7, dopts_num = 26, dots_num = 22, &
+    INTEGER, PARAMETER ::  dopr_norm_num = 7, dopts_num = 26, dots_max = 100, &
                            replace_num = 6
+
+    INTEGER ::  dots_num = 22
 
     CHARACTER, DIMENSION( replace_num ) :: &
@@ -677,15 +682,17 @@
              'm2/s2  ', 'number2' /)
 
-    CHARACTER (LEN=7), DIMENSION(dots_num) :: dots_label = &
+    CHARACTER (LEN=7), DIMENSION(dots_max) :: dots_label = &
           (/ 'E      ', 'E*     ', 'dt     ', 'u*     ', 'th*    ', 'umax   ', &
              'vmax   ', 'wmax   ', 'div_new', 'div_old', 'z_i_wpt', 'z_i_pt ', &
              'w*     ', 'w"pt"0 ', 'w"pt"  ', 'wpt    ', 'pt(0)  ', 'pt(zp) ', &
-             'splptx ', 'splpty ', 'splptz ', 'mo_L   ' /)
-
-    CHARACTER (LEN=7), DIMENSION(dots_num) :: dots_unit = &
+             'splptx ', 'splpty ', 'splptz ', 'mo_L   ',                       &
+             ( 'unknown', i9 = 1, 78) /)
+
+    CHARACTER (LEN=7), DIMENSION(dots_max) :: dots_unit = &
           (/ 'm2/s2  ', 'm2/s2  ', 's      ', 'm/s    ', 'K      ', 'm/s    ', &
              'm/s    ', 'm/s    ', 's-1    ', 's-1    ', 'm      ', 'm      ', &
              'm/s    ', 'K m/s  ', 'K m/s  ', 'k m/s  ', 'K      ', 'K      ', &
-             '%      ', '%      ', '%      ', 'm      ' /)
+             '%      ', '%      ', '%      ', 'm      ',                       &
+             ( 'unknown', i9 = 1, 78 ) /)
 
     CHARACTER (LEN=7), DIMENSION(100) ::  dopr_unit = 'unknown'
@@ -737,6 +744,7 @@
                 id_var_xu_yz, id_var_x_3d, id_var_xu_3d, id_var_y_xy, &
                 id_var_yv_xy, id_var_y_xz, id_var_yv_xz, id_var_y_yz, &
-                id_var_yv_yz, id_var_y_3d, id_var_yv_3d, id_var_zu_xy, &
-                id_var_zu1_xy, id_var_zu_xz, id_var_zu_yz, id_var_zu_3d, &
+                id_var_yv_yz, id_var_y_3d, id_var_yv_3d, id_var_zusi_xy, &
+                id_var_zusi_3d, id_var_zu_xy, id_var_zu1_xy, id_var_zu_xz, &
+                id_var_zu_yz, id_var_zu_3d, id_var_zwwi_xy, id_var_zwwi_3d, &
                 id_var_zw_xy, id_var_zw_xz, id_var_zw_yz, id_var_zw_3d
 
@@ -749,5 +757,5 @@
     INTEGER, DIMENSION(100,0:9)        ::  id_dim_z_pr, id_var_dopr, &
                                            id_var_z_pr
-    INTEGER, DIMENSION(dots_num,0:9)   ::  id_var_dots
+    INTEGER, DIMENSION(dots_max,0:9)   ::  id_var_dots
 
 
@@ -1020,10 +1028,10 @@
 
     CHARACTER (LEN=40) ::  region(0:9)
-    INTEGER ::  statistic_regions = 0, var_hom = 80, var_sum = 80
+    INTEGER ::  statistic_regions = 0, var_hom = 80, var_sum = 80, var_ts = 100
     INTEGER ::  u_max_ijk(3), v_max_ijk(3), w_max_ijk(3)
     LOGICAL ::  flow_statistics_called = .FALSE.
     REAL ::     u_max, v_max, w_max
     REAL, DIMENSION(:), ALLOCATABLE       ::  sums_divnew_l, sums_divold_l
-    REAL, DIMENSION(:,:), ALLOCATABLE     ::  sums, sums_wsts_bc_l
+    REAL, DIMENSION(:,:), ALLOCATABLE     ::  sums, sums_wsts_bc_l, ts_value
     REAL, DIMENSION(:,:,:), ALLOCATABLE   ::  hom_sum, rmask, spectrum_x, &
                                               spectrum_y, sums_l, sums_l_l, &
Index: palm/trunk/SOURCE/netcdf.f90
===================================================================
--- palm/trunk/SOURCE/netcdf.f90	(revision 46)
+++ palm/trunk/SOURCE/netcdf.f90	(revision 48)
@@ -7,5 +7,6 @@
 ! Current revisions:
 ! ------------------
-! 
+! Output topography height information (zu_s_inner, zw_s_inner) to 2d-xy and 3d
+! datasets
 !
 ! Former revisions:
@@ -290,4 +291,41 @@
 
 !
+!--       In case of non-flat topography define 2d-arrays containing the height
+!--       informations
+          IF ( TRIM( topography ) /= 'flat' )  THEN
+!
+!--          Define zusi = zu(nzb_s_inner)
+             nc_stat = NF90_DEF_VAR( id_set_3d(av), 'zusi', NF90_DOUBLE,     &
+                                     (/ id_dim_x_3d(av), id_dim_y_3d(av) /), &
+                                     id_var_zusi_3d(av) )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 413 )
+             
+             nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_zusi_3d(av), &
+                                     'units', 'meters' )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 414 )
+             
+             nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_zusi_3d(av), &
+                                     'long_name', 'zu(nzb_s_inner)' )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 415 )
+
+!             
+!--          Define zwwi = zw(nzb_w_inner)
+             nc_stat = NF90_DEF_VAR( id_set_3d(av), 'zwwi', NF90_DOUBLE,     &
+                                     (/ id_dim_x_3d(av), id_dim_y_3d(av) /), &
+                                     id_var_zwwi_3d(av) )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 416 )
+             
+             nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_zwwi_3d(av), &
+                                     'units', 'meters' )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 417 )
+             
+             nc_stat = NF90_PUT_ATT( id_set_3d(av), id_var_zwwi_3d(av), &
+                                     'long_name', 'zw(nzb_w_inner)' )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 418 )
+
+          ENDIF             
+
+
+!
 !--       Define the variables
           var_list = ';'
@@ -393,8 +431,4 @@
 !--       No arrays to output
           IF ( i == 1 )  RETURN
-!             nc_stat = NF90_CLOSE( id_set_3d(av) )
-!             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 9999 )
-!             RETURN
-!          ENDIF
 
 !
@@ -468,4 +502,22 @@
           IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 86 )
 
+
+!
+!--       In case of non-flat topography write height information
+          IF ( TRIM( topography ) /= 'flat' )  THEN
+
+             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zusi_3d(av), &
+                                     zu_s_inner(0:nx+1,0:ny+1), &
+                                     start = (/ 1, 1 /), &
+                                     count = (/ nx+2, ny+2 /) )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 419 )
+
+             nc_stat = NF90_PUT_VAR( id_set_3d(av), id_var_zwwi_3d(av), &
+                                     zw_w_inner(0:nx+1,0:ny+1), &
+                                     start = (/ 1, 1 /), &
+                                     count = (/ nx+2, ny+2 /) )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 420 )
+
+          ENDIF
 
        CASE ( '3d_ext' )
@@ -742,4 +794,41 @@
 
 !
+!--       In case of non-flat topography define 2d-arrays containing the height
+!--       informations
+          IF ( TRIM( topography ) /= 'flat' )  THEN
+!
+!--          Define zusi = zu(nzb_s_inner)
+             nc_stat = NF90_DEF_VAR( id_set_xy(av), 'zusi', NF90_DOUBLE, &
+                                     (/ id_dim_x_xy(av), id_dim_y_xy(av) /), &
+                                     id_var_zusi_xy(av) )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 421 )
+             
+             nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_zusi_xy(av), &
+                                     'units', 'meters' )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 422 )
+             
+             nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_zusi_xy(av), &
+                                     'long_name', 'zu(nzb_s_inner)' )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 423 )
+
+!             
+!--          Define zwwi = zw(nzb_w_inner)
+             nc_stat = NF90_DEF_VAR( id_set_xy(av), 'zwwi', NF90_DOUBLE, &
+                                     (/ id_dim_x_xy(av), id_dim_y_xy(av) /), &
+                                     id_var_zwwi_xy(av) )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 424 )
+             
+             nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_zwwi_xy(av), &
+                                     'units', 'meters' )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 425 )
+             
+             nc_stat = NF90_PUT_ATT( id_set_xy(av), id_var_zwwi_xy(av), &
+                                     'long_name', 'zw(nzb_w_inner)' )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 426 )
+
+          ENDIF
+
+
+!
 !--       Define the variables
           var_list = ';'
@@ -870,8 +959,4 @@
 !--       No arrays to output. Close the netcdf file and return.
           IF ( i == 1 )  RETURN
-!             nc_stat = NF90_CLOSE( id_set_xy(av) )
-!             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 9999 )
-!             RETURN
-!          ENDIF
 
 !
@@ -981,4 +1066,22 @@
 
           DEALLOCATE( netcdf_data )
+
+!
+!--       In case of non-flat topography write height information
+          IF ( TRIM( topography ) /= 'flat' )  THEN
+
+             nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zusi_xy(av), &
+                                     zu_s_inner(0:nx+1,0:ny+1), &
+                                     start = (/ 1, 1 /), &
+                                     count = (/ nx+2, ny+2 /) )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 427 )
+
+             nc_stat = NF90_PUT_VAR( id_set_xy(av), id_var_zwwi_xy(av), &
+                                     zw_w_inner(0:nx+1,0:ny+1), &
+                                     start = (/ 1, 1 /), &
+                                     count = (/ nx+2, ny+2 /) )
+             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 428 )
+
+          ENDIF
 
 
@@ -1398,8 +1501,4 @@
 !--       No arrays to output. Close the netcdf file and return.
           IF ( i == 1 )  RETURN
-!             nc_stat = NF90_CLOSE( id_set_xz(av) )
-!             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 9999 )
-!             RETURN
-!          ENDIF
 
 !
@@ -1913,8 +2012,4 @@
 !--       No arrays to output. Close the netcdf file and return.
           IF ( i == 1 )  RETURN
-!             nc_stat = NF90_CLOSE( id_set_yz(av) )
-!             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 9999 )
-!             RETURN
-!          ENDIF
 
 !
Index: palm/trunk/SOURCE/parin.f90
===================================================================
--- palm/trunk/SOURCE/parin.f90	(revision 46)
+++ palm/trunk/SOURCE/parin.f90	(revision 48)
@@ -4,5 +4,5 @@
 ! Actual revisions:
 ! -----------------
-! +netcdf_64bit_3d in d3par
+! +netcdf_64bit_3d in d3par, -data_output_ts
 !
 ! Former revisions:
@@ -90,5 +90,5 @@
                        cross_normalized_y, cross_profiles, cross_ts_uymax, &
                        cross_ts_uymin, cross_xtext, cycle_mg, data_output, &
-                       data_output_format, data_output_pr, data_output_ts, &
+                       data_output_format, data_output_pr, &
                        data_output_2d_on_each_pe, disturbance_amplitude, &
                        disturbance_energy_limit, disturbance_level_b, &
Index: palm/trunk/SOURCE/time_integration.f90
===================================================================
--- palm/trunk/SOURCE/time_integration.f90	(revision 46)
+++ palm/trunk/SOURCE/time_integration.f90	(revision 48)
@@ -380,5 +380,5 @@
 !--    Graphic output for time series
        IF ( time_dots >= dt_dots )  THEN
-          IF ( dots_n /= 0 )  CALL data_output_tseries
+          CALL data_output_tseries
           time_dots = MOD( time_dots, MAX( dt_dots, dt_3d ) )
        ENDIF
Index: palm/trunk/SOURCE/user_interface.f90
===================================================================
--- palm/trunk/SOURCE/user_interface.f90	(revision 46)
+++ palm/trunk/SOURCE/user_interface.f90	(revision 48)
@@ -5,5 +5,7 @@
 ! -----------------
 ! New routine user_init_3d_model which allows the initial setting of all 3d
-! arrays under control of the user
+! arrays under control of the user,
+! routine user_statistics now has one argument (sr),
+! sample for generating time series quantities added
 !
 ! Former revisions:
@@ -174,4 +176,20 @@
 !       ENDDO
 !    ENDIF
+
+!
+!-- 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.
+!    dots_label(dots_num+1) = 'abs_umx'
+!    dots_unit(dots_num+1)  = 'm/s'
+!    dots_label(dots_num+2) = 'abs_vmx'
+!    dots_unit(dots_num+2)  = 'm/s'
+!
+!    dots_num_palm = dots_num
+!    dots_num = dots_num + 2
 
  END SUBROUTINE user_init
@@ -421,5 +439,5 @@
 
 
- SUBROUTINE user_statistics
+ SUBROUTINE user_statistics( sr )
 
 !------------------------------------------------------------------------------!
@@ -428,4 +446,6 @@
 ! ------------
 ! Calculation of user-defined statistics
+! This routine is called for every statistic region sr defined by the user,
+! but at least for the region "total domain" (sr=0).
 !------------------------------------------------------------------------------!
 
@@ -435,4 +455,13 @@
     IMPLICIT NONE
 
+    INTEGER ::  sr
+
+!
+!-- 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.
+!    ts_value(dots_num_palm+1,sr) = ABS( u_max )
+!    ts_value(dots_num_palm+2,sr) = ABS( v_max )
 
  END SUBROUTINE user_statistics
