Index: palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- palm/trunk/SOURCE/flow_statistics.f90	(revision 3241)
+++ palm/trunk/SOURCE/flow_statistics.f90	(revision 3274)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Modularization of all bulk cloud physics code components
+! 
+! 3241 2018-09-12 15:02:00Z raasch
 ! unused variables removed
 ! 
@@ -283,16 +286,16 @@
                momentumflux_output_conversion, nc, nr, p, prho, prr, pt, q,    &
                qc, ql, qr, rho_air, rho_air_zw, rho_ocean, s,                  &
-               sa, u, ug, v, vg, vpt, w, w_subs, waterflux_output_conversion, zw
+               sa, u, ug, v, vg, vpt, w, w_subs, waterflux_output_conversion,  &
+               zw, d_exner
         
-    USE cloud_parameters,                                                      &
-        ONLY:   l_d_cp, pt_d_t
+    USE basic_constants_and_equations_mod,                                     &
+        ONLY:   g, lv_d_cp
         
     USE control_parameters,                                                    &
-        ONLY:   average_count_pr, cloud_droplets, cloud_physics, do_sum,       &
-                dt_3d, g, humidity, initializing_actions, land_surface,        &
+        ONLY:   average_count_pr, cloud_droplets, do_sum,                      &
+                dt_3d, humidity, initializing_actions, land_surface,           &
                 large_scale_forcing, large_scale_subsidence, max_pr_user,      &
-                message_string, neutral, microphysics_morrison,                &
-                microphysics_seifert, ocean, passive_scalar, simulated_time,   &
-                simulated_time_at_begin, use_subsidence_tendencies,            & 
+                message_string, neutral, ocean, passive_scalar, simulated_time,&
+                simulated_time_at_begin, use_subsidence_tendencies,            &
                 use_surface_fluxes, use_top_fluxes, ws_scheme_mom,             &
                 ws_scheme_sca
@@ -313,4 +316,7 @@
         
     USE kinds
+
+    USE bulk_cloud_model_mod,                                                  &
+        ONLY: bulk_cloud_model, microphysics_morrison, microphysics_seifert
     
     USE land_surface_model_mod,                                                &
@@ -515,5 +521,5 @@
              ENDDO
           ENDDO
-          IF ( cloud_physics )  THEN
+          IF ( bulk_cloud_model )  THEN
              !$OMP DO
              DO  i = nxl, nxr
@@ -525,5 +531,5 @@
                                                                * flag
                       sums_l(k,43,tn) = sums_l(k,43,tn) + (                    &
-                                      pt(k,j,i) + l_d_cp*pt_d_t(k) * ql(k,j,i) &
+                                      pt(k,j,i) + lv_d_cp * d_exner(k) * ql(k,j,i) &
                                                           ) * rmask(j,i,sr)    &
                                                             * flag
@@ -563,5 +569,5 @@
                 sums_l(:,41,0) = sums_l(:,41,0) + sums_l(:,41,i)
                 sums_l(:,44,0) = sums_l(:,44,0) + sums_l(:,44,i)
-                IF ( cloud_physics )  THEN
+                IF ( bulk_cloud_model )  THEN
                    sums_l(:,42,0) = sums_l(:,42,0) + sums_l(:,42,i)
                    sums_l(:,43,0) = sums_l(:,43,0) + sums_l(:,43,i)
@@ -598,5 +604,5 @@
           CALL MPI_ALLREDUCE( sums_l(nzb,41,0), sums(nzb,41), nzt+2-nzb,       &
                               MPI_REAL, MPI_SUM, comm2d, ierr )
-          IF ( cloud_physics ) THEN
+          IF ( bulk_cloud_model ) THEN
              IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
              CALL MPI_ALLREDUCE( sums_l(nzb,42,0), sums(nzb,42), nzt+2-nzb,    &
@@ -621,5 +627,5 @@
           sums(:,44) = sums_l(:,44,0)
           sums(:,41) = sums_l(:,41,0)
-          IF ( cloud_physics ) THEN
+          IF ( bulk_cloud_model ) THEN
              sums(:,42) = sums_l(:,42,0)
              sums(:,43) = sums_l(:,43,0)
@@ -654,5 +660,5 @@
           hom(:,1,44,sr) = sums(:,44)             ! vpt
           hom(:,1,41,sr) = sums(:,41)             ! qv (q)
-          IF ( cloud_physics ) THEN
+          IF ( bulk_cloud_model ) THEN
              sums(:,42) = sums(:,42) / ngp_2dh_s_inner(:,sr)
              sums(:,43) = sums(:,43) / ngp_2dh_s_inner(:,sr)
@@ -948,5 +954,5 @@
                                                * ddzu(k+1) * rmask(j,i,sr) * flag
 
-                   IF ( cloud_physics ) THEN
+                   IF ( bulk_cloud_model ) THEN
                       sums_l(k,51,tn) = sums_l(k,51,tn)                        &
                                          - 0.5_wp * ( kh(k,j,i) + kh(k+1,j,i) )&
@@ -1014,5 +1020,5 @@
                                           * heatflux_output_conversion(k+ki)
                             ENDIF
-                            IF ( cloud_physics )  THEN
+                            IF ( bulk_cloud_model )  THEN
 !
 !--                            Formula does not work if ql(k+ki) /= 0.0
@@ -1067,5 +1073,5 @@
                                           * heatflux_output_conversion(nzb)
                       ENDIF
-                      IF ( cloud_physics )  THEN
+                      IF ( bulk_cloud_model )  THEN
 !
 !--                      Formula does not work if ql(nzb) /= 0.0
@@ -1118,5 +1124,5 @@
                                           * heatflux_output_conversion(nzb)
                       ENDIF
-                      IF ( cloud_physics )  THEN
+                      IF ( bulk_cloud_model )  THEN
 !
 !--                      Formula does not work if ql(nzb) /= 0.0
@@ -1293,5 +1299,5 @@
                                            * heatflux_output_conversion(nzt)
                    ENDIF
-                   IF ( cloud_physics )  THEN
+                   IF ( bulk_cloud_model )  THEN
 !
 !--                   Formula does not work if ql(nzb) /= 0.0
@@ -1347,5 +1353,5 @@
 !--             content, rain drop concentration and rain water content
                 IF ( humidity )  THEN
-                   IF ( cloud_physics .OR. cloud_droplets )  THEN
+                   IF ( bulk_cloud_model .OR. cloud_droplets )  THEN
                       pts = 0.5_wp * ( vpt(k,j,i)   - hom(k,1,44,sr) +         &
                                     vpt(k+1,j,i) - hom(k+1,1,44,sr) )
