Index: palm/trunk/SOURCE/CURRENT_MODIFICATIONS
===================================================================
--- palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 192)
+++ palm/trunk/SOURCE/CURRENT_MODIFICATIONS	(revision 197)
@@ -28,5 +28,9 @@
 Particle advection adjusted for ocean runs.
 
+Multigrid levels are limited by subdomains if mg_switch_to_pe0_level = -1.
+
 User-defined spectra.
+
+Output of q*2 profile added.
 
 Argument -c introduced to most of the subjob calls, which allows the user to
@@ -91,5 +95,11 @@
 (combine_plot_fields)
 
-advec_s_ups, advec_u_ups, advec_v_ups, advec_w_ups, calc_spectra, check_open, check_parameters, cpu_statistics, data_output_spectra, header, init_1d_model, init_3d_model, modules, netcdf, palm, parin, poisfft, production_e, read_var_list, read_3d_binary, transpose, wall_fluxes, write_var_list, write_3d_binary
+Time coordinate t=0 stored on netcdf-file only if an output is required for
+this time for at least one of the profiles
+
+Spline timeseries splptx etc. removed, timeseries w'u', w'v', w'q' (k=0) added
+(flow_statistics)
+
+advec_s_ups, advec_u_ups, advec_v_ups, advec_w_ups, calc_spectra, check_open, check_parameters, cpu_statistics, data_output_profiles, data_output_spectra, flow_statistics, header, init_1d_model, init_3d_model, modules, netcdf, palm, parin, poisfft, production_e, read_var_list, read_3d_binary, transpose, wall_fluxes, write_var_list, write_3d_binary
 
 
@@ -148,4 +158,6 @@
 Bugfix: misplaced #endif directives (combine_plot_fields)
 
-calc_spectra, check_parameters, diffusion_s, flow_statistics, init_dvrp, init_3d_model, local_stop, plant_canopy_model, poismg, prandtl_fluxes, pres, read_3d_binary, user_interface, wall_fluxes, write_3d_binary
+data are collected from PE0 in an ordered sequence which seems to avoid hanging of processes on SGI-ICE (cpu_statistics)
 
+calc_spectra, check_parameters, cpu_statistics, diffusion_s, flow_statistics, init_dvrp, init_3d_model, local_stop, plant_canopy_model, poismg, prandtl_fluxes, pres, read_3d_binary, user_interface, wall_fluxes, write_3d_binary
+
Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 192)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 197)
@@ -10,5 +10,6 @@
 ! Leaf area density (LAD) explicitly set to its surface value at k=0
 ! Case of reading data for recycling included in initializing_actions,
-! check of turbulent_inflow and calculation of recycling_plane
+! check of turbulent_inflow and calculation of recycling_plane.
+! q*2 profile added
 !
 ! Former revisions:
@@ -2256,4 +2257,17 @@
              hom(:,2,69,:) = SPREAD( zu, 2, statistic_regions+1 )
 
+          CASE ( 'q*2' )
+             IF ( .NOT. humidity )  THEN
+                IF ( myid == 0 )  THEN
+                   PRINT*, '+++ check_parameters:  data_output_pr = ', &
+                           data_output_pr(i),                          &
+                           '    is not implemented for humidity = FALSE'
+                ENDIF
+                CALL local_stop
+             ELSE
+                dopr_index(i) = 70
+                dopr_unit(i)  = 'kg2/kg2'
+                hom(:,2,70,:) = SPREAD( zu, 2, statistic_regions+1 )
+             ENDIF
 
           CASE DEFAULT
Index: palm/trunk/SOURCE/cpu_statistics.f90
===================================================================
--- palm/trunk/SOURCE/cpu_statistics.f90	(revision 192)
+++ palm/trunk/SOURCE/cpu_statistics.f90	(revision 197)
@@ -4,5 +4,7 @@
 ! Actual revisions:
 ! -----------------
-! Format adjustments in order to allow CPU# > 999
+! Format adjustments in order to allow CPU# > 999,
+! data are collected from PE0 in an ordered sequence which seems to avoid
+! hanging of processes on SGI-ICE
 !
 ! Former revisions:
@@ -69,5 +71,5 @@
        DO  i = 1, numprocs-1
           CALL MPI_RECV( pe_max(1), SIZE( log_point ), MPI_REAL, &
-                         MPI_ANY_SOURCE, MPI_ANY_TAG, comm2d, status, ierr )
+                         i, i, comm2d, status, ierr )
           sender = status(MPI_SOURCE)
           pe_log_points(:,sender) = pe_max
@@ -87,8 +89,4 @@
 !--       Calculate rms
           DO  i = 0, numprocs-1
-!             IF ( log_point(iii)%place == 'run_control' )  THEN
-!                PRINT*, 'pe_rms=',pe_rms(iii),' plp=',pe_log_points(iii,i), &
-!                        ' lps=',log_point(iii)%sum
-!             ENDIF
              pe_rms(iii) = pe_rms(iii) + ( &
                                  pe_log_points(iii,i) - log_point(iii)%sum &
@@ -103,5 +101,5 @@
        ALLOCATE( pe_max( SIZE( log_point ) ) )
        pe_max = log_point%sum
-       CALL MPI_SEND( pe_max(1), SIZE( log_point ), MPI_REAL, 0, 0, comm2d, &
+       CALL MPI_SEND( pe_max(1), SIZE( log_point ), MPI_REAL, 0, myid, comm2d, &
                       ierr )
 #endif
Index: palm/trunk/SOURCE/data_output_profiles.f90
===================================================================
--- palm/trunk/SOURCE/data_output_profiles.f90	(revision 192)
+++ palm/trunk/SOURCE/data_output_profiles.f90	(revision 197)
@@ -4,5 +4,6 @@
 ! Actual revisions:
 ! -----------------
-! 
+! Time coordinate t=0 stored on netcdf-file only if an output is required for
+! this time for at least one of the profiles
 !
 ! Former revisions:
@@ -39,4 +40,5 @@
 
     INTEGER ::  i, id, ilc, ils, j, k, sr
+    LOGICAL ::  output_for_t0
     REAL    ::  uxma, uxmi
 
@@ -101,8 +103,17 @@
 #if defined( __netcdf )
 !
-!--          Store initial time (t=0) to time axis          
-             nc_stat = NF90_PUT_VAR( id_set_pr, id_var_time_pr, (/ 0.0 /), &
-                                     start = (/ 1 /), count = (/ 1 /) )
-             IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 329 )
+!--          Store initial time (t=0) to time axis, but only if an output
+!--          is required for at least one of the profiles
+             output_for_t0 = .FALSE.
+             DO  i = 1, dopr_n
+                IF ( dopr_initial_index(i) /= 0 )  THEN
+                   nc_stat = NF90_PUT_VAR( id_set_pr, id_var_time_pr,  &
+                                           (/ 0.0 /), start = (/ 1 /), &
+                                           count = (/ 1 /) )
+                   IF ( nc_stat /= NF90_NOERR )  CALL handle_netcdf_error( 329 )
+                   output_for_t0 = .TRUE.
+                   EXIT
+                ENDIF
+             ENDDO
 
 !
@@ -331,5 +342,7 @@
           ENDDO   ! Loop over dopr_n for initial profiles
 
-          IF ( netcdf_output )  dopr_time_count = dopr_time_count + 1
+          IF ( netcdf_output  .AND.  output_for_t0 )  THEN
+             dopr_time_count = dopr_time_count + 1
+          ENDIF
 
        ENDIF   ! Initial profiles
Index: palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- palm/trunk/SOURCE/flow_statistics.f90	(revision 192)
+++ palm/trunk/SOURCE/flow_statistics.f90	(revision 197)
@@ -4,4 +4,6 @@
 ! Actual revisions:
 ! -----------------
+! Spline timeseries splptx etc. removed, timeseries w'u', w'v', w'q' (k=0)
+! added
 ! Bugfix: divide sums(k,8) (e) and sums(k,34) (e*) by ngp_2dh_s_inner(k,sr) 
 ! (like other scalars)
@@ -109,9 +111,4 @@
        sums_l(nzb+9,pr_palm,0)  = sums_divold_l(sr)  ! old divergence from pres
        sums_l(nzb+10,pr_palm,0) = sums_divnew_l(sr)  ! new divergence from pres
-!--    WARNING: next four lines still may have to be adjusted for OpenMP 
-       sums_l(nzb:nzb+2,pr_palm-1,0)    = sums_up_fraction_l(1,1:3,sr)! upstream
-       sums_l(nzb+3:nzb+5,pr_palm-1,0)  = sums_up_fraction_l(2,1:3,sr)! parts
-       sums_l(nzb+6:nzb+8,pr_palm-1,0)  = sums_up_fraction_l(3,1:3,sr)! from
-       sums_l(nzb+9:nzb+11,pr_palm-1,0) = sums_up_fraction_l(4,1:3,sr)! spline
 
 !
@@ -380,4 +377,8 @@
              sums_l(nzb+3,pr_palm,tn) = sums_l(nzb+3,pr_palm,tn) + &
                                         ts(j,i)   * rmask(j,i,sr)
+             IF ( humidity )  THEN
+                sums_l(nzb+12,pr_palm,tn) = sums_l(nzb+12,pr_palm,tn) + &
+                                            qs(j,i)   * rmask(j,i,sr)
+             ENDIF
           ENDDO
        ENDDO
@@ -807,4 +808,6 @@
 !--    above the topography, they are being divided by ngp_2dh(sr)
        sums(nzb:nzb+3,pr_palm)    = sums(nzb:nzb+3,pr_palm)    / &
+                                    ngp_2dh(sr)
+       sums(nzb+12,pr_palm)       = sums(nzb+12,pr_palm)       / &    ! qs
                                     ngp_2dh(sr)
 !--    eges, e*
@@ -882,4 +885,5 @@
        hom(:,1,68,sr) = sums(:,68)     ! w*p*
        hom(:,1,69,sr) = sums(:,69)     ! w"e + w"p"/rho
+       hom(:,1,70,sr) = sums(:,70)     ! q*2
 
        hom(:,1,pr_palm-1,sr) = sums(:,pr_palm-1)
@@ -999,7 +1003,8 @@
        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,pr_palm-1,sr)  ! splptx
-       ts_value(20,sr) = hom(nzb+10,1,pr_palm-1,sr) ! splpty
-       ts_value(21,sr) = hom(nzb+11,1,pr_palm-1,sr) ! splptz
+       ts_value(19,sr) = hom(nzb+1,1,pr_palm,sr)    ! u'w'    at k=0
+       ts_value(20,sr) = hom(nzb+2,1,pr_palm,sr)    ! v'w'    at k=0
+       ts_value(21,sr) = hom(nzb+12,1,pr_palm,sr)   ! w'q'    at k=0
+
        IF ( ts_value(5,sr) /= 0.0 )  THEN
           ts_value(22,sr) = ts_value(4,sr)**2 / &
Index: palm/trunk/SOURCE/header.f90
===================================================================
--- palm/trunk/SOURCE/header.f90	(revision 192)
+++ palm/trunk/SOURCE/header.f90	(revision 197)
@@ -4,4 +4,5 @@
 ! Actual revisions:
 ! -----------------
+! TEST: mg_switch_to_pe0_level = -1!!!!!!!!!
 ! allow 100 spectra levels instead of 10 for consistency with 
 ! define_netcdf_header
@@ -117,6 +118,8 @@
     ELSEIF ( INDEX( initializing_actions, 'set_constant_profiles' ) /= 0 )  THEN
        run_classification = '3D - run without 1D - prerun'
-    ELSEIF ( INDEX(initializing_actions, 'set_1d-model_profiles') /= 0 ) THEN
+    ELSEIF ( INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 )  THEN
        run_classification = '3D - run with 1D - prerun'
+    ELSEIF ( INDEX( initializing_actions, 'by_user' ) /=0 )  THEN
+       run_classification = '3D - run initialized by user'
     ELSE
        PRINT*,'+++ header:  unknown action(s): ',initializing_actions
@@ -184,5 +187,5 @@
           WRITE ( io, 136 )  nxr_mg(1)-nxl_mg(1)+1, nyn_mg(1)-nys_mg(1)+1, &
                              nzt_mg(1)
-       ELSE
+       ELSEIF (  mg_switch_to_pe0_level /= -1 )  THEN
           WRITE ( io, 137 )  mg_switch_to_pe0_level,            &
                              mg_loc_ind(2,0)-mg_loc_ind(1,0)+1, &
Index: palm/trunk/SOURCE/init_pegrid.f90
===================================================================
--- palm/trunk/SOURCE/init_pegrid.f90	(revision 192)
+++ palm/trunk/SOURCE/init_pegrid.f90	(revision 197)
@@ -5,4 +5,5 @@
 ! -----------------
 ! ATTENTION: nnz_x undefined problem still has to be solved!!!!!!!!
+! multigrid levels are limited by subdomains if mg_switch_to_pe0_level = -1,
 ! nz is used instead nnz for calculating mg-levels
 ! Collect on PE0 horizontal index bounds from all other PEs,
@@ -719,5 +720,5 @@
 !--    Find out, if the total domain allows more levels. These additional
 !--    levels are processed on PE0 only.
-       IF ( numprocs > 1 )  THEN
+       IF ( numprocs > 1  .AND.  mg_switch_to_pe0_level /= -1 )  THEN
           IF ( mg_levels_z > MIN( mg_levels_x, mg_levels_y ) )  THEN
              mg_switch_to_pe0_level_l = maximum_grid_level
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 192)
+++ palm/trunk/SOURCE/modules.f90	(revision 197)
@@ -788,5 +788,5 @@
              '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   ',                       &
+             'w"u"0  ', 'w"v"0  ', 'w"q"0  ', 'mo_L   ',                       &
              ( 'unknown', i9 = 1, 78) /)
 
@@ -795,5 +795,5 @@
              'm/s    ', 'm/s    ', 's-1    ', 's-1    ', 'm      ', 'm      ', &
              'm/s    ', 'K m/s  ', 'K m/s  ', 'k m/s  ', 'K      ', 'K      ', &
-             '%      ', '%      ', '%      ', 'm      ',                       &
+             'm2/s2  ', 'm2/s2  ', 'kg m/s ', 'm      ',                       &
              ( 'unknown', i9 = 1, 78 ) /)
 
Index: palm/trunk/SOURCE/palm.f90
===================================================================
--- palm/trunk/SOURCE/palm.f90	(revision 192)
+++ palm/trunk/SOURCE/palm.f90	(revision 197)
@@ -66,5 +66,5 @@
     INTEGER           ::  i, run_description_header_i(80)
 
-    version = 'PALM 3.4a'
+    version = 'PALM 3.5'
 
 #if defined( __parallel )
Index: palm/trunk/SOURCE/parin.f90
===================================================================
--- palm/trunk/SOURCE/parin.f90	(revision 192)
+++ palm/trunk/SOURCE/parin.f90	(revision 197)
@@ -8,4 +8,5 @@
 ! +inflow_damping_height, inflow_damping_width, recycling_width,
 ! turbulent_inflow in inipar
+! -skip_time_dosp in d3par,
 ! Allocation of hom_sum moved from init_3d_model to here,
 ! npex, npey moved from inipar to d3par, setting of myid_char_14 removed,
@@ -109,7 +110,7 @@
              surface_heatflux, surface_pressure, surface_scalarflux, &
              surface_waterflux, s_surface, s_surface_initial_change, &
-             s_vertical_gradient, s_vertical_gradient_level, top_heatflux, &
-             top_momentumflux_u, top_momentumflux_v, top_salinityflux, &
-             timestep_scheme, topography, turbulent_inflow, ug_surface, &
+             s_vertical_gradient, s_vertical_gradient_level, timestep_scheme,
+             topography, top_heatflux, top_momentumflux_u, top_momentumflux_v, &
+             top_salinityflux, turbulent_inflow, ug_surface, &
              ug_vertical_gradient, ug_vertical_gradient_level, ups_limit_e, &
              ups_limit_pt, ups_limit_u, ups_limit_v, ups_limit_w, &
@@ -143,5 +144,5 @@
                        section_yz, skip_time_data_output, &
                        skip_time_data_output_av, skip_time_dopr, &
-                       skip_time_dosp, skip_time_do2d_xy, skip_time_do2d_xz, &
+                       skip_time_do2d_xy, skip_time_do2d_xz, &
                        skip_time_do2d_yz, skip_time_do3d, &
                        termination_time_needed, use_prior_plot1d_parameters, &
