Index: palm/trunk/SOURCE/bulk_cloud_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 4541)
+++ palm/trunk/SOURCE/bulk_cloud_model_mod.f90	(revision 4542)
@@ -1,20 +1,19 @@
 !> @file bulk_cloud_model_mod.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:
@@ -25,87 +24,90 @@
 ! -----------------
 ! $Id$
+! file re-formatted to follow the PALM coding standard
+!
+! 4535 2020-05-15 12:07:23Z raasch
 ! bugfix for restart data format query
-! 
+!
 ! 4533 2020-05-14 14:46:46Z schwenkel
 ! Reformat intrinsic function
-! 
+!
 ! 4532 2020-05-14 13:41:35Z schwenkel
 ! Calculate mean droplet radius assuming gamma distibution for condensation
-! 
+!
 ! 4521 2020-05-06 11:39:49Z schwenkel
 ! Rename variable
-! 
+!
 ! 4517 2020-05-03 14:29:30Z raasch
 ! added restart with MPI-IO for reading local arrays
-! 
+!
 ! 4506 2020-04-21 10:57:45Z schwenkel
 ! Use correct magnus formula for liquid water temperature
-! 
+!
 ! 4502 2020-04-17 16:14:16Z schwenkel
 ! Implementation of ice microphysics
-! 
+!
 ! 4495 2020-04-13 20:11:20Z raasch
 ! restart data handling with MPI-IO added
-! 
+!
 ! 4457 2020-03-11 14:20:43Z raasch
 ! use statement for exchange horiz added
-! 
+!
 ! 4418 2020-02-21 09:41:13Z raasch
 ! bugfix for raindrop number adjustment
-! 
+!
 ! 4370 2020-01-10 14:00:44Z raasch
 ! vector directives added to force vectorization on Intel19 compiler
-! 
+!
 ! 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
-! 
+!
 ! 4289 2019-11-05 14:33:41Z knoop
 ! Removed parameters precipitation and precipitation_amount_interval from namelist
-! 
+!
 ! 4268 2019-10-17 11:29:38Z schwenkel
 ! Introducing bcm_boundary_conditions
-! 
+!
 ! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
-! 
+!
 ! 4168 2019-08-16 13:50:17Z suehring
 ! Replace function get_topography_top_index by topo_top_ind
-! 
+!
 ! 4110 2019-07-22 17:05:21Z suehring
-! Pass integer flag array as well as boundary flags to WS scalar advection 
+! Pass integer flag array as well as boundary flags to WS scalar advection
 ! routine
-! 
+!
 ! 4109 2019-07-22 17:00:34Z suehring
 ! Added microphyics scheme 'morrision_no_rain'
-! 
+!
 ! 3931 2019-04-24 16:34:28Z schwenkel
 ! Added bcm_exchange_horiz which is called after non_transport_physics
-! 
+!
 ! 3885 2019-04-11 11:29:34Z kanani
-! Changes related to global restructuring of location messages and introduction 
+! Changes related to global restructuring of location messages and introduction
 ! of additional debug messages
-! 
+!
 ! 3874 2019-04-08 16:53:48Z knoop
 ! Implemented non_transport_physics module interfaces
-! 
+!
 ! 3870 2019-04-08 13:44:34Z knoop
 ! Moving prognostic equations of bcm into bulk_cloud_model_mod
-! 
+!
 ! 3869 2019-04-08 11:54:20Z knoop
 ! moving the furniture around ;-)
-! 
+!
 ! 3786 2019-03-06 16:58:03Z raasch
 ! unsed variables removed
-! 
+!
 ! 3767 2019-02-27 08:18:02Z raasch
 ! unused variable for file index removed from rrd-subroutines parameter list
-! 
+!
 ! 3724 2019-02-06 16:28:23Z kanani
 ! Correct double-used log_point_s unit
-! 
+!
 ! 3700 2019-01-26 17:03:42Z knoop
 ! nopointer option removed
@@ -116,99 +118,98 @@
 ! ------------
 !> Calculate bulk cloud microphysics.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
  MODULE bulk_cloud_model_mod
 
 
-    USE advec_s_bc_mod,                                                        &
+    USE advec_s_bc_mod,                                                                            &
         ONLY:  advec_s_bc
 
-    USE advec_s_pw_mod,                                                        &
+    USE advec_s_pw_mod,                                                                            &
         ONLY:  advec_s_pw
 
-    USE advec_s_up_mod,                                                        &
+    USE advec_s_up_mod,                                                                            &
         ONLY:  advec_s_up
 
-    USE advec_ws,                                                              &
+    USE advec_ws,                                                                                  &
         ONLY:  advec_s_ws
 
-    USE arrays_3d,                                                             &
-        ONLY:  ddzu, diss, dzu, dzw, hyp, hyrho,                               &
-               nc, nc_1, nc_2, nc_3, nc_p, nr, nr_1, nr_2, nr_3, nr_p,         &
-               precipitation_amount, prr, pt, d_exner, pt_init, q, ql, ql_1,   &
-               qc, qc_1, qc_2, qc_3, qc_p, qr, qr_1, qr_2, qr_3, qr_p,         &
-               exner, zu, tnc_m, tnr_m, tqc_m, tqr_m, tend, rdf_sc,            &
-               flux_l_qc, flux_l_qr, flux_l_nc, flux_l_nr,                     &
-               flux_s_qc, flux_s_qr, flux_s_nc, flux_s_nr,                     &
-               diss_l_qc, diss_l_qr, diss_l_nc, diss_l_nr,                     &
-               diss_s_qc, diss_s_qr, diss_s_nc, diss_s_nr,                     &
-               ni, ni_1, ni_2, ni_3, ni_p, tni_m,                              &
-               qi, qi_1, qi_2, qi_3, qi_p, tqi_m,                              &
-               flux_l_qi, flux_l_ni, flux_s_qi, flux_s_ni,                     &
-               diss_l_qi, diss_l_ni, diss_s_qi, diss_s_ni
-
-
-    USE averaging,                                                             &
-        ONLY:  nc_av, nr_av, prr_av, qc_av, ql_av, qr_av, ni_av, qi_av
-
-    USE basic_constants_and_equations_mod,                                     &
-        ONLY:  c_p, g, lv_d_cp, lv_d_rd, l_v, magnus, magnus_ice, magnus_tl,   &
-               molecular_weight_of_solute,                                     &
-               molecular_weight_of_water, pi, rho_l, rho_s, r_d, r_v, vanthoff,&
-               exner_function, exner_function_invers, ideal_gas_law_rho,       &
-               ideal_gas_law_rho_pt, barometric_formula, rd_d_rv, l_s,         &
-               ls_d_cp
-
-    USE control_parameters,                                                    &
-        ONLY:  bc_dirichlet_l,                                                 &
-               bc_dirichlet_n,                                                 &
-               bc_dirichlet_r,                                                 &
-               bc_dirichlet_s,                                                 &
-               bc_radiation_l,                                                 &
-               bc_radiation_n,                                                 &
-               bc_radiation_r,                                                 &
-               bc_radiation_s,                                                 &
-               debug_output,                                                   &
-               dt_3d, dt_do2d_xy, intermediate_timestep_count,                 &
-               intermediate_timestep_count_max, large_scale_forcing,           &
-               lsf_surf, pt_surface, restart_data_format_output, rho_surface,  &
-               surface_pressure,                                               &
-               time_do2d_xy, message_string, initializing_actions,             &
-               ws_scheme_sca, scalar_advec, timestep_scheme, tsc,              &
-               loop_optimization, simulated_time
-
-    USE cpulog,                                                                &
+    USE arrays_3d,                                                                                 &
+        ONLY:  diss_s_qc, diss_s_qr, diss_s_nc, diss_s_nr,                                         &
+               diss_l_qc, diss_l_qr, diss_l_nc, diss_l_nr,                                         &
+               diss_l_qi, diss_l_ni, diss_s_qi, diss_s_ni,                                         &
+               ddzu, diss, dzu, dzw, hyp, hyrho,                                                   &
+               exner, zu, tnc_m, tnr_m, tqc_m, tqr_m, tend, rdf_sc,                                &
+               flux_l_qc, flux_l_qr, flux_l_nc, flux_l_nr,                                         &
+               flux_l_qi, flux_l_ni, flux_s_qi, flux_s_ni,                                         &
+               flux_s_qc, flux_s_qr, flux_s_nc, flux_s_nr,                                         &
+               nc, nc_1, nc_2, nc_3, nc_p, nr, nr_1, nr_2, nr_3, nr_p,                             &
+               ni, ni_1, ni_2, ni_3, ni_p, tni_m,                                                  &
+               precipitation_amount, prr, pt, d_exner, pt_init, q, ql, ql_1,                       &
+               qc, qc_1, qc_2, qc_3, qc_p, qr, qr_1, qr_2, qr_3, qr_p,                             &
+               qi, qi_1, qi_2, qi_3, qi_p, tqi_m
+
+
+    USE averaging,                                                                                 &
+        ONLY:  nc_av,ni_av, nr_av, prr_av, qc_av, ql_av, qi_av, qr_av
+
+    USE basic_constants_and_equations_mod,                                                         &
+        ONLY:  c_p, g, lv_d_cp, lv_d_rd, l_v, magnus, magnus_ice, magnus_tl,                       &
+               exner_function, exner_function_invers, ideal_gas_law_rho,                           &
+               ideal_gas_law_rho_pt, barometric_formula, rd_d_rv, l_s,                             &
+               ls_d_cp,                                                                            &
+               molecular_weight_of_solute,                                                         &
+               molecular_weight_of_water, pi, rho_l, rho_s, r_d, r_v, vanthoff
+
+    USE control_parameters,                                                                        &
+        ONLY:  bc_dirichlet_l,                                                                     &
+               bc_dirichlet_n,                                                                     &
+               bc_dirichlet_r,                                                                     &
+               bc_dirichlet_s,                                                                     &
+               bc_radiation_l,                                                                     &
+               bc_radiation_n,                                                                     &
+               bc_radiation_r,                                                                     &
+               bc_radiation_s,                                                                     &
+               debug_output,                                                                       &
+               dt_3d, dt_do2d_xy, intermediate_timestep_count,                                     &
+               intermediate_timestep_count_max, large_scale_forcing,                               &
+               loop_optimization, simulated_time,                                                  &
+               lsf_surf, pt_surface, restart_data_format_output, rho_surface,                      &
+               surface_pressure,                                                                   &
+               time_do2d_xy, message_string, initializing_actions,                                 &
+               ws_scheme_sca, scalar_advec, timestep_scheme, tsc
+
+    USE cpulog,                                                                                    &
         ONLY:  cpu_log, log_point, log_point_s
 
-    USE diffusion_s_mod,                                                       &
+    USE diffusion_s_mod,                                                                           &
         ONLY:  diffusion_s
 
-    USE grid_variables,                                                        &
+    USE grid_variables,                                                                            &
         ONLY:  dx, dy
 
-    USE indices,                                                               &
-        ONLY:  advc_flags_s,                                                   &
-               nbgp, nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb, nzt,     &
-               topo_top_ind,                                                   &
+    USE indices,                                                                                   &
+        ONLY:  advc_flags_s,                                                                       &
+               nbgp, nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb, nzt,                         &
+               topo_top_ind,                                                                       &
                wall_flags_total_0
 
     USE kinds
 
-    USE pegrid,                                                                &
+    USE pegrid,                                                                                    &
         ONLY:  threads_per_task
 
-    USE restart_data_mpi_io_mod,                                               &
+    USE restart_data_mpi_io_mod,                                                                   &
         ONLY:  rd_mpi_io_check_array, rrd_mpi_io, wrd_mpi_io
 
-    USE statistics,                                                            &
-        ONLY:  weight_pres, weight_substep, sums_wsncs_ws_l, sums_wsnrs_ws_l,  &
-               sums_wsqcs_ws_l, sums_wsqrs_ws_l,                               &
-               sums_wsqis_ws_l, sums_wsnis_ws_l
-
-    USE surface_mod,                                                           &
-        ONLY :  bc_h,                                                          &
-                surf_bulk_cloud_model,                                         &
-                surf_microphysics_morrison, surf_microphysics_seifert,         &
-                surf_microphysics_ice_phase,                               &
-                surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h,    &
+    USE statistics,                                                                                &
+        ONLY:  sums_wsncs_ws_l, sums_wsnis_ws_l, sums_wsnrs_ws_l, sums_wsqcs_ws_l, sums_wsqis_ws_l,&
+               sums_wsqrs_ws_l, weight_pres, weight_substep
+
+    USE surface_mod,                                                                               &
+        ONLY :  bc_h,                                                                              &
+                surf_bulk_cloud_model,                                                             &
+                surf_microphysics_morrison, surf_microphysics_seifert,                             &
+                surf_microphysics_ice_phase,                                                       &
+                surf_def_h, surf_def_v, surf_lsm_h, surf_lsm_v, surf_usm_h,                        &
                 surf_usm_v
 
@@ -218,86 +219,84 @@
     CHARACTER (LEN=20)   ::  cloud_scheme = 'saturation_adjust'           !< namelist parameter
 
-    LOGICAL ::  aerosol_nacl =.TRUE.                             !< nacl aerosol for bulk scheme
-    LOGICAL ::  aerosol_c3h4o4 =.FALSE.                          !< malonic acid aerosol for bulk scheme
-    LOGICAL ::  aerosol_nh4no3 =.FALSE.                          !< malonic acid aerosol for bulk scheme
-
-    LOGICAL ::  bulk_cloud_model = .FALSE.                       !< namelist parameter
-
-    LOGICAL ::  cloud_water_sedimentation = .FALSE.       !< cloud water sedimentation
-    LOGICAL ::  curvature_solution_effects_bulk = .FALSE. !< flag for considering koehler theory
-    LOGICAL ::  ice_crystal_sedimentation = .FALSE.        !< flag for ice crystal sedimentation
-    LOGICAL ::  limiter_sedimentation = .TRUE.            !< sedimentation limiter
-    LOGICAL ::  collision_turbulence = .FALSE.            !< turbulence effects
-    LOGICAL ::  ventilation_effect = .TRUE.               !< ventilation effect
-
-    LOGICAL ::  call_microphysics_at_all_substeps = .FALSE.      !< namelist parameter
-    LOGICAL ::  microphysics_ice_phase = .FALSE.              !< use ice microphysics scheme
-    LOGICAL ::  microphysics_sat_adjust = .FALSE.                !< use saturation adjust bulk scheme?
-    LOGICAL ::  microphysics_kessler = .FALSE.                   !< use kessler bulk scheme?
-    LOGICAL ::  microphysics_morrison = .FALSE.                  !< use 2-moment Morrison (add. prog. eq. for nc and qc)
-    LOGICAL ::  microphysics_seifert = .FALSE.                   !< use 2-moment Seifert and Beheng scheme
-    LOGICAL ::  microphysics_morrison_no_rain = .FALSE.          !< use 2-moment Morrison
-    LOGICAL ::  precipitation = .FALSE.                          !< namelist parameter
-
-    REAL(wp) ::  precipitation_amount_interval = 9999999.9_wp    !< namelist parameter
-
-    REAL(wp) ::  a_1 = 8.69E-4_wp          !< coef. in turb. parametrization (cm-2 s3)
-    REAL(wp) ::  a_2 = -7.38E-5_wp         !< coef. in turb. parametrization (cm-2 s3)
-    REAL(wp) ::  a_3 = -1.40E-2_wp         !< coef. in turb. parametrization
-    REAL(wp) ::  a_term = 9.65_wp          !< coef. for terminal velocity (m s-1)
-    REAL(wp) ::  a_vent = 0.78_wp          !< coef. for ventilation effect
-    REAL(wp) ::  b_1 = 11.45E-6_wp         !< coef. in turb. parametrization (m)
-    REAL(wp) ::  b_2 = 9.68E-6_wp          !< coef. in turb. parametrization (m)
-    REAL(wp) ::  b_3 = 0.62_wp             !< coef. in turb. parametrization
-    REAL(wp) ::  b_term = 9.8_wp           !< coef. for terminal velocity (m s-1)
-    REAL(wp) ::  b_vent = 0.308_wp         !< coef. for ventilation effect
-    REAL(wp) ::  beta_cc = 3.09E-4_wp      !< coef. in turb. parametrization (cm-2 s3)
-    REAL(wp) ::  c_1 = 4.82E-6_wp          !< coef. in turb. parametrization (m)
-    REAL(wp) ::  c_2 = 4.8E-6_wp           !< coef. in turb. parametrization (m)
-    REAL(wp) ::  c_3 = 0.76_wp             !< coef. in turb. parametrization
-    REAL(wp) ::  c_const = 0.93_wp         !< const. in Taylor-microscale Reynolds number
-    REAL(wp) ::  c_evap = 0.7_wp           !< constant in evaporation
-    REAL(wp) ::  c_term = 600.0_wp         !< coef. for terminal velocity (m-1)
-    REAL(wp) ::  diff_coeff_l = 0.23E-4_wp  !< diffusivity of water vapor (m2 s-1)
-    REAL(wp) ::  eps_sb = 1.0E-10_wp       !< threshold in two-moments scheme
-    REAL(wp) ::  eps_mr = 0.0_wp           !< threshold for morrison scheme
-    REAL(wp) ::  k_cc = 9.44E09_wp         !< const. cloud-cloud kernel (m3 kg-2 s-1)
-    REAL(wp) ::  k_cr0 = 4.33_wp           !< const. cloud-rain kernel (m3 kg-1 s-1)
-    REAL(wp) ::  k_rr = 7.12_wp            !< const. rain-rain kernel (m3 kg-1 s-1)
-    REAL(wp) ::  k_br = 1000.0_wp          !< const. in breakup parametrization (m-1)
-    REAL(wp) ::  k_st = 1.2E8_wp           !< const. in drizzle parametrization (m-1 s-1)
-    REAL(wp) ::  kin_vis_air = 1.4086E-5_wp  !< kin. viscosity of air (m2 s-1)
-    REAL(wp) ::  prec_time_const = 0.001_wp  !< coef. in Kessler scheme (s-1)
-    REAL(wp) ::  ql_crit = 0.0005_wp       !< coef. in Kessler scheme (kg kg-1)
-    REAL(wp) ::  schmidt_p_1d3=0.8921121_wp  !< Schmidt number**0.33333, 0.71**0.33333
-    REAL(wp) ::  sigma_gc = 1.3_wp         !< geometric standard deviation cloud droplets
-    REAL(wp) ::  thermal_conductivity_l = 2.43E-2_wp  !< therm. cond. air (J m-1 s-1 K-1)
-    REAL(wp) ::  w_precipitation = 9.65_wp  !< maximum terminal velocity (m s-1)
-    REAL(wp) ::  x0 = 2.6E-10_wp           !< separating drop mass (kg)
-    REAL(wp) ::  ximin = 4.42E-14_wp       !< minimum mass of ice crystal (kg) (D~10Âµm)
-    REAL(wp) ::  xcmin = 4.18E-15_wp       !< minimum cloud drop size (kg) (~ 1Âµm)
-    REAL(wp) ::  xrmin = 2.6E-10_wp        !< minimum rain drop size (kg)
-    REAL(wp) ::  xrmax = 5.0E-6_wp         !< maximum rain drop site (kg)
-
+    LOGICAL ::  aerosol_nacl =.TRUE.                         !< nacl aerosol for bulk scheme
+    LOGICAL ::  aerosol_c3h4o4 =.FALSE.                      !< malonic acid aerosol for bulk scheme
+    LOGICAL ::  aerosol_nh4no3 =.FALSE.                      !< malonic acid aerosol for bulk scheme
+    LOGICAL ::  bulk_cloud_model = .FALSE.                   !< namelist parameter
+    LOGICAL ::  call_microphysics_at_all_substeps = .FALSE.  !< namelist parameter
+    LOGICAL ::  cloud_water_sedimentation = .FALSE.          !< cloud water sedimentation
+    LOGICAL ::  collision_turbulence = .FALSE.               !< turbulence effects
+    LOGICAL ::  curvature_solution_effects_bulk = .FALSE.    !< flag for considering koehler theory
+    LOGICAL ::  ice_crystal_sedimentation = .FALSE.          !< flag for ice crystal sedimentation
+    LOGICAL ::  limiter_sedimentation = .TRUE.               !< sedimentation limiter
+    LOGICAL ::  microphysics_ice_phase = .FALSE.             !< use ice microphysics scheme
+    LOGICAL ::  microphysics_kessler = .FALSE.               !< use kessler bulk scheme?
+    LOGICAL ::  microphysics_morrison = .FALSE.              !< use 2-moment Morrison
+                                                             !< (add. prog. eq. for nc and qc)
+    LOGICAL ::  microphysics_morrison_no_rain = .FALSE.      !< use 2-moment Morrison
+    LOGICAL ::  microphysics_sat_adjust = .FALSE.            !< use saturation adjust bulk scheme?
+    LOGICAL ::  microphysics_seifert = .FALSE.               !< use 2-moment Seifert and Beheng
+                                                             !< scheme
+    LOGICAL ::  precipitation = .FALSE.                      !< namelist parameter
+    LOGICAL ::  ventilation_effect = .TRUE.                  !< ventilation effect
+
+
+    REAL(wp) ::  a_1 = 8.69E-4_wp                !< coef. in turb. parametrization    (cm-2 s3)
+    REAL(wp) ::  a_2 = -7.38E-5_wp               !< coef. in turb. parametrization    (cm-2 s3)
+    REAL(wp) ::  a_3 = -1.40E-2_wp               !< coef. in turb. parametrization
+    REAL(wp) ::  a_term = 9.65_wp                !< coef. for terminal velocity       (m s-1)
+    REAL(wp) ::  a_vent = 0.78_wp                !< coef. for ventilation effect
+    REAL(wp) ::  b_1 = 11.45E-6_wp               !< coef. in turb. parametrization    (m)
+    REAL(wp) ::  b_2 = 9.68E-6_wp                !< coef. in turb. parametrization    (m)
+    REAL(wp) ::  b_3 = 0.62_wp                   !< coef. in turb. parametrization
+    REAL(wp) ::  b_term = 9.8_wp                 !< coef. for terminal velocity       (m s-1)
+    REAL(wp) ::  b_vent = 0.308_wp               !< coef. for ventilation effect
+    REAL(wp) ::  beta_cc = 3.09E-4_wp            !< coef. in turb. parametrization    (cm-2 s3)
+    REAL(wp) ::  c_1 = 4.82E-6_wp                !< coef. in turb. parametrization    (m)
+    REAL(wp) ::  c_2 = 4.8E-6_wp                 !< coef. in turb. parametrization    (m)
+    REAL(wp) ::  c_3 = 0.76_wp                   !< coef. in turb. parametrization
+    REAL(wp) ::  c_const = 0.93_wp               !< const. in Taylor-microscale Reynolds number
+    REAL(wp) ::  c_evap = 0.7_wp                 !< constant in evaporation
     REAL(wp) ::  c_sedimentation = 2.0_wp        !< Courant number of sedimentation process
+    REAL(wp) ::  c_term = 600.0_wp               !< coef. for terminal velocity       (m-1)
+    REAL(wp) ::  diff_coeff_l = 0.23E-4_wp       !< diffusivity of water vapor        (m2 s-1)
     REAL(wp) ::  dpirho_l                        !< 6.0 / ( pi * rho_l )
     REAL(wp) ::  dry_aerosol_radius = 0.05E-6_wp !< dry aerosol radius
     REAL(wp) ::  dt_micro                        !< microphysics time step
+    REAL(wp) ::  eps_sb = 1.0E-10_wp             !< threshold in two-moments scheme
+    REAL(wp) ::  dt_precipitation = 100.0_wp     !< timestep precipitation (s)
+    REAL(wp) ::  e_s                             !< saturation water vapor pressure
+    REAL(wp) ::  e_si                            !< saturation water vapor pressure over ice
+    REAL(wp) ::  eps_mr = 0.0_wp                 !< threshold for morrison scheme
     REAL(wp) ::  in_init = 1000.0_wp             !< initial number of potential ice nucleii
-    REAL(wp) ::  sigma_bulk = 2.0_wp             !< width of aerosol spectrum
+    REAL(wp) ::  k_cc = 9.44E09_wp               !< const. cloud-cloud kernel         (m3 kg-2 s-1)
+    REAL(wp) ::  k_cr0 = 4.33_wp                 !< const. cloud-rain kernel          (m3 kg-1 s-1)
+    REAL(wp) ::  k_rr = 7.12_wp                  !< const. rain-rain kernel           (m3 kg-1 s-1)
+    REAL(wp) ::  k_br = 1000.0_wp                !< const. in breakup parametrization (m-1)
+    REAL(wp) ::  k_st = 1.2E8_wp                 !< const. in drizzle parametrization (m-1 s-1)
+    REAL(wp) ::  kin_vis_air = 1.4086E-5_wp      !< kin. viscosity of air             (m2 s-1)
     REAL(wp) ::  na_init = 100.0E6_wp            !< Total particle/aerosol concentration (cm-3)
     REAL(wp) ::  nc_const = 70.0E6_wp            !< cloud droplet concentration
-    REAL(wp) ::  dt_precipitation = 100.0_wp     !< timestep precipitation (s)
+    REAL(wp) ::  pirho_l                         !< pi * rho_l / 6.0
+    REAL(wp) ::  prec_time_const = 0.001_wp      !< coef. in Kessler scheme           (s-1)
+    REAL(wp) ::  precipitation_amount_interval = 9999999.9_wp     !< namelist parameter
+    REAL(wp) ::  ql_crit = 0.0005_wp             !< coef. in Kessler scheme           (kg kg-1)
+    REAL(wp) ::  q_s                             !< saturation mixing ratio
+    REAL(wp) ::  q_si                            !< saturation mixing ratio over ice
+    REAL(wp) ::  sat                             !< supersaturation
+    REAL(wp) ::  sat_ice                         !< supersaturation over ice
+    REAL(wp) ::  start_ice_microphysics = 0.0_wp !< time from which on ice microhysics are executed
     REAL(wp) ::  sed_qc_const                    !< const. for sedimentation of cloud water
-    REAL(wp) ::  pirho_l                         !< pi * rho_l / 6.0
-    REAL(wp) ::  start_ice_microphysics = 0.0_wp !< time from which on ice microhysics are executed
-
-    REAL(wp) ::  e_s     !< saturation water vapor pressure
-    REAL(wp) ::  e_si    !< saturation water vapor pressure over ice
-    REAL(wp) ::  q_s     !< saturation mixing ratio
-    REAL(wp) ::  q_si    !< saturation mixing ratio over ice
-    REAL(wp) ::  sat     !< supersaturation
-    REAL(wp) ::  sat_ice !< supersaturation over ice
-    REAL(wp) ::  t_l     !< liquid-(ice) water temperature
+    REAL(wp) ::  schmidt_p_1d3=0.8921121_wp      !< Schmidt number**0.33333, 0.71**0.33333
+    REAL(wp) ::  sigma_bulk = 2.0_wp             !< width of aerosol spectrum
+    REAL(wp) ::  sigma_gc = 1.3_wp               !< geometric standard deviation cloud droplets
+    REAL(wp) ::  t_l                             !< liquid-(ice) water temperature
+    REAL(wp) ::  thermal_conductivity_l = 2.43E-2_wp  !< therm. cond. air         (J m-1 s-1 K-1)
+    REAL(wp) ::  w_precipitation = 9.65_wp       !< maximum terminal velocity         (m s-1)
+    REAL(wp) ::  x0 = 2.6E-10_wp                 !< separating drop mass              (kg)
+    REAL(wp) ::  ximin = 4.42E-14_wp             !< minimum mass of ice crystal       (kg) (D~10Âµm)
+    REAL(wp) ::  xcmin = 4.18E-15_wp             !< minimum cloud drop size           (kg) (~ 1Âµm)
+    REAL(wp) ::  xrmin = 2.6E-10_wp              !< minimum rain drop size            (kg)
+    REAL(wp) ::  xrmax = 5.0E-6_wp               !< maximum rain drop site            (kg)
+
 
     SAVE
@@ -305,44 +304,44 @@
     PRIVATE
 
-    PUBLIC bcm_parin, &
-           bcm_check_parameters, &
-           bcm_check_data_output, &
-           bcm_check_data_output_pr, &
-           bcm_init_arrays, &
-           bcm_init, &
-           bcm_header, &
-           bcm_actions, &
-           bcm_non_advective_processes, &
-           bcm_exchange_horiz, &
-           bcm_prognostic_equations, &
-           bcm_boundary_conditions, &
-           bcm_3d_data_averaging, &
-           bcm_data_output_2d, &
-           bcm_data_output_3d, &
-           bcm_swap_timelevel, &
-           bcm_rrd_global, &
-           bcm_rrd_local, &
-           bcm_wrd_global, &
-           bcm_wrd_local, &
+    PUBLIC bcm_parin,                                                                              &
+           bcm_check_parameters,                                                                   &
+           bcm_check_data_output,                                                                  &
+           bcm_check_data_output_pr,                                                               &
+           bcm_init_arrays,                                                                        &
+           bcm_init,                                                                               &
+           bcm_header,                                                                             &
+           bcm_actions,                                                                            &
+           bcm_non_advective_processes,                                                            &
+           bcm_exchange_horiz,                                                                     &
+           bcm_prognostic_equations,                                                               &
+           bcm_boundary_conditions,                                                                &
+           bcm_3d_data_averaging,                                                                  &
+           bcm_data_output_2d,                                                                     &
+           bcm_data_output_3d,                                                                     &
+           bcm_swap_timelevel,                                                                     &
+           bcm_rrd_global,                                                                         &
+           bcm_rrd_local,                                                                          &
+           bcm_wrd_global,                                                                         &
+           bcm_wrd_local,                                                                          &
            calc_liquid_water_content
 
-    PUBLIC call_microphysics_at_all_substeps, &
-           cloud_water_sedimentation, &
-           bulk_cloud_model, &
-           cloud_scheme, &
-           collision_turbulence, &
-           dt_precipitation, &
-           microphysics_morrison, &
-           microphysics_morrison_no_rain, &
-           microphysics_sat_adjust, &
-           microphysics_seifert, &
-           microphysics_ice_phase, &
-           na_init, &
-           nc_const, &
-           precipitation, &
-           sigma_gc, &
-           start_ice_microphysics, &
-           ice_crystal_sedimentation, &
-           in_init
+    PUBLIC bulk_cloud_model,                                                                       &
+           call_microphysics_at_all_substeps,                                                      &
+           cloud_water_sedimentation,                                                              &
+           cloud_scheme,                                                                           &
+           collision_turbulence,                                                                   &
+           dt_precipitation,                                                                       &
+           ice_crystal_sedimentation,                                                              &
+           in_init,                                                                                &
+           microphysics_morrison,                                                                  &
+           microphysics_morrison_no_rain,                                                          &
+           microphysics_sat_adjust,                                                                &
+           microphysics_seifert,                                                                   &
+           microphysics_ice_phase,                                                                 &
+           na_init,                                                                                &
+           nc_const,                                                                               &
+           precipitation,                                                                          &
+           sigma_gc,                                                                               &
+           start_ice_microphysics
 
     INTERFACE bcm_parin
@@ -438,9 +437,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Parin for &bulk_cloud_parameters for the bulk cloud module
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_parin
 
@@ -448,25 +447,26 @@
        IMPLICIT NONE
 
-       CHARACTER (LEN=80)  ::  line  !< dummy string that contains the current line of the parameter file
-
-       NAMELIST /bulk_cloud_parameters/  &
-          aerosol_bulk, &
-          c_sedimentation, &
-          call_microphysics_at_all_substeps, &
-          bulk_cloud_model, &
-          cloud_scheme, &
-          cloud_water_sedimentation, &
-          collision_turbulence, &
-          curvature_solution_effects_bulk, &
-          dry_aerosol_radius, &
-          limiter_sedimentation, &
-          na_init, &
-          nc_const, &
-          sigma_bulk, &
-          ventilation_effect, &
-          ice_crystal_sedimentation, &
-          microphysics_ice_phase, &
-          start_ice_microphysics, &
-          in_init
+       CHARACTER (LEN=80)  ::  line  !< dummy string that contains the current line of the parameter
+                                     !< file
+
+       NAMELIST /bulk_cloud_parameters/                                                            &
+          aerosol_bulk,                                                                            &
+          bulk_cloud_model,                                                                        &
+          c_sedimentation,                                                                         &
+          call_microphysics_at_all_substeps,                                                       &
+          cloud_scheme,                                                                            &
+          cloud_water_sedimentation,                                                               &
+          collision_turbulence,                                                                    &
+          curvature_solution_effects_bulk,                                                         &
+          dry_aerosol_radius,                                                                      &
+          ice_crystal_sedimentation,                                                               &
+          in_init,                                                                                 &
+          limiter_sedimentation,                                                                   &
+          microphysics_ice_phase,                                                                  &
+          na_init,                                                                                 &
+          nc_const,                                                                                &
+          sigma_bulk,                                                                              &
+          start_ice_microphysics,                                                                  &
+          ventilation_effect
 
        line = ' '
@@ -492,9 +492,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Check parameters routine for bulk cloud module
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_check_parameters
 
@@ -503,7 +503,6 @@
 !
 !--    Check cloud scheme
-!--    This scheme considers only saturation adjustment,
-!--    i.e. water vapor surplus is converted into liquid
-!--    water. No other microphysical processes are considered
+!--    This scheme considers only saturation adjustment, i.e. water vapor surplus is converted into
+!--    liquid water. No other microphysical processes are considered.
        IF ( cloud_scheme == 'saturation_adjust' )  THEN
           microphysics_sat_adjust = .TRUE.
@@ -513,11 +512,9 @@
           microphysics_morrison_no_rain = .FALSE.
 !
-!--    This scheme includes all process of the seifert 
-!--    beheng scheme (2001,2006). Especially rain processes are 
-!--    considered with prognostic quantities of qr and nr. 
-!--    Cloud droplet concentration is assumed to be constant and 
-!--    qc is diagnostic.
-!--    Technical remark: The switch 'microphysics_seifert' allocates
-!--    fields of qr and nr and enables all rain processes.
+!--    This scheme includes all process of the seifert beheng scheme (2001,2006). Especially rain
+!--    processes are considered with prognostic quantities of qr and nr.
+!--    Cloud droplet concentration is assumed to be constant and qc is diagnostic.
+!--    Technical remark: The switch 'microphysics_seifert' allocates fields of qr and nr and enables
+!--    all rain processes.
        ELSEIF ( cloud_scheme == 'seifert_beheng' )  THEN
           microphysics_sat_adjust = .FALSE.
@@ -528,7 +525,6 @@
           microphysics_morrison_no_rain = .FALSE.
 !
-!--    The kessler scheme is a simplified scheme without any
-!--    prognostic quantities for microphyical variables but 
-!--    considering autoconversion.
+!--    The kessler scheme is a simplified scheme without any prognostic quantities for microphyical
+!--    variables but considering autoconversion.
        ELSEIF ( cloud_scheme == 'kessler' )  THEN
           microphysics_sat_adjust = .FALSE.
@@ -539,13 +535,11 @@
           microphysics_morrison_no_rain = .FALSE.
 !
-!--    The morrison scheme is an extension of the seifer beheng scheme
-!--    including also relevant processes for cloud droplet size particles
-!--    such as activation and an diagnostic mehtod for diffusional growth.
-!--    I.e. here all processes of Seifert and Beheng as well as of the 
-!--    morrision scheme are used. Therefore, ztis includes prognostic 
-!--    quantities for qc and nc.
-!--    Technical remark: The switch 'microphysics_morrison' allocates
-!--    fields of qc and nc and enables diagnostic diffusional growth and 
-!--    activation.
+!--    The morrison scheme is an extension of the seifer beheng scheme including also relevant
+!--    processes for cloud droplet size particles such as activation and an diagnostic mehtod for
+!--    diffusional growth.
+!--    I.e. here all processes of Seifert and Beheng as well as of the morrision scheme are used.
+!--    Therefore, ztis includes prognostic quantities for qc and nc.
+!--    Technical remark: The switch 'microphysics_morrison' allocates fields of qc and nc and
+!--    enables diagnostic diffusional growth and activation.
        ELSEIF ( cloud_scheme == 'morrison' )  THEN
           microphysics_sat_adjust = .FALSE.
@@ -554,10 +548,9 @@
           microphysics_morrison   = .TRUE.
           precipitation           = .TRUE.
-          microphysics_morrison_no_rain = .FALSE.    
-!          
-!--    The 'morrision_no_rain' scheme includes only processes of morrision scheme
-!--    without the rain processes of seifert beheng. Therfore, the prog. quantities
-!--    of qr and nr remain unallocated. This might be appropiate for cloud in which 
-!--    the size distribution is narrow, e.g. fog. 
+          microphysics_morrison_no_rain = .FALSE.
+!
+!--    The 'morrision_no_rain' scheme includes only processes of morrision scheme without the rain
+!--    processes of seifert beheng. Therfore, the prog. quantities of qr and nr remain unallocated.
+!--    This might be appropiate for cloud in which the size distribution is narrow, e.g. fog.
        ELSEIF ( cloud_scheme == 'morrison_no_rain' )  THEN
           microphysics_sat_adjust = .FALSE.
@@ -568,5 +561,5 @@
           precipitation           = .FALSE.
        ELSE
-          message_string = 'unknown cloud microphysics scheme cloud_scheme ="' // &
+          message_string = 'unknown cloud microphysics scheme cloud_scheme ="' //                  &
                            TRIM( cloud_scheme ) // '"'
           CALL message( 'check_parameters', 'PA0357', 1, 2, 0, 6, 0 )
@@ -582,7 +575,7 @@
           ELSE
              IF ( precipitation_amount_interval > dt_do2d_xy )  THEN
-                WRITE( message_string, * )  'precipitation_amount_interval = ',   &
-                    precipitation_amount_interval, ' must not be larger than ',   &
-                    'dt_do2d_xy = ', dt_do2d_xy
+                WRITE( message_string, * )  'precipitation_amount_interval = ',                    &
+                   precipitation_amount_interval, ' must not be larger than ',                     &
+                   'dt_do2d_xy = ', dt_do2d_xy
                 CALL message( 'check_parameters', 'PA0090', 1, 2, 0, 6, 0 )
              ENDIF
@@ -590,5 +583,5 @@
        ENDIF
 
-       ! TODO: find better sollution for circular dependency problem
+       ! TODO: find better solution for circular dependency problem
        surf_bulk_cloud_model = bulk_cloud_model
        surf_microphysics_morrison = microphysics_morrison
@@ -617,9 +610,9 @@
     END SUBROUTINE bcm_check_parameters
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Check data output for bulk cloud module
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_check_data_output( var, unit )
 
@@ -633,6 +626,5 @@
           CASE ( 'nc' )
              IF ( .NOT.  microphysics_morrison )  THEN
-                message_string = 'output of "' // TRIM( var ) // '" ' //       &
-                                 'requires ' //                                &
+                message_string = 'output of "' // TRIM( var ) // '" ' // 'requires ' //            &
                                  'cloud_scheme = "morrison"'
                 CALL message( 'check_parameters', 'PA0359', 1, 2, 0, 6, 0 )
@@ -642,6 +634,5 @@
           CASE ( 'ni' )
              IF ( .NOT.  microphysics_ice_phase )  THEN
-                message_string = 'output of "' // TRIM( var ) // '" ' //       &
-                                 'requires ' //                                &
+                message_string = 'output of "' // TRIM( var ) // '" ' // 'requires ' //            &
                                  'microphysics_ice_phase = ".TRUE."'
                 CALL message( 'check_parameters', 'PA0359', 1, 2, 0, 6, 0 )
@@ -651,6 +642,5 @@
           CASE ( 'nr' )
              IF ( .NOT.  microphysics_seifert )  THEN
-                message_string = 'output of "' // TRIM( var ) // '" ' //       &
-                                 'requires ' //                                &
+                message_string = 'output of "' // TRIM( var ) // '" ' // 'requires ' //            &
                                  'cloud_scheme = "seifert_beheng"'
                 CALL message( 'check_parameters', 'PA0359', 1, 2, 0, 6, 0 )
@@ -660,6 +650,5 @@
           CASE ( 'prr' )
              IF ( microphysics_sat_adjust )  THEN
-                message_string = 'output of "' // TRIM( var ) // '" ' //       &
-                                 'is not available for ' //                    &
+                message_string = 'output of "' // TRIM( var ) // '" ' // 'is not available for ' //&
                                  'cloud_scheme = "saturation_adjust"'
                 CALL message( 'check_parameters', 'PA0423', 1, 2, 0, 6, 0 )
@@ -672,6 +661,5 @@
           CASE ( 'qi' )
              IF ( .NOT.  microphysics_ice_phase ) THEN
-                message_string = 'output of "' // TRIM( var ) // '" ' //       &
-                                 'requires ' //                                &
+                message_string = 'output of "' // TRIM( var ) // '" ' // 'requires ' //            &
                                  'microphysics_ice_phase = ".TRUE."'
                 CALL message( 'check_parameters', 'PA0359', 1, 2, 0, 6, 0 )
@@ -681,6 +669,5 @@
           CASE ( 'qr' )
              IF ( .NOT.  microphysics_seifert ) THEN
-                message_string = 'output of "' // TRIM( var ) // '" ' //       &
-                                 'requires ' //                                &
+                message_string = 'output of "' // TRIM( var ) // '" ' // 'requires ' //            &
                                  'cloud_scheme = "seifert_beheng"'
                 CALL message( 'check_parameters', 'PA0359', 1, 2, 0, 6, 0 )
@@ -689,25 +676,21 @@
 
           CASE ( 'pra*' )
-             IF ( .NOT. microphysics_kessler  .AND.                            &
-                  .NOT. microphysics_seifert )  THEN
-                message_string = 'output of "' // TRIM( var ) // '" ' //       &
-                                 'requires ' //                                &
+             IF ( .NOT. microphysics_kessler  .AND.  .NOT. microphysics_seifert )  THEN
+                message_string = 'output of "' // TRIM( var ) // '" ' // 'requires ' //            &
                                  'cloud_scheme = "kessler" or "seifert_beheng"'
                 CALL message( 'check_parameters', 'PA0112', 1, 2, 0, 6, 0 )
              ENDIF
 ! TODO: find sollution (maybe connected to flow_statistics redesign?)
-!              IF ( j == 1 )  THEN
-!                 message_string = 'temporal averaging of precipitation ' //     &
-!                           'amount "' // TRIM( var ) // '" is not possible'
-!                 CALL message( 'check_parameters', 'PA0113', 1, 2, 0, 6, 0 )
-!              ENDIF
+!             IF ( j == 1 )  THEN
+!                message_string = 'temporal averaging of precipitation ' //                        &
+!                                 'amount "' // TRIM( var ) // '" is not possible'
+!                CALL message( 'check_parameters', 'PA0113', 1, 2, 0, 6, 0 )
+!             ENDIF
              unit = 'mm'
 
           CASE ( 'prr*' )
-             IF ( .NOT. microphysics_kessler  .AND.                            &
-                  .NOT. microphysics_seifert )  THEN
-                message_string = 'output of "' // TRIM( var ) // '"' //        &
-                         ' requires' //                                        &
-                         ' cloud_scheme = "kessler" or "seifert_beheng"'
+             IF ( .NOT. microphysics_kessler  .AND.  .NOT. microphysics_seifert )  THEN
+                message_string = 'output of "' // TRIM( var ) // '"' // ' requires' //             &
+                                 ' cloud_scheme = "kessler" or "seifert_beheng"'
                 CALL message( 'check_parameters', 'PA0112', 1, 2, 0, 6, 0 )
              ENDIF
@@ -723,21 +706,21 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Check data output of profiles for bulk cloud module
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_check_data_output_pr( variable, var_count, unit, dopr_unit )
 
-       USE arrays_3d,                                                          &
+       USE arrays_3d,                                                                              &
            ONLY: zu
 
-       USE control_parameters,                                                 &
+       USE control_parameters,                                                                     &
            ONLY: data_output_pr
 
-       USE profil_parameter,                                                   &
+       USE profil_parameter,                                                                       &
            ONLY: dopr_index
 
-       USE statistics,                                                         &
+       USE statistics,                                                                             &
            ONLY: hom, statistic_regions
 
@@ -757,8 +740,6 @@
           CASE ( 'nc' )
              IF ( .NOT.  microphysics_morrison )  THEN
-                message_string = 'data_output_pr = ' //                        &
-                                 TRIM( data_output_pr(var_count) ) //          &
-                                 ' is not implemented for' //                  &
-                                 ' cloud_scheme /= morrison'
+                message_string = 'data_output_pr = ' // TRIM( data_output_pr(var_count) ) //       &
+                                 ' is not implemented for' // ' cloud_scheme /= morrison'
                 CALL message( 'check_parameters', 'PA0358', 1, 2, 0, 6, 0 )
              ENDIF
@@ -771,8 +752,6 @@
           CASE ( 'ni' )
              IF ( .NOT.  microphysics_ice_phase )  THEN
-                message_string = 'data_output_pr = ' //                        &
-                                 TRIM( data_output_pr(var_count) ) //          &
-                                 ' is not implemented for' //                  &
-                                 ' microphysics_ice_phase = ".F."'
+                message_string = 'data_output_pr = ' // TRIM( data_output_pr(var_count) ) //       &
+                                 ' is not implemented for' // ' microphysics_ice_phase = ".F."'
                 CALL message( 'check_parameters', 'PA0358', 1, 2, 0, 6, 0 )
              ENDIF
@@ -785,8 +764,6 @@
           CASE ( 'nr' )
              IF ( .NOT.  microphysics_seifert )  THEN
-                message_string = 'data_output_pr = ' //                        &
-                                 TRIM( data_output_pr(var_count) ) //          &
-                                 ' is not implemented for' //                  &
-                                 ' cloud_scheme /= seifert_beheng'
+                message_string = 'data_output_pr = ' // TRIM( data_output_pr(var_count) ) //       &
+                                 ' is not implemented for' // ' cloud_scheme /= seifert_beheng'
                 CALL message( 'check_parameters', 'PA0358', 1, 2, 0, 6, 0 )
              ENDIF
@@ -799,10 +776,8 @@
           CASE ( 'prr' )
              IF ( microphysics_sat_adjust )  THEN
-                message_string = 'data_output_pr = ' //                        &
-                                 TRIM( data_output_pr(var_count) ) //          &
-                                 ' is not available for' //                    &
-                                 ' cloud_scheme = saturation_adjust'
+                message_string = 'data_output_pr = ' // TRIM( data_output_pr(var_count) ) //       &
+                                 ' is not available for' // ' cloud_scheme = saturation_adjust'
                 CALL message( 'check_parameters', 'PA0422', 1, 2, 0, 6, 0 )
-             ENDIF 
+             ENDIF
              pr_index = 76
              dopr_index(var_count) = pr_index
@@ -820,8 +795,6 @@
           CASE ( 'qi' )
              IF ( .NOT.  microphysics_ice_phase )  THEN
-                message_string = 'data_output_pr = ' //                        &
-                                 TRIM( data_output_pr(var_count) ) //          &
-                                 ' is not implemented for' //                  &
-                                 ' microphysics_ice_phase = ".F."'
+                message_string = 'data_output_pr = ' //  TRIM( data_output_pr(var_count) ) //      &
+                                 ' is not implemented for' // ' microphysics_ice_phase = ".F."'
                 CALL message( 'check_parameters', 'PA0358', 1, 2, 0, 6, 0 )
              ENDIF
@@ -834,8 +807,6 @@
           CASE ( 'qr' )
              IF ( .NOT.  microphysics_seifert )  THEN
-                message_string = 'data_output_pr = ' //                        &
-                                 TRIM( data_output_pr(var_count) ) //          &
-                                 ' is not implemented for' //                  &
-                                 ' cloud_scheme /= seifert_beheng'
+                message_string = 'data_output_pr = ' // TRIM( data_output_pr(var_count) ) //       &
+                                 ' is not implemented for' // ' cloud_scheme /= seifert_beheng'
                 CALL message( 'check_parameters', 'PA0358', 1, 2, 0, 6, 0 )
              ENDIF
@@ -854,12 +825,12 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Allocate bulk cloud module arrays and define pointers
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_init_arrays
 
-       USE indices,                                                            &
+       USE indices,                                                                                &
            ONLY:  nxlg, nxrg, nysg, nyng, nzb, nzt
 
@@ -887,9 +858,9 @@
 !
 !--       3D-cloud drop water content, cloud drop concentration arrays
-          ALLOCATE( nc_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
-                    nc_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
-                    nc_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
-                    qc_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
-                    qc_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
+          ALLOCATE( nc_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
+                    nc_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
+                    nc_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
+                    qc_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
+                    qc_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
                     qc_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
        ENDIF
@@ -898,9 +869,9 @@
 !
 !--       3D-rain water content, rain drop concentration arrays
-          ALLOCATE( nr_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
-                    nr_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
-                    nr_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
-                    qr_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
-                    qr_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
+          ALLOCATE( nr_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
+                    nr_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
+                    nr_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
+                    qr_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
+                    qr_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
                     qr_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
        ENDIF
@@ -909,9 +880,9 @@
 !
 !--       3D-cloud drop water content, cloud drop concentration arrays
-          ALLOCATE( ni_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
-                    ni_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
-                    ni_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
-                    qi_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
-                    qi_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                       &
+          ALLOCATE( ni_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
+                    ni_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
+                    ni_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
+                    qi_1(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
+                    qi_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg),                                           &
                     qi_3(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
        ENDIF
@@ -940,37 +911,36 @@
 !
 !--    Arrays needed for reasons of speed optimization for cache version.
-!--    For the vector version the buffer arrays are not necessary,
-!--    because the the fluxes can swapped directly inside the loops of the
-!--    advection routines.
+!--    For the vector version the buffer arrays are not necessary, because the the fluxes can
+!--    swapped directly inside the loops of the advection routines.
        IF ( loop_optimization /= 'vector' )  THEN
           IF ( ws_scheme_sca )  THEN
              IF ( microphysics_morrison )  THEN
-                ALLOCATE( flux_s_qc(nzb+1:nzt,0:threads_per_task-1),           &
-                          diss_s_qc(nzb+1:nzt,0:threads_per_task-1),           &
-                          flux_s_nc(nzb+1:nzt,0:threads_per_task-1),           &
+                ALLOCATE( flux_s_qc(nzb+1:nzt,0:threads_per_task-1),                               &
+                          diss_s_qc(nzb+1:nzt,0:threads_per_task-1),                               &
+                          flux_s_nc(nzb+1:nzt,0:threads_per_task-1),                               &
                           diss_s_nc(nzb+1:nzt,0:threads_per_task-1) )
-                ALLOCATE( flux_l_qc(nzb+1:nzt,nys:nyn,0:threads_per_task-1),   &
-                          diss_l_qc(nzb+1:nzt,nys:nyn,0:threads_per_task-1),   &
-                          flux_l_nc(nzb+1:nzt,nys:nyn,0:threads_per_task-1),   &
+                ALLOCATE( flux_l_qc(nzb+1:nzt,nys:nyn,0:threads_per_task-1),                       &
+                          diss_l_qc(nzb+1:nzt,nys:nyn,0:threads_per_task-1),                       &
+                          flux_l_nc(nzb+1:nzt,nys:nyn,0:threads_per_task-1),                       &
                           diss_l_nc(nzb+1:nzt,nys:nyn,0:threads_per_task-1) )
              ENDIF
              IF ( microphysics_seifert )  THEN
-                ALLOCATE( flux_s_qr(nzb+1:nzt,0:threads_per_task-1),           &
-                          diss_s_qr(nzb+1:nzt,0:threads_per_task-1),           &
-                          flux_s_nr(nzb+1:nzt,0:threads_per_task-1),           &
+                ALLOCATE( flux_s_qr(nzb+1:nzt,0:threads_per_task-1),                               &
+                          diss_s_qr(nzb+1:nzt,0:threads_per_task-1),                               &
+                          flux_s_nr(nzb+1:nzt,0:threads_per_task-1),                               &
                           diss_s_nr(nzb+1:nzt,0:threads_per_task-1) )
-                ALLOCATE( flux_l_qr(nzb+1:nzt,nys:nyn,0:threads_per_task-1),   &
-                          diss_l_qr(nzb+1:nzt,nys:nyn,0:threads_per_task-1),   &
-                          flux_l_nr(nzb+1:nzt,nys:nyn,0:threads_per_task-1),   &
+                ALLOCATE( flux_l_qr(nzb+1:nzt,nys:nyn,0:threads_per_task-1),                       &
+                          diss_l_qr(nzb+1:nzt,nys:nyn,0:threads_per_task-1),                       &
+                          flux_l_nr(nzb+1:nzt,nys:nyn,0:threads_per_task-1),                       &
                           diss_l_nr(nzb+1:nzt,nys:nyn,0:threads_per_task-1) )
              ENDIF
              IF ( microphysics_ice_phase )  THEN
-                ALLOCATE( flux_s_qi(nzb+1:nzt,0:threads_per_task-1),           &
-                          diss_s_qi(nzb+1:nzt,0:threads_per_task-1),           &
-                          flux_s_ni(nzb+1:nzt,0:threads_per_task-1),           &
+                ALLOCATE( flux_s_qi(nzb+1:nzt,0:threads_per_task-1),                               &
+                          diss_s_qi(nzb+1:nzt,0:threads_per_task-1),                               &
+                          flux_s_ni(nzb+1:nzt,0:threads_per_task-1),                               &
                           diss_s_ni(nzb+1:nzt,0:threads_per_task-1) )
-                ALLOCATE( flux_l_qi(nzb+1:nzt,nys:nyn,0:threads_per_task-1),   &
-                          diss_l_qi(nzb+1:nzt,nys:nyn,0:threads_per_task-1),   &
-                          flux_l_ni(nzb+1:nzt,nys:nyn,0:threads_per_task-1),   &
+                ALLOCATE( flux_l_qi(nzb+1:nzt,nys:nyn,0:threads_per_task-1),                       &
+                          diss_l_qi(nzb+1:nzt,nys:nyn,0:threads_per_task-1),                       &
+                          flux_l_ni(nzb+1:nzt,nys:nyn,0:threads_per_task-1),                       &
                           diss_l_ni(nzb+1:nzt,nys:nyn,0:threads_per_task-1) )
              ENDIF
@@ -1002,9 +972,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Initialization of the bulk cloud module
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_init
 
@@ -1048,6 +1018,5 @@
              ENDIF
 !
-!--          Liquid water content and precipitation amount
-!--          are zero at beginning of the simulation
+!--          Liquid water content and precipitation amount are zero at beginning of the simulation.
              ql = 0.0_wp
              qc = 0.0_wp
@@ -1076,7 +1045,6 @@
           ENDIF ! Only if not read_restart_data
 !
-!--       constant for the sedimentation of cloud water (2-moment cloud physics)
-          sed_qc_const = k_st * ( 3.0_wp / ( 4.0_wp * pi * rho_l )                &
-                             )**( 2.0_wp / 3.0_wp ) *                             &
+!--       Constant for the sedimentation of cloud water (2-moment cloud physics)
+          sed_qc_const = k_st * ( 3.0_wp / ( 4.0_wp * pi * rho_l ) )**( 2.0_wp / 3.0_wp ) *        &
                          EXP( 5.0_wp * LOG( sigma_gc )**2 )
 
@@ -1084,6 +1052,5 @@
 !--       Calculate timestep according to precipitation
           IF ( microphysics_seifert )  THEN
-             dt_precipitation = c_sedimentation * MINVAL( dzu(nzb+2:nzt) ) /      &
-                                w_precipitation
+             dt_precipitation = c_sedimentation * MINVAL( dzu(nzb+2:nzt) ) / w_precipitation
           ENDIF
 
@@ -1122,9 +1089,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Header output for bulk cloud module
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_header ( io )
 
@@ -1166,7 +1133,6 @@
 
 
-1   FORMAT ( //' Bulk cloud module information:'/ &
-               ' ------------------------------------------'/ )
-2   FORMAT ( '--> Bulk scheme with liquid water potential temperature and'/ &
+1   FORMAT ( //' Bulk cloud module information:'/ ' ------------------------------------------'/ )
+2   FORMAT ( '--> Bulk scheme with liquid water potential temperature and'/                        &
              '    total water content is used.' )
 3   FORMAT ( '--> Condensation is parameterized via 0% - or 100% scheme.' )
@@ -1191,9 +1157,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Control of microphysics for all grid points
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_actions( location )
 
@@ -1230,18 +1196,21 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Control of microphysics for grid points i,j
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_actions_ij( i, j, location )
 
 
-    INTEGER(iwp),      INTENT(IN) ::  i         !< grid index in x-direction
-    INTEGER(iwp),      INTENT(IN) ::  j         !< grid index in y-direction
     CHARACTER (LEN=*), INTENT(IN) ::  location  !< call location string
-    INTEGER(iwp)  ::  dummy  !< call location string
-
-    IF ( bulk_cloud_model    )   dummy = i + j
+
+    INTEGER(iwp)  ::  dummy                !< call location string
+
+    INTEGER(iwp), INTENT(IN) ::  i         !< grid index in x-direction
+    INTEGER(iwp), INTENT(IN) ::  j         !< grid index in y-direction
+
+
+    IF ( bulk_cloud_model )   dummy = i + j
 
     SELECT CASE ( location )
@@ -1276,9 +1245,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Control of microphysics for all grid points
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_non_advective_processes
 
@@ -1286,7 +1255,6 @@
        CALL cpu_log( log_point(51), 'microphysics', 'start' )
 
-       IF ( .NOT. microphysics_sat_adjust  .AND.                               &
-            ( intermediate_timestep_count == 1  .OR.                           &
-              call_microphysics_at_all_substeps ) )                            &
+       IF ( .NOT. microphysics_sat_adjust  .AND.  ( intermediate_timestep_count == 1  .OR.         &
+            call_microphysics_at_all_substeps ) )                                                  &
        THEN
 
@@ -1294,7 +1262,6 @@
 !
 !--          Calculate vertical profile of the hydrostatic pressure (hyp)
-             hyp    = barometric_formula(zu, pt_surface *                      &
-                      exner_function(surface_pressure * 100.0_wp),             &
-                      surface_pressure * 100.0_wp)
+             hyp    = barometric_formula(zu, pt_surface *                                          &
+                      exner_function(surface_pressure * 100.0_wp), surface_pressure * 100.0_wp)
              d_exner = exner_function_invers(hyp)
              exner = 1.0_wp / exner_function_invers(hyp)
@@ -1302,7 +1269,6 @@
 !
 !--          Compute reference density
-             rho_surface = ideal_gas_law_rho(surface_pressure * 100.0_wp,      &
-                           pt_surface *                                        &
-                           exner_function(surface_pressure * 100.0_wp))
+             rho_surface = ideal_gas_law_rho(surface_pressure * 100.0_wp,                          &
+                           pt_surface * exner_function(surface_pressure * 100.0_wp))
           ENDIF
 
@@ -1320,5 +1286,5 @@
 
 !
-!--       Compute cloud physics
+!--       Compute cloud physics.
 !--       Here the the simple kessler scheme is used.
           IF ( microphysics_kessler )  THEN
@@ -1327,12 +1293,12 @@
 
 !
-!--       Here the seifert beheng scheme is used. Cloud concentration is assumed to
-!--       a constant value an qc a diagnostic value.
+!--       Here the seifert beheng scheme is used. Cloud concentration is assumed to a constant value
+!--       an qc a diagnostic value.
           ELSEIF ( microphysics_seifert  .AND.  .NOT. microphysics_morrison )  THEN
              CALL adjust_cloud
-             IF ( microphysics_ice_phase  .AND.  simulated_time > start_ice_microphysics )     &
-             CALL ice_nucleation
-             IF ( microphysics_ice_phase  .AND.  simulated_time > start_ice_microphysics )     &
-             CALL ice_deposition
+             IF ( microphysics_ice_phase  .AND.  simulated_time > start_ice_microphysics )  THEN
+                CALL ice_nucleation
+                CALL ice_deposition
+             ENDIF
              CALL autoconversion
              CALL accretion
@@ -1341,36 +1307,33 @@
              CALL sedimentation_rain
              IF ( cloud_water_sedimentation )  CALL sedimentation_cloud
-             IF ( microphysics_ice_phase  .AND.  simulated_time > start_ice_microphysics )     &
-             CALL adjust_ice
-             IF ( ice_crystal_sedimentation .AND. microphysics_ice_phase &
-                  .AND. simulated_time > start_ice_microphysics ) CALL sedimentation_ice
-
-!
-!--       Here the morrison scheme is used. No rain processes are considered and qr and nr
-!--       are not allocated
+             IF ( microphysics_ice_phase  .AND.  simulated_time > start_ice_microphysics )  THEN
+                CALL adjust_ice
+                IF ( ice_crystal_sedimentation )  CALL sedimentation_ice
+             ENDIF
+
+!
+!--       Here the morrison scheme is used. No rain processes are considered and qr and nr are not
+!--       allocated.
           ELSEIF ( microphysics_morrison_no_rain  .AND.  .NOT. microphysics_seifert )  THEN
              CALL activation
              CALL condensation
-             IF ( microphysics_ice_phase  .AND.  simulated_time > start_ice_microphysics )     &
-             CALL adjust_ice
-             IF ( microphysics_ice_phase  .AND.  simulated_time > start_ice_microphysics )     &
-             CALL ice_nucleation
-             IF ( microphysics_ice_phase  .AND.  simulated_time > start_ice_microphysics )     &
-             CALL ice_deposition
+             IF ( microphysics_ice_phase  .AND.  simulated_time > start_ice_microphysics )  THEN
+                CALL adjust_ice
+                CALL ice_nucleation
+                CALL ice_deposition
+             ENDIF
              IF ( cloud_water_sedimentation )  CALL sedimentation_cloud
 
 !
-!--       Here the full morrison scheme is used and all processes of Seifert and Beheng are
-!--       included
+!--       Here the full morrison scheme is used and all processes of Seifert and Beheng are included
           ELSEIF ( microphysics_morrison  .AND.  microphysics_seifert )  THEN
              CALL adjust_cloud
              CALL activation
              CALL condensation
-             IF ( microphysics_ice_phase  .AND.  simulated_time > start_ice_microphysics )     &
-             CALL adjust_ice
-             IF ( microphysics_ice_phase  .AND.  simulated_time > start_ice_microphysics )     &
-             CALL ice_nucleation
-             IF ( microphysics_ice_phase  .AND.  simulated_time > start_ice_microphysics )     &
-             CALL ice_deposition
+             IF ( microphysics_ice_phase  .AND.  simulated_time > start_ice_microphysics )  THEN
+                CALL adjust_ice
+                CALL ice_nucleation
+                CALL ice_deposition
+             ENDIF
              CALL autoconversion
              CALL accretion
@@ -1391,9 +1354,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Control of microphysics for grid points i,j
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_non_advective_processes_ij( i, j )
 
@@ -1402,7 +1365,6 @@
        INTEGER(iwp) ::  j                 !<
 
-       IF ( .NOT. microphysics_sat_adjust  .AND.                               &
-            ( intermediate_timestep_count == 1  .OR.                           &
-              call_microphysics_at_all_substeps ) )                            &
+       IF ( .NOT. microphysics_sat_adjust  .AND.  ( intermediate_timestep_count == 1  .OR.         &
+            call_microphysics_at_all_substeps ) )                                                  &
        THEN
 
@@ -1410,7 +1372,6 @@
 !
 !--          Calculate vertical profile of the hydrostatic pressure (hyp)
-             hyp    = barometric_formula(zu, pt_surface *                      &
-                      exner_function(surface_pressure * 100.0_wp),             &
-                      surface_pressure * 100.0_wp)
+             hyp    = barometric_formula(zu, pt_surface *                                          &
+                      exner_function(surface_pressure * 100.0_wp), surface_pressure * 100.0_wp)
              d_exner = exner_function_invers(hyp)
              exner = 1.0_wp / exner_function_invers(hyp)
@@ -1418,7 +1379,6 @@
 !
 !--          Compute reference density
-             rho_surface = ideal_gas_law_rho(surface_pressure * 100.0_wp,      &
-                           pt_surface *                                        &
-                           exner_function(surface_pressure * 100.0_wp))
+             rho_surface = ideal_gas_law_rho(surface_pressure * 100.0_wp,                          &
+                           pt_surface * exner_function(surface_pressure * 100.0_wp))
           ENDIF
 
@@ -1442,12 +1402,12 @@
 
 !
-!--       Here the seifert beheng scheme is used. Cloud concentration is assumed to
-!--       a constant value an qc a diagnostic value.
+!--       Here the seifert beheng scheme is used. Cloud concentration is assumed to a constant value
+!--       an qc a diagnostic value.
           ELSEIF ( microphysics_seifert  .AND.  .NOT. microphysics_morrison )  THEN
              CALL adjust_cloud_ij( i,j )
-             IF ( microphysics_ice_phase .AND. simulated_time > start_ice_microphysics )       &
+             IF ( microphysics_ice_phase .AND. simulated_time > start_ice_microphysics )  THEN
                  CALL ice_nucleation_ij( i,j )
-             IF ( microphysics_ice_phase .AND. simulated_time > start_ice_microphysics )       &
                  CALL ice_deposition_ij( i,j )
+             ENDIF
              CALL autoconversion_ij( i,j )
              CALL accretion_ij( i,j )
@@ -1456,35 +1416,33 @@
              CALL sedimentation_rain_ij( i,j )
              IF ( cloud_water_sedimentation )  CALL sedimentation_cloud_ij( i,j )
-             IF ( microphysics_ice_phase .AND. simulated_time > start_ice_microphysics )       &
+             IF ( microphysics_ice_phase .AND. simulated_time > start_ice_microphysics )  THEN
                  CALL adjust_ice_ij ( i,j )
-             IF ( ice_crystal_sedimentation .AND. microphysics_ice_phase &
-                  .AND. simulated_time > start_ice_microphysics )  CALL sedimentation_ice_ij ( i,j )
-!
-!--       Here the morrison scheme is used. No rain processes are considered and qr and nr
-!--       are not allocated
+                 IF ( ice_crystal_sedimentation )  CALL sedimentation_ice_ij ( i,j )
+             ENDIF
+
+!
+!--       Here the morrison scheme is used. No rain processes are considered and qr and nr are not
+!--       allocated.
           ELSEIF ( microphysics_morrison_no_rain  .AND.  .NOT. microphysics_seifert )  THEN
              CALL activation_ij( i,j )
              CALL condensation_ij( i,j )
-             IF ( microphysics_ice_phase .AND. simulated_time > start_ice_microphysics )       &
+             IF ( microphysics_ice_phase .AND. simulated_time > start_ice_microphysics )  THEN
                  CALL adjust_ice_ij ( i,j )
-             IF ( microphysics_ice_phase .AND. simulated_time > start_ice_microphysics )       &
                  CALL ice_nucleation_ij( i,j )
-             IF ( microphysics_ice_phase .AND. simulated_time > start_ice_microphysics )       &
                  CALL ice_deposition_ij( i,j )
+             ENDIF
              IF ( cloud_water_sedimentation )  CALL sedimentation_cloud_ij( i,j )
 
 !
-!--       Here the full morrison scheme is used and all processes of Seifert and Beheng are
-!--       included
+!--       Here the full morrison scheme is used and all processes of Seifert and Beheng are included
           ELSEIF ( microphysics_morrison  .AND.  microphysics_seifert )  THEN
              CALL adjust_cloud_ij( i,j )
              CALL activation_ij( i,j )
              CALL condensation_ij( i,j )
-             IF ( microphysics_ice_phase .AND. simulated_time > start_ice_microphysics )       &
+             IF ( microphysics_ice_phase .AND. simulated_time > start_ice_microphysics )  THEN
                  CALL adjust_ice_ij ( i,j )
-             IF ( microphysics_ice_phase .AND. simulated_time > start_ice_microphysics )       &
                  CALL ice_nucleation_ij( i,j )
-             IF ( microphysics_ice_phase .AND. simulated_time > start_ice_microphysics )       &
                  CALL ice_deposition_ij( i,j )
+             ENDIF
              CALL autoconversion_ij( i,j )
              CALL accretion_ij( i,j )
@@ -1501,20 +1459,19 @@
 
     END SUBROUTINE bcm_non_advective_processes_ij
-    
-    
-!------------------------------------------------------------------------------!
+
+
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Control of microphysics for all grid points
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_exchange_horiz
 
-       USE exchange_horiz_mod,                                                  &
+       USE exchange_horiz_mod,                                                                     &
            ONLY:  exchange_horiz
 
 
-       IF ( .NOT. microphysics_sat_adjust  .AND.                                &
-            ( intermediate_timestep_count == 1  .OR.                            &
-              call_microphysics_at_all_substeps ) )                             &
+       IF ( .NOT. microphysics_sat_adjust  .AND.  ( intermediate_timestep_count == 1  .OR.         &
+            call_microphysics_at_all_substeps ) )                                                  &
        THEN
           IF ( microphysics_morrison )  THEN
@@ -1539,9 +1496,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Control of microphysics for all grid points
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_prognostic_equations
 
@@ -1554,6 +1511,6 @@
 
 !
-!--    If required, calculate prognostic equations for cloud water content
-!--    and cloud drop concentration
+!--    If required, calculate prognostic equations for cloud water content and cloud drop
+!--    concentration.
        IF ( microphysics_morrison )  THEN
 
@@ -1581,8 +1538,8 @@
              IF ( timestep_scheme(1:5) == 'runge' )  THEN
                 IF ( ws_scheme_sca )  THEN
-                   CALL advec_s_ws( advc_flags_s, qc, 'qc',                    &
-                                    bc_dirichlet_l  .OR.  bc_radiation_l,      &
-                                    bc_dirichlet_n  .OR.  bc_radiation_n,      &
-                                    bc_dirichlet_r  .OR.  bc_radiation_r,      &
+                   CALL advec_s_ws( advc_flags_s, qc, 'qc',                                        &
+                                    bc_dirichlet_l  .OR.  bc_radiation_l,                          &
+                                    bc_dirichlet_n  .OR.  bc_radiation_n,                          &
+                                    bc_dirichlet_r  .OR.  bc_radiation_r,                          &
                                     bc_dirichlet_s  .OR.  bc_radiation_s )
                 ELSE
@@ -1594,13 +1551,13 @@
           ENDIF
 
-          CALL diffusion_s( qc,                                                &
-                            surf_def_h(0)%qcsws, surf_def_h(1)%qcsws,          &
-                            surf_def_h(2)%qcsws,                               &
-                            surf_lsm_h%qcsws,    surf_usm_h%qcsws,             &
-                            surf_def_v(0)%qcsws, surf_def_v(1)%qcsws,          &
-                            surf_def_v(2)%qcsws, surf_def_v(3)%qcsws,          &
-                            surf_lsm_v(0)%qcsws, surf_lsm_v(1)%qcsws,          &
-                            surf_lsm_v(2)%qcsws, surf_lsm_v(3)%qcsws,          &
-                            surf_usm_v(0)%qcsws, surf_usm_v(1)%qcsws,          &
+          CALL diffusion_s( qc,                                                                    &
+                            surf_def_h(0)%qcsws, surf_def_h(1)%qcsws,                              &
+                            surf_def_h(2)%qcsws,                                                   &
+                            surf_lsm_h%qcsws,    surf_usm_h%qcsws,                                 &
+                            surf_def_v(0)%qcsws, surf_def_v(1)%qcsws,                              &
+                            surf_def_v(2)%qcsws, surf_def_v(3)%qcsws,                              &
+                            surf_lsm_v(0)%qcsws, surf_lsm_v(1)%qcsws,                              &
+                            surf_lsm_v(2)%qcsws, surf_lsm_v(3)%qcsws,                              &
+                            surf_usm_v(0)%qcsws, surf_usm_v(1)%qcsws,                              &
                             surf_usm_v(2)%qcsws, surf_usm_v(3)%qcsws )
 
@@ -1612,12 +1569,11 @@
                 !DIR$ IVDEP
                 DO  k = nzb+1, nzt
-                   qc_p(k,j,i) = qc(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +   &
-                                                      tsc(3) * tqc_m(k,j,i) )  &
-                                                    - tsc(5) * rdf_sc(k) *     &
-                                                               qc(k,j,i)       &
-                                             )                                 &
-                                    * MERGE( 1.0_wp, 0.0_wp,                   &
-                                             BTEST( wall_flags_total_0(k,j,i), 0 )   &
-                                          )
+                   qc_p(k,j,i) = qc(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +                       &
+                                                      tsc(3) * tqc_m(k,j,i) )                      &
+                                                    - tsc(5) * rdf_sc(k) *                         &
+                                                               qc(k,j,i)                           &
+                                             )                                                     &
+                                  * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 )   &
+                                         )
                    IF ( qc_p(k,j,i) < 0.0_wp )  qc_p(k,j,i) = 0.0_wp
                 ENDDO
@@ -1641,6 +1597,5 @@
                    DO  j = nys, nyn
                       DO  k = nzb+1, nzt
-                         tqc_m(k,j,i) =   -9.5625_wp * tend(k,j,i)             &
-                                         + 5.3125_wp * tqc_m(k,j,i)
+                         tqc_m(k,j,i) =   -9.5625_wp * tend(k,j,i) + 5.3125_wp * tqc_m(k,j,i)
                       ENDDO
                    ENDDO
@@ -1673,8 +1628,8 @@
              IF ( timestep_scheme(1:5) == 'runge' )  THEN
                 IF ( ws_scheme_sca )  THEN
-                   CALL advec_s_ws( advc_flags_s, nc, 'nc',                    &
-                                    bc_dirichlet_l  .OR.  bc_radiation_l,      &
-                                    bc_dirichlet_n  .OR.  bc_radiation_n,      &
-                                    bc_dirichlet_r  .OR.  bc_radiation_r,      &
+                   CALL advec_s_ws( advc_flags_s, nc, 'nc',                                        &
+                                    bc_dirichlet_l  .OR.  bc_radiation_l,                          &
+                                    bc_dirichlet_n  .OR.  bc_radiation_n,                          &
+                                    bc_dirichlet_r  .OR.  bc_radiation_r,                          &
                                     bc_dirichlet_s  .OR.  bc_radiation_s )
                 ELSE
@@ -1686,13 +1641,13 @@
           ENDIF
 
-          CALL diffusion_s( nc,                                                &
-                            surf_def_h(0)%ncsws, surf_def_h(1)%ncsws,          &
-                            surf_def_h(2)%ncsws,                               &
-                            surf_lsm_h%ncsws,    surf_usm_h%ncsws,             &
-                            surf_def_v(0)%ncsws, surf_def_v(1)%ncsws,          &
-                            surf_def_v(2)%ncsws, surf_def_v(3)%ncsws,          &
-                            surf_lsm_v(0)%ncsws, surf_lsm_v(1)%ncsws,          &
-                            surf_lsm_v(2)%ncsws, surf_lsm_v(3)%ncsws,          &
-                            surf_usm_v(0)%ncsws, surf_usm_v(1)%ncsws,          &
+          CALL diffusion_s( nc,                                                                    &
+                            surf_def_h(0)%ncsws, surf_def_h(1)%ncsws,                              &
+                            surf_def_h(2)%ncsws,                                                   &
+                            surf_lsm_h%ncsws,    surf_usm_h%ncsws,                                 &
+                            surf_def_v(0)%ncsws, surf_def_v(1)%ncsws,                              &
+                            surf_def_v(2)%ncsws, surf_def_v(3)%ncsws,                              &
+                            surf_lsm_v(0)%ncsws, surf_lsm_v(1)%ncsws,                              &
+                            surf_lsm_v(2)%ncsws, surf_lsm_v(3)%ncsws,                              &
+                            surf_usm_v(0)%ncsws, surf_usm_v(1)%ncsws,                              &
                             surf_usm_v(2)%ncsws, surf_usm_v(3)%ncsws )
 
@@ -1704,11 +1659,10 @@
                 !DIR$ IVDEP
                 DO  k = nzb+1, nzt
-                   nc_p(k,j,i) = nc(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +   &
-                                                      tsc(3) * tnc_m(k,j,i) )  &
-                                                    - tsc(5) * rdf_sc(k) *     &
-                                                               nc(k,j,i)       &
-                                             )                                 &
-                                   * MERGE( 1.0_wp, 0.0_wp,                    &
-                                             BTEST( wall_flags_total_0(k,j,i), 0 )   &
+                   nc_p(k,j,i) = nc(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +                       &
+                                                      tsc(3) * tnc_m(k,j,i) )                      &
+                                                    - tsc(5) * rdf_sc(k) *                         &
+                                                               nc(k,j,i)                           &
+                                             )                                                     &
+                                   * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 )  &
                                           )
                    IF ( nc_p(k,j,i) < 0.0_wp )  nc_p(k,j,i) = 0.0_wp
@@ -1733,6 +1687,5 @@
                    DO  j = nys, nyn
                       DO  k = nzb+1, nzt
-                         tnc_m(k,j,i) =  -9.5625_wp * tend(k,j,i)             &
-                                         + 5.3125_wp * tnc_m(k,j,i)
+                         tnc_m(k,j,i) =  -9.5625_wp * tend(k,j,i) + 5.3125_wp * tnc_m(k,j,i)
                       ENDDO
                    ENDDO
@@ -1746,6 +1699,6 @@
 
 !
-!--    If required, calculate prognostic equations for ice crystal content
-!--    and ice crystal concentration
+!--    If required, calculate prognostic equations for ice crystal content and ice crystal
+!--    concentration
        IF ( microphysics_ice_phase )  THEN
 
@@ -1773,8 +1726,8 @@
              IF ( timestep_scheme(1:5) == 'runge' )  THEN
                 IF ( ws_scheme_sca )  THEN
-                   CALL advec_s_ws( advc_flags_s, qi, 'qi',                    &
-                                    bc_dirichlet_l  .OR.  bc_radiation_l,      &
-                                    bc_dirichlet_n  .OR.  bc_radiation_n,      &
-                                    bc_dirichlet_r  .OR.  bc_radiation_r,      &
+                   CALL advec_s_ws( advc_flags_s, qi, 'qi',                                        &
+                                    bc_dirichlet_l  .OR.  bc_radiation_l,                          &
+                                    bc_dirichlet_n  .OR.  bc_radiation_n,                          &
+                                    bc_dirichlet_r  .OR.  bc_radiation_r,                          &
                                     bc_dirichlet_s  .OR.  bc_radiation_s )
                 ELSE
@@ -1786,13 +1739,13 @@
           ENDIF
 
-          CALL diffusion_s( qi,                                                &
-                            surf_def_h(0)%qisws, surf_def_h(1)%qisws,          &
-                            surf_def_h(2)%qisws,                               &
-                            surf_lsm_h%qisws,    surf_usm_h%qisws,             &
-                            surf_def_v(0)%qisws, surf_def_v(1)%qisws,          &
-                            surf_def_v(2)%qisws, surf_def_v(3)%qisws,          &
-                            surf_lsm_v(0)%qisws, surf_lsm_v(1)%qisws,          &
-                            surf_lsm_v(2)%qisws, surf_lsm_v(3)%qisws,          &
-                            surf_usm_v(0)%qisws, surf_usm_v(1)%qisws,          &
+          CALL diffusion_s( qi,                                                                    &
+                            surf_def_h(0)%qisws, surf_def_h(1)%qisws,                              &
+                            surf_def_h(2)%qisws,                                                   &
+                            surf_lsm_h%qisws,    surf_usm_h%qisws,                                 &
+                            surf_def_v(0)%qisws, surf_def_v(1)%qisws,                              &
+                            surf_def_v(2)%qisws, surf_def_v(3)%qisws,                              &
+                            surf_lsm_v(0)%qisws, surf_lsm_v(1)%qisws,                              &
+                            surf_lsm_v(2)%qisws, surf_lsm_v(3)%qisws,                              &
+                            surf_usm_v(0)%qisws, surf_usm_v(1)%qisws,                              &
                             surf_usm_v(2)%qisws, surf_usm_v(3)%qisws )
 
@@ -1804,11 +1757,10 @@
                 !DIR$ IVDEP
                 DO  k = nzb+1, nzt
-                   qi_p(k,j,i) = qi(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +   &
-                                                      tsc(3) * tqi_m(k,j,i) )  &
-                                                    - tsc(5) * rdf_sc(k) *     &
-                                                               qi(k,j,i)       &
-                                             )                                 &
-                                    * MERGE( 1.0_wp, 0.0_wp,                   &
-                                             BTEST( wall_flags_total_0(k,j,i), 0 )   &
+                   qi_p(k,j,i) = qi(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +                       &
+                                                      tsc(3) * tqi_m(k,j,i) )                      &
+                                                    - tsc(5) * rdf_sc(k) *                         &
+                                                               qi(k,j,i)                           &
+                                             )                                                     &
+                                    * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) &
                                           )
                    IF ( qi_p(k,j,i) < 0.0_wp )  qi_p(k,j,i) = 0.0_wp
@@ -1833,6 +1785,5 @@
                    DO  j = nys, nyn
                       DO  k = nzb+1, nzt
-                         tqi_m(k,j,i) =   -9.5625_wp * tend(k,j,i)             &
-                                         + 5.3125_wp * tqi_m(k,j,i)
+                         tqi_m(k,j,i) =   -9.5625_wp * tend(k,j,i) + 5.3125_wp * tqi_m(k,j,i)
                       ENDDO
                    ENDDO
@@ -1865,8 +1816,8 @@
              IF ( timestep_scheme(1:5) == 'runge' )  THEN
                 IF ( ws_scheme_sca )  THEN
-                   CALL advec_s_ws( advc_flags_s, ni, 'ni',                    &
-                                    bc_dirichlet_l  .OR.  bc_radiation_l,      &
-                                    bc_dirichlet_n  .OR.  bc_radiation_n,      &
-                                    bc_dirichlet_r  .OR.  bc_radiation_r,      &
+                   CALL advec_s_ws( advc_flags_s, ni, 'ni',                                        &
+                                    bc_dirichlet_l  .OR.  bc_radiation_l,                          &
+                                    bc_dirichlet_n  .OR.  bc_radiation_n,                          &
+                                    bc_dirichlet_r  .OR.  bc_radiation_r,                          &
                                     bc_dirichlet_s  .OR.  bc_radiation_s )
                 ELSE
@@ -1878,13 +1829,13 @@
           ENDIF
 
-          CALL diffusion_s( ni,                                                &
-                            surf_def_h(0)%nisws, surf_def_h(1)%nisws,          &
-                            surf_def_h(2)%nisws,                               &
-                            surf_lsm_h%nisws,    surf_usm_h%nisws,             &
-                            surf_def_v(0)%nisws, surf_def_v(1)%nisws,          &
-                            surf_def_v(2)%nisws, surf_def_v(3)%nisws,          &
-                            surf_lsm_v(0)%nisws, surf_lsm_v(1)%nisws,          &
-                            surf_lsm_v(2)%nisws, surf_lsm_v(3)%nisws,          &
-                            surf_usm_v(0)%nisws, surf_usm_v(1)%nisws,          &
+          CALL diffusion_s( ni,                                                                    &
+                            surf_def_h(0)%nisws, surf_def_h(1)%nisws,                              &
+                            surf_def_h(2)%nisws,                                                   &
+                            surf_lsm_h%nisws,    surf_usm_h%nisws,                                 &
+                            surf_def_v(0)%nisws, surf_def_v(1)%nisws,                              &
+                            surf_def_v(2)%nisws, surf_def_v(3)%nisws,                              &
+                            surf_lsm_v(0)%nisws, surf_lsm_v(1)%nisws,                              &
+                            surf_lsm_v(2)%nisws, surf_lsm_v(3)%nisws,                              &
+                            surf_usm_v(0)%nisws, surf_usm_v(1)%nisws,                              &
                             surf_usm_v(2)%nisws, surf_usm_v(3)%nisws )
 
@@ -1896,11 +1847,10 @@
                 !DIR$ IVDEP
                 DO  k = nzb+1, nzt
-                   ni_p(k,j,i) = ni(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +   &
-                                                      tsc(3) * tni_m(k,j,i) )  &
-                                                    - tsc(5) * rdf_sc(k) *     &
-                                                               ni(k,j,i)       &
-                                             )                                 &
-                                   * MERGE( 1.0_wp, 0.0_wp,                    &
-                                             BTEST( wall_flags_total_0(k,j,i), 0 )   &
+                   ni_p(k,j,i) = ni(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +                       &
+                                                      tsc(3) * tni_m(k,j,i) )                      &
+                                                    - tsc(5) * rdf_sc(k) *                         &
+                                                               ni(k,j,i)                           &
+                                             )                                                     &
+                                   * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 )  &
                                           )
                    IF ( ni_p(k,j,i) < 0.0_wp )  ni_p(k,j,i) = 0.0_wp
@@ -1925,6 +1875,5 @@
                    DO  j = nys, nyn
                       DO  k = nzb+1, nzt
-                         tni_m(k,j,i) =  -9.5625_wp * tend(k,j,i)             &
-                                         + 5.3125_wp * tni_m(k,j,i)
+                         tni_m(k,j,i) =  -9.5625_wp * tend(k,j,i) + 5.3125_wp * tni_m(k,j,i)
                       ENDDO
                    ENDDO
@@ -1938,6 +1887,6 @@
 
 !
-!--    If required, calculate prognostic equations for rain water content
-!--    and rain drop concentration
+!--    If required, calculate prognostic equations for rain water content and rain drop
+!--    concentration.
        IF ( microphysics_seifert )  THEN
 
@@ -1965,8 +1914,8 @@
              IF ( timestep_scheme(1:5) == 'runge' )  THEN
                 IF ( ws_scheme_sca )  THEN
-                   CALL advec_s_ws( advc_flags_s, qr, 'qr',                    &
-                                    bc_dirichlet_l  .OR.  bc_radiation_l,      &
-                                    bc_dirichlet_n  .OR.  bc_radiation_n,      &
-                                    bc_dirichlet_r  .OR.  bc_radiation_r,      &
+                   CALL advec_s_ws( advc_flags_s, qr, 'qr',                                        &
+                                    bc_dirichlet_l  .OR.  bc_radiation_l,                          &
+                                    bc_dirichlet_n  .OR.  bc_radiation_n,                          &
+                                    bc_dirichlet_r  .OR.  bc_radiation_r,                          &
                                     bc_dirichlet_s  .OR.  bc_radiation_s )
                 ELSE
@@ -1978,13 +1927,13 @@
           ENDIF
 
-          CALL diffusion_s( qr,                                                &
-                            surf_def_h(0)%qrsws, surf_def_h(1)%qrsws,          &
-                            surf_def_h(2)%qrsws,                               &
-                            surf_lsm_h%qrsws,    surf_usm_h%qrsws,             &
-                            surf_def_v(0)%qrsws, surf_def_v(1)%qrsws,          &
-                            surf_def_v(2)%qrsws, surf_def_v(3)%qrsws,          &
-                            surf_lsm_v(0)%qrsws, surf_lsm_v(1)%qrsws,          &
-                            surf_lsm_v(2)%qrsws, surf_lsm_v(3)%qrsws,          &
-                            surf_usm_v(0)%qrsws, surf_usm_v(1)%qrsws,          &
+          CALL diffusion_s( qr,                                                                    &
+                            surf_def_h(0)%qrsws, surf_def_h(1)%qrsws,                              &
+                            surf_def_h(2)%qrsws,                                                   &
+                            surf_lsm_h%qrsws,    surf_usm_h%qrsws,                                 &
+                            surf_def_v(0)%qrsws, surf_def_v(1)%qrsws,                              &
+                            surf_def_v(2)%qrsws, surf_def_v(3)%qrsws,                              &
+                            surf_lsm_v(0)%qrsws, surf_lsm_v(1)%qrsws,                              &
+                            surf_lsm_v(2)%qrsws, surf_lsm_v(3)%qrsws,                              &
+                            surf_usm_v(0)%qrsws, surf_usm_v(1)%qrsws,                              &
                             surf_usm_v(2)%qrsws, surf_usm_v(3)%qrsws )
 
@@ -1996,11 +1945,10 @@
                 !DIR$ IVDEP
                 DO  k = nzb+1, nzt
-                   qr_p(k,j,i) = qr(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +   &
-                                                      tsc(3) * tqr_m(k,j,i) )  &
-                                                    - tsc(5) * rdf_sc(k) *     &
-                                                               qr(k,j,i)       &
-                                             )                                 &
-                                    * MERGE( 1.0_wp, 0.0_wp,                   &
-                                             BTEST( wall_flags_total_0(k,j,i), 0 )   &
+                   qr_p(k,j,i) = qr(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +                       &
+                                                      tsc(3) * tqr_m(k,j,i) )                      &
+                                                    - tsc(5) * rdf_sc(k) *                         &
+                                                               qr(k,j,i)                           &
+                                             )                                                     &
+                                    * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) &
                                           )
                    IF ( qr_p(k,j,i) < 0.0_wp )  qr_p(k,j,i) = 0.0_wp
@@ -2025,6 +1973,5 @@
                    DO  j = nys, nyn
                       DO  k = nzb+1, nzt
-                         tqr_m(k,j,i) =   -9.5625_wp * tend(k,j,i)             &
-                                         + 5.3125_wp * tqr_m(k,j,i)
+                         tqr_m(k,j,i) =   -9.5625_wp * tend(k,j,i) + 5.3125_wp * tqr_m(k,j,i)
                       ENDDO
                    ENDDO
@@ -2057,8 +2004,8 @@
              IF ( timestep_scheme(1:5) == 'runge' )  THEN
                 IF ( ws_scheme_sca )  THEN
-                   CALL advec_s_ws( advc_flags_s, nr, 'nr',                    &
-                                    bc_dirichlet_l  .OR.  bc_radiation_l,      &
-                                    bc_dirichlet_n  .OR.  bc_radiation_n,      &
-                                    bc_dirichlet_r  .OR.  bc_radiation_r,      &
+                   CALL advec_s_ws( advc_flags_s, nr, 'nr',                                        &
+                                    bc_dirichlet_l  .OR.  bc_radiation_l,                          &
+                                    bc_dirichlet_n  .OR.  bc_radiation_n,                          &
+                                    bc_dirichlet_r  .OR.  bc_radiation_r,                          &
                                     bc_dirichlet_s  .OR.  bc_radiation_s )
                 ELSE
@@ -2070,13 +2017,13 @@
           ENDIF
 
-          CALL diffusion_s( nr,                                                &
-                            surf_def_h(0)%nrsws, surf_def_h(1)%nrsws,          &
-                            surf_def_h(2)%nrsws,                               &
-                            surf_lsm_h%nrsws,    surf_usm_h%nrsws,             &
-                            surf_def_v(0)%nrsws, surf_def_v(1)%nrsws,          &
-                            surf_def_v(2)%nrsws, surf_def_v(3)%nrsws,          &
-                            surf_lsm_v(0)%nrsws, surf_lsm_v(1)%nrsws,          &
-                            surf_lsm_v(2)%nrsws, surf_lsm_v(3)%nrsws,          &
-                            surf_usm_v(0)%nrsws, surf_usm_v(1)%nrsws,          &
+          CALL diffusion_s( nr,                                                                    &
+                            surf_def_h(0)%nrsws, surf_def_h(1)%nrsws,                              &
+                            surf_def_h(2)%nrsws,                                                   &
+                            surf_lsm_h%nrsws,    surf_usm_h%nrsws,                                 &
+                            surf_def_v(0)%nrsws, surf_def_v(1)%nrsws,                              &
+                            surf_def_v(2)%nrsws, surf_def_v(3)%nrsws,                              &
+                            surf_lsm_v(0)%nrsws, surf_lsm_v(1)%nrsws,                              &
+                            surf_lsm_v(2)%nrsws, surf_lsm_v(3)%nrsws,                              &
+                            surf_usm_v(0)%nrsws, surf_usm_v(1)%nrsws,                              &
                             surf_usm_v(2)%nrsws, surf_usm_v(3)%nrsws )
 
@@ -2088,11 +2035,10 @@
                 !DIR$ IVDEP
                 DO  k = nzb+1, nzt
-                   nr_p(k,j,i) = nr(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +   &
-                                                      tsc(3) * tnr_m(k,j,i) )  &
-                                                    - tsc(5) * rdf_sc(k) *     &
-                                                               nr(k,j,i)       &
-                                             )                                 &
-                                   * MERGE( 1.0_wp, 0.0_wp,                    &
-                                             BTEST( wall_flags_total_0(k,j,i), 0 )   &
+                   nr_p(k,j,i) = nr(k,j,i) + ( dt_3d * ( sbt * tend(k,j,i) +                       &
+                                                      tsc(3) * tnr_m(k,j,i) )                      &
+                                                    - tsc(5) * rdf_sc(k) *                         &
+                                                               nr(k,j,i)                           &
+                                             )                                                     &
+                                   * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 )  &
                                           )
                    IF ( nr_p(k,j,i) < 0.0_wp )  nr_p(k,j,i) = 0.0_wp
@@ -2132,21 +2078,22 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Control of microphysics for grid points i,j
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_prognostic_equations_ij( i, j, i_omp_start, tn )
 
 
        INTEGER(iwp), INTENT(IN) ::  i            !< grid index in x-direction
+       INTEGER(iwp), INTENT(IN) ::  i_omp_start  !< first loop index of i-loop in
+                                                 !< prognostic_equations
        INTEGER(iwp), INTENT(IN) ::  j            !< grid index in y-direction
        INTEGER(iwp)             ::  k            !< grid index in z-direction
-       INTEGER(iwp), INTENT(IN) ::  i_omp_start  !< first loop index of i-loop in prognostic_equations
        INTEGER(iwp), INTENT(IN) ::  tn           !< task number of openmp task
 
 !
-!--    If required, calculate prognostic equations for cloud water content
-!--    and cloud drop concentration
+!--    If required, calculate prognostic equations for cloud water content and cloud drop
+!--    concentration.
        IF ( microphysics_morrison )  THEN
 !
@@ -2156,10 +2103,10 @@
           THEN
              IF ( ws_scheme_sca )  THEN
-                CALL advec_s_ws( advc_flags_s, i, j, qc, 'qc', flux_s_qc,      &
-                                 diss_s_qc, flux_l_qc, diss_l_qc,              &
-                                 i_omp_start, tn,                              &
-                                 bc_dirichlet_l  .OR.  bc_radiation_l,         &
-                                 bc_dirichlet_n  .OR.  bc_radiation_n,         &
-                                 bc_dirichlet_r  .OR.  bc_radiation_r,         &
+                CALL advec_s_ws( advc_flags_s, i, j, qc, 'qc', flux_s_qc,                          &
+                                 diss_s_qc, flux_l_qc, diss_l_qc,                                  &
+                                 i_omp_start, tn,                                                  &
+                                 bc_dirichlet_l  .OR.  bc_radiation_l,                             &
+                                 bc_dirichlet_n  .OR.  bc_radiation_n,                             &
+                                 bc_dirichlet_r  .OR.  bc_radiation_r,                             &
                                  bc_dirichlet_s  .OR.  bc_radiation_s )
              ELSE
@@ -2169,13 +2116,13 @@
              CALL advec_s_up( i, j, qc )
           ENDIF
-          CALL diffusion_s( i, j, qc,                                   &
-                            surf_def_h(0)%qcsws, surf_def_h(1)%qcsws,   &
-                            surf_def_h(2)%qcsws,                        &
-                            surf_lsm_h%qcsws,    surf_usm_h%qcsws,      &
-                            surf_def_v(0)%qcsws, surf_def_v(1)%qcsws,   &
-                            surf_def_v(2)%qcsws, surf_def_v(3)%qcsws,   &
-                            surf_lsm_v(0)%qcsws, surf_lsm_v(1)%qcsws,   &
-                            surf_lsm_v(2)%qcsws, surf_lsm_v(3)%qcsws,   &
-                            surf_usm_v(0)%qcsws, surf_usm_v(1)%qcsws,   &
+          CALL diffusion_s( i, j, qc,                                                              &
+                            surf_def_h(0)%qcsws, surf_def_h(1)%qcsws,                              &
+                            surf_def_h(2)%qcsws,                                                   &
+                            surf_lsm_h%qcsws,    surf_usm_h%qcsws,                                 &
+                            surf_def_v(0)%qcsws, surf_def_v(1)%qcsws,                              &
+                            surf_def_v(2)%qcsws, surf_def_v(3)%qcsws,                              &
+                            surf_lsm_v(0)%qcsws, surf_lsm_v(1)%qcsws,                              &
+                            surf_lsm_v(2)%qcsws, surf_lsm_v(3)%qcsws,                              &
+                            surf_usm_v(0)%qcsws, surf_usm_v(1)%qcsws,                              &
                             surf_usm_v(2)%qcsws, surf_usm_v(3)%qcsws )
 
@@ -2183,12 +2130,11 @@
 !--       Prognostic equation for cloud water content
           DO  k = nzb+1, nzt
-             qc_p(k,j,i) = qc(k,j,i) + ( dt_3d *                         &
-                                                ( tsc(2) * tend(k,j,i) + &
-                                                  tsc(3) * tqc_m(k,j,i) )&
-                                                - tsc(5) * rdf_sc(k)     &
-                                                         * qc(k,j,i)     &
-                                       )                                 &
-                                 * MERGE( 1.0_wp, 0.0_wp,                &
-                                          BTEST( wall_flags_total_0(k,j,i), 0 )&
+             qc_p(k,j,i) = qc(k,j,i) + ( dt_3d *                                                   &
+                                                ( tsc(2) * tend(k,j,i) +                           &
+                                                  tsc(3) * tqc_m(k,j,i) )                          &
+                                                - tsc(5) * rdf_sc(k)                               &
+                                                         * qc(k,j,i)                               &
+                                       )                                                           &
+                                 * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 )    &
                                         )
              IF ( qc_p(k,j,i) < 0.0_wp )  qc_p(k,j,i) = 0.0_wp
@@ -2204,6 +2150,5 @@
                       intermediate_timestep_count_max )  THEN
                 DO  k = nzb+1, nzt
-                   tqc_m(k,j,i) =   -9.5625_wp * tend(k,j,i) +           &
-                                     5.3125_wp * tqc_m(k,j,i)
+                   tqc_m(k,j,i) =   -9.5625_wp * tend(k,j,i) + 5.3125_wp * tqc_m(k,j,i)
                 ENDDO
              ENDIF
@@ -2215,10 +2160,10 @@
           IF ( timestep_scheme(1:5) == 'runge' )  THEN
              IF ( ws_scheme_sca )  THEN
-                CALL advec_s_ws( advc_flags_s, i, j, nc, 'nc', flux_s_nc,      &
-                                 diss_s_nc, flux_l_nc, diss_l_nc,              &
-                                 i_omp_start, tn,                              &
-                                 bc_dirichlet_l  .OR.  bc_radiation_l,         &
-                                 bc_dirichlet_n  .OR.  bc_radiation_n,         &
-                                 bc_dirichlet_r  .OR.  bc_radiation_r,         &
+                CALL advec_s_ws( advc_flags_s, i, j, nc, 'nc', flux_s_nc,                          &
+                                 diss_s_nc, flux_l_nc, diss_l_nc,                                  &
+                                 i_omp_start, tn,                                                  &
+                                 bc_dirichlet_l  .OR.  bc_radiation_l,                             &
+                                 bc_dirichlet_n  .OR.  bc_radiation_n,                             &
+                                 bc_dirichlet_r  .OR.  bc_radiation_r,                             &
                                  bc_dirichlet_s  .OR.  bc_radiation_s )
              ELSE
@@ -2228,13 +2173,13 @@
              CALL advec_s_up( i, j, nc )
           ENDIF
-          CALL diffusion_s( i, j, nc,                                    &
-                            surf_def_h(0)%ncsws, surf_def_h(1)%ncsws,    &
-                            surf_def_h(2)%ncsws,                         &
-                            surf_lsm_h%ncsws,    surf_usm_h%ncsws,       &
-                            surf_def_v(0)%ncsws, surf_def_v(1)%ncsws,    &
-                            surf_def_v(2)%ncsws, surf_def_v(3)%ncsws,    &
-                            surf_lsm_v(0)%ncsws, surf_lsm_v(1)%ncsws,    &
-                            surf_lsm_v(2)%ncsws, surf_lsm_v(3)%ncsws,    &
-                            surf_usm_v(0)%ncsws, surf_usm_v(1)%ncsws,    &
+          CALL diffusion_s( i, j, nc,                                                              &
+                            surf_def_h(0)%ncsws, surf_def_h(1)%ncsws,                              &
+                            surf_def_h(2)%ncsws,                                                   &
+                            surf_lsm_h%ncsws,    surf_usm_h%ncsws,                                 &
+                            surf_def_v(0)%ncsws, surf_def_v(1)%ncsws,                              &
+                            surf_def_v(2)%ncsws, surf_def_v(3)%ncsws,                              &
+                            surf_lsm_v(0)%ncsws, surf_lsm_v(1)%ncsws,                              &
+                            surf_lsm_v(2)%ncsws, surf_lsm_v(3)%ncsws,                              &
+                            surf_usm_v(0)%ncsws, surf_usm_v(1)%ncsws,                              &
                             surf_usm_v(2)%ncsws, surf_usm_v(3)%ncsws )
 
@@ -2242,12 +2187,11 @@
 !--       Prognostic equation for cloud drop concentration
           DO  k = nzb+1, nzt
-             nc_p(k,j,i) = nc(k,j,i) + ( dt_3d *                         &
-                                                ( tsc(2) * tend(k,j,i) + &
-                                                  tsc(3) * tnc_m(k,j,i) )&
-                                                - tsc(5) * rdf_sc(k)     &
-                                                         * nc(k,j,i)     &
-                                       )                                 &
-                                 * MERGE( 1.0_wp, 0.0_wp,                &
-                                          BTEST( wall_flags_total_0(k,j,i), 0 )&
+             nc_p(k,j,i) = nc(k,j,i) + ( dt_3d *                                                   &
+                                                ( tsc(2) * tend(k,j,i) +                           &
+                                                  tsc(3) * tnc_m(k,j,i) )                          &
+                                                - tsc(5) * rdf_sc(k)                               &
+                                                         * nc(k,j,i)                               &
+                                       )                                                           &
+                                 * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 )    &
                                         )
              IF ( nc_p(k,j,i) < 0.0_wp )  nc_p(k,j,i) = 0.0_wp
@@ -2263,6 +2207,5 @@
                       intermediate_timestep_count_max )  THEN
                 DO  k = nzb+1, nzt
-                   tnc_m(k,j,i) =   -9.5625_wp * tend(k,j,i) +           &
-                                     5.3125_wp * tnc_m(k,j,i)
+                   tnc_m(k,j,i) =   -9.5625_wp * tend(k,j,i) + 5.3125_wp * tnc_m(k,j,i)
                 ENDDO
              ENDIF
@@ -2272,6 +2215,6 @@
 
 !
-!--    If required, calculate prognostic equations for ice crystal mixing ratio
-!--    and ice crystal concentration
+!--    If required, calculate prognostic equations for ice crystal mixing ratio and ice crystal
+!--    concentration.
        IF ( microphysics_ice_phase )  THEN
 !
@@ -2281,10 +2224,10 @@
           THEN
              IF ( ws_scheme_sca )  THEN
-                CALL advec_s_ws( advc_flags_s, i, j, qi, 'qi', flux_s_qi,      &
-                                 diss_s_qi, flux_l_qi, diss_l_qi,              &
-                                 i_omp_start, tn,                              &
-                                 bc_dirichlet_l  .OR.  bc_radiation_l,         &
-                                 bc_dirichlet_n  .OR.  bc_radiation_n,         &
-                                 bc_dirichlet_r  .OR.  bc_radiation_r,         &
+                CALL advec_s_ws( advc_flags_s, i, j, qi, 'qi', flux_s_qi,                          &
+                                 diss_s_qi, flux_l_qi, diss_l_qi,                                  &
+                                 i_omp_start, tn,                                                  &
+                                 bc_dirichlet_l  .OR.  bc_radiation_l,                             &
+                                 bc_dirichlet_n  .OR.  bc_radiation_n,                             &
+                                 bc_dirichlet_r  .OR.  bc_radiation_r,                             &
                                  bc_dirichlet_s  .OR.  bc_radiation_s )
              ELSE
@@ -2294,13 +2237,13 @@
              CALL advec_s_up( i, j, qi )
           ENDIF
-          CALL diffusion_s( i, j, qi,                                   &
-                            surf_def_h(0)%qisws, surf_def_h(1)%qisws,   &
-                            surf_def_h(2)%qisws,                        &
-                            surf_lsm_h%qisws,    surf_usm_h%qisws,      &
-                            surf_def_v(0)%qisws, surf_def_v(1)%qisws,   &
-                            surf_def_v(2)%qisws, surf_def_v(3)%qisws,   &
-                            surf_lsm_v(0)%qisws, surf_lsm_v(1)%qisws,   &
-                            surf_lsm_v(2)%qisws, surf_lsm_v(3)%qisws,   &
-                            surf_usm_v(0)%qisws, surf_usm_v(1)%qisws,   &
+          CALL diffusion_s( i, j, qi,                                                              &
+                            surf_def_h(0)%qisws, surf_def_h(1)%qisws,                              &
+                            surf_def_h(2)%qisws,                                                   &
+                            surf_lsm_h%qisws,    surf_usm_h%qisws,                                 &
+                            surf_def_v(0)%qisws, surf_def_v(1)%qisws,                              &
+                            surf_def_v(2)%qisws, surf_def_v(3)%qisws,                              &
+                            surf_lsm_v(0)%qisws, surf_lsm_v(1)%qisws,                              &
+                            surf_lsm_v(2)%qisws, surf_lsm_v(3)%qisws,                              &
+                            surf_usm_v(0)%qisws, surf_usm_v(1)%qisws,                              &
                             surf_usm_v(2)%qisws, surf_usm_v(3)%qisws )
 
@@ -2308,12 +2251,11 @@
 !--       Prognostic equation for ice crystal mixing ratio
           DO  k = nzb+1, nzt
-             qi_p(k,j,i) = qi(k,j,i) + ( dt_3d *                         &
-                                                ( tsc(2) * tend(k,j,i) + &
-                                                  tsc(3) * tqi_m(k,j,i) )&
-                                                - tsc(5) * rdf_sc(k)     &
-                                                         * qi(k,j,i)     &
-                                       )                                 &
-                                 * MERGE( 1.0_wp, 0.0_wp,                &
-                                          BTEST( wall_flags_total_0(k,j,i), 0 )&
+             qi_p(k,j,i) = qi(k,j,i) + ( dt_3d *                                                   &
+                                                ( tsc(2) * tend(k,j,i) +                           &
+                                                  tsc(3) * tqi_m(k,j,i) )                          &
+                                                - tsc(5) * rdf_sc(k)                               &
+                                                         * qi(k,j,i)                               &
+                                       )                                                           &
+                                 * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 )    &
                                         )
              IF ( qi_p(k,j,i) < 0.0_wp )  qi_p(k,j,i) = 0.0_wp
@@ -2329,6 +2271,5 @@
                       intermediate_timestep_count_max )  THEN
                 DO  k = nzb+1, nzt
-                   tqi_m(k,j,i) =   -9.5625_wp * tend(k,j,i) +           &
-                                     5.3125_wp * tqi_m(k,j,i)
+                   tqi_m(k,j,i) =   -9.5625_wp * tend(k,j,i) + 5.3125_wp * tqi_m(k,j,i)
                 ENDDO
              ENDIF
@@ -2340,10 +2281,10 @@
           IF ( timestep_scheme(1:5) == 'runge' )  THEN
              IF ( ws_scheme_sca )  THEN
-                CALL advec_s_ws( advc_flags_s, i, j, ni, 'ni', flux_s_ni,      &
-                                 diss_s_ni, flux_l_ni, diss_l_ni,              &
-                                 i_omp_start, tn,                              &
-                                 bc_dirichlet_l  .OR.  bc_radiation_l,         &
-                                 bc_dirichlet_n  .OR.  bc_radiation_n,         &
-                                 bc_dirichlet_r  .OR.  bc_radiation_r,         &
+                CALL advec_s_ws( advc_flags_s, i, j, ni, 'ni', flux_s_ni,                          &
+                                 diss_s_ni, flux_l_ni, diss_l_ni,                                  &
+                                 i_omp_start, tn,                                                  &
+                                 bc_dirichlet_l  .OR.  bc_radiation_l,                             &
+                                 bc_dirichlet_n  .OR.  bc_radiation_n,                             &
+                                 bc_dirichlet_r  .OR.  bc_radiation_r,                             &
                                  bc_dirichlet_s  .OR.  bc_radiation_s )
              ELSE
@@ -2353,13 +2294,13 @@
              CALL advec_s_up( i, j, ni )
           ENDIF
-          CALL diffusion_s( i, j, ni,                                    &
-                            surf_def_h(0)%nisws, surf_def_h(1)%nisws,    &
-                            surf_def_h(2)%nisws,                         &
-                            surf_lsm_h%nisws,    surf_usm_h%nisws,       &
-                            surf_def_v(0)%nisws, surf_def_v(1)%nisws,    &
-                            surf_def_v(2)%nisws, surf_def_v(3)%nisws,    &
-                            surf_lsm_v(0)%nisws, surf_lsm_v(1)%nisws,    &
-                            surf_lsm_v(2)%nisws, surf_lsm_v(3)%nisws,    &
-                            surf_usm_v(0)%nisws, surf_usm_v(1)%nisws,    &
+          CALL diffusion_s( i, j, ni,                                                              &
+                            surf_def_h(0)%nisws, surf_def_h(1)%nisws,                              &
+                            surf_def_h(2)%nisws,                                                   &
+                            surf_lsm_h%nisws,    surf_usm_h%nisws,                                 &
+                            surf_def_v(0)%nisws, surf_def_v(1)%nisws,                              &
+                            surf_def_v(2)%nisws, surf_def_v(3)%nisws,                              &
+                            surf_lsm_v(0)%nisws, surf_lsm_v(1)%nisws,                              &
+                            surf_lsm_v(2)%nisws, surf_lsm_v(3)%nisws,                              &
+                            surf_usm_v(0)%nisws, surf_usm_v(1)%nisws,                              &
                             surf_usm_v(2)%nisws, surf_usm_v(3)%nisws )
 
@@ -2367,12 +2308,11 @@
 !--       Prognostic equation for ice crystal concentration
           DO  k = nzb+1, nzt
-             ni_p(k,j,i) = ni(k,j,i) + ( dt_3d *                         &
-                                                ( tsc(2) * tend(k,j,i) + &
-                                                  tsc(3) * tni_m(k,j,i) )&
-                                                - tsc(5) * rdf_sc(k)     &
-                                                         * ni(k,j,i)     &
-                                       )                                 &
-                                 * MERGE( 1.0_wp, 0.0_wp,                &
-                                          BTEST( wall_flags_total_0(k,j,i), 0 )&
+             ni_p(k,j,i) = ni(k,j,i) + ( dt_3d *                                                   &
+                                                ( tsc(2) * tend(k,j,i) +                           &
+                                                  tsc(3) * tni_m(k,j,i) )                          &
+                                                - tsc(5) * rdf_sc(k)                               &
+                                                         * ni(k,j,i)                               &
+                                       )                                                           &
+                                 * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 )    &
                                         )
              IF ( ni_p(k,j,i) < 0.0_wp )  ni_p(k,j,i) = 0.0_wp
@@ -2388,6 +2328,5 @@
                       intermediate_timestep_count_max )  THEN
                 DO  k = nzb+1, nzt
-                   tni_m(k,j,i) =   -9.5625_wp * tend(k,j,i) +           &
-                                     5.3125_wp * tni_m(k,j,i)
+                   tni_m(k,j,i) =   -9.5625_wp * tend(k,j,i) + 5.3125_wp * tni_m(k,j,i)
                 ENDDO
              ENDIF
@@ -2397,19 +2336,19 @@
 
 !
-!--    If required, calculate prognostic equations for rain water content
-!--    and rain drop concentration
+!--    If required, calculate prognostic equations for rain water content and rain drop
+!--    concentration
        IF ( microphysics_seifert )  THEN
 !
-!--             Calculate prognostic equation for rain water content
+!--       Calculate prognostic equation for rain water content
           tend(:,j,i) = 0.0_wp
           IF ( timestep_scheme(1:5) == 'runge' ) &
           THEN
              IF ( ws_scheme_sca )  THEN
-                CALL advec_s_ws( advc_flags_s, i, j, qr, 'qr', flux_s_qr,      &
-                                 diss_s_qr, flux_l_qr, diss_l_qr,              &
-                                 i_omp_start, tn,                              &
-                                 bc_dirichlet_l  .OR.  bc_radiation_l,         &
-                                 bc_dirichlet_n  .OR.  bc_radiation_n,         &
-                                 bc_dirichlet_r  .OR.  bc_radiation_r,         &
+                CALL advec_s_ws( advc_flags_s, i, j, qr, 'qr', flux_s_qr,                          &
+                                 diss_s_qr, flux_l_qr, diss_l_qr,                                  &
+                                 i_omp_start, tn,                                                  &
+                                 bc_dirichlet_l  .OR.  bc_radiation_l,                             &
+                                 bc_dirichlet_n  .OR.  bc_radiation_n,                             &
+                                 bc_dirichlet_r  .OR.  bc_radiation_r,                             &
                                  bc_dirichlet_s  .OR.  bc_radiation_s )
              ELSE
@@ -2419,13 +2358,13 @@
              CALL advec_s_up( i, j, qr )
           ENDIF
-          CALL diffusion_s( i, j, qr,                                   &
-                            surf_def_h(0)%qrsws, surf_def_h(1)%qrsws,   &
-                            surf_def_h(2)%qrsws,                        &
-                            surf_lsm_h%qrsws,    surf_usm_h%qrsws,      &
-                            surf_def_v(0)%qrsws, surf_def_v(1)%qrsws,   &
-                            surf_def_v(2)%qrsws, surf_def_v(3)%qrsws,   &
-                            surf_lsm_v(0)%qrsws, surf_lsm_v(1)%qrsws,   &
-                            surf_lsm_v(2)%qrsws, surf_lsm_v(3)%qrsws,   &
-                            surf_usm_v(0)%qrsws, surf_usm_v(1)%qrsws,   &
+          CALL diffusion_s( i, j, qr,                                                              &
+                            surf_def_h(0)%qrsws, surf_def_h(1)%qrsws,                              &
+                            surf_def_h(2)%qrsws,                                                   &
+                            surf_lsm_h%qrsws,    surf_usm_h%qrsws,                                 &
+                            surf_def_v(0)%qrsws, surf_def_v(1)%qrsws,                              &
+                            surf_def_v(2)%qrsws, surf_def_v(3)%qrsws,                              &
+                            surf_lsm_v(0)%qrsws, surf_lsm_v(1)%qrsws,                              &
+                            surf_lsm_v(2)%qrsws, surf_lsm_v(3)%qrsws,                              &
+                            surf_usm_v(0)%qrsws, surf_usm_v(1)%qrsws,                              &
                             surf_usm_v(2)%qrsws, surf_usm_v(3)%qrsws )
 
@@ -2433,12 +2372,11 @@
 !--       Prognostic equation for rain water content
           DO  k = nzb+1, nzt
-             qr_p(k,j,i) = qr(k,j,i) + ( dt_3d *                         &
-                                                ( tsc(2) * tend(k,j,i) + &
-                                                  tsc(3) * tqr_m(k,j,i) )&
-                                                - tsc(5) * rdf_sc(k)     &
-                                                         * qr(k,j,i)     &
-                                       )                                 &
-                                 * MERGE( 1.0_wp, 0.0_wp,                &
-                                          BTEST( wall_flags_total_0(k,j,i), 0 )&
+             qr_p(k,j,i) = qr(k,j,i) + ( dt_3d *                                                   &
+                                                ( tsc(2) * tend(k,j,i) +                           &
+                                                  tsc(3) * tqr_m(k,j,i) )                          &
+                                                - tsc(5) * rdf_sc(k)                               &
+                                                         * qr(k,j,i)                               &
+                                       )                                                           &
+                                 * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 )    &
                                         )
              IF ( qr_p(k,j,i) < 0.0_wp )  qr_p(k,j,i) = 0.0_wp
@@ -2454,6 +2392,5 @@
                       intermediate_timestep_count_max )  THEN
                 DO  k = nzb+1, nzt
-                   tqr_m(k,j,i) =   -9.5625_wp * tend(k,j,i) +           &
-                                     5.3125_wp * tqr_m(k,j,i)
+                   tqr_m(k,j,i) =   -9.5625_wp * tend(k,j,i) + 5.3125_wp * tqr_m(k,j,i)
                 ENDDO
              ENDIF
@@ -2465,10 +2402,10 @@
           IF ( timestep_scheme(1:5) == 'runge' )  THEN
              IF ( ws_scheme_sca )  THEN
-                CALL advec_s_ws( advc_flags_s, i, j, nr, 'nr', flux_s_nr,      &
-                                 diss_s_nr, flux_l_nr, diss_l_nr,              &
-                                 i_omp_start, tn,                              &
-                                 bc_dirichlet_l  .OR.  bc_radiation_l,         &
-                                 bc_dirichlet_n  .OR.  bc_radiation_n,         &
-                                 bc_dirichlet_r  .OR.  bc_radiation_r,         &
+                CALL advec_s_ws( advc_flags_s, i, j, nr, 'nr', flux_s_nr,                          &
+                                 diss_s_nr, flux_l_nr, diss_l_nr,                                  &
+                                 i_omp_start, tn,                                                  &
+                                 bc_dirichlet_l  .OR.  bc_radiation_l,                             &
+                                 bc_dirichlet_n  .OR.  bc_radiation_n,                             &
+                                 bc_dirichlet_r  .OR.  bc_radiation_r,                             &
                                  bc_dirichlet_s  .OR.  bc_radiation_s )
              ELSE
@@ -2478,13 +2415,13 @@
              CALL advec_s_up( i, j, nr )
           ENDIF
-          CALL diffusion_s( i, j, nr,                                    &
-                            surf_def_h(0)%nrsws, surf_def_h(1)%nrsws,    &
-                            surf_def_h(2)%nrsws,                         &
-                            surf_lsm_h%nrsws,    surf_usm_h%nrsws,       &
-                            surf_def_v(0)%nrsws, surf_def_v(1)%nrsws,    &
-                            surf_def_v(2)%nrsws, surf_def_v(3)%nrsws,    &
-                            surf_lsm_v(0)%nrsws, surf_lsm_v(1)%nrsws,    &
-                            surf_lsm_v(2)%nrsws, surf_lsm_v(3)%nrsws,    &
-                            surf_usm_v(0)%nrsws, surf_usm_v(1)%nrsws,    &
+          CALL diffusion_s( i, j, nr,                                                              &
+                            surf_def_h(0)%nrsws, surf_def_h(1)%nrsws,                              &
+                            surf_def_h(2)%nrsws,                                                   &
+                            surf_lsm_h%nrsws,    surf_usm_h%nrsws,                                 &
+                            surf_def_v(0)%nrsws, surf_def_v(1)%nrsws,                              &
+                            surf_def_v(2)%nrsws, surf_def_v(3)%nrsws,                              &
+                            surf_lsm_v(0)%nrsws, surf_lsm_v(1)%nrsws,                              &
+                            surf_lsm_v(2)%nrsws, surf_lsm_v(3)%nrsws,                              &
+                            surf_usm_v(0)%nrsws, surf_usm_v(1)%nrsws,                              &
                             surf_usm_v(2)%nrsws, surf_usm_v(3)%nrsws )
 
@@ -2492,12 +2429,11 @@
 !--       Prognostic equation for rain drop concentration
           DO  k = nzb+1, nzt
-             nr_p(k,j,i) = nr(k,j,i) + ( dt_3d *                         &
-                                                ( tsc(2) * tend(k,j,i) + &
-                                                  tsc(3) * tnr_m(k,j,i) )&
-                                                - tsc(5) * rdf_sc(k)     &
-                                                         * nr(k,j,i)     &
-                                       )                                 &
-                                 * MERGE( 1.0_wp, 0.0_wp,                &
-                                          BTEST( wall_flags_total_0(k,j,i), 0 )&
+             nr_p(k,j,i) = nr(k,j,i) + ( dt_3d *                                                   &
+                                                ( tsc(2) * tend(k,j,i) +                           &
+                                                  tsc(3) * tnr_m(k,j,i) )                          &
+                                                - tsc(5) * rdf_sc(k)                               &
+                                                         * nr(k,j,i)                               &
+                                       )                                                           &
+                                 * MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 )    &
                                         )
              IF ( nr_p(k,j,i) < 0.0_wp )  nr_p(k,j,i) = 0.0_wp
@@ -2513,6 +2449,5 @@
                       intermediate_timestep_count_max )  THEN
                 DO  k = nzb+1, nzt
-                   tnr_m(k,j,i) =   -9.5625_wp * tend(k,j,i) +           &
-                                     5.3125_wp * tnr_m(k,j,i)
+                   tnr_m(k,j,i) =   -9.5625_wp * tend(k,j,i) + 5.3125_wp * tnr_m(k,j,i)
                 ENDDO
              ENDIF
@@ -2524,9 +2459,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Swapping of timelevels
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_swap_timelevel ( mod_count )
 
@@ -2577,7 +2512,7 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description: Boundary conditions of the bulk cloud module variables
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_boundary_conditions
 
@@ -2592,8 +2527,8 @@
        IF ( microphysics_morrison )  THEN
 !
-!--       Surface conditions cloud water (Dirichlet)
-!--       Run loop over all non-natural and natural walls. Note, in wall-datatype
-!--       the k coordinate belongs to the atmospheric grid point, therefore, set
-!--       qr_p and nr_p at upward (k-1) and downward-facing (k+1) walls
+!--       Surface conditions cloud water (Dirichlet).
+!--       Run loop over all non-natural and natural walls. Note, in wall-datatype the k coordinate
+!--       belongs to the atmospheric grid point, therefore, set qr_p and nr_p at upward (k-1) and
+!--       downward-facing (k+1) walls.
           DO  l = 0, 1
           !$OMP PARALLEL DO PRIVATE( i, j, k )
@@ -2615,8 +2550,8 @@
        IF ( microphysics_ice_phase )  THEN
 !
-!--       Surface conditions ice crysral (Dirichlet)
-!--       Run loop over all non-natural and natural walls. Note, in wall-datatype
-!--       the k coordinate belongs to the atmospheric grid point, therefore, set
-!--       qr_p and nr_p at upward (k-1) and downward-facing (k+1) walls
+!--       Surface conditions ice crysral (Dirichlet).
+!--       Run loop over all non-natural and natural walls. Note, in wall-datatype the k coordinate
+!--       belongs to the atmospheric grid point, therefore, set qr_p and nr_p at upward (k-1) and
+!--       downward-facing (k+1) walls
           DO  l = 0, 1
           !$OMP PARALLEL DO PRIVATE( i, j, k )
@@ -2639,8 +2574,8 @@
        IF ( microphysics_seifert )  THEN
 !
-!--       Surface conditions rain water (Dirichlet)
-!--       Run loop over all non-natural and natural walls. Note, in wall-datatype
-!--       the k coordinate belongs to the atmospheric grid point, therefore, set
-!--       qr_p and nr_p at upward (k-1) and downward-facing (k+1) walls
+!--       Surface conditions rain water (Dirichlet).
+!--       Run loop over all non-natural and natural walls. Note, in wall-datatype the k coordinate
+!--       belongs to the atmospheric grid point, therefore, set qr_p and nr_p at upward (k-1) and
+!--       downward-facing (k+1) walls
           DO  l = 0, 1
           !$OMP PARALLEL DO PRIVATE( i, j, k )
@@ -2662,6 +2597,5 @@
 !
 !--    Lateral boundary conditions for scalar quantities at the outflow.
-!--    Lateral oundary conditions for TKE and dissipation are set
-!--    in tcm_boundary_conds.
+!--    Lateral oundary conditions for TKE and dissipation are set in tcm_boundary_conds.
        IF ( bc_radiation_s )  THEN
           IF ( microphysics_morrison )  THEN
@@ -2720,13 +2654,13 @@
     END SUBROUTINE bcm_boundary_conditions
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 !
 ! Description:
 ! ------------
 !> Subroutine for averaging 3D data
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_3d_data_averaging( mode, variable )
 
-       USE control_parameters,                                                 &
+       USE control_parameters,                                                                     &
            ONLY:  average_count_3d
 
@@ -2790,5 +2724,5 @@
 
              CASE ( 'nc' )
-                IF ( ALLOCATED( nc_av ) ) THEN
+                IF ( ALLOCATED( nc_av ) )  THEN
                    DO  i = nxlg, nxrg
                       DO  j = nysg, nyng
@@ -2801,5 +2735,5 @@
 
              CASE ( 'nr' )
-                IF ( ALLOCATED( nr_av ) ) THEN
+                IF ( ALLOCATED( nr_av ) )  THEN
                    DO  i = nxlg, nxrg
                       DO  j = nysg, nyng
@@ -2812,5 +2746,5 @@
 
              CASE ( 'prr' )
-                IF ( ALLOCATED( prr_av ) ) THEN
+                IF ( ALLOCATED( prr_av ) )  THEN
                    DO  i = nxlg, nxrg
                       DO  j = nysg, nyng
@@ -2823,5 +2757,5 @@
 
              CASE ( 'qc' )
-                IF ( ALLOCATED( qc_av ) ) THEN
+                IF ( ALLOCATED( qc_av ) )  THEN
                    DO  i = nxlg, nxrg
                       DO  j = nysg, nyng
@@ -2834,5 +2768,5 @@
 
              CASE ( 'ql' )
-                IF ( ALLOCATED( ql_av ) ) THEN
+                IF ( ALLOCATED( ql_av ) )  THEN
                    DO  i = nxlg, nxrg
                       DO  j = nysg, nyng
@@ -2845,5 +2779,5 @@
 
              CASE ( 'qr' )
-                IF ( ALLOCATED( qr_av ) ) THEN
+                IF ( ALLOCATED( qr_av ) )  THEN
                    DO  i = nxlg, nxrg
                       DO  j = nysg, nyng
@@ -2865,9 +2799,9 @@
 
              CASE ( 'nc' )
-                IF ( ALLOCATED( nc_av ) ) THEN
+                IF ( ALLOCATED( nc_av ) )  THEN
                    DO  i = nxlg, nxrg
                       DO  j = nysg, nyng
                          DO  k = nzb, nzt+1
-                            nc_av(k,j,i) = nc_av(k,j,i) / REAL( average_count_3d, KIND=wp )
+                            nc_av(k,j,i) = nc_av(k,j,i) / REAL( average_count_3d, KIND = wp )
                          ENDDO
                       ENDDO
@@ -2876,9 +2810,9 @@
 
              CASE ( 'nr' )
-                IF ( ALLOCATED( nr_av ) ) THEN
+                IF ( ALLOCATED( nr_av ) )  THEN
                    DO  i = nxlg, nxrg
                       DO  j = nysg, nyng
                          DO  k = nzb, nzt+1
-                            nr_av(k,j,i) = nr_av(k,j,i) / REAL( average_count_3d, KIND=wp )
+                            nr_av(k,j,i) = nr_av(k,j,i) / REAL( average_count_3d, KIND = wp )
                          ENDDO
                       ENDDO
@@ -2887,9 +2821,9 @@
 
              CASE ( 'prr' )
-                IF ( ALLOCATED( prr_av ) ) THEN
+                IF ( ALLOCATED( prr_av ) )  THEN
                    DO  i = nxlg, nxrg
                       DO  j = nysg, nyng
                          DO  k = nzb, nzt+1
-                            prr_av(k,j,i) = prr_av(k,j,i) / REAL( average_count_3d, KIND=wp )
+                            prr_av(k,j,i) = prr_av(k,j,i) / REAL( average_count_3d, KIND = wp )
                          ENDDO
                       ENDDO
@@ -2898,9 +2832,9 @@
 
              CASE ( 'qc' )
-                IF ( ALLOCATED( qc_av ) ) THEN
+                IF ( ALLOCATED( qc_av ) )  THEN
                    DO  i = nxlg, nxrg
                       DO  j = nysg, nyng
                          DO  k = nzb, nzt+1
-                            qc_av(k,j,i) = qc_av(k,j,i) / REAL( average_count_3d, KIND=wp )
+                            qc_av(k,j,i) = qc_av(k,j,i) / REAL( average_count_3d, KIND = wp )
                          ENDDO
                       ENDDO
@@ -2909,9 +2843,9 @@
 
              CASE ( 'ql' )
-                IF ( ALLOCATED( ql_av ) ) THEN
+                IF ( ALLOCATED( ql_av ) )  THEN
                    DO  i = nxlg, nxrg
                       DO  j = nysg, nyng
                          DO  k = nzb, nzt+1
-                            ql_av(k,j,i) = ql_av(k,j,i) / REAL( average_count_3d, KIND=wp )
+                            ql_av(k,j,i) = ql_av(k,j,i) / REAL( average_count_3d, KIND = wp )
                          ENDDO
                       ENDDO
@@ -2920,9 +2854,9 @@
 
              CASE ( 'qr' )
-                IF ( ALLOCATED( qr_av ) ) THEN
+                IF ( ALLOCATED( qr_av ) )  THEN
                    DO  i = nxlg, nxrg
                       DO  j = nysg, nyng
                          DO  k = nzb, nzt+1
-                            qr_av(k,j,i) = qr_av(k,j,i) / REAL( average_count_3d, KIND=wp )
+                            qr_av(k,j,i) = qr_av(k,j,i) / REAL( average_count_3d, KIND = wp )
                          ENDDO
                       ENDDO
@@ -2940,11 +2874,10 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Define 2D output variables.
-!------------------------------------------------------------------------------!
- SUBROUTINE bcm_data_output_2d( av, variable, found, grid, mode, local_pf,     &
-                                two_d, nzb_do, nzt_do )
+!--------------------------------------------------------------------------------------------------!
+ SUBROUTINE bcm_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do )
 
 
@@ -2952,6 +2885,6 @@
 
     CHARACTER (LEN=*), INTENT(INOUT) ::  grid       !< name of vertical grid
-    CHARACTER (LEN=*), INTENT(IN) ::  mode       !< either 'xy', 'xz' or 'yz'
-    CHARACTER (LEN=*), INTENT(IN) ::  variable   !< name of variable
+    CHARACTER (LEN=*), INTENT(IN)    ::  mode       !< either 'xy', 'xz' or 'yz'
+    CHARACTER (LEN=*), INTENT(IN)    ::  variable   !< name of variable
 
     INTEGER(iwp), INTENT(IN) ::  av        !< flag for (non-)average output
@@ -2960,17 +2893,19 @@
 
     INTEGER(iwp) ::  flag_nr   !< number of masking flag
-
     INTEGER(iwp) ::  i         !< loop index along x-direction
     INTEGER(iwp) ::  j         !< loop index along y-direction
     INTEGER(iwp) ::  k         !< loop index along z-direction
 
+    LOGICAL ::  resorted  !< flag if output is already resorted
+
     LOGICAL, INTENT(INOUT) ::  found   !< flag if output variable is found
-    LOGICAL, INTENT(INOUT) ::  two_d !< flag parameter that indicates 2D variables (horizontal cross sections)
-    LOGICAL ::  resorted  !< flag if output is already resorted
+    LOGICAL, INTENT(INOUT) ::  two_d   !< flag parameter that indicates 2D variables
+                                       !<  (horizontal cross sections)
+
 
     REAL(wp), PARAMETER ::  fill_value = -999.0_wp  !< value for the _FillValue attribute
 
     REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do), INTENT(INOUT) ::  local_pf !< local
-       !< array to which output data is resorted to
+                                                        !< array to which output data is resorted to
 
     REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !< points to selected output variable
@@ -2988,5 +2923,5 @@
              to_be_resorted => nc
           ELSE
-             IF ( .NOT. ALLOCATED( nc_av ) ) THEN
+             IF ( .NOT. ALLOCATED( nc_av ) )  THEN
                 ALLOCATE( nc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 nc_av = REAL( fill_value, KIND = wp )
@@ -3000,5 +2935,5 @@
              to_be_resorted => ni
           ELSE
-             IF ( .NOT. ALLOCATED( ni_av ) ) THEN
+             IF ( .NOT. ALLOCATED( ni_av ) )  THEN
                 ALLOCATE( ni_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ni_av = REAL( fill_value, KIND = wp )
@@ -3012,5 +2947,5 @@
              to_be_resorted => nr
           ELSE
-             IF ( .NOT. ALLOCATED( nr_av ) ) THEN
+             IF ( .NOT. ALLOCATED( nr_av ) )  THEN
                 ALLOCATE( nr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 nr_av = REAL( fill_value, KIND = wp )
@@ -3043,5 +2978,5 @@
              ENDDO
           ELSE
-             IF ( .NOT. ALLOCATED( prr_av ) ) THEN
+             IF ( .NOT. ALLOCATED( prr_av ) )  THEN
                 ALLOCATE( prr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 prr_av = REAL( fill_value, KIND = wp )
@@ -3063,5 +2998,5 @@
              to_be_resorted => qc
           ELSE
-             IF ( .NOT. ALLOCATED( qc_av ) ) THEN
+             IF ( .NOT. ALLOCATED( qc_av ) )  THEN
                 ALLOCATE( qc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 qc_av = REAL( fill_value, KIND = wp )
@@ -3075,5 +3010,5 @@
              to_be_resorted => qi
           ELSE
-             IF ( .NOT. ALLOCATED( qi_av ) ) THEN
+             IF ( .NOT. ALLOCATED( qi_av ) )  THEN
                 ALLOCATE( qi_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 qi_av = REAL( fill_value, KIND = wp )
@@ -3087,5 +3022,5 @@
              to_be_resorted => ql
           ELSE
-             IF ( .NOT. ALLOCATED( ql_av ) ) THEN
+             IF ( .NOT. ALLOCATED( ql_av ) )  THEN
                 ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ql_av = REAL( fill_value, KIND = wp )
@@ -3099,5 +3034,5 @@
              to_be_resorted => qr
           ELSE
-             IF ( .NOT. ALLOCATED( qr_av ) ) THEN
+             IF ( .NOT. ALLOCATED( qr_av ) )  THEN
                 ALLOCATE( qr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 qr_av = REAL( fill_value, KIND = wp )
@@ -3117,9 +3052,9 @@
           DO  j = nys, nyn
              DO  k = nzb_do, nzt_do
-                local_pf(i,j,k) = MERGE( &
-                                     to_be_resorted(k,j,i),                    &
-                                     REAL( fill_value, KIND = wp ),            &
-                                     BTEST( wall_flags_total_0(k,j,i), flag_nr )     &
-                                  )
+                local_pf(i,j,k) = MERGE(                                                           &
+                                         to_be_resorted(k,j,i),                                    &
+                                         REAL( fill_value, KIND = wp ),                            &
+                                         BTEST( wall_flags_total_0(k,j,i), flag_nr )               &
+                                       )
              ENDDO
           ENDDO
@@ -3130,9 +3065,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Define 3D output variables.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE bcm_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
 
@@ -3142,21 +3077,22 @@
     CHARACTER (LEN=*), INTENT(IN) ::  variable   !< name of variable
 
-    INTEGER(iwp), INTENT(IN) ::  av        !< flag for (non-)average output
-    INTEGER(iwp), INTENT(IN) ::  nzb_do    !< lower limit of the data output (usually 0)
-    INTEGER(iwp), INTENT(IN) ::  nzt_do    !< vertical upper limit of the data output (usually nz_do3d)
+    INTEGER(iwp), INTENT(IN) ::  av       !< flag for (non-)average output
+    INTEGER(iwp), INTENT(IN) ::  nzb_do   !< lower limit of the data output (usually 0)
+    INTEGER(iwp), INTENT(IN) ::  nzt_do   !< vertical upper limit of the data output
+                                          !< (usually nz_do3d)
 
     INTEGER(iwp) ::  flag_nr   !< number of masking flag
-
     INTEGER(iwp) ::  i         !< loop index along x-direction
     INTEGER(iwp) ::  j         !< loop index along y-direction
     INTEGER(iwp) ::  k         !< loop index along z-direction
 
+    LOGICAL      ::  resorted  !< flag if output is already resorted
+
     LOGICAL, INTENT(INOUT) ::  found     !< flag if output variable is found
-    LOGICAL ::  resorted  !< flag if output is already resorted
 
     REAL(wp) ::  fill_value = -999.0_wp  !< value for the _FillValue attribute
 
     REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do), INTENT(INOUT) ::  local_pf   !< local
-       !< array to which output data is resorted to
+                                                        !< array to which output data is resorted to
 
     REAL(wp), DIMENSION(:,:,:), POINTER ::  to_be_resorted  !< points to selected output variable
@@ -3185,5 +3121,5 @@
              to_be_resorted => ni
           ELSE
-             IF ( .NOT. ALLOCATED( ni_av ) ) THEN
+             IF ( .NOT. ALLOCATED( ni_av ) )  THEN
                 ALLOCATE( ni_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ni_av = REAL( fill_value, KIND = wp )
@@ -3196,5 +3132,5 @@
              to_be_resorted => nr
           ELSE
-             IF ( .NOT. ALLOCATED( nr_av ) ) THEN
+             IF ( .NOT. ALLOCATED( nr_av ) )  THEN
                 ALLOCATE( nr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 nr_av = REAL( fill_value, KIND = wp )
@@ -3213,5 +3149,5 @@
              ENDDO
           ELSE
-             IF ( .NOT. ALLOCATED( prr_av ) ) THEN
+             IF ( .NOT. ALLOCATED( prr_av ) )  THEN
                 ALLOCATE( prr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 prr_av = REAL( fill_value, KIND = wp )
@@ -3231,5 +3167,5 @@
              to_be_resorted => qc
           ELSE
-             IF ( .NOT. ALLOCATED( qc_av ) ) THEN
+             IF ( .NOT. ALLOCATED( qc_av ) )  THEN
                 ALLOCATE( qc_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 qc_av = REAL( fill_value, KIND = wp )
@@ -3242,5 +3178,5 @@
              to_be_resorted => qi
           ELSE
-             IF ( .NOT. ALLOCATED( qi_av ) ) THEN
+             IF ( .NOT. ALLOCATED( qi_av ) )  THEN
                 ALLOCATE( qi_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 qi_av = REAL( fill_value, KIND = wp )
@@ -3253,5 +3189,5 @@
              to_be_resorted => ql
           ELSE
-             IF ( .NOT. ALLOCATED( ql_av ) ) THEN
+             IF ( .NOT. ALLOCATED( ql_av ) )  THEN
                 ALLOCATE( ql_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 ql_av = REAL( fill_value, KIND = wp )
@@ -3264,5 +3200,5 @@
              to_be_resorted => qr
           ELSE
-             IF ( .NOT. ALLOCATED( qr_av ) ) THEN
+             IF ( .NOT. ALLOCATED( qr_av ) )  THEN
                 ALLOCATE( qr_av(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
                 qr_av = REAL( fill_value, KIND = wp )
@@ -3281,9 +3217,9 @@
           DO  j = nys, nyn
              DO  k = nzb_do, nzt_do
-                local_pf(i,j,k) = MERGE(                                       &
-                                     to_be_resorted(k,j,i),                    &
-                                     REAL( fill_value, KIND = wp ),            &
-                                     BTEST( wall_flags_total_0(k,j,i), flag_nr )     &
-                                  )
+                local_pf(i,j,k) = MERGE(                                                           &
+                                     to_be_resorted(k,j,i),                                        &
+                                     REAL( fill_value, KIND = wp ),                                &
+                                     BTEST( wall_flags_total_0(k,j,i), flag_nr )                   &
+                                       )
              ENDDO
           ENDDO
@@ -3294,13 +3230,13 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Read module-specific global restart data (Fortran binary format).
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_rrd_global_ftn( found )
 
 
-       USE control_parameters,                                                 &
+       USE control_parameters,                                                                     &
            ONLY: length, restart_string
 
@@ -3379,9 +3315,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Read module-specific global restart data (MPI-IO).
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_rrd_global_mpi
 
@@ -3410,12 +3346,11 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Read module-specific local restart data arrays (Fortran binary format).
-!------------------------------------------------------------------------------!
-    SUBROUTINE bcm_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_2d, tmp_3d, found )
+!--------------------------------------------------------------------------------------------------!
+    SUBROUTINE bcm_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_2d, tmp_3d, found )
 
 
@@ -3446,4 +3381,5 @@
 
        REAL(wp), DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_2d   !<
+
        REAL(wp), DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp) :: tmp_3d   !<
 
@@ -3455,5 +3391,5 @@
           CASE ( 'nc' )
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             nc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =             &
+             nc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                       &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -3463,10 +3399,10 @@
              ENDIF
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             nc_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
+             nc_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                    &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
           CASE ( 'ni' )
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             ni(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =             &
+             ni(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                       &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -3476,10 +3412,10 @@
              ENDIF
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             ni_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
+             ni_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                    &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
           CASE ( 'nr' )
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             nr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =             &
+             nr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                       &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -3489,12 +3425,11 @@
              ENDIF
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             nr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
+             nr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                    &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
           CASE ( 'precipitation_amount' )
              IF ( k == 1 )  READ ( 13 )  tmp_2d
-             precipitation_amount(nysc-nbgp:nync+nbgp,                   &
-                                  nxlc-nbgp:nxrc+nbgp)  =                &
-                   tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+             precipitation_amount(nysc-nbgp:nync+nbgp, nxlc-nbgp:nxrc+nbgp) =                      &
+                tmp_2d(nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
           CASE ( 'prr' )
@@ -3503,5 +3438,5 @@
              ENDIF
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             prr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =            &
+             prr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                      &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -3511,15 +3446,15 @@
              ENDIF
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             prr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =         &
+             prr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                   &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
           CASE ( 'qc' )
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             qc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =             &
+             qc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                       &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
           CASE ( 'qi' )
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             qi(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =             &
+             qi(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                       &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -3529,5 +3464,5 @@
              ENDIF
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             qi_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
+             qi_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                    &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -3537,10 +3472,10 @@
              ENDIF
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             qc_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
+             qc_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                    &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
           CASE ( 'ql' )
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             ql(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =             &
+             ql(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                       &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -3550,10 +3485,10 @@
              ENDIF
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             ql_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
+             ql_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                    &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
           CASE ( 'qr' )
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             qr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =             &
+             qr(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                       &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 
@@ -3563,5 +3498,5 @@
              ENDIF
              IF ( k == 1 )  READ ( 13 )  tmp_3d
-             qr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =          &
+             qr_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                                    &
                 tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
 !
@@ -3576,9 +3511,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Read module-specific local restart data arrays (MPI-IO).
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_rrd_local_mpi
 
@@ -3678,9 +3613,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> This routine writes the respective restart data for the bulk cloud module.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_wrd_global
 
@@ -3745,5 +3680,5 @@
           WRITE ( 14 )  ice_crystal_sedimentation
 
-       ELSEIF ( restart_data_format_output(1:3) == 'mpi' )  THEN
+       ELSEIF ( TRIM( restart_data_format_output(1:3) ) == 'mpi' )  THEN
 
           CALL wrd_mpi_io( 'c_sedimentation', c_sedimentation )
@@ -3771,9 +3706,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> This routine writes the respective restart data for the bulk cloud module.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE bcm_wrd_local
 
@@ -3868,5 +3803,5 @@
           ENDIF
 
-       ELSEIF ( restart_data_format_output(1:3) == 'mpi' )  THEN
+       ELSEIF ( TRIM( restart_data_format_output(1:3) ) == 'mpi' )  THEN
 
           IF ( ALLOCATED( prr ) )  CALL wrd_mpi_io( 'prr', prr )
@@ -3900,11 +3835,10 @@
     END SUBROUTINE bcm_wrd_local
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Adjust number of raindrops to avoid nonlinear effects in sedimentation and
-!> evaporation of rain drops due to too small or too big weights
-!> of rain drops (Stevens and Seifert, 2008).
-!------------------------------------------------------------------------------!
+!> Adjust number of raindrops to avoid nonlinear effects in sedimentation and evaporation of rain
+!> drops due to too small or too big weights of rain drops (Stevens and Seifert, 2008).
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE adjust_cloud
 
@@ -3938,5 +3872,5 @@
                 ENDIF
 
-                IF ( microphysics_morrison ) THEN
+                IF ( microphysics_morrison )  THEN
                    IF ( qc(k,j,i) <= eps_sb )  THEN
                       qc(k,j,i) = 0.0_wp
@@ -3957,13 +3891,12 @@
     END SUBROUTINE adjust_cloud
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Adjust number of raindrops to avoid nonlinear effects in
-!> sedimentation and evaporation of rain drops due to too small or
-!> too big weights of rain drops (Stevens and Seifert, 2008).
-!> The same procedure is applied to cloud droplets if they are determined
-!> prognostically. Call for grid point i,j
-!------------------------------------------------------------------------------!
+!> Adjust number of raindrops to avoid nonlinear effects in sedimentation and evaporation of rain
+!> drops due to too small or too big weights of rain drops (Stevens and Seifert, 2008).
+!> The same procedure is applied to cloud droplets if they are determined prognostically. Call for
+!> grid point i,j
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE adjust_cloud_ij( i, j )
 
@@ -3981,5 +3914,5 @@
           flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
 
-          IF ( .NOT.  microphysics_morrison_no_rain )  THEN
+          IF ( .NOT. microphysics_morrison_no_rain )  THEN
              IF ( qr(k,j,i) <= eps_sb )  THEN
                 qr(k,j,i) = 0.0_wp
@@ -3987,7 +3920,7 @@
              ELSE
 !
-!--             Adjust number of raindrops to avoid nonlinear effects in
-!--             sedimentation and evaporation of rain drops due to too small or
-!--             too big weights of rain drops (Stevens and Seifert, 2008).
+!--             Adjust number of raindrops to avoid nonlinear effects in sedimentation and
+!--             evaporation of rain drops due to too small or too big weights of rain drops
+!--            (Stevens and Seifert, 2008).
                 IF ( nr(k,j,i) * xrmin > qr(k,j,i) * hyrho(k) )  THEN
                    nr(k,j,i) = qr(k,j,i) * hyrho(k) / xrmin * flag
@@ -3998,5 +3931,5 @@
           ENDIF
 
-          IF ( microphysics_morrison ) THEN
+          IF ( microphysics_morrison )  THEN
              IF ( qc(k,j,i) <= eps_sb )  THEN
                 qc(k,j,i) = 0.0_wp
@@ -4013,11 +3946,10 @@
     END SUBROUTINE adjust_cloud_ij
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Adjust number of ice crystal to avoid nonlinear effects in sedimentation and
-!> evaporation of ice crytals due to too small or too big weights
-!> of ice crytals (Stevens and Seifert, 2008).
-!------------------------------------------------------------------------------!
+!> Adjust number of ice crystal to avoid nonlinear effects in sedimentation and evaporation of ice
+!> crytals due to too small or too big weights of ice crytals (Stevens and Seifert, 2008).
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE adjust_ice
 
@@ -4054,13 +3986,12 @@
     END SUBROUTINE adjust_ice
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Adjust number of of ice crystal to avoid nonlinear effects in
-!> sedimentation and evaporation of ice crystals due to too small or
-!> too big weights of ice crytals (Stevens and Seifert, 2008).
-!> The same procedure is applied to cloud droplets if they are determined
-!> prognostically. Call for grid point i,j
-!------------------------------------------------------------------------------!
+!> Adjust number of of ice crystal to avoid nonlinear effects in sedimentation and evaporation of
+!> ice crystals due to too small or too big weights of ice crytals (Stevens and Seifert, 2008).
+!> The same procedure is applied to cloud droplets if they are determined prognostically. Call for
+!> grid point i,j
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE adjust_ice_ij( i, j )
 
@@ -4090,10 +4021,10 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Calculate number of activated condensation nucleii after simple activation
 !> scheme of Twomey, 1959.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE activation
 
@@ -4108,4 +4039,5 @@
        REAL(wp)     ::  beta_act          !<
        REAL(wp)     ::  bfactor           !<
+       REAL(wp)     ::  flag              !< flag to indicate first grid level above
        REAL(wp)     ::  k_act             !<
        REAL(wp)     ::  n_act             !<
@@ -4116,5 +4048,4 @@
        REAL(wp)     ::  sigma_act         !<
 
-       REAL(wp) ::  flag                  !< flag to indicate first grid level above
 
        CALL cpu_log( log_point_s(65), 'activation', 'start' )
@@ -4131,11 +4062,10 @@
                 CALL supersaturation ( i, j, k )
 !
-!--             Prescribe parameters for activation
-!--             (see: Bott + Trautmann, 2002, Atm. Res., 64)
+!--             Prescribe parameters for activation (see: Bott + Trautmann, 2002, Atm. Res., 64)
                 k_act  = 0.7_wp
                 activ  = 0.0_wp
 
 
-                IF ( sat > 0.0 .AND. .NOT. curvature_solution_effects_bulk ) THEN
+                IF ( sat > 0.0  .AND.  .NOT. curvature_solution_effects_bulk )  THEN
 !
 !--                Compute the number of activated Aerosols
@@ -4143,6 +4073,5 @@
                    n_act     = na_init * sat**k_act
 !
-!--                Compute the number of cloud droplets
-!--                (see: Morrison + Grabowski, 2007, JAS, 64)
+!--                Compute the number of cloud droplets (see: Morrison + Grabowski, 2007, JAS, 64)
 !                  activ = MAX( n_act - nc(k,j,i), 0.0_wp) / dt_micro
 
@@ -4151,36 +4080,32 @@
 !--                (see: Khairoutdinov + Kogan, 2000, Mon. Wea. Rev., 128)
                    sat_max = 1.0_wp / 100.0_wp
-                   activ   = MAX( 0.0_wp, ( (na_init + nc(k,j,i) ) * MIN       &
-                      ( 1.0_wp, ( sat / sat_max )**k_act) - nc(k,j,i) ) ) /    &
-                       dt_micro
-                ELSEIF ( sat > 0.0 .AND. curvature_solution_effects_bulk ) THEN
-!
-!--                Curvature effect (afactor) with surface tension
-!--                parameterization by Straka (2009)
+                   activ   = MAX( 0.0_wp, ( (na_init + nc(k,j,i) ) *                               &
+                             MIN( 1.0_wp, ( sat / sat_max )**k_act) - nc(k,j,i) ) ) / dt_micro
+                ELSEIF ( sat > 0.0  .AND.  curvature_solution_effects_bulk )  THEN
+!
+!--                Curvature effect (afactor) with surface tension parameterization by Straka (2009)
                    sigma = 0.0761_wp - 0.000155_wp * ( t_l - 273.15_wp )
                    afactor = 2.0_wp * sigma / ( rho_l * r_v * t_l )
 !
 !--                Solute effect (bfactor)
-                   bfactor = vanthoff * molecular_weight_of_water *            &
-                       rho_s / ( molecular_weight_of_solute * rho_l )
-
-!
-!--                Prescribe power index that describes the soluble fraction
-!--                of an aerosol particle (beta) 
-!--                (see: Morrison + Grabowski, 2007, JAS, 64)
+                   bfactor = vanthoff * molecular_weight_of_water * rho_s /                        &
+                             ( molecular_weight_of_solute * rho_l )
+
+!
+!--                Prescribe power index that describes the soluble fraction of an aerosol particle
+!--                (beta) (see: Morrison + Grabowski, 2007, JAS, 64)
                    beta_act  = 0.5_wp
                    sigma_act = sigma_bulk**( 1.0_wp + beta_act )
 !
-!--                Calculate mean geometric supersaturation (s_0) with
-!--                parameterization by Khvorostyanov and Curry (2006)
-                   s_0   = dry_aerosol_radius **(- ( 1.0_wp + beta_act ) ) *    &
-                       ( 4.0_wp * afactor**3 / ( 27.0_wp * bfactor ) )**0.5_wp
-
-!
-!--                Calculate number of activated CCN as a function of
-!--                supersaturation and taking Koehler theory into account
-!--                (see: Khvorostyanov + Curry, 2006, J. Geo. Res., 111)
-                   n_ccn = ( na_init / 2.0_wp ) * ( 1.0_wp - ERF(              &
-                      LOG( s_0 / sat ) / ( SQRT(2.0_wp) * LOG(sigma_act) ) ) )
+!--                Calculate mean geometric supersaturation (s_0) with parameterization by
+!--                Khvorostyanov and Curry (2006)
+                   s_0 = dry_aerosol_radius **(- ( 1.0_wp + beta_act ) ) * ( 4.0_wp * afactor**3 / &
+                         ( 27.0_wp * bfactor ) )**0.5_wp
+
+!
+!--                Calculate number of activated CCN as a function of supersaturation and taking
+!--                Koehler theory into account (see: Khvorostyanov + Curry, 2006, J. Geo. Res., 111)
+                   n_ccn = ( na_init / 2.0_wp ) * ( 1.0_wp - ERF(                                  &
+                           LOG( s_0 / sat ) / ( SQRT(2.0_wp) * LOG(sigma_act) ) ) )
                    activ = MAX( ( n_ccn - nc(k,j,i) ) / dt_micro, 0.0_wp )
                 ENDIF
@@ -4196,10 +4121,10 @@
     END SUBROUTINE activation
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Calculate number of activated condensation nucleii after simple activation
-!> scheme of Twomey, 1959.
-!------------------------------------------------------------------------------!
+!> Calculate number of activated condensation nucleii after simple activation scheme of
+!> Twomey, 1959.
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE activation_ij( i, j )
 
@@ -4231,6 +4156,5 @@
           CALL supersaturation ( i, j, k )
 !
-!--       Prescribe parameters for activation
-!--       (see: Bott + Trautmann, 2002, Atm. Res., 64)
+!--       Prescribe parameters for activation (see: Bott + Trautmann, 2002, Atm. Res., 64)
           k_act  = 0.7_wp
           activ  = 0.0_wp
@@ -4250,38 +4174,34 @@
 !--          (see: Khairoutdinov + Kogan, 2000, Mon. Wea. Rev., 128)
              sat_max = 0.8_wp / 100.0_wp
-             activ   = MAX( 0.0_wp, ( (na_init + nc(k,j,i) ) * MIN             &
-                 ( 1.0_wp, ( sat / sat_max )**k_act) - nc(k,j,i) ) ) /         &
-                  dt_micro
+             activ   = MAX( 0.0_wp, ( (na_init + nc(k,j,i) ) *                                     &
+                       MIN( 1.0_wp, ( sat / sat_max )**k_act) - nc(k,j,i) ) ) / dt_micro
 
              nc(k,j,i) = MIN( (nc(k,j,i) + activ * dt_micro), na_init)
-          ELSEIF ( sat > 0.0 .AND. curvature_solution_effects_bulk )  THEN
-!
-!--          Curvature effect (afactor) with surface tension
-!--          parameterization by Straka (2009)
+          ELSEIF ( sat > 0.0  .AND.  curvature_solution_effects_bulk )  THEN
+!
+!--          Curvature effect (afactor) with surface tension parameterization by Straka (2009)
              sigma = 0.0761_wp - 0.000155_wp * ( t_l - 273.15_wp )
              afactor = 2.0_wp * sigma / ( rho_l * r_v * t_l )
 !
 !--          Solute effect (bfactor)
-             bfactor = vanthoff * molecular_weight_of_water *                  &
-                  rho_s / ( molecular_weight_of_solute * rho_l )
-
-!
-!--          Prescribe power index that describes the soluble fraction
-!--          of an aerosol particle (beta).
-!--          (see: Morrison + Grabowski, 2007, JAS, 64)
+             bfactor = vanthoff * molecular_weight_of_water * rho_s /                              &
+                       ( molecular_weight_of_solute * rho_l )
+
+!
+!--          Prescribe power index that describes the soluble fraction of an aerosol particle
+!--          (beta). (see: Morrison + Grabowski, 2007, JAS, 64)
              beta_act  = 0.5_wp
              sigma_act = sigma_bulk**( 1.0_wp + beta_act )
 !
-!--          Calculate mean geometric supersaturation (s_0) with
-!--          parameterization by Khvorostyanov and Curry (2006)
-             s_0   = dry_aerosol_radius **(- ( 1.0_wp + beta_act ) ) *         &
-               ( 4.0_wp * afactor**3 / ( 27.0_wp * bfactor ) )**0.5_wp
-
-!
-!--          Calculate number of activated CCN as a function of
-!--          supersaturation and taking Koehler theory into account
-!--          (see: Khvorostyanov + Curry, 2006, J. Geo. Res., 111)
-             n_ccn = ( na_init / 2.0_wp ) * ( 1.0_wp - ERF(                    &
-                LOG( s_0 / sat ) / ( SQRT(2.0_wp) * LOG(sigma_act) ) ) )
+!--          Calculate mean geometric supersaturation (s_0) with parameterization by Khvorostyanov
+!--          and Curry (2006)
+             s_0   = dry_aerosol_radius **(- ( 1.0_wp + beta_act ) ) *                             &
+                     ( 4.0_wp * afactor**3 / ( 27.0_wp * bfactor ) )**0.5_wp
+
+!
+!--          Calculate number of activated CCN as a function of supersaturation and taking Koehler
+!--          theory into account (see: Khvorostyanov + Curry, 2006, J. Geo. Res., 111)
+             n_ccn = ( na_init / 2.0_wp ) * ( 1.0_wp - ERF(                                        &
+                     LOG( s_0 / sat ) / ( SQRT(2.0_wp) * LOG(sigma_act) ) ) )
              activ = MAX( ( n_ccn ) / dt_micro, 0.0_wp )
 
@@ -4293,10 +4213,10 @@
     END SUBROUTINE activation_ij
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Calculate ice nucleation by applying the deposition-condensation formula as
-!> given by Meyers et al 1992 and as described in Seifert and Beheng 2006
-!------------------------------------------------------------------------------!
+!> Calculate ice nucleation by applying the deposition-condensation formula as given by
+!> Meyers et al 1992 and as described in Seifert and Beheng 2006
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE ice_nucleation
 
@@ -4326,5 +4246,5 @@
                    CALL supersaturation_ice ( i, j, k )
                    nucle = 0.0_wp
-                   IF ( sat_ice >= 0.05_wp  .OR.  ql(k,j,i) >= 0.001E-3_wp  ) THEN
+                   IF ( sat_ice >= 0.05_wp  .OR.  ql(k,j,i) >= 0.001E-3_wp  )  THEN
 !
 !--                   Calculate ice nucleation
@@ -4364,10 +4284,10 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Calculate ice nucleation by applying the deposition-condensation formula as
-!> given by Meyers et al 1992 and as described in Seifert and Beheng 2006
-!------------------------------------------------------------------------------!
+!> Calculate ice nucleation by applying the deposition-condensation formula as given by
+!> Meyers et al 1992 and as described in Seifert and Beheng 2006.
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE ice_nucleation_ij( i, j )
 
@@ -4393,5 +4313,5 @@
              CALL supersaturation_ice ( i, j, k )
              nucle = 0.0_wp
-             IF ( sat_ice >= 0.05_wp  .OR.  ql(k,j,i) >= 0.001E-3_wp ) THEN
+             IF ( sat_ice >= 0.05_wp  .OR.  ql(k,j,i) >= 0.001E-3_wp )  THEN
 !
 !--             Calculate ice nucleation
@@ -4409,5 +4329,5 @@
              CALL supersaturation_ice ( i, j, k )
              nucle = 0.0_wp
-             IF ( sat_ice > 0.0 ) THEN
+             IF ( sat_ice > 0.0 )  THEN
 !
 !--             Calculate ice nucleation
@@ -4422,10 +4342,9 @@
     END SUBROUTINE ice_nucleation_ij
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Calculate condensation rate for cloud water content (after Khairoutdinov and
-!> Kogan, 2000).
-!------------------------------------------------------------------------------!
+!> Calculate condensation rate for cloud water content (after Khairoutdinov and Kogan, 2000).
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE condensation
 
@@ -4455,9 +4374,8 @@
                 flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
 !
-!--             Call calculation of supersaturation 
+!--             Call calculation of supersaturation
                 CALL supersaturation ( i, j, k )
 !
-!--             Actual temperature, t_l is calculated directly before
-!--             in supersaturation
+!--             Actual temperature, t_l is calculated directly before in supersaturation
                 IF ( microphysics_ice_phase ) THEN
                    temp = t_l + lv_d_cp * ql(k,j,i) + ls_d_cp * qi(k,j,i)
@@ -4466,8 +4384,8 @@
                 ENDIF
 
-                g_fac  = 1.0_wp / ( ( l_v / ( r_v * temp ) - 1.0_wp ) *        &
-                                    l_v / ( thermal_conductivity_l * temp )    &
-                                    + r_v * temp / ( diff_coeff_l * e_s )      &
-                                    )
+                g_fac  = 1.0_wp / ( ( l_v / ( r_v * temp ) - 1.0_wp ) *                            &
+                                      l_v / ( thermal_conductivity_l  * temp )                     &
+                                    + r_v * temp / ( diff_coeff_l * e_s )                          &
+                                  )
 !
 !--             Mean weight of cloud drops
@@ -4475,12 +4393,12 @@
 !
 !--             Calculating mean radius of cloud droplets assuming gamma distribution with shape
-!--             parameter nu=1 (Seifert and Beheng, 2006). Tuning factor alpha_rc (intorduced
-!--             in Seifert and Stevens, 2010 ) is switched off. Minimum radius is set to 1Âµm
+!--             parameter nu=1 (Seifert and Beheng, 2006). Tuning factor alpha_rc (introduced
+!--             in Seifert and Stevens, 2010 ) is switched off. Minimum radius is set to 1ÃÂµm
 !--             following (Seifert and Beheng, 2006, Kogan and Khairoutdinov, 2000,
 !--             Seifert and Stevens, 2010)
-                rc = MAX( alpha_rc  * GAMMA(nu + 1.33_wp) / GAMMA(nu + 1.0_wp) *                   &
-                        ( 3.0_wp * qc(k,j,i) /                                                     &
+                rc = MAX( alpha_rc  * GAMMA( nu + 1.33_wp ) / GAMMA( nu + 1.0_wp ) *               &
+                          ( 3.0_wp * qc(k,j,i) /                                                   &
                                    ( 4.0_wp * pi * rho_l  * ( nu + 2.0_wp ) * nc(k,j,i) )          &
-                        )**0.33_wp, 1.0E-6_wp )
+                          )**0.33_wp, 1.0E-6_wp )
 !
 !--             Condensation needs only to be calculated in supersaturated regions
@@ -4491,13 +4409,13 @@
 !--                2007, and Seifert and Stevens, 2010)
                    cond      = 4.0_wp * pi * nc(k,j,i) * g_fac * sat * rc / hyrho(k)
-                   IF ( microphysics_seifert ) THEN
+                   IF ( microphysics_seifert )  THEN
                       cond_max  = q(k,j,i) - q_s - qc(k,j,i) - qr(k,j,i)
-                   ELSEIF ( microphysics_morrison_no_rain ) THEN
-                      cond_max  = q(k,j,i) - q_s - qc(k,j,i) 
+                   ELSEIF ( microphysics_morrison_no_rain )  THEN
+                      cond_max  = q(k,j,i) - q_s - qc(k,j,i)
                    ENDIF
                    cond      = MIN( cond, cond_max / dt_micro )
 
                    qc(k,j,i) = qc(k,j,i) + cond * dt_micro * flag
-                ELSEIF ( sat < 0.0_wp ) THEN
+                ELSEIF ( sat < 0.0_wp )  THEN
                    evap      = 4.0_wp * pi * nc(k,j,i) * g_fac * sat * rc / hyrho(k)
                    evap      = MAX( evap, -qc(k,j,i) / dt_micro )
@@ -4516,10 +4434,9 @@
     END SUBROUTINE condensation
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Calculate condensation rate for cloud water content (after Khairoutdinov and
-!> Kogan, 2000).
-!------------------------------------------------------------------------------!
+!> Calculate condensation rate for cloud water content (after Khairoutdinov and Kogan, 2000).
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE condensation_ij( i, j )
 
@@ -4548,6 +4465,5 @@
           CALL supersaturation ( i, j, k )
 !
-!--       Actual temperature, t_l is calculated directly before
-!--       in supersaturation
+!--       Actual temperature, t_l is calculated directly before in supersaturation
           IF ( microphysics_ice_phase ) THEN
              temp = t_l + lv_d_cp * ql(k,j,i) + ls_d_cp * qi(k,j,i)
@@ -4556,19 +4472,19 @@
           ENDIF
 
-          g_fac  = 1.0_wp / ( ( l_v / ( r_v * temp ) - 1.0_wp ) *              &
-                              l_v / ( thermal_conductivity_l * temp )          &
-                              + r_v * temp / ( diff_coeff_l * e_s )            &
+          g_fac  = 1.0_wp / ( ( l_v / ( r_v * temp ) - 1.0_wp ) *                                  &
+                                l_v / ( thermal_conductivity_l  * temp )                           &
+                              + r_v * temp / ( diff_coeff_l * e_s )                                &
                             )
 !
 !--       Mean weight of cloud drops
-          IF ( nc(k,j,i) <= 0.0_wp) CYCLE
+          IF ( nc(k,j,i) <= 0.0_wp)  CYCLE
 !
 !--       Calculating mean radius of cloud droplets assuming gamma distribution with shape
-!--       parameter nu=1 (Seifert and Beheng, 2006). Tuning factor alpha_rc (intorduced
-!--       in Seifert and Stevens, 2010 ) is switched off. Minimum radius is set to 1Âµm following
+!--       parameter nu=1 (Seifert and Beheng, 2006). Tuning factor alpha_rc (introduced
+!--       in Seifert and Stevens, 2010 ) is switched off. Minimum radius is set to 1ÃÂµm following
 !--       (Seifert and Beheng, 2006, Kogan and Khairoutdinov, 2000, Seifert and Stevens, 2010)
-          rc = MAX( alpha_rc  * GAMMA(nu + 1.33_wp) / GAMMA(nu + 1.0_wp) *                         &
-               ( 3.0_wp * qc(k,j,i) / ( 4.0_wp * pi * rho_l  * ( nu + 2.0_wp ) * nc(k,j,i) )       &
-               )**0.33_wp, 1.0E-6_wp )
+          rc = MAX( alpha_rc  * GAMMA( nu + 1.33_wp ) / GAMMA( nu + 1.0_wp ) *                     &
+                    ( 3.0_wp * qc(k,j,i) / ( 4.0_wp * pi * rho_l  * ( nu + 2.0_wp ) * nc(k,j,i) )  &
+                  )**0.33_wp, 1.0E-6_wp )
 !
 !--       Condensation needs only to be calculated in supersaturated regions
@@ -4579,13 +4495,13 @@
 !--          and Seifert and Stevens, 2010)
              cond      = 4.0_wp * pi * nc(k,j,i) * g_fac * sat * rc / hyrho(k)
-             IF ( microphysics_seifert ) THEN
+             IF ( microphysics_seifert )  THEN
                 cond_max  = q(k,j,i) - q_s - qc(k,j,i) - qr(k,j,i)
-             ELSEIF ( microphysics_morrison_no_rain ) THEN
-                cond_max  = q(k,j,i) - q_s - qc(k,j,i) 
+             ELSEIF ( microphysics_morrison_no_rain )  THEN
+                cond_max  = q(k,j,i) - q_s - qc(k,j,i)
              ENDIF
              cond      = MIN( cond, cond_max / dt_micro )
 
              qc(k,j,i) = qc(k,j,i) + cond * dt_micro * flag
-          ELSEIF ( sat < 0.0_wp ) THEN
+          ELSEIF ( sat < 0.0_wp )  THEN
              evap      = 4.0_wp * pi * nc(k,j,i) * g_fac * sat * rc / hyrho(k)
              evap      = MAX( evap, -qc(k,j,i) / dt_micro )
@@ -4597,10 +4513,9 @@
     END SUBROUTINE condensation_ij
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Calculate the growth of ice particles by water vapor deposition (after
-!> Seifert and Beheng, 2006).
-!------------------------------------------------------------------------------!
+!> Calculate the growth of ice particles by water vapor deposition (after Seifert and Beheng, 2006).
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE ice_deposition
 
@@ -4611,14 +4526,13 @@
        REAL(wp) ::  ac = 0.09_wp        !< parameter for ice capacitance
        REAL(wp) ::  bc = 0.33_wp        !< parameter for ice capacitance
-       REAL(wp) ::  fac_gamma = 0.76_wp !< parameter to describe spectral
-                                        !< distribution, here following gamma
-                                        !< size distribution with Âµ =1/3 and nu=0
        REAL(wp) ::  deposition_rate     !< depositions rate
        REAL(wp) ::  deposition_rate_max !< maximum deposition rate
+       REAL(wp) ::  fac_gamma = 0.76_wp !< parameter to describe spectral distribution, here
+                                        !< following gamma size distribution with Âµ =1/3 and nu=0
+       REAL(wp) ::  flag                !< flag to indicate first grid level above
+       REAL(wp) ::  gfac_dep            !< factor
        REAL(wp) ::  sublimation_rate    !< sublimations rate
-       REAL(wp) ::  gfac_dep            !< factor
        REAL(wp) ::  temp                !< actual temperature
        REAL(wp) ::  xi                  !< mean mass of ice crystal
-       REAL(wp) ::  flag                !< flag to indicate first grid level above
 
        CALL cpu_log( log_point_s(95), 'ice deposition', 'start' )
@@ -4637,16 +4551,14 @@
                 temp = t_l + lv_d_cp * ql(k,j,i) + ls_d_cp * qi(k,j,i)
 
-                IF ( temp >= 273.15_wp ) CYCLE
-!
-!--             calculating gfac_dep ( 1/ (Fk + Fd) ) see e.g.
-!--             Rogers and Yau, 1989
-                gfac_dep  = 1.0_wp / ( ( l_s / ( r_v * temp ) - 1.0_wp ) *     &
-                                    l_s / ( thermal_conductivity_l * temp )    &
-                                    + r_v * temp / ( diff_coeff_l * e_si )     &
-                                    )
-!
-!--             If there is nothing nucleated, than there is also no
-!--             deposition (above -38Â°C)
-                IF ( ni(k,j,i) <= 0.0_wp ) CYCLE
+                IF ( temp >= 273.15_wp )  CYCLE
+!
+!--             calculating gfac_dep ( 1/ (Fk + Fd) ) see e.g. Rogers and Yau, 1989
+                gfac_dep  = 1.0_wp / ( ( l_s / ( r_v * temp ) - 1.0_wp ) *                         &
+                                         l_s / ( thermal_conductivity_l  * temp )                  &
+                                    + r_v * temp / ( diff_coeff_l * e_si )                         &
+                                     )
+!
+!--             If there is nothing nucleated, than there is also no deposition (above -38Â°C)
+                IF ( ni(k,j,i) <= 0.0_wp )  CYCLE
 !
 !--             calculate mean mass of ice crystal
@@ -4654,30 +4566,23 @@
                 xi = MAX( ( qi(k,j,i) * hyrho(k) / ni(k,j,i)), ximin )
 !
-!--             Condensation needs only to be calculated in supersaturated
-!--             regions (regarding ice)
+!--             Condensation needs only to be calculated in supersaturated regions (regarding ice)
                 IF ( sat_ice > 0.0_wp )  THEN
 !
-!--                Calculate deposition rate assuming ice crystal shape as
-!--                prescribed in Ovchinnikov et al., 2014 and a gamma size
-!--                distribution according to Seifert and Beheng with to
-!--                Âµ =1/3 and nu=0
-                   deposition_rate  = 4.0_wp * pi * sat_ice * gfac_dep *       &
-                                      fac_gamma * ac * xi**bc * ni(k,j,i)
-                   IF ( microphysics_seifert ) THEN
-                      deposition_rate_max  = q(k,j,i) -                        &
-                                             q_si - qr(k,j,i) - qi(k,j,i)
+!--                Calculate deposition rate assuming ice crystal shape as prescribed in
+!--                Ovchinnikov et al., 2014 and a gamma size distribution according to
+!--                Seifert and Beheng with Âµ =1/3 and nu=0
+                   deposition_rate  = 4.0_wp * pi * sat_ice * gfac_dep * fac_gamma * ac * xi**bc * &
+                                      ni(k,j,i)
+                   IF ( microphysics_seifert )  THEN
+                      deposition_rate_max  = q(k,j,i) - q_si - qr(k,j,i) - qi(k,j,i)
                    ELSEIF ( microphysics_morrison_no_rain ) THEN
-                      deposition_rate_max  = q(k,j,i) -                        &
-                                             q_si - qc(k,j,i) - qi(k,j,i)
+                      deposition_rate_max  = q(k,j,i) - q_si - qc(k,j,i) - qi(k,j,i)
                    ENDIF
-                   deposition_rate = MIN( deposition_rate,                     &
-                                          deposition_rate_max / dt_micro )
-
+                   deposition_rate = MIN( deposition_rate, deposition_rate_max / dt_micro )
                    qi(k,j,i) = qi(k,j,i) + deposition_rate * dt_micro * flag
-                ELSEIF ( sat_ice < 0.0_wp ) THEN
-                   sublimation_rate = 4.0_wp * pi * sat_ice * gfac_dep *       &
-                                      fac_gamma * ac * xi**bc * ni(k,j,i)
-                   sublimation_rate = MAX( sublimation_rate,                   &
-                                           -qi(k,j,i) / dt_micro )
+                ELSEIF ( sat_ice < 0.0_wp )  THEN
+                   sublimation_rate = 4.0_wp * pi * sat_ice * gfac_dep * fac_gamma * ac * xi**bc * &
+                                      ni(k,j,i)
+                   sublimation_rate = MAX( sublimation_rate, - qi(k,j,i) / dt_micro )
                    qi(k,j,i) = qi(k,j,i) + sublimation_rate * dt_micro * flag
                 ENDIF
@@ -4690,10 +4595,9 @@
     END SUBROUTINE ice_deposition
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Calculate condensation rate for cloud water content (after Khairoutdinov and
-!> Kogan, 2000).
-!------------------------------------------------------------------------------!
+!> Calculate condensation rate for cloud water content (after Khairoutdinov and Kogan, 2000).
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE ice_deposition_ij( i, j )
 
@@ -4704,14 +4608,13 @@
        REAL(wp) ::  ac = 0.09_wp        !< parameter for ice capacitance
        REAL(wp) ::  bc = 0.33_wp        !< parameter for ice capacitance
-       REAL(wp) ::  fac_gamma = 0.76_wp !< parameter to describe spectral
-                                        !< distribution, here following gamma
-                                        !< size distribution with nu=1, v=0
        REAL(wp) ::  deposition_rate     !< depositions rate
        REAL(wp) ::  deposition_rate_max !< maximum deposition rate
+       REAL(wp) ::  fac_gamma = 0.76_wp !< parameter to describe spectral distribution, here
+                                        !< following gamma size distribution with nu=1, v=0
+       REAL(wp) ::  flag                !< flag to indicate first grid level above
+       REAL(wp) ::  gfac_dep            !< factor
        REAL(wp) ::  sublimation_rate    !< sublimations rate
-       REAL(wp) ::  gfac_dep            !< factor
        REAL(wp) ::  temp                !< actual temperature
        REAL(wp) ::  xi                  !< mean mass of ice crystal
-       REAL(wp) ::  flag                !< flag to indicate first grid level above
 
        DO  k = nzb+1, nzt
@@ -4721,21 +4624,20 @@
 !
 !--       Call calculation of supersaturation over a plane ice surface
-          CALL supersaturation_ice ( i, j, k )
+          CALL supersaturation_ice (i,j,k)
 !
 !--       Actual temperature:
           temp = t_l + lv_d_cp * ql(k,j,i) + ls_d_cp * qi(k,j,i)
 
-          IF ( temp >= 273.15_wp ) CYCLE
+          IF ( temp >= 273.15_wp )  CYCLE
 !
 !--       calculating gfac_dep ( 1/ (Fk + Fd) ) see e.g.
 !--       Rogers and Yau, 1989
-          gfac_dep  = 1.0_wp / ( ( l_s / ( r_v * temp ) - 1.0_wp ) *           &
-                              l_s / ( thermal_conductivity_l * temp )          &
-                              + r_v * temp / ( diff_coeff_l * e_si )           &
-                              )
-!
-!--       If there is nothing nucleated, than there is also no
-!--       deposition (above -38Â°C)
-          IF ( ni(k,j,i) <= 0.0_wp ) CYCLE
+          gfac_dep  = 1.0_wp / ( ( l_s / ( r_v * temp ) - 1.0_wp ) *                               &
+                                   l_s / ( thermal_conductivity_l  * temp )                        &
+                                 + r_v * temp / ( diff_coeff_l * e_si )                            &
+                               )
+!
+!--       If there is nothing nucleated, than there is also no deposition (above -38Â°C)
+          IF ( ni(k,j,i) <= 0.0_wp )  CYCLE
 !
 !--       calculate mean mass of ice crystal
@@ -4743,30 +4645,24 @@
           xi = MAX( ( qi(k,j,i) * hyrho(k) / ni(k,j,i)), ximin )
 !
-!--       Condensation needs only to be calculated in supersaturated
-!--       regions (regarding ice)
+!--       Condensation needs only to be calculated in supersaturated regions (regarding ice)
           IF ( sat_ice > 0.0_wp )  THEN
 !
-!--          Calculate deposition rate assuming ice crystal shape as
-!--          prescribed in Ovchinnikov et al., 2014 and a gamma size
-!--          distribution according to Seifert and Beheng with to
-!--          Âµ =1/3 and nu=0
-             deposition_rate  = 4.0_wp * pi * sat_ice * gfac_dep *             &
-                                fac_gamma * ac * xi**bc * ni(k,j,i)
-             IF ( microphysics_seifert ) THEN
-                deposition_rate_max  = q(k,j,i) -                              &
-                                       q_si - qr(k,j,i) - qi(k,j,i)
-             ELSEIF ( microphysics_morrison_no_rain ) THEN
-                deposition_rate_max  = q(k,j,i) -                              &
-                                       q_si - qc(k,j,i) - qi(k,j,i)
-             ENDIF
-             deposition_rate = MIN( deposition_rate,                           &
-                                    deposition_rate_max / dt_micro )
+!--          Calculate deposition rate assuming ice crystal shape as prescribed in
+!--          Ovchinnikov et al., 2014 and a gamma size distribution according to
+!--          Seifert and Beheng with Âµ =1/3 and nu=0
+             deposition_rate  = 4.0_wp * pi * sat_ice * gfac_dep * fac_gamma * ac * xi**bc *       &
+                                ni(k,j,i)
+             IF ( microphysics_seifert )  THEN
+                deposition_rate_max  = q(k,j,i) - q_si - qr(k,j,i) - qi(k,j,i)
+             ELSEIF ( microphysics_morrison_no_rain )  THEN
+                deposition_rate_max  = q(k,j,i) - q_si - qc(k,j,i) - qi(k,j,i)
+             ENDIF
+             deposition_rate = MIN( deposition_rate, deposition_rate_max / dt_micro )
 
              qi(k,j,i) = qi(k,j,i) + deposition_rate * dt_micro * flag
-          ELSEIF ( sat_ice < 0.0_wp ) THEN
-             sublimation_rate = 4.0_wp * pi * sat_ice * gfac_dep *             &
-                                fac_gamma * ac * xi**bc * ni(k,j,i)
-             sublimation_rate = MAX( sublimation_rate,                         &
-                                     -qi(k,j,i) / dt_micro )
+          ELSEIF ( sat_ice < 0.0_wp )  THEN
+             sublimation_rate = 4.0_wp * pi * sat_ice * gfac_dep * fac_gamma * ac * xi**bc *       &
+                                ni(k,j,i)
+             sublimation_rate = MAX( sublimation_rate, - qi(k,j,i) / dt_micro )
              qi(k,j,i) = qi(k,j,i) + sublimation_rate * dt_micro * flag
           ENDIF
@@ -4776,9 +4672,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Autoconversion rate (Seifert and Beheng, 2006).
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE autoconversion
 
@@ -4814,5 +4710,5 @@
                 flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
 
-                IF ( microphysics_morrison ) THEN
+                IF ( microphysics_morrison )  THEN
                    nc_auto = nc(k,j,i)
                 ELSE
@@ -4826,11 +4722,9 @@
 !--                Intern time scale of coagulation (Seifert and Beheng, 2006):
 !--                (1.0_wp - qc(k,j,i) / ( qc(k,j,i) + qr(k,j,i) ))
-                   tau_cloud = MAX( 1.0_wp - qc(k,j,i) / ( qr(k,j,i) +         &
-                                    qc(k,j,i) ), 0.0_wp )
+                   tau_cloud = MAX( 1.0_wp - qc(k,j,i) / ( qr(k,j,i) + qc(k,j,i) ), 0.0_wp )
 !
 !--                Universal function for autoconversion process
 !--                (Seifert and Beheng, 2006):
-                   phi_au = 600.0_wp * tau_cloud**0.68_wp *                    &
-                            ( 1.0_wp - tau_cloud**0.68_wp )**3
+                   phi_au = 600.0_wp * tau_cloud**0.68_wp * ( 1.0_wp - tau_cloud**0.68_wp )**3
 !
 !--                Shape parameter of gamma distribution (Geoffroy et al., 2010):
@@ -4839,8 +4733,8 @@
 !
 !--                Mean weight of cloud droplets:
-                   xc = MAX( hyrho(k) * qc(k,j,i) / nc_auto, xcmin) 
-!
-!--                Parameterized turbulence effects on autoconversion (Seifert,
-!--                Nuijens and Stevens, 2010)
+                   xc = MAX( hyrho(k) * qc(k,j,i) / nc_auto, xcmin)
+!
+!--                Parameterized turbulence effects on autoconversion
+!--                (Seifert, Nuijens and Stevens, 2010)
                    IF ( collision_turbulence )  THEN
 !
@@ -4852,45 +4746,39 @@
                       sigma_cc = ( c_1 + c_2 * nu_c ) / ( 1.0_wp + c_3 * nu_c )
 !
-!--                   Mixing length (neglecting distance to ground and
-!--                   stratification)
+!--                   Mixing length (neglecting distance to ground and stratification)
                       l_mix = ( dx * dy * dzu(k) )**( 1.0_wp / 3.0_wp )
 !
-!--                   Limit dissipation rate according to Seifert, Nuijens and
-!--                   Stevens (2010)
+!--                   Limit dissipation rate according to Seifert, Nuijens and Stevens (2010)
                       dissipation = MIN( 0.06_wp, diss(k,j,i) )
 !
 !--                   Compute Taylor-microscale Reynolds number:
-                      re_lambda = 6.0_wp / 11.0_wp *                           &
-                                  ( l_mix / c_const )**( 2.0_wp / 3.0_wp ) *   &
-                                  SQRT( 15.0_wp / kin_vis_air ) *              &
-                                  dissipation**( 1.0_wp / 6.0_wp )
-!
-!--                   The factor of 1.0E4 is needed to convert the dissipation
-!--                   rate from m2 s-3 to cm2 s-3.
-                      k_au = k_au * ( 1.0_wp +                                 &
-                                      dissipation * 1.0E4_wp *                 &
-                                      ( re_lambda * 1.0E-3_wp )**0.25_wp *     &
-                                      ( alpha_cc * EXP( -1.0_wp * ( ( rc -     &
-                                                                      r_cc ) / &
-                                                        sigma_cc )**2          &
-                                                      ) + beta_cc              &
-                                      )                                        &
+                      re_lambda = 6.0_wp / 11.0_wp * ( l_mix / c_const )**( 2.0_wp / 3.0_wp ) *    &
+                                  SQRT( 15.0_wp / kin_vis_air ) * dissipation**( 1.0_wp / 6.0_wp )
+!
+!--                   The factor of 1.0E4 is needed to convert the dissipation rate from m2 s-3 to
+!--                   cm2 s-3.
+                      k_au = k_au * ( 1.0_wp +                                                     &
+                                      dissipation * 1.0E4_wp *                                     &
+                                      ( re_lambda * 1.0E-3_wp )**0.25_wp *                         &
+                                      ( alpha_cc * EXP( -1.0_wp * ( ( rc -                         &
+                                                                      r_cc ) /                     &
+                                                        sigma_cc )**2                              &
+                                                      ) + beta_cc                                  &
+                                      )                                                            &
                                     )
                    ENDIF
 !
 !--                Autoconversion rate (Seifert and Beheng, 2006):
-                   autocon = k_au * ( nu_c + 2.0_wp ) * ( nu_c + 4.0_wp ) /    &
-                             ( nu_c + 1.0_wp )**2 * qc(k,j,i)**2 * xc**2 *     &
-                             ( 1.0_wp + phi_au / ( 1.0_wp - tau_cloud )**2 ) * &
-                             rho_surface
+                   autocon = k_au * ( nu_c + 2.0_wp ) * ( nu_c + 4.0_wp )    /                     &
+                             ( nu_c + 1.0_wp )**2 * qc(k,j,i)**2 * xc**2     *                     &
+                             ( 1.0_wp + phi_au / ( 1.0_wp - tau_cloud )**2 ) * rho_surface
                    autocon = MIN( autocon, qc(k,j,i) / dt_micro )
 
                    qr(k,j,i) = qr(k,j,i) + autocon * dt_micro * flag
                    qc(k,j,i) = qc(k,j,i) - autocon * dt_micro * flag
-                   nr(k,j,i) = nr(k,j,i) + autocon / x0 * hyrho(k) * dt_micro  &
-                                                              * flag
-                   IF ( microphysics_morrison ) THEN
-                      nc(k,j,i) = nc(k,j,i) - MIN( nc(k,j,i), 2.0_wp *         &
-                                    autocon / x0 * hyrho(k) * dt_micro * flag )
+                   nr(k,j,i) = nr(k,j,i) + autocon / x0 * hyrho(k) * dt_micro * flag
+                   IF ( microphysics_morrison )  THEN
+                      nc(k,j,i) = nc(k,j,i) - MIN( nc(k,j,i), 2.0_wp *                             &
+                                  autocon / x0 * hyrho(k) * dt_micro * flag )
                    ENDIF
 
@@ -4906,9 +4794,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Autoconversion rate (Seifert and Beheng, 2006). Call for grid point i,j
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE autoconversion_ij( i, j )
 
@@ -4951,9 +4839,7 @@
 !--          Intern time scale of coagulation (Seifert and Beheng, 2006):
 !--          (1.0_wp - qc(k,j,i) / ( qc(k,j,i) + qr(k,j,i) ))
-             tau_cloud = MAX( 1.0_wp - qc(k,j,i) / ( qr(k,j,i) + qc(k,j,i) ),     &
-                              0.0_wp )
-!
-!--          Universal function for autoconversion process
-!--          (Seifert and Beheng, 2006):
+             tau_cloud = MAX( 1.0_wp - qc(k,j,i) / ( qr(k,j,i) + qc(k,j,i) ), 0.0_wp )
+!
+!--          Universal function for autoconversion process (Seifert and Beheng, 2006):
              phi_au = 600.0_wp * tau_cloud**0.68_wp * ( 1.0_wp - tau_cloud**0.68_wp )**3
 !
@@ -4965,6 +4851,5 @@
              xc = hyrho(k) * qc(k,j,i) / nc_auto
 !
-!--          Parameterized turbulence effects on autoconversion (Seifert,
-!--          Nuijens and Stevens, 2010)
+!--          Parameterized turbulence effects on autoconversion (Seifert, Nuijens and Stevens, 2010)
              IF ( collision_turbulence )  THEN
 !
@@ -4979,39 +4864,34 @@
                 l_mix = ( dx * dy * dzu(k) )**( 1.0_wp / 3.0_wp )
 !
-!--             Limit dissipation rate according to Seifert, Nuijens and
-!--             Stevens (2010)
+!--             Limit dissipation rate according to Seifert, Nuijens and Stevens (2010)
                 dissipation = MIN( 0.06_wp, diss(k,j,i) )
 !
 !--             Compute Taylor-microscale Reynolds number:
-                re_lambda = 6.0_wp / 11.0_wp *                                 &
-                            ( l_mix / c_const )**( 2.0_wp / 3.0_wp ) *         &
-                            SQRT( 15.0_wp / kin_vis_air ) *                    &
-                            dissipation**( 1.0_wp / 6.0_wp )
-!
-!--             The factor of 1.0E4 is needed to convert the dissipation rate
-!--             from m2 s-3 to cm2 s-3.
-                k_au = k_au * ( 1.0_wp +                                       &
-                                dissipation * 1.0E4_wp *                       &
-                                ( re_lambda * 1.0E-3_wp )**0.25_wp *           &
-                                ( alpha_cc * EXP( -1.0_wp * ( ( rc - r_cc ) /  &
-                                                  sigma_cc )**2                &
-                                                ) + beta_cc                    &
-                                )                                              &
+                re_lambda = 6.0_wp / 11.0_wp * ( l_mix / c_const )**( 2.0_wp / 3.0_wp ) *          &
+                            SQRT( 15.0_wp / kin_vis_air ) * dissipation**( 1.0_wp / 6.0_wp )
+!
+!--             The factor of 1.0E4 is needed to convert the dissipation rate from m2 s-3 to
+!--             cm2 s-3.
+                k_au = k_au * ( 1.0_wp +                                                           &
+                                dissipation * 1.0E4_wp *                                           &
+                                ( re_lambda * 1.0E-3_wp )**0.25_wp *                               &
+                                ( alpha_cc * EXP( -1.0_wp * ( ( rc - r_cc ) /                      &
+                                                  sigma_cc )**2                                    &
+                                                ) + beta_cc                                        &
+                                )                                                                  &
                               )
              ENDIF
 !
 !--          Autoconversion rate (Seifert and Beheng, 2006):
-             autocon = k_au * ( nu_c + 2.0_wp ) * ( nu_c + 4.0_wp ) /          &
-                       ( nu_c + 1.0_wp )**2 * qc(k,j,i)**2 * xc**2 *           &
-                       ( 1.0_wp + phi_au / ( 1.0_wp - tau_cloud )**2 ) *       &
-                       rho_surface
+             autocon = k_au * ( nu_c + 2.0_wp ) * ( nu_c + 4.0_wp )    /                           &
+                       ( nu_c + 1.0_wp )**2 * qc(k,j,i)**2 * xc**2     *                           &
+                       ( 1.0_wp + phi_au / ( 1.0_wp - tau_cloud )**2 ) * rho_surface
              autocon = MIN( autocon, qc(k,j,i) / dt_micro )
-
              qr(k,j,i) = qr(k,j,i) + autocon * dt_micro                 * flag
              qc(k,j,i) = qc(k,j,i) - autocon * dt_micro                 * flag
              nr(k,j,i) = nr(k,j,i) + autocon / x0 * hyrho(k) * dt_micro * flag
-             IF ( microphysics_morrison ) THEN
-                nc(k,j,i) = nc(k,j,i) - MIN( nc(k,j,i), 2.0_wp *                &
-                                    autocon / x0 * hyrho(k) * dt_micro * flag )
+             IF ( microphysics_morrison )  THEN
+                nc(k,j,i) = nc(k,j,i) - MIN( nc(k,j,i), 2.0_wp *                                   &
+                            autocon / x0 * hyrho(k) * dt_micro * flag )
              ENDIF
 
@@ -5023,9 +4903,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Autoconversion process (Kessler, 1969).
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE autoconversion_kessler
 
@@ -5059,6 +4939,6 @@
                 qc(k,j,i) = qc(k,j,i) - dqdt_precip * dt_micro * flag
                 q(k,j,i)  = q(k,j,i)  - dqdt_precip * dt_micro * flag
-                pt(k,j,i) = pt(k,j,i) + dqdt_precip * dt_micro * lv_d_cp *     &
-                                        d_exner(k)              * flag
+                pt(k,j,i) = pt(k,j,i) + dqdt_precip * dt_micro * lv_d_cp *                         &
+                                        d_exner(k)             * flag
 
 !
@@ -5072,9 +4952,9 @@
    END SUBROUTINE autoconversion_kessler
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Autoconversion process (Kessler, 1969).
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE autoconversion_kessler_ij( i, j )
 
@@ -5087,5 +4967,5 @@
        INTEGER(iwp) ::  k_wall !< topography top index
 
-       REAL(wp)    ::  dqdt_precip !<
+       REAL(wp)    ::  dqdt_precip       !<
        REAL(wp)    ::  flag              !< flag to indicate first grid level above surface
 
@@ -5106,6 +4986,5 @@
           qc(k,j,i) = qc(k,j,i) - dqdt_precip * dt_micro * flag
           q(k,j,i)  = q(k,j,i)  - dqdt_precip * dt_micro * flag
-          pt(k,j,i) = pt(k,j,i) + dqdt_precip * dt_micro * lv_d_cp * d_exner(k)  &
-                                                                 * flag
+          pt(k,j,i) = pt(k,j,i) + dqdt_precip * dt_micro * lv_d_cp * d_exner(k) * flag
 
 !
@@ -5118,9 +4997,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Accretion rate (Seifert and Beheng, 2006).
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE accretion
 
@@ -5149,5 +5028,5 @@
                 flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
 
-                IF ( microphysics_morrison ) THEN
+                IF ( microphysics_morrison )  THEN
                    nc_accr = nc(k,j,i)
                 ELSE
@@ -5155,6 +5034,6 @@
                 ENDIF
 
-                IF ( ( qc(k,j,i) > eps_sb )  .AND.  ( qr(k,j,i) > eps_sb )    &
-                                             .AND.  ( nc_accr > eps_mr ) ) THEN
+                IF ( ( qc(k,j,i) > eps_sb )  .AND.  ( qr(k,j,i) > eps_sb )                         &
+                                             .AND.  ( nc_accr > eps_mr   ) )  THEN
 !
 !--                Intern time scale of coagulation (Seifert and Beheng, 2006):
@@ -5169,11 +5048,10 @@
                    xc = MAX( (hyrho(k) * qc(k,j,i) / nc_accr), xcmin)
 !
-!--                Parameterized turbulence effects on autoconversion (Seifert,
-!--                Nuijens and Stevens, 2010). The factor of 1.0E4 is needed to
-!--                convert the dissipation rate (diss) from m2 s-3 to cm2 s-3.
+!--                Parameterized turbulence effects on autoconversion
+!--                (Seifert, Nuijens and Stevens, 2010). The factor of 1.0E4 is needed to convert
+!--                the dissipation rate (diss) from m2 s-3 to cm2 s-3.
                    IF ( collision_turbulence )  THEN
-                      k_cr = k_cr0 * ( 1.0_wp + 0.05_wp *                      &
-                                       MIN( 600.0_wp,                          &
-                                            diss(k,j,i) * 1.0E4_wp )**0.25_wp  &
+                      k_cr = k_cr0 * ( 1.0_wp + 0.05_wp *                                          &
+                                       MIN( 600.0_wp, diss(k,j,i) * 1.0E4_wp )**0.25_wp            &
                                      )
                    ELSE
@@ -5182,13 +5060,11 @@
 !
 !--                Accretion rate (Seifert and Beheng, 2006):
-                   accr = k_cr * qc(k,j,i) * qr(k,j,i) * phi_ac *              &
-                          SQRT( rho_surface * hyrho(k) )
+                   accr = k_cr * qc(k,j,i) * qr(k,j,i) * phi_ac * SQRT( rho_surface * hyrho(k) )
                    accr = MIN( accr, qc(k,j,i) / dt_micro )
-
                    qr(k,j,i) = qr(k,j,i) + accr * dt_micro * flag
                    qc(k,j,i) = qc(k,j,i) - accr * dt_micro * flag
                    IF ( microphysics_morrison )  THEN
-                      nc(k,j,i) = nc(k,j,i) - MIN( nc(k,j,i),                  &
-                                         accr / xc * hyrho(k) * dt_micro * flag)
+                      nc(k,j,i) = nc(k,j,i) - MIN( nc(k,j,i),                                      &
+                                                   accr / xc * hyrho(k) * dt_micro * flag)
                    ENDIF
 
@@ -5203,9 +5079,9 @@
     END SUBROUTINE accretion
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Accretion rate (Seifert and Beheng, 2006). Call for grid point i,j
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE accretion_ij( i, j )
 
@@ -5229,5 +5105,5 @@
 !--       Predetermine flag to mask topography
           flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
-          IF ( microphysics_morrison ) THEN
+          IF ( microphysics_morrison )  THEN
              nc_accr = nc(k,j,i)
           ELSE
@@ -5235,12 +5111,11 @@
           ENDIF
 
-          IF ( ( qc(k,j,i) > eps_sb )  .AND.  ( qr(k,j,i) > eps_sb )  .AND.    &
-               ( nc_accr > eps_mr ) )  THEN
+          IF ( ( qc(k,j,i) > eps_sb )  .AND.  ( qr(k,j,i) > eps_sb )  .AND.                        &
+               ( nc_accr > eps_mr   ) )  THEN
 !
 !--          Intern time scale of coagulation (Seifert and Beheng, 2006):
              tau_cloud = 1.0_wp - qc(k,j,i) / ( qc(k,j,i) + qr(k,j,i) )
 !
-!--          Universal function for accretion process
-!--          (Seifert and Beheng, 2001):
+!--          Universal function for accretion process (Seifert and Beheng, 2001):
              phi_ac = ( tau_cloud / ( tau_cloud + 5.0E-5_wp ) )**4
 
@@ -5249,11 +5124,10 @@
              xc = MAX( (hyrho(k) * qc(k,j,i) / nc_accr), xcmin)
 !
-!--          Parameterized turbulence effects on autoconversion (Seifert,
-!--          Nuijens and Stevens, 2010). The factor of 1.0E4 is needed to
-!--          convert the dissipation rate (diss) from m2 s-3 to cm2 s-3.
+!--          Parameterized turbulence effects on autoconversion
+!--          (Seifert, Nuijens and Stevens, 2010). The factor of 1.0E4 is needed to convert the
+!--          dissipation rate (diss) from m2 s-3 to cm2 s-3.
              IF ( collision_turbulence )  THEN
-                k_cr = k_cr0 * ( 1.0_wp + 0.05_wp *                            &
-                                 MIN( 600.0_wp,                                &
-                                      diss(k,j,i) * 1.0E4_wp )**0.25_wp        &
+                k_cr = k_cr0 * ( 1.0_wp + 0.05_wp *                                                &
+                                 MIN( 600.0_wp, diss(k,j,i) * 1.0E4_wp )**0.25_wp                  &
                                )
              ELSE
@@ -5262,14 +5136,10 @@
 !
 !--          Accretion rate (Seifert and Beheng, 2006):
-             accr = k_cr * qc(k,j,i) * qr(k,j,i) * phi_ac *                    &
-                    SQRT( rho_surface * hyrho(k) )
+             accr = k_cr * qc(k,j,i) * qr(k,j,i) * phi_ac * SQRT( rho_surface * hyrho(k) )
              accr = MIN( accr, qc(k,j,i) / dt_micro )
-
              qr(k,j,i) = qr(k,j,i) + accr * dt_micro * flag
              qc(k,j,i) = qc(k,j,i) - accr * dt_micro * flag
              IF ( microphysics_morrison )  THEN
-                nc(k,j,i) = nc(k,j,i) - MIN( nc(k,j,i), accr / xc *            &
-                                             hyrho(k) * dt_micro * flag        &
-                                         )
+                nc(k,j,i) = nc(k,j,i) - MIN( nc(k,j,i), accr / xc * hyrho(k) * dt_micro * flag )
              ENDIF
 
@@ -5282,9 +5152,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Collisional breakup rate (Seifert, 2008).
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE selfcollection_breakup
 
@@ -5313,10 +5183,8 @@
 !
 !--                Selfcollection rate (Seifert and Beheng, 2001):
-                   selfcoll = k_rr * nr(k,j,i) * qr(k,j,i) *                   &
-                              SQRT( hyrho(k) * rho_surface )
+                   selfcoll = k_rr * nr(k,j,i) * qr(k,j,i) * SQRT( hyrho(k) * rho_surface )
 !
 !--                Weight averaged diameter of rain drops:
-                   dr = ( hyrho(k) * qr(k,j,i) /                               &
-                          nr(k,j,i) * dpirho_l )**( 1.0_wp / 3.0_wp )
+                   dr = ( hyrho(k) * qr(k,j,i) / nr(k,j,i) * dpirho_l )**( 1.0_wp / 3.0_wp )
 !
 !--                Collisional breakup rate (Seifert, 2008):
@@ -5341,9 +5209,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Collisional breakup rate (Seifert, 2008). Call for grid point i,j
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE selfcollection_breakup_ij( i, j )
 
@@ -5390,10 +5258,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Evaporation of precipitable water. Condensation is neglected for
-!> precipitable water.
-!------------------------------------------------------------------------------!
+!> Evaporation of precipitable water. Condensation is neglected for precipitable water.
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE evaporation_rain
 
@@ -5430,5 +5297,5 @@
 
 !
-!--                Call calculation of supersaturation  
+!--                Call calculation of supersaturation
                    CALL supersaturation ( i, j, k )
 !
@@ -5439,7 +5306,7 @@
                       temp = t_l + lv_d_cp * ( qc(k,j,i) + qr(k,j,i) )
 
-                      g_evap = 1.0_wp / ( ( l_v / ( r_v * temp ) - 1.0_wp ) *     &
-                                          l_v / ( thermal_conductivity_l * temp ) &
-                                          + r_v * temp / ( diff_coeff_l * e_s )   &
+                      g_evap = 1.0_wp / ( ( l_v / ( r_v * temp ) - 1.0_wp ) *                      &
+                                            l_v / ( thermal_conductivity_l  * temp )               &
+                                          + r_v * temp / ( diff_coeff_l * e_s )                    &
                                         )
 !
@@ -5456,10 +5323,8 @@
 !--                      Shape parameter of gamma distribution (Milbrandt and Yau,
 !--                      2005; Stevens and Seifert, 2008):
-                         mu_r = 10.0_wp * ( 1.0_wp + TANH( 1.2E3_wp *          &
-                                                          ( dr - 1.4E-3_wp ) ) )
+                         mu_r = 10.0_wp * ( 1.0_wp + TANH( 1.2E3_wp * ( dr - 1.4E-3_wp ) ) )
 !
 !--                      Slope parameter of gamma distribution (Seifert, 2008):
-                         lambda_r = ( ( mu_r + 3.0_wp ) * ( mu_r + 2.0_wp ) *  &
-                                      ( mu_r + 1.0_wp )                        &
+                         lambda_r = ( ( mu_r + 3.0_wp ) * ( mu_r + 2.0_wp ) * ( mu_r + 1.0_wp )    &
                                     )**( 1.0_wp / 3.0_wp ) / dr
 
@@ -5467,21 +5332,17 @@
                          mu_r_5d2 = mu_r + 2.5_wp
 
-                         f_vent = a_vent * gamm( mu_r_2 ) *                     &
-                                  lambda_r**( -mu_r_2 ) + b_vent *              &
-                                  schmidt_p_1d3 * SQRT( a_term / kin_vis_air ) *&
-                                  gamm( mu_r_5d2 ) * lambda_r**( -mu_r_5d2 ) *  &
-                                  ( 1.0_wp -                                    &
-                                    0.5_wp * ( b_term / a_term ) *              &
-                                    ( lambda_r / ( c_term + lambda_r )          &
-                                    )**mu_r_5d2 -                               &
-                                    0.125_wp * ( b_term / a_term )**2 *         &
-                                    ( lambda_r / ( 2.0_wp * c_term + lambda_r ) &
-                                    )**mu_r_5d2 -                               &
-                                    0.0625_wp * ( b_term / a_term )**3 *        &
-                                    ( lambda_r / ( 3.0_wp * c_term + lambda_r ) &
-                                    )**mu_r_5d2 -                               &
-                                    0.0390625_wp * ( b_term / a_term )**4 *     &
-                                    ( lambda_r / ( 4.0_wp * c_term + lambda_r ) &
-                                    )**mu_r_5d2                                 &
+                         f_vent = a_vent * gamm( mu_r_2 ) *                                        &
+                                  lambda_r**( -mu_r_2 ) + b_vent *                                 &
+                                  schmidt_p_1d3 * SQRT( a_term / kin_vis_air ) *                   &
+                                  gamm( mu_r_5d2 ) * lambda_r**( -mu_r_5d2 ) *                     &
+                                  ( 1.0_wp -                                                       &
+                                    0.5_wp       * ( b_term / a_term ) *                           &
+                                    ( lambda_r / ( c_term + lambda_r ) )**mu_r_5d2          -      &
+                                    0.125_wp     * ( b_term / a_term )**2 *                        &
+                                    ( lambda_r / ( 2.0_wp * c_term + lambda_r ) )**mu_r_5d2 -      &
+                                    0.0625_wp    * ( b_term / a_term )**3 *                        &
+                                    ( lambda_r / ( 3.0_wp * c_term + lambda_r ) )**mu_r_5d2 -      &
+                                    0.0390625_wp * ( b_term / a_term )**4 *                        &
+                                    ( lambda_r / ( 4.0_wp * c_term + lambda_r ) )**mu_r_5d2        &
                                   )
 
@@ -5492,13 +5353,9 @@
                          nr_0   = nr(k,j,i) * dr
                       ENDIF
-   !
-   !--                Evaporation rate of rain water content (Seifert and
-   !--                Beheng, 2006):
-                      evap    = 2.0_wp * pi * nr_0 * g_evap * f_vent * sat /   &
-                                hyrho(k)
+!
+!--                   Evaporation rate of rain water content (Seifert and Beheng, 2006):
+                      evap    = 2.0_wp * pi * nr_0 * g_evap * f_vent * sat / hyrho(k)
                       evap    = MAX( evap, -qr(k,j,i) / dt_micro )
-                      evap_nr = MAX( c_evap * evap / xr * hyrho(k),            &
-                                     -nr(k,j,i) / dt_micro )
-
+                      evap_nr = MAX( c_evap * evap / xr * hyrho(k), - nr(k,j,i) / dt_micro )
                       qr(k,j,i) = qr(k,j,i) + evap    * dt_micro * flag
                       nr(k,j,i) = nr(k,j,i) + evap_nr * dt_micro * flag
@@ -5516,10 +5373,10 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Evaporation of precipitable water. Condensation is neglected for
-!> precipitable water. Call for grid point i,j
-!------------------------------------------------------------------------------!
+!> Evaporation of precipitable water. Condensation is neglected for precipitable water. Call for
+!> grid point i,j
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE evaporation_rain_ij( i, j )
 
@@ -5560,7 +5417,7 @@
                 temp = t_l + lv_d_cp * ( qc(k,j,i) + qr(k,j,i) )
 
-                g_evap = 1.0_wp / ( ( l_v / ( r_v * temp ) - 1.0_wp ) * l_v /  &
-                                    ( thermal_conductivity_l * temp ) +        &
-                                    r_v * temp / ( diff_coeff_l * e_s )        &
+                g_evap = 1.0_wp / ( ( l_v / ( r_v * temp ) - 1.0_wp ) *                            &
+                                      l_v / ( thermal_conductivity_l  * temp )                     &
+                                    + r_v * temp / ( diff_coeff_l * e_s )                          &
                                   )
 !
@@ -5580,6 +5437,5 @@
 !
 !--                Slope parameter of gamma distribution (Seifert, 2008):
-                   lambda_r = ( ( mu_r + 3.0_wp ) * ( mu_r + 2.0_wp ) *        &
-                                ( mu_r + 1.0_wp )                              &
+                   lambda_r = ( ( mu_r + 3.0_wp ) * ( mu_r + 2.0_wp ) * ( mu_r + 1.0_wp )          &
                               )**( 1.0_wp / 3.0_wp ) / dr
 
@@ -5587,25 +5443,20 @@
                    mu_r_5d2 = mu_r + 2.5_wp
 
-                   f_vent = a_vent * gamm( mu_r_2 ) * lambda_r**( -mu_r_2 ) +  &
-                            b_vent * schmidt_p_1d3 *                           &
-                            SQRT( a_term / kin_vis_air ) * gamm( mu_r_5d2 ) *  &
-                            lambda_r**( -mu_r_5d2 ) *                          &
-                            ( 1.0_wp -                                         &
-                              0.5_wp * ( b_term / a_term ) *                   &
-                              ( lambda_r / ( c_term + lambda_r )               &
-                              )**mu_r_5d2 -                                    &
-                              0.125_wp * ( b_term / a_term )**2 *              &
-                              ( lambda_r / ( 2.0_wp * c_term + lambda_r )      &
-                              )**mu_r_5d2 -                                    &
-                              0.0625_wp * ( b_term / a_term )**3 *             &
-                              ( lambda_r / ( 3.0_wp * c_term + lambda_r )      &
-                              )**mu_r_5d2 -                                    &
-                              0.0390625_wp * ( b_term / a_term )**4 *          &
-                              ( lambda_r / ( 4.0_wp * c_term + lambda_r )      &
-                              )**mu_r_5d2                                      &
+                   f_vent = a_vent * gamm( mu_r_2 ) * lambda_r**( -mu_r_2 ) +                      &
+                            b_vent * schmidt_p_1d3 *                                               &
+                            SQRT( a_term / kin_vis_air ) * gamm( mu_r_5d2 ) *                      &
+                            lambda_r**( -mu_r_5d2 ) *                                              &
+                            ( 1.0_wp -                                                             &
+                              0.5_wp       * ( b_term / a_term ) *                                 &
+                              ( lambda_r / ( c_term + lambda_r ) )**mu_r_5d2          -            &
+                              0.125_wp     * ( b_term / a_term )**2 *                              &
+                              ( lambda_r / ( 2.0_wp * c_term + lambda_r ) )**mu_r_5d2 -            &
+                              0.0625_wp    * ( b_term / a_term )**3 *                              &
+                              ( lambda_r / ( 3.0_wp * c_term + lambda_r ) )**mu_r_5d2 -            &
+                              0.0390625_wp * ( b_term / a_term )**4 *                              &
+                              ( lambda_r / ( 4.0_wp * c_term + lambda_r ) )**mu_r_5d2              &
                             )
 
-                   nr_0   = nr(k,j,i) * lambda_r**( mu_r + 1.0_wp ) /           &
-                            gamm( mu_r + 1.0_wp )
+                   nr_0   = nr(k,j,i) * lambda_r**( mu_r + 1.0_wp ) / gamm( mu_r + 1.0_wp )
                 ELSE
                    f_vent = 1.0_wp
@@ -5616,7 +5467,5 @@
                 evap    = 2.0_wp * pi * nr_0 * g_evap * f_vent * sat / hyrho(k)
                 evap    = MAX( evap, -qr(k,j,i) / dt_micro )
-                evap_nr = MAX( c_evap * evap / xr * hyrho(k),                  &
-                               -nr(k,j,i) / dt_micro )
-
+                evap_nr = MAX( c_evap * evap / xr * hyrho(k), - nr(k,j,i) / dt_micro )
                 qr(k,j,i) = qr(k,j,i) + evap    * dt_micro * flag
                 nr(k,j,i) = nr(k,j,i) + evap_nr * dt_micro * flag
@@ -5630,9 +5479,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Sedimentation of cloud droplets (Ackermann et al., 2009, MWR).
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE sedimentation_cloud
 
@@ -5647,6 +5496,6 @@
        REAL(wp) ::  nc_sedi           !<
 
+       REAL(wp), DIMENSION(nzb:nzt+1) ::  sed_nc !<
        REAL(wp), DIMENSION(nzb:nzt+1) ::  sed_qc !<
-       REAL(wp), DIMENSION(nzb:nzt+1) ::  sed_nc !<
 
 
@@ -5663,5 +5512,5 @@
                 flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
 
-                IF ( microphysics_morrison ) THEN
+                IF ( microphysics_morrison )  THEN
                    nc_sedi = nc(k,j,i)
                 ELSE
@@ -5670,48 +5519,45 @@
 
 !
-!--             Sedimentation fluxes for number concentration are only calculated
-!--             for cloud_scheme = 'morrison'
-                IF ( microphysics_morrison ) THEN
+!--             Sedimentation fluxes for number concentration are only calculated for cloud_scheme =
+!--             'morrison'
+                IF ( microphysics_morrison )  THEN
                    IF ( qc(k,j,i) > eps_sb  .AND.  nc(k,j,i) > eps_mr )  THEN
-                      sed_nc(k) = sed_qc_const *                               &
-                              ( qc(k,j,i) * hyrho(k) )**( 2.0_wp / 3.0_wp ) *  &
-                              ( nc(k,j,i) )**( 1.0_wp / 3.0_wp )
+                      sed_nc(k) = sed_qc_const * ( qc(k,j,i) * hyrho(k) )**( 2.0_wp / 3.0_wp ) *   &
+                                  ( nc(k,j,i) )**( 1.0_wp / 3.0_wp )
                    ELSE
                       sed_nc(k) = 0.0_wp
                    ENDIF
 
-                   sed_nc(k) = MIN( sed_nc(k), hyrho(k) * dzu(k+1) *           &
-                                    nc(k,j,i) / dt_micro + sed_nc(k+1)         &
+                   sed_nc(k) = MIN( sed_nc(k), hyrho(k) * dzu(k+1) *                               &
+                                    nc(k,j,i) / dt_micro + sed_nc(k+1)                             &
                                   ) * flag
 
-                   nc(k,j,i) = nc(k,j,i) + ( sed_nc(k+1) - sed_nc(k) ) *       &
-                                         ddzu(k+1) / hyrho(k) * dt_micro * flag
+                   nc(k,j,i) = nc(k,j,i) + ( sed_nc(k+1) - sed_nc(k) ) * ddzu(k+1) /               &
+                               hyrho(k) * dt_micro * flag
                 ENDIF
 
                 IF ( qc(k,j,i) > eps_sb .AND.  nc_sedi > eps_mr )  THEN
-                   sed_qc(k) = sed_qc_const * nc_sedi**( -2.0_wp / 3.0_wp ) *  &
-                               ( qc(k,j,i) * hyrho(k) )**( 5.0_wp / 3.0_wp ) * &
-                                                                           flag
+                   sed_qc(k) = sed_qc_const * nc_sedi**( -2.0_wp / 3.0_wp )  *                     &
+                               ( qc(k,j,i) * hyrho(k) )**( 5.0_wp / 3.0_wp ) * flag
                 ELSE
                    sed_qc(k) = 0.0_wp
                 ENDIF
 
-                sed_qc(k) = MIN( sed_qc(k), hyrho(k) * dzu(k+1) * q(k,j,i) /   &
-                                            dt_micro + sed_qc(k+1)             &
+                sed_qc(k) = MIN( sed_qc(k), hyrho(k) * dzu(k+1) * q(k,j,i) / dt_micro + sed_qc(k+1)&
                                ) * flag
 
-                q(k,j,i)  = q(k,j,i)  + ( sed_qc(k+1) - sed_qc(k) ) *          &
+                q(k,j,i)  = q(k,j,i)  + ( sed_qc(k+1) - sed_qc(k) ) *                              &
                                         ddzu(k+1) / hyrho(k) * dt_micro * flag
-                qc(k,j,i) = qc(k,j,i) + ( sed_qc(k+1) - sed_qc(k) ) *          &
+                qc(k,j,i) = qc(k,j,i) + ( sed_qc(k+1) - sed_qc(k) ) *                              &
                                         ddzu(k+1) / hyrho(k) * dt_micro * flag
-                pt(k,j,i) = pt(k,j,i) - ( sed_qc(k+1) - sed_qc(k) ) *          &
-                                        ddzu(k+1) / hyrho(k) * lv_d_cp *       &
-                                        d_exner(k) * dt_micro            * flag
+                pt(k,j,i) = pt(k,j,i) - ( sed_qc(k+1) - sed_qc(k) ) *                              &
+                                        ddzu(k+1) / hyrho(k) * lv_d_cp *                           &
+                                        d_exner(k) * dt_micro           * flag
 
 !
 !--             Compute the precipitation rate due to cloud (fog) droplets
                 IF ( call_microphysics_at_all_substeps )  THEN
-                   prr(k,j,i) = prr(k,j,i) +  sed_qc(k) / hyrho(k)             &
-                                * weight_substep(intermediate_timestep_count)  &
+                   prr(k,j,i) = prr(k,j,i) +  sed_qc(k) / hyrho(k)                                 &
+                                * weight_substep(intermediate_timestep_count)                      &
                                 * flag
                 ELSE
@@ -5728,10 +5574,10 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Sedimentation of cloud droplets (Ackermann et al., 2009, MWR).
 !> Call for grid point i,j
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE sedimentation_cloud_ij( i, j )
 
@@ -5756,5 +5602,5 @@
 !--       Predetermine flag to mask topography
           flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
-          IF ( microphysics_morrison ) THEN
+          IF ( microphysics_morrison )  THEN
              nc_sedi = nc(k,j,i)
           ELSE
@@ -5762,10 +5608,9 @@
           ENDIF
 !
-!--       Sedimentation fluxes for number concentration are only calculated
-!--       for cloud_scheme = 'morrison'
-          IF ( microphysics_morrison ) THEN
+!--       Sedimentation fluxes for number concentration are only calculated for cloud_scheme =
+!--       'morrison'
+          IF ( microphysics_morrison )  THEN
              IF ( qc(k,j,i) > eps_sb  .AND.  nc(k,j,i) > eps_mr )  THEN
-                sed_nc(k) = sed_qc_const *                                     &
-                            ( qc(k,j,i) * hyrho(k) )**( 2.0_wp / 3.0_wp ) *    &
+                sed_nc(k) = sed_qc_const * ( qc(k,j,i) * hyrho(k) )**( 2.0_wp / 3.0_wp ) *         &
                             ( nc(k,j,i) )**( 1.0_wp / 3.0_wp )
              ELSE
@@ -5773,14 +5618,14 @@
              ENDIF
 
-             sed_nc(k) = MIN( sed_nc(k), hyrho(k) * dzu(k+1) *                 &
-                              nc(k,j,i) / dt_micro + sed_nc(k+1)               &
+             sed_nc(k) = MIN( sed_nc(k), hyrho(k) * dzu(k+1) *                                     &
+                              nc(k,j,i) / dt_micro + sed_nc(k+1)                                   &
                             ) * flag
 
-             nc(k,j,i) = nc(k,j,i) + ( sed_nc(k+1) - sed_nc(k) ) *             &
-                                         ddzu(k+1) / hyrho(k) * dt_micro * flag
+             nc(k,j,i) = nc(k,j,i) + ( sed_nc(k+1) - sed_nc(k) ) * ddzu(k+1) /                     &
+                         hyrho(k) * dt_micro * flag
           ENDIF
 
           IF ( qc(k,j,i) > eps_sb  .AND.  nc_sedi > eps_mr )  THEN
-             sed_qc(k) = sed_qc_const * nc_sedi**( -2.0_wp / 3.0_wp ) *        &
+             sed_qc(k) = sed_qc_const * nc_sedi**( -2.0_wp / 3.0_wp )   *                          &
                          ( qc(k,j,i) * hyrho(k) )**( 5.0_wp / 3.0_wp )  * flag
           ELSE
@@ -5788,21 +5633,19 @@
           ENDIF
 
-          sed_qc(k) = MIN( sed_qc(k), hyrho(k) * dzu(k+1) * q(k,j,i) /         &
-                                      dt_micro + sed_qc(k+1)                   &
+          sed_qc(k) = MIN( sed_qc(k), hyrho(k) * dzu(k+1) * q(k,j,i) / dt_micro + sed_qc(k+1)      &
                          ) * flag
 
-          q(k,j,i)  = q(k,j,i)  + ( sed_qc(k+1) - sed_qc(k) ) * ddzu(k+1) /    &
-                                hyrho(k) * dt_micro * flag
-          qc(k,j,i) = qc(k,j,i) + ( sed_qc(k+1) - sed_qc(k) ) * ddzu(k+1) /    &
-                                hyrho(k) * dt_micro * flag
-          pt(k,j,i) = pt(k,j,i) - ( sed_qc(k+1) - sed_qc(k) ) * ddzu(k+1) /    &
-                                hyrho(k) * lv_d_cp * d_exner(k) * dt_micro     &
-                                                                * flag
+          q(k,j,i)  = q(k,j,i)  + ( sed_qc(k+1) - sed_qc(k) ) *                                    &
+                                  ddzu(k+1) / hyrho(k) * dt_micro * flag
+          qc(k,j,i) = qc(k,j,i) + ( sed_qc(k+1) - sed_qc(k) ) *                                    &
+                                  ddzu(k+1) / hyrho(k) * dt_micro * flag
+          pt(k,j,i) = pt(k,j,i) - ( sed_qc(k+1) - sed_qc(k) ) *                                    &
+                                  ddzu(k+1) / hyrho(k) * lv_d_cp * d_exner(k) * dt_micro * flag
 
 !
 !--       Compute the precipitation rate of cloud (fog) droplets
           IF ( call_microphysics_at_all_substeps )  THEN
-             prr(k,j,i) = prr(k,j,i) + sed_qc(k) / hyrho(k) *                  &
-                              weight_substep(intermediate_timestep_count) * flag
+             prr(k,j,i) = prr(k,j,i) + sed_qc(k) / hyrho(k) *                                      &
+                          weight_substep(intermediate_timestep_count) * flag
           ELSE
              prr(k,j,i) = prr(k,j,i) + sed_qc(k) / hyrho(k) * flag
@@ -5813,9 +5656,9 @@
     END SUBROUTINE sedimentation_cloud_ij
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Sedimentation of ice crystals
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE sedimentation_ice
 
@@ -5824,13 +5667,11 @@
        INTEGER(iwp) ::  k             !< loop index
 
-       REAL(wp) ::  flag              !< flag to indicate first grid level
-       REAL(wp) ::  av = 6.39_wp      !< parameter for calculating fall speed
-       REAL(wp) ::  bv = 0.1666_wp    !< parameter (1/6)
-       REAL(wp) ::  xi = 0.0_wp       !< mean mass of ice crystal
-       REAL(wp) ::  vi = 0.0_wp       !< mean fall speed of ice crystal
-       REAL(wp) ::  factor_sed_gamma_k0 = 0.76_wp !< factor for zeroth moment and
-                                                  !< Âµ =1/3 and nu=0
-       REAL(wp) ::  factor_sed_gamma_k1 = 1.61_wp !< factor for first moment and
-                                                  !< Âµ =1/3 and nu=0
+       REAL(wp) ::  av = 6.39_wp                  !< parameter for calculating fall speed
+       REAL(wp) ::  bv = 0.1666_wp                !< parameter (1/6)
+       REAL(wp) ::  factor_sed_gamma_k0 = 0.76_wp !< factor for zeroth moment and Âµ =1/3 and nu=0
+       REAL(wp) ::  factor_sed_gamma_k1 = 1.61_wp !< factor for first moment and Âµ =1/3 and nu=0
+       REAL(wp) ::  flag                          !< flag to indicate first grid level
+       REAL(wp) ::  xi = 0.0_wp                   !< mean mass of ice crystal
+       REAL(wp) ::  vi = 0.0_wp                   !< mean fall speed of ice crystal
 
        REAL(wp), DIMENSION(nzb:nzt+1) ::  sed_ni  !< sedimentation rate zeroth moment
@@ -5846,5 +5687,5 @@
              DO  k = nzt, nzb+1, -1
 
-                IF ( ni(k,j,i) <= 0.0_wp ) THEN
+                IF ( ni(k,j,i) <= 0.0_wp )  THEN
                    xi = 0.0_wp
                 ELSE
@@ -5853,5 +5694,5 @@
                 ENDIF
 !
-!--             calculate fall speed of ice crystal
+!--             Calculate fall speed of ice crystal
                 vi = av * xi**bv
 !
@@ -5859,6 +5700,5 @@
                 flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
 !
-!--             Calculate sedimentation rate for each grid box, factors are
-!--             calculated using
+!--             Calculate sedimentation rate for each grid box, factors are calculated using !> explanation missing eventually
                 IF ( qi(k,j,i) > eps_sb  .AND.  ni(k,j,i) >= 0.0_wp )  THEN
                    sed_qi(k) = qi(k,j,i) * vi * factor_sed_gamma_k1 * flag
@@ -5870,24 +5710,22 @@
 !
 !--             Calculate sedimentation: divergence of sedimentation flux
-                sed_qi(k) = MIN( sed_qi(k), hyrho(k) * dzu(k+1) * q(k,j,i) /   &
-                                            dt_micro + sed_qi(k+1)             &
+                sed_qi(k) = MIN( sed_qi(k), hyrho(k) * dzu(k+1) * q(k,j,i) / dt_micro + sed_qi(k+1)&
                                ) * flag
 
-                q(k,j,i)  = q(k,j,i)  + ( sed_qi(k+1) - sed_qi(k) ) * ddzu(k+1)&
+                q(k,j,i)  = q(k,j,i)  + ( sed_qi(k+1) - sed_qi(k) ) * ddzu(k+1)                    &
                                       / hyrho(k) * dt_micro * flag
-                qi(k,j,i) = qi(k,j,i) + ( sed_qi(k+1) - sed_qi(k) ) * ddzu(k+1)&
+                qi(k,j,i) = qi(k,j,i) + ( sed_qi(k+1) - sed_qi(k) ) * ddzu(k+1)                    &
                                       / hyrho(k) * dt_micro * flag
-                ni(k,j,i) = ni(k,j,i) + ( sed_ni(k+1) - sed_ni(k) ) * ddzu(k+1)&
+                ni(k,j,i) = ni(k,j,i) + ( sed_ni(k+1) - sed_ni(k) ) * ddzu(k+1)                    &
                                       / hyrho(k) * dt_micro * flag
 
-                pt(k,j,i) = pt(k,j,i) - ( sed_qi(k+1) - sed_qi(k) ) * ddzu(k+1)&
-                                      / hyrho(k) * l_s / c_p * d_exner(k) *    &
+                pt(k,j,i) = pt(k,j,i) - ( sed_qi(k+1) - sed_qi(k) ) * ddzu(k+1)                    &
+                                      / hyrho(k) * l_s / c_p * d_exner(k) *                        &
                                         dt_micro * flag
 !
 !--             Compute the precipitation rate of cloud (fog) droplets
                 IF ( call_microphysics_at_all_substeps )  THEN
-                   prr(k,j,i) = prr(k,j,i) + sed_qi(k) / hyrho(k) *            &
-                                weight_substep(intermediate_timestep_count) *  &
-                                flag
+                   prr(k,j,i) = prr(k,j,i) + sed_qi(k) / hyrho(k) *                                &
+                                weight_substep(intermediate_timestep_count) * flag
                 ELSE
                    prr(k,j,i) = prr(k,j,i) + sed_qi(k) / hyrho(k) * flag
@@ -5903,9 +5741,9 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Sedimentation of ice crystals
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE sedimentation_ice_ij( i, j )
 
@@ -5914,11 +5752,11 @@
        INTEGER(iwp) ::  k             !<
 
-       REAL(wp) ::  flag           !< flag to indicate first grid level
        REAL(wp) ::  av = 6.39_wp   !< parameter for calculating fall speed
        REAL(wp) ::  bv = 0.1666_wp !<
+       REAL(wp) ::  factor_sed_gamma_k0 = 0.76_wp
+       REAL(wp) ::  factor_sed_gamma_k1 = 1.61_wp
+       REAL(wp) ::  flag           !< flag to indicate first grid level
        REAL(wp) ::  xi = 0.0_wp    !< mean mass of ice crystal
        REAL(wp) ::  vi = 0.0_wp    !< mean fall speed of ice crystal
-       REAL(wp) ::  factor_sed_gamma_k0 = 0.76_wp
-       REAL(wp) ::  factor_sed_gamma_k1 = 1.61_wp
 
        REAL(wp), DIMENSION(nzb:nzt+1) ::  sed_ni  !<
@@ -5929,5 +5767,5 @@
 
        DO  k = nzt, nzb+1, -1
-          IF ( ni(k,j,i) <= 0.0_wp ) THEN
+          IF ( ni(k,j,i) <= 0.0_wp )  THEN
              xi = 0.0_wp
           ELSE
@@ -5966,22 +5804,20 @@
           ENDIF
 
-          sed_qi(k) = MIN( sed_qi(k), hyrho(k) * dzu(k+1) * q(k,j,i) /         &
-                                      dt_micro + sed_qi(k+1)                   &
+          sed_qi(k) = MIN( sed_qi(k), hyrho(k) * dzu(k+1) * q(k,j,i) / dt_micro + sed_qi(k+1)      &
                          ) * flag
 
-          q(k,j,i)  = q(k,j,i)  + ( sed_qi(k+1) - sed_qi(k) ) * ddzu(k+1) /    &
+          q(k,j,i)  = q(k,j,i)  + ( sed_qi(k+1) - sed_qi(k) ) * ddzu(k+1) /                        &
                                 hyrho(k) * dt_micro * flag
-          qi(k,j,i) = qi(k,j,i) + ( sed_qi(k+1) - sed_qi(k) ) * ddzu(k+1) /    &
+          qi(k,j,i) = qi(k,j,i) + ( sed_qi(k+1) - sed_qi(k) ) * ddzu(k+1) /                        &
                                 hyrho(k) * dt_micro * flag
-          ni(k,j,i) = ni(k,j,i) + ( sed_ni(k+1) - sed_ni(k) ) * ddzu(k+1) /    &
+          ni(k,j,i) = ni(k,j,i) + ( sed_ni(k+1) - sed_ni(k) ) * ddzu(k+1) /                        &
                                 hyrho(k) * dt_micro * flag
-          pt(k,j,i) = pt(k,j,i) - ( sed_qi(k+1) - sed_qi(k) ) * ddzu(k+1) /    &
-                                hyrho(k) * l_s / c_p * d_exner(k) * dt_micro   &
-                                                                  * flag
+          pt(k,j,i) = pt(k,j,i) - ( sed_qi(k+1) - sed_qi(k) ) * ddzu(k+1) /                        &
+                                hyrho(k) * l_s / c_p * d_exner(k) * dt_micro * flag
 !
 !--       Compute the precipitation rate of cloud (fog) droplets
           IF ( call_microphysics_at_all_substeps )  THEN
-             prr(k,j,i) = prr(k,j,i) + sed_qi(k) / hyrho(k) *                  &
-                              weight_substep(intermediate_timestep_count) * flag
+             prr(k,j,i) = prr(k,j,i) + sed_qi(k) / hyrho(k) *                                      &
+                          weight_substep(intermediate_timestep_count) * flag
           ELSE
              prr(k,j,i) = prr(k,j,i) + sed_qi(k) / hyrho(k) * flag
@@ -5994,10 +5830,10 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Computation of sedimentation flux. Implementation according to Stevens
 !> and Seifert (2008). Code is based on UCLA-LES.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE sedimentation_rain
 
@@ -6046,30 +5882,28 @@
 !
 !--                Weight averaged diameter of rain drops:
-                   dr = ( hyrho(k) * qr(k,j,i) /                               &
-                          nr(k,j,i) * dpirho_l )**( 1.0_wp / 3.0_wp )
+                   dr = ( hyrho(k) * qr(k,j,i) / nr(k,j,i) * dpirho_l )**( 1.0_wp / 3.0_wp )
 !
 !--                Shape parameter of gamma distribution (Milbrandt and Yau, 2005;
 !--                Stevens and Seifert, 2008):
-                   mu_r = 10.0_wp * ( 1.0_wp + TANH( 1.2E3_wp *                &
-                                                     ( dr - 1.4E-3_wp ) ) )
+                   mu_r = 10.0_wp * ( 1.0_wp + TANH( 1.2E3_wp * ( dr - 1.4E-3_wp ) ) )
 !
 !--                Slope parameter of gamma distribution (Seifert, 2008):
-                   lambda_r = ( ( mu_r + 3.0_wp ) * ( mu_r + 2.0_wp ) *        &
+                   lambda_r = ( ( mu_r + 3.0_wp ) * ( mu_r + 2.0_wp ) *                            &
                                 ( mu_r + 1.0_wp ) )**( 1.0_wp / 3.0_wp ) / dr
 
-                   w_nr(k) = MAX( 0.1_wp, MIN( 20.0_wp,                        &
-                                               a_term - b_term * ( 1.0_wp +    &
-                                                  c_term /                     &
-                                                  lambda_r )**( -1.0_wp *      &
-                                                  ( mu_r + 1.0_wp ) )          &
-                                              )                                &
+                   w_nr(k) = MAX( 0.1_wp, MIN( 20.0_wp,                                            &
+                                               a_term - b_term * ( 1.0_wp +                        &
+                                                  c_term /                                         &
+                                                  lambda_r )**( -1.0_wp *                          &
+                                                  ( mu_r + 1.0_wp ) )                              &
+                                              )                                                    &
                                 ) * flag
 
-                   w_qr(k) = MAX( 0.1_wp, MIN( 20.0_wp,                        &
-                                               a_term - b_term * ( 1.0_wp +    &
-                                                  c_term /                     &
-                                                  lambda_r )**( -1.0_wp *      &
-                                                  ( mu_r + 4.0_wp ) )          &
-                                             )                                 &
+                   w_qr(k) = MAX( 0.1_wp, MIN( 20.0_wp,                                            &
+                                               a_term - b_term * ( 1.0_wp +                        &
+                                                  c_term /                                         &
+                                                  lambda_r )**( -1.0_wp *                          &
+                                                  ( mu_r + 4.0_wp ) )                              &
+                                             )                                                     &
                                 ) * flag
                 ELSE
@@ -6108,9 +5942,7 @@
                 flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
 
-                c_nr(k) = 0.25_wp * ( w_nr(k-1) +                              &
-                                      2.0_wp * w_nr(k) + w_nr(k+1) ) *         &
+                c_nr(k) = 0.25_wp * ( w_nr(k-1) + 2.0_wp * w_nr(k) + w_nr(k+1) ) *                 &
                           dt_micro * ddzu(k) * flag
-                c_qr(k) = 0.25_wp * ( w_qr(k-1) +                              &
-                                      2.0_wp * w_qr(k) + w_qr(k+1) ) *         &
+                c_qr(k) = 0.25_wp * ( w_qr(k-1) + 2.0_wp * w_qr(k) + w_qr(k+1) ) *                 &
                           dt_micro * ddzu(k) * flag
              ENDDO
@@ -6128,7 +5960,6 @@
                    d_max  = MAX( qr(k+1,j,i), qr(k,j,i), qr(k-1,j,i) ) - qr(k,j,i)
 
-                   qr_slope(k) = SIGN(1.0_wp, d_mean) * MIN ( 2.0_wp * d_min,  &
-                                                              2.0_wp * d_max,  &
-                                                              ABS( d_mean ) )  &
+                   qr_slope(k) = SIGN(1.0_wp, d_mean) * MIN ( 2.0_wp * d_min, 2.0_wp * d_max,      &
+                                                              ABS( d_mean ) )                      &
                                                       * flag
 
@@ -6137,6 +5968,5 @@
                    d_max  = MAX( nr(k+1,j,i), nr(k,j,i), nr(k-1,j,i) ) - nr(k,j,i)
 
-                   nr_slope(k) = SIGN(1.0_wp, d_mean) * MIN ( 2.0_wp * d_min,  &
-                                                              2.0_wp * d_max,  &
+                   nr_slope(k) = SIGN(1.0_wp, d_mean) * MIN ( 2.0_wp * d_min, 2.0_wp * d_max,      &
                                                               ABS( d_mean ) )
                 ENDDO
@@ -6165,27 +5995,19 @@
                 c_run = MIN( 1.0_wp, c_nr(k) )
                 DO WHILE ( c_run > 0.0_wp  .AND.  k_run <= nzt )
-                   flux  = flux + hyrho(k_run) *                               &
-                           ( nr(k_run,j,i) + nr_slope(k_run) *                 &
-                           ( 1.0_wp - c_run ) * 0.5_wp ) * c_run * dzu(k_run)  &
-                                              * flag
+                   flux  = flux + hyrho(k_run) * ( nr(k_run,j,i) + nr_slope(k_run) *               &
+                           ( 1.0_wp - c_run ) * 0.5_wp ) * c_run * dzu(k_run) * flag
                    z_run = z_run + dzu(k_run) * flag
                    k_run = k_run + 1          * flag
-                   c_run = MIN( 1.0_wp, c_nr(k_run) - z_run * ddzu(k_run) )    &
-                                              * flag
+                   c_run = MIN( 1.0_wp, c_nr(k_run) - z_run * ddzu(k_run) )   * flag
                 ENDDO
 !
-!--             It is not allowed to sediment more rain drop number density than
-!--             available
-                flux = MIN( flux,                                              &
-                            hyrho(k) * dzu(k+1) * nr(k,j,i) + sed_nr(k+1) *    &
-                            dt_micro                                           &
-                          )
+!--             It is not allowed to sediment more rain drop number density than available.
+                flux = MIN( flux, hyrho(k) * dzu(k+1) * nr(k,j,i) + sed_nr(k+1) * dt_micro )
 
                 sed_nr(k) = flux / dt_micro * flag
-                nr(k,j,i) = nr(k,j,i) + ( sed_nr(k+1) - sed_nr(k) ) *          &
+                nr(k,j,i) = nr(k,j,i) + ( sed_nr(k+1) - sed_nr(k) ) *                              &
                                         ddzu(k+1) / hyrho(k) * dt_micro * flag
 !
-!--             Sum up all rain water content which contributes to the flux
-!--             through k-1/2
+!--             Sum up all rain water content which contributes to the flux through k-1/2
                 flux  = 0.0_wp
                 z_run = 0.0_wp ! height above z(k)
@@ -6195,36 +6017,31 @@
                 DO WHILE ( c_run > 0.0_wp  .AND.  k_run <= nzt )
 
-                   flux  = flux + hyrho(k_run) * ( qr(k_run,j,i) +             &
-                                  qr_slope(k_run) * ( 1.0_wp - c_run ) *       &
+                   flux  = flux + hyrho(k_run) * ( qr(k_run,j,i) +                                 &
+                                  qr_slope(k_run) * ( 1.0_wp - c_run ) *                           &
                                   0.5_wp ) * c_run * dzu(k_run) * flag
                    z_run = z_run + dzu(k_run)                   * flag
                    k_run = k_run + 1                            * flag
-                   c_run = MIN( 1.0_wp, c_qr(k_run) - z_run * ddzu(k_run) )    &
+                   c_run = MIN( 1.0_wp, c_qr(k_run) - z_run * ddzu(k_run) )                        &
                                                                 * flag
 
                 ENDDO
 !
-!--             It is not allowed to sediment more rain water content than
-!--             available
-                flux = MIN( flux,                                              &
-                            hyrho(k) * dzu(k) * qr(k,j,i) + sed_qr(k+1) *      &
-                            dt_micro                                           &
-                          )
+!--             It is not allowed to sediment more rain water content than available.
+                flux = MIN( flux, hyrho(k) * dzu(k) * qr(k,j,i) + sed_qr(k+1) * dt_micro )
 
                 sed_qr(k) = flux / dt_micro * flag
 
-                qr(k,j,i) = qr(k,j,i) + ( sed_qr(k+1) - sed_qr(k) ) *          &
+                qr(k,j,i) = qr(k,j,i) + ( sed_qr(k+1) - sed_qr(k) ) *                              &
                                         ddzu(k+1) / hyrho(k) * dt_micro * flag
-                q(k,j,i)  = q(k,j,i)  + ( sed_qr(k+1) - sed_qr(k) ) *          &
+                q(k,j,i)  = q(k,j,i)  + ( sed_qr(k+1) - sed_qr(k) ) *                              &
                                         ddzu(k+1) / hyrho(k) * dt_micro * flag
-                pt(k,j,i) = pt(k,j,i) - ( sed_qr(k+1) - sed_qr(k) ) *          &
-                                        ddzu(k+1) / hyrho(k) * lv_d_cp *       &
+                pt(k,j,i) = pt(k,j,i) - ( sed_qr(k+1) - sed_qr(k) ) *                              &
+                                        ddzu(k+1) / hyrho(k) * lv_d_cp *                           &
                                         d_exner(k) * dt_micro            * flag
 !
 !--             Compute the rain rate
                 IF ( call_microphysics_at_all_substeps )  THEN
-                   prr(k,j,i) = prr(k,j,i) + sed_qr(k) / hyrho(k)             &
-                                * weight_substep(intermediate_timestep_count) &
-                                * flag
+                   prr(k,j,i) = prr(k,j,i) + sed_qr(k) / hyrho(k)                                  &
+                                * weight_substep(intermediate_timestep_count) * flag
                 ELSE
                    prr(k,j,i) = prr(k,j,i) + sed_qr(k) / hyrho(k) * flag
@@ -6240,10 +6057,10 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Computation of sedimentation flux. Implementation according to Stevens
 !> and Seifert (2008). Code is based on UCLA-LES. Call for grid point i,j
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE sedimentation_rain_ij( i, j )
 
@@ -6258,14 +6075,14 @@
        INTEGER(iwp) ::  surf_s        !< Start index of surface elements at (j,i)-gridpoint
 
-       REAL(wp)     ::  c_run                      !<
-       REAL(wp)     ::  d_max                      !<
-       REAL(wp)     ::  d_mean                     !<
-       REAL(wp)     ::  d_min                      !<
-       REAL(wp)     ::  dr                         !<
-       REAL(wp)     ::  flux                       !<
-       REAL(wp)     ::  flag                       !< flag to indicate first grid level above surface
-       REAL(wp)     ::  lambda_r                   !<
-       REAL(wp)     ::  mu_r                       !<
-       REAL(wp)     ::  z_run                      !<
+       REAL(wp)     ::  c_run                     !<
+       REAL(wp)     ::  d_max                     !<
+       REAL(wp)     ::  d_mean                    !<
+       REAL(wp)     ::  d_min                     !<
+       REAL(wp)     ::  dr                        !<
+       REAL(wp)     ::  flux                      !<
+       REAL(wp)     ::  flag                      !< flag to indicate first grid level above surface
+       REAL(wp)     ::  lambda_r                  !<
+       REAL(wp)     ::  mu_r                      !<
+       REAL(wp)     ::  z_run                     !<
 
        REAL(wp), DIMENSION(nzb:nzt+1) ::  c_nr     !<
@@ -6295,18 +6112,16 @@
 !
 !--          Slope parameter of gamma distribution (Seifert, 2008):
-             lambda_r = ( ( mu_r + 3.0_wp ) * ( mu_r + 2.0_wp ) *              &
+             lambda_r = ( ( mu_r + 3.0_wp ) * ( mu_r + 2.0_wp ) *                                  &
                           ( mu_r + 1.0_wp ) )**( 1.0_wp / 3.0_wp ) / dr
 
-             w_nr(k) = MAX( 0.1_wp, MIN( 20.0_wp,                              &
-                                         a_term - b_term * ( 1.0_wp +          &
-                                            c_term / lambda_r )**( -1.0_wp *   &
-                                            ( mu_r + 1.0_wp ) )                &
-                                        )                                      &
+             w_nr(k) = MAX( 0.1_wp, MIN( 20.0_wp,                                                  &
+                                         a_term - b_term * ( 1.0_wp + c_term / lambda_r            &
+                                                           )**( -1.0_wp * ( mu_r + 1.0_wp ) )      &
+                                       )                                                           &
                           ) * flag
-             w_qr(k) = MAX( 0.1_wp, MIN( 20.0_wp,                              &
-                                         a_term - b_term * ( 1.0_wp +          &
-                                            c_term / lambda_r )**( -1.0_wp *   &
-                                            ( mu_r + 4.0_wp ) )                &
-                                       )                                       &
+             w_qr(k) = MAX( 0.1_wp, MIN( 20.0_wp,                                                  &
+                                         a_term - b_term * ( 1.0_wp + c_term / lambda_r            &
+                                                           )**( -1.0_wp * ( mu_r + 4.0_wp ) )      &
+                                       )                                                           &
                           ) * flag
           ELSE
@@ -6345,7 +6160,7 @@
           flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
 
-          c_nr(k) = 0.25_wp * ( w_nr(k-1) + 2.0_wp * w_nr(k) + w_nr(k+1) ) *   &
+          c_nr(k) = 0.25_wp * ( w_nr(k-1) + 2.0_wp * w_nr(k) + w_nr(k+1) ) *                       &
                     dt_micro * ddzu(k) * flag
-          c_qr(k) = 0.25_wp * ( w_qr(k-1) + 2.0_wp * w_qr(k) + w_qr(k+1) ) *   &
+          c_qr(k) = 0.25_wp * ( w_qr(k-1) + 2.0_wp * w_qr(k) + w_qr(k+1) ) *                       &
                     dt_micro * ddzu(k) * flag
        ENDDO
@@ -6363,6 +6178,5 @@
              d_max  = MAX( qr(k+1,j,i), qr(k,j,i), qr(k-1,j,i) ) - qr(k,j,i)
 
-             qr_slope(k) = SIGN(1.0_wp, d_mean) * MIN ( 2.0_wp * d_min,        &
-                                                        2.0_wp * d_max,        &
+             qr_slope(k) = SIGN(1.0_wp, d_mean) * MIN ( 2.0_wp * d_min, 2.0_wp * d_max,            &
                                                         ABS( d_mean ) ) * flag
 
@@ -6371,6 +6185,5 @@
              d_max  = MAX( nr(k+1,j,i), nr(k,j,i), nr(k-1,j,i) ) - nr(k,j,i)
 
-             nr_slope(k) = SIGN(1.0_wp, d_mean) * MIN ( 2.0_wp * d_min,        &
-                                                        2.0_wp * d_max,        &
+             nr_slope(k) = SIGN(1.0_wp, d_mean) * MIN ( 2.0_wp * d_min,  2.0_wp * d_max,           &
                                                         ABS( d_mean ) ) * flag
           ENDDO
@@ -6392,6 +6205,5 @@
           flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
 !
-!--       Sum up all rain drop number densities which contribute to the flux
-!--       through k-1/2
+!--       Sum up all rain drop number densities which contribute to the flux through k-1/2
           flux  = 0.0_wp
           z_run = 0.0_wp ! height above z(k)
@@ -6399,7 +6211,7 @@
           c_run = MIN( 1.0_wp, c_nr(k) )
           DO WHILE ( c_run > 0.0_wp  .AND.  k_run <= nzt )
-             flux  = flux + hyrho(k_run) *                                     &
-                     ( nr(k_run,j,i) + nr_slope(k_run) * ( 1.0_wp - c_run ) *  &
-                     0.5_wp ) * c_run * dzu(k_run) * flag
+             flux  = flux + hyrho(k_run) *                                                         &
+                     ( nr(k_run,j,i) + nr_slope(k_run) * ( 1.0_wp - c_run ) * 0.5_wp ) *           &
+                       c_run *  dzu(k_run)         * flag
              z_run = z_run + dzu(k_run)            * flag
              k_run = k_run + 1                     * flag
@@ -6407,11 +6219,9 @@
           ENDDO
 !
-!--       It is not allowed to sediment more rain drop number density than
-!--       available
-          flux = MIN( flux,                                                    &
-                      hyrho(k) * dzu(k+1) * nr(k,j,i) + sed_nr(k+1) * dt_micro )
+!--       It is not allowed to sediment more rain drop number density than available.
+          flux = MIN( flux, hyrho(k) * dzu(k+1) * nr(k,j,i) + sed_nr(k+1) * dt_micro )
 
           sed_nr(k) = flux / dt_micro * flag
-          nr(k,j,i)  = nr(k,j,i) + ( sed_nr(k+1) - sed_nr(k) ) * ddzu(k+1) /   &
+          nr(k,j,i)  = nr(k,j,i) + ( sed_nr(k+1) - sed_nr(k) ) * ddzu(k+1) /                       &
                                     hyrho(k) * dt_micro * flag
 !
@@ -6425,7 +6235,7 @@
           DO WHILE ( c_run > 0.0_wp  .AND.  k_run <= nzt )
 
-             flux  = flux + hyrho(k_run) *                                     &
-                     ( qr(k_run,j,i) + qr_slope(k_run) * ( 1.0_wp - c_run ) *  &
-                     0.5_wp ) * c_run * dzu(k_run) * flag
+             flux  = flux + hyrho(k_run) *                                                         &
+                     ( qr(k_run,j,i) + qr_slope(k_run) * ( 1.0_wp - c_run ) * 0.5_wp ) *           &
+                       c_run * dzu(k_run)          * flag
              z_run = z_run + dzu(k_run)            * flag
              k_run = k_run + 1                     * flag
@@ -6434,21 +6244,19 @@
           ENDDO
 !
-!--       It is not allowed to sediment more rain water content than available
-          flux = MIN( flux,                                                    &
-                      hyrho(k) * dzu(k) * qr(k,j,i) + sed_qr(k+1) * dt_micro )
+!--       It is not allowed to sediment more rain water content than available.
+          flux = MIN( flux, hyrho(k) * dzu(k) * qr(k,j,i) + sed_qr(k+1) * dt_micro )
 
           sed_qr(k) = flux / dt_micro * flag
 
-          qr(k,j,i) = qr(k,j,i) + ( sed_qr(k+1) - sed_qr(k) ) * ddzu(k+1) /    &
+          qr(k,j,i) = qr(k,j,i) + ( sed_qr(k+1) - sed_qr(k) ) * ddzu(k+1) /                        &
                                 hyrho(k) * dt_micro * flag
-          q(k,j,i)  = q(k,j,i)  + ( sed_qr(k+1) - sed_qr(k) ) * ddzu(k+1) /    &
+          q(k,j,i)  = q(k,j,i)  + ( sed_qr(k+1) - sed_qr(k) ) * ddzu(k+1) /                        &
                                 hyrho(k) * dt_micro * flag
-          pt(k,j,i) = pt(k,j,i) - ( sed_qr(k+1) - sed_qr(k) ) * ddzu(k+1) /    &
-                                hyrho(k) * lv_d_cp * d_exner(k) * dt_micro     &
-                                                                * flag
+          pt(k,j,i) = pt(k,j,i) - ( sed_qr(k+1) - sed_qr(k) ) * ddzu(k+1) /                        &
+                                hyrho(k) * lv_d_cp * d_exner(k) * dt_micro * flag
 !
 !--       Compute the rain rate
           IF ( call_microphysics_at_all_substeps )  THEN
-             prr(k,j,i) = prr(k,j,i) + sed_qr(k) / hyrho(k)                    &
+             prr(k,j,i) = prr(k,j,i) + sed_qr(k) / hyrho(k)                                        &
                           * weight_substep(intermediate_timestep_count) * flag
           ELSE
@@ -6461,10 +6269,10 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Computation of the precipitation amount due to gravitational settling of
-!> rain and cloud (fog) droplets
-!------------------------------------------------------------------------------!
+!> Computation of the precipitation amount due to gravitational settling of rain and cloud (fog)
+!> droplets
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE calc_precipitation_amount
 
@@ -6476,17 +6284,15 @@
        INTEGER(iwp) ::  m             !< running index surface elements
 
-       IF ( ( dt_do2d_xy - time_do2d_xy ) < precipitation_amount_interval .AND.&
-            ( .NOT. call_microphysics_at_all_substeps .OR.                     &
-            intermediate_timestep_count == intermediate_timestep_count_max ) ) &
+       IF ( ( dt_do2d_xy - time_do2d_xy ) < precipitation_amount_interval .AND.                    &
+            ( .NOT. call_microphysics_at_all_substeps .OR.                                         &
+            intermediate_timestep_count == intermediate_timestep_count_max ) )                     &
        THEN
 !
-!--       Run over all upward-facing surface elements, i.e. non-natural,
-!--       natural and urban
+!--       Run over all upward-facing surface elements, i.e. non-natural, natural and urban
           DO  m = 1, bc_h(0)%ns
              i = bc_h(0)%i(m)
              j = bc_h(0)%j(m)
              k = bc_h(0)%k(m)
-             precipitation_amount(j,i) = precipitation_amount(j,i) +           &
-                                               prr(k,j,i) * hyrho(k) * dt_3d
+             precipitation_amount(j,i) = precipitation_amount(j,i) + prr(k,j,i) * hyrho(k) * dt_3d
           ENDDO
 
@@ -6496,10 +6302,10 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> This subroutine computes the precipitation amount due to gravitational
-!> settling of rain and cloud (fog) droplets
-!------------------------------------------------------------------------------!
+!> This subroutine computes the precipitation amount due to gravitational settling of rain and cloud
+!> (fog) droplets
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE calc_precipitation_amount_ij( i, j )
 
@@ -6513,7 +6319,7 @@
        INTEGER(iwp) ::  surf_s        !< Start index of surface elements at (j,i)-gridpoint
 
-       IF ( ( dt_do2d_xy - time_do2d_xy ) < precipitation_amount_interval .AND.&
-            ( .NOT. call_microphysics_at_all_substeps .OR.                     &
-            intermediate_timestep_count == intermediate_timestep_count_max ) ) &
+       IF ( ( dt_do2d_xy - time_do2d_xy ) < precipitation_amount_interval .AND.                    &
+            ( .NOT. call_microphysics_at_all_substeps .OR.                                         &
+            intermediate_timestep_count == intermediate_timestep_count_max ) )                     &
        THEN
 
@@ -6522,6 +6328,5 @@
           DO  m = surf_s, surf_e
              k                         = bc_h(0)%k(m)
-             precipitation_amount(j,i) = precipitation_amount(j,i) +           &
-                                               prr(k,j,i) * hyrho(k) * dt_3d
+             precipitation_amount(j,i) = precipitation_amount(j,i) + prr(k,j,i) * hyrho(k) * dt_3d
           ENDDO
 
@@ -6531,10 +6336,10 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Computation of the diagnostic supersaturation sat, actual liquid water
-!< temperature t_l and saturation water vapor mixing ratio q_s
-!------------------------------------------------------------------------------!
+!> Computation of the diagnostic supersaturation sat, actual liquid water temperature t_l and
+!> saturation water vapor mixing ratio q_s
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE supersaturation ( i,j,k )
 
@@ -6559,18 +6364,17 @@
        alpha = rd_d_rv * lv_d_rd * lv_d_cp / ( t_l * t_l )
 !
-!--    Correction of the approximated value
-!--    (see: Cuijpers + Duynkerke, 1993, JAS, 23)
+!--    Correction of the approximated value (see: Cuijpers + Duynkerke, 1993, JAS, 23)
        q_s   = q_s * ( 1.0_wp + alpha * q(k,j,i) ) / ( 1.0_wp + alpha * q_s )
 
-       IF ( .NOT. microphysics_ice_phase ) THEN
-          IF ( microphysics_seifert ) THEN
+       IF ( .NOT. microphysics_ice_phase )  THEN
+          IF ( microphysics_seifert )  THEN
              sat = ( q(k,j,i) - qr(k,j,i) - qc(k,j,i) ) / q_s - 1.0_wp
-          ELSEIF ( microphysics_morrison_no_rain ) THEN
+          ELSEIF ( microphysics_morrison_no_rain )  THEN
              sat = ( q(k,j,i) - qc(k,j,i) ) / q_s - 1.0_wp
           ENDIF
        ELSE
-          IF ( microphysics_seifert ) THEN
+          IF ( microphysics_seifert )  THEN
              sat = ( q(k,j,i) - qr(k,j,i) - qc(k,j,i) - qi(k,j,i) ) / q_s - 1.0_wp
-          ELSEIF ( microphysics_morrison_no_rain ) THEN
+          ELSEIF ( microphysics_morrison_no_rain )  THEN
              sat = ( q(k,j,i) - qc(k,j,i) - qi(k,j,i) ) / q_s - 1.0_wp
           ENDIF
@@ -6579,10 +6383,10 @@
     END SUBROUTINE supersaturation
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Computation of the diagnostic supersaturation sat, actual liquid water
-!< temperature t_l and saturation water vapor mixing ratio q_s
-!------------------------------------------------------------------------------!
+!> Computation of the diagnostic supersaturation sat, actual liquid water temperature t_l and
+!> saturation water vapor mixing ratio q_s
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE supersaturation_ice ( i, j, k )
 
@@ -6600,6 +6404,5 @@
        temp = t_l + lv_d_cp * ql(k,j,i) + ls_d_cp * qi(k,j,i)
 !
-!--    Calculate water vapor saturation pressure with formular using actual
-!--    temperature
+!--    Calculate water vapor saturation pressure with formular using actual temperature
        e_si = magnus_ice( temp )
 !
@@ -6608,10 +6411,9 @@
 !
 !--    Current vapor pressure
-       e_a = (   q(k,j,i) - qr(k,j,i) - qc(k,j,i) - qi(k,j,i) ) * hyp(k) /     &
+       e_a = (   q(k,j,i) - qr(k,j,i) - qc(k,j,i) - qi(k,j,i) ) * hyp(k) /                         &
              ( ( q(k,j,i) - qr(k,j,i) - qc(k,j,i) - qi(k,j,i) ) + rd_d_rv )
 !
 !--    Supersaturation:
-!--    Not in case of microphysics_kessler or microphysics_sat_adjust
-!--    since qr is unallocated
+!--    Not in case of microphysics_kessler or microphysics_sat_adjust since qr is unallocated
        sat_ice = e_a / e_si - 1.0_wp
 
@@ -6619,11 +6421,11 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
-!> Calculation of the liquid water content (0%-or-100%-scheme). This scheme is
-!> used by the one and the two moment cloud physics scheme. Using the two moment
-!> scheme, this calculation results in the cloud water content.
-!------------------------------------------------------------------------------!
+!> Calculation of the liquid water content (0%-or-100%-scheme). This scheme is used by the one and
+!> the two moment cloud physics scheme. Using the two moment scheme, this calculation results in the
+!> cloud water content.
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE calc_liquid_water_content
 
@@ -6646,6 +6448,5 @@
 !--             Compute the liquid water content
                 IF ( .NOT. microphysics_ice_phase ) THEN
-                   IF ( microphysics_seifert  .AND. .NOT.                      &
-                        microphysics_morrison )  THEN
+                   IF ( microphysics_seifert  .AND. .NOT. microphysics_morrison )  THEN
 !--                   Seifert and Beheng scheme: saturation adjustment
                       IF ( ( q(k,j,i) - q_s - qr(k,j,i) ) > 0.0_wp )  THEN
@@ -6659,11 +6460,11 @@
 !
 !--                Morrison scheme: explicit condensation (see above)
-                   ELSEIF ( microphysics_morrison  .AND.                       &
-                            microphysics_seifert )  THEN
+                   ELSEIF ( microphysics_morrison  .AND.  microphysics_seifert )  THEN
                       ql(k,j,i) = qc(k,j,i) + qr(k,j,i) * flag
+!
 !--                Morrison without rain: explicit condensation
-                   ELSEIF ( microphysics_morrison  .AND.                       &
-                            .NOT. microphysics_seifert )  THEN
+                   ELSEIF ( microphysics_morrison  .AND. .NOT. microphysics_seifert )  THEN
                       ql(k,j,i) = qc(k,j,i)
+!
 !--                Kessler and saturation adjustment scheme
                    ELSE
@@ -6676,16 +6477,12 @@
                       ENDIF
                    ENDIF
-!--             Calculations of liquid water content in case of mixed-phase
-!--             cloud microphyics
+!--             Calculations of liquid water content in case of mixed-phase cloud microphyics
                 ELSE
-                   IF ( microphysics_seifert  .AND.                            &
-                        .NOT. microphysics_morrison ) &
+                   IF ( microphysics_seifert  .AND. .NOT. microphysics_morrison ) &
                    THEN
 !
 !--                   Seifert and Beheng scheme: saturation adjustment
-                      IF ( ( q(k,j,i)                                          &
-                             - q_s - qr(k,j,i) - qi(k,j,i) ) > 0.0_wp )  THEN
-                         qc(k,j,i) = ( q(k,j,i) - q_s - qr(k,j,i) - qi(k,j,i) )&
-                                       * flag
+                      IF ( ( q(k,j,i) - q_s - qr(k,j,i) - qi(k,j,i) ) > 0.0_wp )  THEN
+                         qc(k,j,i) = ( q(k,j,i) - q_s - qr(k,j,i) - qi(k,j,i) ) * flag
                          ql(k,j,i) = ( qc(k,j,i) + qr(k,j,i) ) * flag
                       ELSE
@@ -6696,12 +6493,13 @@
                          ql(k,j,i) = qr(k,j,i) * flag
                       ENDIF
+!
 !--                Morrison scheme: explicit condensation (see above)
-                   ELSEIF ( microphysics_morrison  .AND.                       &
-                            microphysics_seifert )  THEN
+                   ELSEIF ( microphysics_morrison  .AND.  microphysics_seifert )  THEN
                       ql(k,j,i) = qc(k,j,i) + qr(k,j,i) * flag
+!
 !--                Morrison without rain: explicit condensation
-                   ELSEIF ( microphysics_morrison  .AND.                       &
-                            .NOT. microphysics_seifert )  THEN
+                   ELSEIF ( microphysics_morrison  .AND. .NOT. microphysics_seifert )  THEN
                       ql(k,j,i) = qc(k,j,i)
+!
 !--                Kessler and saturation adjustment scheme
                    ELSE
@@ -6721,11 +6519,10 @@
     END SUBROUTINE calc_liquid_water_content
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> This function computes the gamma function (Press et al., 1992).
-!> The gamma function is needed for the calculation of the evaporation
-!> of rain drops.
-!------------------------------------------------------------------------------!
+!> The gamma function is needed for the calculation of the evaporation of rain drops.
+!--------------------------------------------------------------------------------------------------!
     FUNCTION gamm( xx )
 
@@ -6743,9 +6540,9 @@
 
        REAL(wp), PARAMETER  ::  stp = 2.5066282746310005_wp               !<
-       REAL(wp), PARAMETER  ::  cof(6) = (/ 76.18009172947146_wp,      &
-                                           -86.50532032941677_wp,      &
-                                            24.01409824083091_wp,      &
-                                            -1.231739572450155_wp,     &
-                                             0.1208650973866179E-2_wp, &
+       REAL(wp), PARAMETER  ::  cof(6) = (/ 76.18009172947146_wp,                                  &
+                                           -86.50532032941677_wp,                                  &
+                                            24.01409824083091_wp,                                  &
+                                            -1.231739572450155_wp,                                 &
+                                             0.1208650973866179E-2_wp,                             &
                                             -0.5395239384953E-5_wp /)     !<
 
@@ -6762,7 +6559,7 @@
 
 !
-!--    Until this point the algorithm computes the logarithm of the gamma
-!--    function. Hence, the exponential function is used.
-!       gamm = EXP( tmp + LOG( stp * ser / x_gamm ) )
+!--    Until this point the algorithm computes the logarithm of the gamma function. Hence, the
+!--    exponential function is used.
+!      gamm = EXP( tmp + LOG( stp * ser / x_gamm ) )
        gamm = EXP( tmp ) * stp * ser / x_gamm
 
Index: palm/trunk/SOURCE/buoyancy.f90
===================================================================
--- palm/trunk/SOURCE/buoyancy.f90	(revision 4541)
+++ palm/trunk/SOURCE/buoyancy.f90	(revision 4542)
@@ -1,20 +1,20 @@
 !> @file buoyancy.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:
@@ -25,9 +25,12 @@
 ! -----------------
 ! $Id$
+! file re-formatted to follow the PALM coding standard
+!
+! 4360 2020-01-07 11:25:50Z suehring
 ! Corrected "Former revisions" section
-! 
+!
 ! 3725 2019-02-07 10:11:02Z raasch
 ! unused variables removed
-! 
+!
 ! 3655 2019-01-07 16:51:22Z knoop
 ! nopointer option removed
@@ -41,16 +44,16 @@
 !> Buoyancy term of the third component of the equation of motion.
 !> @attention Humidity is not regarded when using a sloping surface!
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
  MODULE buoyancy_mod
 
-    USE basic_constants_and_equations_mod,                                     &
+    USE basic_constants_and_equations_mod,                                                         &
         ONLY:  g
 
-    USE arrays_3d,                                                             &
+    USE arrays_3d,                                                                                 &
         ONLY:  pt, pt_slope_ref, ref_state, tend
 
-    USE control_parameters,                                                    &
-        ONLY:  atmos_ocean_sign, cos_alpha_surface, message_string, pt_surface,&
-               sin_alpha_surface, sloping_surface
+    USE control_parameters,                                                                        &
+        ONLY:  atmos_ocean_sign, cos_alpha_surface, message_string, pt_surface, sin_alpha_surface, &
+               sloping_surface
 
     USE kinds
@@ -67,12 +70,12 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Call for all grid points
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE buoyancy( var, wind_component )
 
-       USE indices,                                                            &
+       USE indices,                                                                                &
            ONLY:  nxl, nxlu, nxr, nyn, nys, nzb, nzt
 
@@ -84,5 +87,5 @@
        INTEGER(iwp) ::  k              !<
        INTEGER(iwp) ::  wind_component !<
-       
+
        REAL(wp), DIMENSION(:,:,:), POINTER ::  var
 
@@ -98,9 +101,9 @@
              DO  j = nys, nyn
                 DO  k = nzb+1, nzt-1
-                   tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5_wp *  &
-                          (                                                     &
-                             ( var(k,j,i)   - ref_state(k) )   / ref_state(k) + &
-                             ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1) &
-                          )
+                   tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5_wp *                     &
+                                 (                                                                 &
+                                    ( var(k,j,i)   - ref_state(k) )   / ref_state(k) +             &
+                                    ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1)             &
+                                 )
                 ENDDO
              ENDDO
@@ -109,9 +112,9 @@
        ELSE
 !
-!--       Buoyancy term for a surface with a slope in x-direction. The equations
-!--       for both the u and w velocity-component contain proportionate terms.
+!--       Buoyancy term for a surface with a slope in x-direction. The equations for both the u and
+!         w velocity-component contain proportionate terms.
 !--       Temperature field at time t=0 serves as environmental temperature.
-!--       Reference temperature (pt_surface) is the one at the lower left corner
-!--       of the total domain.
+!--       Reference temperature (pt_surface) is the one at the lower left corner of the total
+!--       domain.
           IF ( wind_component == 1 )  THEN
 
@@ -119,8 +122,8 @@
                 DO  j = nys, nyn
                    DO  k = nzb+1, nzt-1
-                      tend(k,j,i) = tend(k,j,i) + g * sin_alpha_surface *         &
-                           0.5_wp * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
-                                    - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
-                                    ) / pt_surface
+                      tend(k,j,i) = tend(k,j,i) + g * sin_alpha_surface *                          &
+                                    0.5_wp * ( ( pt(k,j,i-1)         + pt(k,j,i)         )         &
+                                             - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) )         &
+                                             ) / pt_surface
                    ENDDO
                 ENDDO
@@ -132,8 +135,8 @@
                 DO  j = nys, nyn
                    DO  k = nzb+1, nzt-1
-                      tend(k,j,i) = tend(k,j,i) + g * cos_alpha_surface *         &
-                           0.5_wp * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
-                                    - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
-                                    ) / pt_surface
+                      tend(k,j,i) = tend(k,j,i) + g * cos_alpha_surface *                          &
+                                    0.5_wp * ( ( pt(k,j,i)         + pt(k+1,j,i)         )         &
+                                             - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) )         &
+                                             ) / pt_surface
                    ENDDO
                 ENDDO
@@ -141,7 +144,6 @@
 
           ELSE
-             
-             WRITE( message_string, * ) 'no term for component "',             &
-                                       wind_component,'"'
+
+             WRITE( message_string, * ) 'no term for component "', wind_component, '"'
              CALL message( 'buoyancy', 'PA0159', 1, 2, 0, 6, 0 )
 
@@ -153,16 +155,16 @@
 
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> Call for grid point i,j
-!> @attention PGI-compiler creates SIGFPE if opt>1 is used! Therefore, opt=1 is
-!>            forced by compiler-directive.
-!------------------------------------------------------------------------------!
+!> @attention PGI-compiler creates SIGFPE if opt>1 is used! Therefore, opt=1 is forced by
+!>            compiler-directive.
+!--------------------------------------------------------------------------------------------------!
 !pgi$r opt=1
     SUBROUTINE buoyancy_ij( i, j, var, wind_component )
 
 
-       USE indices,                                                            &
+       USE indices,                                                                                &
            ONLY:  nzb, nzt
 
@@ -173,5 +175,5 @@
        INTEGER(iwp) ::  k              !<
        INTEGER(iwp) ::  wind_component !<
-       
+
        REAL(wp), DIMENSION(:,:,:), POINTER ::  var
 
@@ -181,7 +183,7 @@
 !--       Normal case: horizontal surface
           DO  k = nzb+1, nzt-1
-              tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5_wp * (    &
-                        ( var(k,j,i)   - ref_state(k)   ) / ref_state(k)   +   &
-                        ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1)     &
+              tend(k,j,i) = tend(k,j,i) + atmos_ocean_sign * g * 0.5_wp * (                        &
+                            ( var(k,j,i)   - ref_state(k)   ) / ref_state(k)   +                   &
+                            ( var(k+1,j,i) - ref_state(k+1) ) / ref_state(k+1)                     &
                                                                           )
           ENDDO
@@ -189,16 +191,16 @@
        ELSE
 !
-!--       Buoyancy term for a surface with a slope in x-direction. The equations
-!--       for both the u and w velocity-component contain proportionate terms.
+!--       Buoyancy term for a surface with a slope in x-direction. The equations for both the u and
+!--       w velocity-component contain proportionate terms.
 !--       Temperature field at time t=0 serves as environmental temperature.
-!--       Reference temperature (pt_surface) is the one at the lower left corner
-!--       of the total domain.
+!--       Reference temperature (pt_surface) is the one at the lower left corner of the total
+!--       domain.
           IF ( wind_component == 1 )  THEN
 
              DO  k = nzb+1, nzt-1
-                tend(k,j,i) = tend(k,j,i) + g * sin_alpha_surface *               &
-                           0.5_wp * ( ( pt(k,j,i-1)         + pt(k,j,i)         ) &
-                                    - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) ) &
-                                    ) / pt_surface
+                tend(k,j,i) = tend(k,j,i) + g * sin_alpha_surface *                                &
+                              0.5_wp * ( ( pt(k,j,i-1)         + pt(k,j,i)         )               &
+                                       - ( pt_slope_ref(k,i-1) + pt_slope_ref(k,i) )               &
+                                       ) / pt_surface
              ENDDO
 
@@ -206,14 +208,13 @@
 
              DO  k = nzb+1, nzt-1
-                tend(k,j,i) = tend(k,j,i) + g * cos_alpha_surface *               &
-                           0.5_wp * ( ( pt(k,j,i)         + pt(k+1,j,i)         ) &
-                                    - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) ) &
-                                    ) / pt_surface
+                tend(k,j,i) = tend(k,j,i) + g * cos_alpha_surface *                                &
+                              0.5_wp * ( ( pt(k,j,i)         + pt(k+1,j,i)         )               &
+                                       - ( pt_slope_ref(k,i) + pt_slope_ref(k+1,i) )               &
+                                       ) / pt_surface
              ENDDO
 
           ELSE
 
-             WRITE( message_string, * ) 'no term for component "',             &
-                                       wind_component,'"'
+             WRITE( message_string, * ) 'no term for component "', wind_component, '"'
              CALL message( 'buoyancy', 'PA0159', 1, 2, 0, 6, 0 )
 
Index: palm/trunk/SOURCE/calc_mean_profile.f90
===================================================================
--- palm/trunk/SOURCE/calc_mean_profile.f90	(revision 4541)
+++ palm/trunk/SOURCE/calc_mean_profile.f90	(revision 4542)
@@ -1,20 +1,20 @@
 !> @file calc_mean_profile.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 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.
+! 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/>.
+! 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:
@@ -25,16 +25,19 @@
 ! -----------------
 ! $Id$
+! file re-formatted to follow the PALM coding standard
+!
+! 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
-! 
+!
 ! 4182 2019-08-22 15:20:23Z scharf
 ! Corrected "Former revisions" section
-! 
+!
 ! 3655 2019-01-07 16:51:22Z knoop
 ! nopointer option removed
-! 
+!
 ! 1365 2014-04-22 15:03:56Z boeske
 ! Initial revision
@@ -47,5 +50,5 @@
 !------------------------------------------------------------------------------!
  MODULE calc_mean_profile_mod
- 
+
 
     PRIVATE
@@ -58,17 +61,16 @@
  CONTAINS
 
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
 ! Description:
 ! ------------
 !> @todo Missing subroutine description.
-!------------------------------------------------------------------------------!
+!--------------------------------------------------------------------------------------------------!
     SUBROUTINE calc_mean_profile( var, pr )
 
-       USE control_parameters,                                                 &
+       USE control_parameters,                                                                     &
            ONLY:  intermediate_timestep_count
 
-       USE indices,                                                            &
-           ONLY:  ngp_2dh_s_inner, nxl, nxr, nyn, nys, nzb, nzb, nzt,          &
-                  wall_flags_total_0
+       USE indices,                                                                                &
+           ONLY:  ngp_2dh_s_inner, nxl, nxr, nyn, nys, nzb, nzb, nzt, wall_flags_total_0
 
        USE kinds
@@ -76,29 +78,27 @@
        USE pegrid
 
-       USE statistics,                                                         &
+       USE statistics,                                                                             &
            ONLY:  flow_statistics_called, hom, sums, sums_l
 
 
        IMPLICIT NONE
-       
+
        INTEGER(iwp) ::  i                  !<
        INTEGER(iwp) ::  j                  !<
        INTEGER(iwp) ::  k                  !<
-       INTEGER(iwp) ::  pr                 !< 
+       INTEGER(iwp) ::  pr                 !<
 !$     INTEGER(iwp) ::  omp_get_thread_num !<
        INTEGER(iwp) ::  tn                 !<
-       
+
        REAL(wp), DIMENSION(:,:,:), POINTER ::  var
 
 !
-!--    Computation of the horizontally averaged profile of variable var, unless
-!--    already done by the relevant call from flow_statistics. The calculation
-!--    is done only for the first respective intermediate timestep in order to
-!--    spare communication time and to produce identical model results with jobs
-!--    which are calling flow_statistics at different time intervals. At 
+!--    Computation of the horizontally averaged profile of variable var, unless already done by the
+!--    relevant call from flow_statistics. The calculation is done only for the first respective
+!--    intermediate timestep in order to spare communication time and to produce identical model
+!--    results with jobs which are calling flow_statistics at different time intervals. At
 !--    initialization, intermediate_timestep_count = 0 is considered as well.
 
-       IF ( .NOT. flow_statistics_called  .AND.                                &
-            intermediate_timestep_count <= 1 )  THEN
+       IF ( .NOT. flow_statistics_called  .AND.  intermediate_timestep_count <= 1 )  THEN
 
 !
@@ -112,7 +112,6 @@
              DO  j =  nys, nyn
                 DO  k = nzb, nzt+1
-                   sums_l(k,pr,tn) = sums_l(k,pr,tn) + var(k,j,i)              &
-                                     * MERGE( 1.0_wp, 0.0_wp,                  &
-                                          BTEST( wall_flags_total_0(k,j,i), 22 ) )
+                   sums_l(k,pr,tn) = sums_l(k,pr,tn) + var(k,j,i) * MERGE( 1.0_wp, 0.0_wp,         &
+                                                            BTEST( wall_flags_total_0(k,j,i), 22 ) )
                 ENDDO
              ENDDO
@@ -127,6 +126,6 @@
 
           IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
-          CALL MPI_ALLREDUCE( sums_l(nzb,pr,0), sums(nzb,pr), nzt+2-nzb,       &
-                              MPI_REAL, MPI_SUM, comm2d, ierr )
+          CALL MPI_ALLREDUCE( sums_l(nzb,pr,0), sums(nzb,pr), nzt+2-nzb, MPI_REAL, MPI_SUM, comm2d,&
+                              ierr )
 
 #else
Index: palm/trunk/SOURCE/check_for_restart.f90
===================================================================
--- palm/trunk/SOURCE/check_for_restart.f90	(revision 4541)
+++ palm/trunk/SOURCE/check_for_restart.f90	(revision 4542)
@@ -1,20 +1,19 @@
 !> @file check_for_restart.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:
@@ -25,6 +24,9 @@
 ! -----------------
 ! $Id$
+! file re-formatted to follow the PALM coding standard
+!
+! 4360 2020-01-07 11:25:50Z suehring
 ! Corrected "Former revisions" section
-! 
+!
 ! 3655 2019-01-07 16:51:22Z knoop
 ! Error messages revised
@@ -36,16 +38,13 @@
 ! Description:
 ! ------------
-!> Set stop flag, if restart is neccessary because of expiring cpu-time or
-!> if it is forced by user
-!------------------------------------------------------------------------------!
+!> Set stop flag, if restart is neccessary because of expiring cpu-time or if it is forced by user.
+!--------------------------------------------------------------------------------------------------!
  SUBROUTINE check_for_restart
- 
-
-    USE control_parameters,                                                    &
-        ONLY:  coupling_mode, dt_restart, end_time, message_string,            &
-               run_description_header, simulated_time, terminate_coupled,      &
-               terminate_coupled_remote, terminate_run,                        &
-               termination_time_needed, time_restart,                          &
-               time_since_reference_point, write_binary
+
+
+    USE control_parameters,                                                                        &
+        ONLY:  coupling_mode, dt_restart, end_time, message_string, run_description_header,        &
+               simulated_time, terminate_coupled, terminate_coupled_remote, terminate_run,         &
+               termination_time_needed, time_restart, time_since_reference_point, write_binary
 
     USE kinds
@@ -53,5 +52,5 @@
     USE pegrid
 
-    USE pmc_interface,                                                         &
+    USE pmc_interface,                                                                             &
         ONLY:  comm_world_nesting, cpl_id, nested_run
 
@@ -80,6 +79,5 @@
 
 !
-!-- Set the global communicator to be used (depends on the mode in which PALM is
-!-- running)
+!-- Set the global communicator to be used (depends on the mode in which PALM is running)
     IF ( nested_run )  THEN
        global_communicator = comm_world_nesting
@@ -90,9 +88,9 @@
 #if defined( __parallel )
 !
-!-- Make a logical OR for all processes. Stop the model run if at least
-!-- one process has reached the time limit.
+!-- Make a logical OR for all processes. Stop the model run if at least one process has reached the
+!-- time limit.
     IF ( collective_wait )  CALL MPI_BARRIER( global_communicator, ierr )
-    CALL MPI_ALLREDUCE( terminate_run_l, terminate_run, 1, MPI_LOGICAL,     &
-                        MPI_LOR, global_communicator, ierr )
+    CALL MPI_ALLREDUCE( terminate_run_l, terminate_run, 1, MPI_LOGICAL, MPI_LOR,                   &
+                        global_communicator, ierr )
 #else
     terminate_run = terminate_run_l
@@ -102,17 +100,16 @@
 !-- Output that job will be terminated
     IF ( terminate_run  .AND.  myid == 0 )  THEN
-       WRITE( message_string, * ) 'run will be terminated because it is ',     &
-                       'running out of job cpu limit & ',                      &
-                       'remaining time:         ', remaining_time, ' s &',     &
-                       'termination time needed:', termination_time_needed, ' s'
+       WRITE( message_string, * ) 'run will be terminated because it is ',                         &
+                                  'running out of job cpu limit & ',                               &
+                                  'remaining time:         ', remaining_time, ' s &',              &
+                                  'termination time needed:', termination_time_needed, ' s'
        CALL message( 'check_for_restart', 'PA0163', 0, 1, 0, 6, 0 )
     ENDIF
 
 !
-!-- In case of coupled runs inform the remote model of the termination 
-!-- and its reason, provided the remote model has not already been 
-!-- informed of another termination reason (terminate_coupled > 0) before, 
-!-- or vice versa (terminate_coupled_remote > 0).
-    IF ( terminate_run .AND. TRIM( coupling_mode ) /= 'uncoupled'  .AND.       &
+!-- In case of coupled runs inform the remote model of the termination and its reason, provided the
+!-- remote model has not already been informed of another termination reason (terminate_coupled > 0)
+!-- before, or vice versa (terminate_coupled_remote > 0).
+    IF ( terminate_run .AND. TRIM( coupling_mode ) /= 'uncoupled'  .AND.                           &
          terminate_coupled == 0  .AND.  terminate_coupled_remote == 0 )  THEN
 
@@ -121,18 +118,17 @@
 #if defined( __parallel )
        IF ( myid == 0 ) THEN
-          CALL MPI_SENDRECV( terminate_coupled,        1, MPI_INTEGER,         &
-                             target_id, 0,                                     &
-                             terminate_coupled_remote, 1, MPI_INTEGER,         &
-                             target_id, 0,                                     &
+          CALL MPI_SENDRECV( terminate_coupled,        1, MPI_INTEGER,                             &
+                             target_id, 0,                                                         &
+                             terminate_coupled_remote, 1, MPI_INTEGER,                             &
+                             target_id, 0,                                                         &
                              comm_inter, status, ierr )
        ENDIF
-       CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0, comm2d,    &
-                       ierr )
-#endif
-    ENDIF
-
-
-!
-!-- Check if a flag file exists that forces a termination of the model
+       CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0, comm2d, ierr )
+#endif
+    ENDIF
+
+
+!
+!-- Check if a flag file exists that forces a termination of the model.
     IF ( myid == 0 )  THEN
        INQUIRE(FILE="DO_STOP_NOW", EXIST=do_stop_now)
@@ -143,9 +139,9 @@
           terminate_run_l = .TRUE.
 
-          WRITE( message_string, * ) 'run will be terminated because user ',   &
-                                  'forced a job finalization using a flag',    &
-                                  'file:',                                     &
-                                  '&DO_STOP_NOW: ', do_stop_now,               &
-                                  '&DO_RESTART_NOW: ', do_restart_now 
+          WRITE( message_string, * ) 'run will be terminated because user ',                       &
+                                     'forced a job finalization using a flag',                     &
+                                     'file:',                                                      &
+                                     '&DO_STOP_NOW: ', do_stop_now,                                &
+                                     '&DO_RESTART_NOW: ', do_restart_now
           CALL message( 'check_for_restart', 'PA0398', 0, 0, 0, 6, 0 )
 
@@ -156,9 +152,8 @@
 #if defined( __parallel )
 !
-!-- Make a logical OR for all processes. Stop the model run if a flag file has
-!-- been detected above.
+!-- Make a logical OR for all processes. Stop the model run if a flag file has been detected above.
     IF ( collective_wait )  CALL MPI_BARRIER( global_communicator, ierr )
-    CALL MPI_ALLREDUCE( terminate_run_l, terminate_run, 1, MPI_LOGICAL,        &
-                        MPI_LOR, global_communicator, ierr )
+    CALL MPI_ALLREDUCE( terminate_run_l, terminate_run, 1, MPI_LOGICAL, MPI_LOR,                   &
+                        global_communicator, ierr )
 #else
     terminate_run = terminate_run_l
@@ -166,9 +161,8 @@
 
 !
-!-- In case of coupled runs inform the remote model of the termination 
-!-- and its reason, provided the remote model has not already been 
-!-- informed of another termination reason (terminate_coupled > 0) before,
-!-- or vice versa (terminate_coupled_remote > 0).
-    IF ( terminate_run .AND. coupling_mode /= 'uncoupled' .AND.                &
+!-- In case of coupled runs inform the remote model of the termination and its reason, provided the
+!-- remote model has not already been informed of another termination reason (terminate_coupled > 0)
+!-- before, or vice versa (terminate_coupled_remote > 0).
+    IF ( terminate_run .AND. coupling_mode /= 'uncoupled' .AND.                                    &
          terminate_coupled == 0 .AND.  terminate_coupled_remote == 0 )  THEN
 
@@ -177,12 +171,11 @@
 #if defined( __parallel )
        IF ( myid == 0 ) THEN
-          CALL MPI_SENDRECV( terminate_coupled,        1, MPI_INTEGER,      &
-                             target_id,  0,                                 &
-                             terminate_coupled_remote, 1, MPI_INTEGER,      &
-                             target_id,  0,                                 &
-                             comm_inter, status, ierr )   
-       ENDIF
-       CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0,         &
-                       comm2d, ierr )  
+          CALL MPI_SENDRECV( terminate_coupled,        1, MPI_INTEGER,                             &
+                             target_id,  0,                                                        &
+                             terminate_coupled_remote, 1, MPI_INTEGER,                             &
+                             target_id,  0,                                                        &
+                             comm_inter, status, ierr )
+       ENDIF
+       CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0, comm2d, ierr )
 #endif
 
@@ -191,15 +184,13 @@
 !
 !-- Set the stop flag also, if restart is forced by user settings
-    IF ( time_restart /= 9999999.9_wp  .AND.                                   &
-         time_restart < time_since_reference_point )  THEN
-
-!
-!--    Restart is not neccessary, if the end time of the run (given by
-!--    the user) has been reached
+    IF ( time_restart /= 9999999.9_wp  .AND.  time_restart < time_since_reference_point )  THEN
+
+!
+!--    Restart is not neccessary, if the end time of the run (given by the user) has been reached.
        IF ( simulated_time < end_time )  THEN
           terminate_run = .TRUE.
 !
-!--       Increment restart time, if forced by user, otherwise set restart
-!--       time to default (no user restart)
+!--       Increment restart time, if forced by user, otherwise set restart time to default (no user
+!--       restart).
           IF ( dt_restart /= 9999999.9_wp )  THEN
              time_restart = time_restart + dt_restart
@@ -208,16 +199,15 @@
           ENDIF
 
-          WRITE( message_string, * ) 'run will be terminated due to user ',    &
-                                  'settings of ',                              &
-                                  'restart_time / dt_restart, ',               &
-                                  'new restart time is: ', time_restart, ' s' 
+          WRITE( message_string, * ) 'run will be terminated due to user ',                        &
+                                     'settings of ',                                               &
+                                     'restart_time / dt_restart, ',                                &
+                                     'new restart time is: ', time_restart, ' s'
           CALL message( 'check_for_restart', 'PA0164', 0, 0, 0, 6, 0 )
- 
-!
-!--       In case of coupled runs inform the remote model of the termination 
-!--       and its reason, provided the remote model has not already been 
-!--       informed of another termination reason (terminate_coupled > 0) before,
-!--       or vice versa (terminate_coupled_remote > 0).
-          IF ( coupling_mode /= 'uncoupled' .AND. terminate_coupled == 0       &
+
+!
+!--       In case of coupled runs inform the remote model of the termination and its reason,
+!--       provided the remote model has not already been informed of another termination reason
+!--       (terminate_coupled > 0) before, or vice versa (terminate_coupled_remote > 0).
+          IF ( coupling_mode /= 'uncoupled' .AND. terminate_coupled == 0                           &
                .AND.  terminate_coupled_remote == 0 )  THEN
 
@@ -229,12 +219,11 @@
 #if defined( __parallel )
              IF ( myid == 0 ) THEN
-                CALL MPI_SENDRECV( terminate_coupled,        1, MPI_INTEGER,   &
-                                   target_id,  0,                              &
-                                   terminate_coupled_remote, 1, MPI_INTEGER,   &
-                                   target_id,  0,                              &
-                                   comm_inter, status, ierr )   
+                CALL MPI_SENDRECV( terminate_coupled,        1, MPI_INTEGER,                       &
+                                   target_id,  0,                                                  &
+                                   terminate_coupled_remote, 1, MPI_INTEGER,                       &
+                                   target_id,  0,                                                  &
+                                   comm_inter, status, ierr )
              ENDIF
-             CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0,      &
-                             comm2d, ierr )  
+             CALL MPI_BCAST( terminate_coupled_remote, 1, MPI_INTEGER, 0, comm2d, ierr )
 #endif
           ENDIF
@@ -245,9 +234,7 @@
 
 !
-!-- If the run is stopped, set a flag file which is necessary to initiate
-!-- the start of a continuation run, except if the user forced to stop the
-!-- run without restart
-    IF ( terminate_run  .AND.  myid == 0  .AND.  cpl_id == 1  .AND.            &
-         .NOT. do_stop_now)  THEN
+!-- If the run is stopped, set a flag file which is necessary to initiate the start of a
+!-- continuation run, except if the user forced to stop the run without restart.
+    IF ( terminate_run  .AND.  myid == 0  .AND.  cpl_id == 1  .AND.  .NOT. do_stop_now)  THEN
 
        OPEN ( 90, FILE='CONTINUE_RUN', FORM='FORMATTED' )
Index: palm/trunk/SOURCE/chemistry_model_mod.f90
===================================================================
--- palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4541)
+++ palm/trunk/SOURCE/chemistry_model_mod.f90	(revision 4542)
@@ -27,4 +27,7 @@
 ! -----------------
 ! $Id$
+! redundant if statement removed
+! 
+! 4535 2020-05-15 12:07:23Z raasch
 ! bugfix for restart data format query
 ! 
@@ -3062,6 +3065,4 @@
 
 
-    CHARACTER (LEN=20) :: spc_name_av !<   
-
     INTEGER(iwp) ::  lsp             !<
     INTEGER(iwp) ::  k               !< 
@@ -3087,31 +3088,23 @@
 
 
-    IF ( ALLOCATED( chem_species ) )  THEN
-
-       DO  lsp = 1, nspec
-
-          !< for time-averaged chemical conc.
-          spc_name_av  =  TRIM( chem_species(lsp)%name )//'_av'
-
-          IF ( restart_string(1:length) == TRIM( chem_species(lsp)%name) )    &
-             THEN
-             !< read data into tmp_3d
-             IF ( k == 1 )  READ ( 13 )  tmp_3d  
-             !< fill ..%conc in the restart run    
-             chem_species(lsp)%conc(:,nysc-nbgp:nync+nbgp,                    &
-                  nxlc-nbgp:nxrc+nbgp) =                  & 
-                  tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-             found = .TRUE.
-          ELSEIF (restart_string(1:length) == spc_name_av )  THEN
-             IF ( k == 1 )  READ ( 13 )  tmp_3d
-             chem_species(lsp)%conc_av(:,nysc-nbgp:nync+nbgp,                 &
-                  nxlc-nbgp:nxrc+nbgp) =               &
-                  tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
-             found = .TRUE.
-          ENDIF
-
-       ENDDO
-
-    ENDIF
+    DO  lsp = 1, nspec
+
+       IF ( restart_string(1:length) == TRIM( chem_species(lsp)%name) )  THEN
+
+          IF ( k == 1 )  READ ( 13 )  tmp_3d
+          chem_species(lsp)%conc(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                      &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+          found = .TRUE.
+
+       ELSEIF (restart_string(1:length) == TRIM( chem_species(lsp)%name ) // '_av' )  THEN
+
+          IF ( k == 1 )  READ ( 13 )  tmp_3d
+          chem_species(lsp)%conc_av(:,nysc-nbgp:nync+nbgp,nxlc-nbgp:nxrc+nbgp) =                   &
+                                                   tmp_3d(:,nysf-nbgp:nynf+nbgp,nxlf-nbgp:nxrf+nbgp)
+          found = .TRUE.
+
+       ENDIF
+
+    ENDDO
 
 
@@ -3128,16 +3121,13 @@
     IMPLICIT NONE
 
-    INTEGER(iwp) ::  lsp !<
-
-    IF ( ALLOCATED( chem_species ) )  THEN
-
-       DO  lsp = 1, nspec
-
-          CALL rrd_mpi_io( TRIM( chem_species(lsp)%name ), chem_species(lsp)%conc )
-          CALL rrd_mpi_io( TRIM( chem_species(lsp)%name )//'_av', chem_species(lsp)%conc_av )
-
-       ENDDO
-
-    ENDIF
+    INTEGER(iwp) ::  lsp  !<
+
+
+    DO  lsp = 1, nspec
+
+       CALL rrd_mpi_io( TRIM( chem_species(lsp)%name ), chem_species(lsp)%conc )
+       CALL rrd_mpi_io( TRIM( chem_species(lsp)%name )//'_av', chem_species(lsp)%conc_av )
+
+    ENDDO
 
  END SUBROUTINE chem_rrd_local_mpi
